Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 25, 2024
1 parent 958ad3c commit 95e4f34
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,20 @@ public static RecipeInfo shaped(String group, ItemStack output, Object... args)
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class EnchantmentAttributesEmulation1_20_6 {
// Update generic attributes for all entities
for (Entity entity : world.getEntities()) {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public abstract class MixinKeyboardInput extends Input {
@ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true)
private boolean changeSneakSlowdownCondition(boolean slowDown) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return this.sneaking;
return this.playerInput.sneak();
} 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 {
return slowDown;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ private boolean allowElytraInVehicle(ClientPlayerEntity instance) {

@Inject(method = "tickMovement()V",
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) {
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.movementForward = (float) ((double) this.input.movementForward / 0.3D);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
@Mixin(FireworkRocketItem.class)
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) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11) && player.isFallFlying();
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11) && player.isGliding();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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)) {
cir.setReturnValue(this.models.getModelManager().getMissingModel());
cir.setReturnValue(this.models.getModel(ItemStack.EMPTY));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.attribute.AttributeContainer;
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.Items;
import net.minecraft.network.ClientConnection;
Expand Down Expand Up @@ -222,7 +222,7 @@ private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, Callbac
}

@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) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) {
return Integer.class; // Dummy class file to false the instanceof check
Expand Down

0 comments on commit 95e4f34

Please sign in to comment.