mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-22 11:56:21 +01:00
Added setting for 1.7 block hit animation
Added setting for 1.8 boat physic/model
This commit is contained in:
parent
730fa81e5e
commit
baf48de0b8
@ -26,6 +26,7 @@ public class ExperimentalSettings extends SettingGroup {
|
||||
|
||||
public final BooleanSetting fixChunkBorders = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.chunkborderfix"), true);
|
||||
public final BooleanSetting waterMovementEdgeDetection = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.watermovement"), true);
|
||||
public final BooleanSetting emulateBoatMovement = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.boatmovement"), false);
|
||||
|
||||
public ExperimentalSettings() {
|
||||
super(Text.translatable("settings.viafabricplus.experimental"));
|
||||
|
@ -43,6 +43,9 @@ public class VisualSettings extends SettingGroup {
|
||||
public final ProtocolSyncBooleanSetting emulateArmorHud = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.armor"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
public final ProtocolSyncBooleanSetting removeNewerFeaturesFromCommandBlockScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.command"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
|
||||
// 1.8.x -> r1_7_6tor1_7_10
|
||||
public final ProtocolSyncBooleanSetting blockHitAnimation = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.blockhitanimation"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
|
||||
// r1_0_0tor1_0_1 -> b1_8tob1_8_1
|
||||
public final ProtocolSyncBooleanSetting replaceHurtSoundWithOOFSound = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.oof"), VersionRange.andOlder(VersionEnum.b1_8tob1_8_1));
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
public interface IBoatEntity_1_8 {
|
||||
public interface IBoatEntity {
|
||||
|
||||
void viafabricplus_setBoatEmpty(boolean boatEmpty);
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
|
||||
import de.florianmichael.viafabricplus.mappings.EntityHeightOffsetMappings;
|
||||
import de.florianmichael.viafabricplus.injection.access.IBoatEntity_1_8;
|
||||
import de.florianmichael.viafabricplus.injection.access.IBoatEntity;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
@ -24,7 +25,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BoatEntity.class)
|
||||
public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8 {
|
||||
public abstract class MixinBoatEntity extends Entity implements IBoatEntity {
|
||||
|
||||
@Shadow
|
||||
private double x;
|
||||
@ -83,7 +84,7 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "pushAwayFrom", at = @At("HEAD"), cancellable = true)
|
||||
private void onPushAwayFrom(Entity entity, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
super.pushAwayFrom(entity);
|
||||
ci.cancel();
|
||||
}
|
||||
@ -91,7 +92,7 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "updateTrackedPositionAndAngles", at = @At("HEAD"), cancellable = true)
|
||||
private void onUpdateTrackedPositionAndAngles(double x, double y, double z, float yaw, float pitch, int interpolationSteps, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
if (hasPassengers()) {
|
||||
this.prevX = x;
|
||||
this.prevY = y;
|
||||
@ -132,7 +133,7 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
private void onTick(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
super.tick();
|
||||
|
||||
if (getDamageWobbleTicks() > 0) {
|
||||
@ -279,7 +280,7 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "updatePassengerPosition", at = @At("HEAD"), cancellable = true)
|
||||
private void onUpdatePassengerPosition(Entity passenger, PositionUpdater positionUpdater, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
if (hasPassenger(passenger)) {
|
||||
double dx = Math.cos(this.getYaw() * Math.PI / 180) * 0.4;
|
||||
double dz = Math.sin(this.getYaw() * Math.PI / 180) * 0.4;
|
||||
@ -291,7 +292,7 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "onPassengerLookAround", at = @At("HEAD"), cancellable = true)
|
||||
private void onOnPassengerLookAround(Entity passenger, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
// don't prevent entities looking around in the boat
|
||||
super.onPassengerLookAround(passenger);
|
||||
ci.cancel();
|
||||
@ -300,7 +301,7 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "fall", at = @At("HEAD"))
|
||||
private void onFall(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
// prevent falling from being negated
|
||||
location = BoatEntity.Location.ON_LAND;
|
||||
}
|
||||
@ -308,12 +309,17 @@ public abstract class MixinBoatEntity extends Entity implements IBoatEntity_1_8
|
||||
|
||||
@Inject(method = "canAddPassenger", at = @At("HEAD"), cancellable = true)
|
||||
private void onCanAddPassenger(Entity passenger, CallbackInfoReturnable<Boolean> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.viafabricplus_boatMovementEmulation()) {
|
||||
// only one entity can ride a boat at a time
|
||||
ci.setReturnValue(super.canAddPassenger(passenger));
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean viafabricplus_boatMovementEmulation() {
|
||||
return ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && ExperimentalSettings.INSTANCE.emulateBoatMovement.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viafabricplus_setBoatEmpty(boolean boatEmpty) {
|
||||
viafabricplus_boatEmpty = boatEmpty;
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
|
||||
import de.florianmichael.viafabricplus.definition.boat.BoatRenderer_1_8;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
@ -43,7 +44,7 @@ public class MixinEntityRenderDispatcher {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject(method = "getRenderer", at = @At("HEAD"), cancellable = true)
|
||||
private <T extends Entity> void onGetRenderer(T entity, CallbackInfoReturnable<EntityRenderer<? super T>> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && entity instanceof BoatEntity) {
|
||||
if (ExperimentalSettings.INSTANCE.emulateBoatMovement.getValue() && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && entity instanceof BoatEntity) {
|
||||
ci.setReturnValue((EntityRenderer<? super T>) viafabricplus_boatRenderer);
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,10 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
import net.minecraft.util.Arm;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||
@ -35,7 +34,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -56,7 +54,7 @@ public abstract class MixinHeldItemRenderer {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
matrices.translate(-0.1F, 0.05F, 0.0F);
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||
if (VisualSettings.INSTANCE.blockHitAnimation.isEnabled()) {
|
||||
final var arm = (hand == Hand.MAIN_HAND) ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
applySwingOffset(matrices, arm, swingProgress);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
import de.florianmichael.viafabricplus.injection.access.IBoatEntity_1_8;
|
||||
import de.florianmichael.viafabricplus.injection.access.IBoatEntity;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
@ -109,7 +109,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
if (!ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) return;
|
||||
|
||||
final var entity = this.world.getEntityById(packet.getId());
|
||||
if (entity instanceof IBoatEntity_1_8 boatEntity) {
|
||||
if (entity instanceof IBoatEntity boatEntity) {
|
||||
boatEntity.viafabricplus_setBoatEmpty(packet.getPassengerIds().length == 0);
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
"experimental.viafabricplus.chunkborderfix": "Fix Chunk borders",
|
||||
"experimental.viafabricplus.watermovement": "Water movement edge detection",
|
||||
"experimental.viafabricplus.boatmovement": "Emulate boat movement and replace model",
|
||||
|
||||
"debug.viafabricplus.sequence": "Disable sequencing",
|
||||
"debug.viafabricplus.merchant": "Smooth out merchant screens",
|
||||
@ -79,6 +80,7 @@
|
||||
"visual.viafabricplus.walkanimation": "Old walking animation",
|
||||
"visual.viafabricplus.sodium": "Fix Sodium Chunk renderer",
|
||||
"visual.viafabricplus.fontrendererbehaviour": "Change Font renderer behaviour",
|
||||
"visual.viafabricplus.blockhitanimation": "Enable 1.7 Block hit animation",
|
||||
|
||||
"bedrocklogin.viafabricplus.text": "Your browser should have opened.\nPlease enter the following Code: %s\nClosing this screen will cancel the process!",
|
||||
"bedrocklogin.viafabricplus.error": "An error has occurred! See the latest.log for more information,\nplease report the bug at: \nhttps://github.com/ViaVersion/ViaFabricPlus/issues",
|
||||
|
Loading…
Reference in New Issue
Block a user