mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-25 12:25:22 +01:00
Finalizing some things
This commit is contained in:
parent
55eb34b5a5
commit
c31637cdbf
@ -133,7 +133,7 @@ public class EntityRidingOffsetsPre1_20_2 {
|
||||
}
|
||||
|
||||
if (entity instanceof AbstractHorseEntity abstractHorseEntity) {
|
||||
if (abstractHorseEntity.lastAngryAnimationProgress > 0.0f) {
|
||||
if (abstractHorseEntity.lastAngryAnimationProgress > 0.0F) {
|
||||
return new Vector3f(0, yOffset + 0.15F * abstractHorseEntity.lastAngryAnimationProgress, -0.7F * abstractHorseEntity.lastAngryAnimationProgress);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ public abstract class MixinFlowableFluid {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return instance.isSideSolidFullSquare(blockView, blockPos, direction);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public abstract class MixinAnvilBlock extends FallingBlock {
|
||||
private boolean viaFabricPlus$requireOriginalShape;
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (viaFabricPlus$requireOriginalShape) {
|
||||
viaFabricPlus$requireOriginalShape = false;
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
|
@ -60,7 +60,7 @@ public abstract class MixinEndPortalFrameBlock extends Block {
|
||||
}
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(FRAME_SHAPE);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public abstract class MixinHopperBlock extends BlockWithEntity {
|
||||
}
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (viaFabricPlus$requireOriginalShape) {
|
||||
viaFabricPlus$requireOriginalShape = false;
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
@ -59,7 +59,7 @@ public abstract class MixinHopperBlock extends BlockWithEntity {
|
||||
}
|
||||
|
||||
@Inject(method = "getRaycastShape", at = @At("HEAD"), cancellable = true)
|
||||
public void changeRaycastShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
private void changeRaycastShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viaFabricPlus$inside_shape_r1_12_2);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public abstract class MixinCamelEntity extends AbstractHorseEntity {
|
||||
final float passengerYaw = passenger.getYaw();
|
||||
|
||||
final float deltaDegrees = MathHelper.wrapDegrees(passengerYaw - this.getYaw());
|
||||
final float clampedDelta = MathHelper.clamp(deltaDegrees, -160.0f, 160.0f);
|
||||
final float clampedDelta = MathHelper.clamp(deltaDegrees, -160.0F, 160.0F);
|
||||
passenger.prevYaw += clampedDelta - deltaDegrees;
|
||||
|
||||
final float newYaw = passengerYaw + clampedDelta - deltaDegrees;
|
||||
|
@ -170,7 +170,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
@Redirect(method = "tickMovement",
|
||||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z")),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0))
|
||||
private boolean redirectIsSneakingWhileSwimming(ClientPlayerEntity instance) {
|
||||
private boolean dontAllowSneakingWhileSwimming(ClientPlayerEntity instance) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_14_1) && instance.isSwimming();
|
||||
}
|
||||
|
||||
|
@ -138,9 +138,10 @@ public abstract class MixinEntity implements IEntity {
|
||||
private static double fixVelocityEpsilon(double epsilon) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return 1E-4;
|
||||
}
|
||||
} else {
|
||||
return epsilon;
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true)
|
||||
private void revertCalculation(float pitch, float yaw, CallbackInfoReturnable<Vec3d> cir) {
|
||||
|
@ -42,17 +42,17 @@ public abstract class MixinEntityRenderDispatcher {
|
||||
@Unique
|
||||
private BoatRenderer1_8 viaFabricPlus$boatRenderer;
|
||||
|
||||
@Inject(method = "reload", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void createBoatRenderer1_8(ResourceManager manager, CallbackInfo ci, EntityRendererFactory.Context context) {
|
||||
viaFabricPlus$boatRenderer = new BoatRenderer1_8(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject(method = "getRenderer", at = @At("HEAD"), cancellable = true)
|
||||
private <T extends Entity> void onGetRenderer(T entity, CallbackInfoReturnable<EntityRenderer<? super T>> ci) {
|
||||
private <T extends Entity> void useBoatRenderer1_8(T entity, CallbackInfoReturnable<EntityRenderer<? super T>> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && entity instanceof BoatEntity) {
|
||||
ci.setReturnValue((EntityRenderer<? super T>) viaFabricPlus$boatRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "reload", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void onReload(ResourceManager manager, CallbackInfo ci, EntityRendererFactory.Context context) {
|
||||
viaFabricPlus$boatRenderer = new BoatRenderer1_8(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public abstract class MixinPlayerEntityRenderer {
|
||||
@Redirect(method = "getPositionOffset(Lnet/minecraft/client/network/AbstractClientPlayerEntity;F)Lnet/minecraft/util/math/Vec3d;",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isInSneakingPose()Z"))
|
||||
private boolean disableSneakPositionOffset(AbstractClientPlayerEntity player) {
|
||||
return (ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_11_1to1_11_2)) && player.isInSneakingPose();
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_11_1to1_11_2) && player.isInSneakingPose();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import de.florianmichael.viafabricplus.fixes.data.ItemRegistryDiff;
|
||||
import de.florianmichael.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -26,6 +28,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -39,17 +42,18 @@ public abstract class MixinItemGroup_EntriesImpl {
|
||||
@Final
|
||||
private ItemGroup group;
|
||||
|
||||
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
|
||||
private boolean removeUnknownItems(Item instance, FeatureSet featureSet) {
|
||||
@WrapOperation(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
|
||||
private boolean removeUnknownItems(Item instance, FeatureSet featureSet, Operation<Boolean> original) {
|
||||
final boolean originalValue = original.call(instance, featureSet);
|
||||
final int index = GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex();
|
||||
|
||||
if (index == 2 || MinecraftClient.getInstance().isInSingleplayer()) return instance.isEnabled(featureSet);
|
||||
if (index == 1 && !Registries.ITEM_GROUP.getId(this.group).getNamespace().equals("minecraft")) return instance.isEnabled(featureSet);
|
||||
|
||||
if (ItemRegistryDiff.keepItem(instance)) {
|
||||
return instance.isEnabled(featureSet);
|
||||
if (index == 2 /* Off */ || MinecraftClient.getInstance().isInSingleplayer()) {
|
||||
return originalValue;
|
||||
} else if (index == 1 /* Vanilla only */ && !Registries.ITEM_GROUP.getId(this.group).getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
|
||||
return originalValue;
|
||||
} else {
|
||||
return ItemRegistryDiff.keepItem(instance) && originalValue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public abstract class MixinItemPlacementContext extends ItemUsageContext {
|
||||
}
|
||||
|
||||
@Inject(method = "getPlayerLookDirection", at = @At("HEAD"), cancellable = true)
|
||||
private void getLookDirection1_12_2(CallbackInfoReturnable<Direction> cir) {
|
||||
private void getPlayerLookDirection1_12_2(CallbackInfoReturnable<Direction> cir) {
|
||||
final ItemPlacementContext self = (ItemPlacementContext) (Object) this;
|
||||
final PlayerEntity player = self.getPlayer();
|
||||
|
||||
|
@ -102,7 +102,6 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
return OptionalDouble.of(3 + materialBonus);
|
||||
}
|
||||
}
|
||||
|
||||
return OptionalDouble.empty();
|
||||
}
|
||||
|
||||
|
@ -146,13 +146,13 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay
|
||||
private boolean handleWindowClick1_16_5(ClientPlayNetworkHandler instance, Packet<?> packet) throws Exception {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
||||
ItemStack slotItemBeforeModification;
|
||||
|
||||
if (this.viaFabricPlus$shouldBeEmpty(clickSlot.getActionType(), clickSlot.getSlot()))
|
||||
if (this.viaFabricPlus$shouldBeEmpty(clickSlot.getActionType(), clickSlot.getSlot())) {
|
||||
slotItemBeforeModification = ItemStack.EMPTY;
|
||||
else if (clickSlot.getSlot() < 0 || clickSlot.getSlot() >= viaFabricPlus$oldItems.size())
|
||||
} else if (clickSlot.getSlot() < 0 || clickSlot.getSlot() >= viaFabricPlus$oldItems.size()) {
|
||||
slotItemBeforeModification = viaFabricPlus$oldCursorStack;
|
||||
else
|
||||
} else {
|
||||
slotItemBeforeModification = viaFabricPlus$oldItems.get(clickSlot.getSlot());
|
||||
}
|
||||
|
||||
final PacketWrapper clickWindowPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, ((IClientConnection) networkHandler.getConnection()).viaFabricPlus$getUserConnection());
|
||||
clickWindowPacket.write(Type.UNSIGNED_BYTE, (short) clickSlot.getSyncId());
|
||||
|
@ -30,20 +30,20 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
public abstract class MixinBookEditScreen {
|
||||
|
||||
@ModifyConstant(method = "method_27596", constant = @Constant(intValue = 1024))
|
||||
private int modifyPageLength(int oldVal) {
|
||||
private int modifyPageLength(int constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return 256;
|
||||
} else {
|
||||
return oldVal;
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "appendNewPage", constant = @Constant(intValue = 100))
|
||||
private int modifyPageCount(int oldVal) {
|
||||
private int modifyPageCount(int constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return 50;
|
||||
} else {
|
||||
return oldVal;
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,12 @@ public abstract class MixinAbstractFurnaceScreenHandler {
|
||||
|
||||
@Redirect(method = "quickMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/AbstractFurnaceScreenHandler;isSmeltable(Lnet/minecraft/item/ItemStack;)Z"))
|
||||
private boolean disableShiftClickSmeltingSlot(AbstractFurnaceScreenHandler instance, ItemStack itemStack) {
|
||||
return this.isSmeltable(itemStack) && !ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_2_1tor1_2_3);
|
||||
return this.isSmeltable(itemStack) && ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_2_1tor1_2_3);
|
||||
}
|
||||
|
||||
@Redirect(method = "quickMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/AbstractFurnaceScreenHandler;isFuel(Lnet/minecraft/item/ItemStack;)Z"))
|
||||
private boolean disableShiftClickFuelSlot(AbstractFurnaceScreenHandler instance, ItemStack itemStack) {
|
||||
return this.isFuel(itemStack) && !ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_2_1tor1_2_3);
|
||||
return this.isFuel(itemStack) && ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_2_1tor1_2_3);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user