More fixes

This commit is contained in:
FlorianMichael 2024-10-25 14:53:34 +02:00
parent 02136f09a9
commit 4df5265a2b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
7 changed files with 14 additions and 13 deletions

View File

@ -109,19 +109,20 @@ public final class RecipeInfo {
} }
final int height = shape.size(); final int height = shape.size();
final DefaultedList<Ingredient> ingredients = DefaultedList.of(); final DefaultedList<Optional<Ingredient>> ingredients = DefaultedList.of();
for (String row : shape) { for (String row : shape) {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
final char key = row.charAt(x); final char key = row.charAt(x);
Ingredient ingredient = legend.get(key); Ingredient ingredient = legend.get(key);
if (ingredient == null) { if (ingredient == null) {
if (key == ' ') { if (key == ' ') {
ingredient = Ingredient.EMPTY; ingredients.add(Optional.empty());
} else { } else {
throw new IllegalArgumentException("Unknown character in shape: " + key); throw new IllegalArgumentException("Unknown character in shape: " + key);
} }
} else {
ingredients.add(Optional.of(ingredient));
} }
ingredients.add(ingredient);
} }
} }

View File

@ -48,7 +48,7 @@ public class EnchantmentAttributesEmulation1_20_6 {
// Update generic attributes for all entities // Update generic attributes for all entities
for (Entity entity : world.getEntities()) { for (Entity entity : world.getEntities()) {
if (entity.isLogicalSideForUpdatingMovement() && entity instanceof LivingEntity livingEntity) { if (entity.isLogicalSideForUpdatingMovement() && entity instanceof LivingEntity livingEntity) {
livingEntity.getAttributeInstance(EntityAttributes.GENERIC_WATER_MOVEMENT_EFFICIENCY).setBaseValue(getEquipmentLevel(Enchantments.DEPTH_STRIDER, livingEntity) / 3F); livingEntity.getAttributeInstance(EntityAttributes.WATER_MOVEMENT_EFFICIENCY).setBaseValue(getEquipmentLevel(Enchantments.DEPTH_STRIDER, livingEntity) / 3F);
setGenericMovementEfficiencyAttribute(livingEntity); setGenericMovementEfficiencyAttribute(livingEntity);
} }
} }

View File

@ -34,9 +34,9 @@ public abstract class MixinKeyboardInput extends Input {
@ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true) @ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true)
private boolean changeSneakSlowdownCondition(boolean slowDown) { private boolean changeSneakSlowdownCondition(boolean slowDown) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return this.sneaking; return this.playerInput.sneak();
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return !MinecraftClient.getInstance().player.isSpectator() && (this.sneaking || slowDown); return !MinecraftClient.getInstance().player.isSpectator() && (this.playerInput.sneak() || slowDown);
} else { } else {
return slowDown; return slowDown;
} }

View File

@ -147,10 +147,10 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Inject(method = "tickMovement()V", @Inject(method = "tickMovement()V",
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")),
at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/Input;sneaking:Z", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/util/PlayerInput;sneak()Z", ordinal = 0))
private void injectTickMovement(CallbackInfo ci) { private void injectTickMovement(CallbackInfo ci) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
if (this.input.sneaking) { if (this.input.playerInput.sneak()) {
this.input.movementSideways = (float) ((double) this.input.movementSideways / 0.3D); this.input.movementSideways = (float) ((double) this.input.movementSideways / 0.3D);
this.input.movementForward = (float) ((double) this.input.movementForward / 0.3D); this.input.movementForward = (float) ((double) this.input.movementForward / 0.3D);
} }

View File

@ -30,9 +30,9 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(FireworkRocketItem.class) @Mixin(FireworkRocketItem.class)
public abstract class MixinFireworkRocketItem { public abstract class MixinFireworkRocketItem {
@Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isFallFlying()Z", ordinal = 0)) @Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isGliding()Z", ordinal = 0))
private boolean disableFireworkElytraBoost(PlayerEntity player) { private boolean disableFireworkElytraBoost(PlayerEntity player) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11) && player.isFallFlying(); return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11) && player.isGliding();
} }
} }

View File

@ -44,7 +44,7 @@ public abstract class MixinItemRenderer {
@Inject(method = "getModel(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)Lnet/minecraft/client/render/model/BakedModel;", at = @At("HEAD"), cancellable = true) @Inject(method = "getModel(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)Lnet/minecraft/client/render/model/BakedModel;", at = @At("HEAD"), cancellable = true)
private void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) { private void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) { if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
cir.setReturnValue(this.models.getModelManager().getMissingModel()); cir.setReturnValue(this.models.getModel(ItemStack.EMPTY));
} }
} }

View File

@ -38,7 +38,7 @@ import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.attribute.AttributeContainer; import net.minecraft.entity.attribute.AttributeContainer;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.entity.vehicle.AbstractBoatEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.network.ClientConnection; import net.minecraft.network.ClientConnection;
@ -222,7 +222,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
} }
@SuppressWarnings({"InvalidInjectorMethodSignature"}) @SuppressWarnings({"InvalidInjectorMethodSignature"})
@ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class)) @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = AbstractBoatEntity.class))
private Class<?> dontChangeYawWhenMountingBoats(Object entity, Class<?> boatClass) { private Class<?> dontChangeYawWhenMountingBoats(Object entity, Class<?> boatClass) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) {
return Integer.class; // Dummy class file to false the instanceof check return Integer.class; // Dummy class file to false the instanceof check