From e51b941c82e0bcb7570e4cfe0b144e0470e42252 Mon Sep 17 00:00:00 2001 From: Cat Core Date: Wed, 1 Jan 2025 22:42:32 +0100 Subject: [PATCH] Port GuiAPI, ModLoader, ModOptionsAPI, PlayerAPI and Reforged mixins --- .../mixin/client/OptionsScreenMixin.java | 6 +- .../modloader/mixin/DispenserBlockMixin.java | 4 +- .../mixin/FurnaceBlockEntityMixin.java | 28 +- .../mixin/FurnaceOutputSlotMixin.java | 5 +- .../client/ClientPlayPacketHandlerMixin.java | 33 ++- .../mixin/client/DisconnectPacketMixin.java | 3 +- .../client/DisconnectingScreenMixin.java | 13 +- .../client/GameStartupErrorPanelMixin.java | 7 +- .../mixin/client/ItemEntityMixin.java | 2 +- .../mixin/client/ServerChunkCacheMixin.java | 18 +- .../VanillaFurnaceBlockEntityMixin.java | 22 +- .../mixin/server/CommandManagerMixin.java | 13 +- .../mixin/server/MinecraftServerMixin.java | 6 +- .../server/ServerEntityTrackerMixin.java | 8 +- .../server/ServerLoginPacketHandlerMixin.java | 19 +- .../mixin/server/ServerWorldSourceMixin.java | 21 +- .../mixin/server/TrackedEntityMixin.java | 28 +- .../mixin/client/ConnectingScreenMixin.java | 4 +- .../mixin/client/OptionsScreenMixin.java | 8 +- .../mixin/client/PauseMenuMixin.java | 17 +- .../mixin/client/SelectWorldScreenMixin.java | 9 +- .../player/PlayerAPIClientPlayerEntity.java | 6 +- .../AbstractClientPlayerEntityMixin.java | 256 +++++++++--------- .../reforged/mixin/BlockMixin.java | 19 +- .../mixin/FurnaceBlockEntityMixin.java | 12 +- .../reforged/mixin/ShearsItemMixin.java | 36 +-- .../reforged/mixin/SheepEntityMixin.java | 11 +- .../mixin/SmeltingRecipeRegistryMixin.java | 7 +- ...tiplayerClientInteractionManagerMixin.java | 15 +- .../SinglePlayerInteractionManagerMixin.java | 13 +- .../client/nostation/GameRendererMixin.java | 8 +- 31 files changed, 316 insertions(+), 341 deletions(-) diff --git a/apron/src/main/java/io/github/betterthanupdates/guiapi/mixin/client/OptionsScreenMixin.java b/apron/src/main/java/io/github/betterthanupdates/guiapi/mixin/client/OptionsScreenMixin.java index 763782dc..1223ef71 100644 --- a/apron/src/main/java/io/github/betterthanupdates/guiapi/mixin/client/OptionsScreenMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/guiapi/mixin/client/OptionsScreenMixin.java @@ -10,12 +10,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.menu.OptionsScreen; +import net.minecraft.client.gui.screen.option.OptionsScreen; import net.minecraft.client.gui.widget.ButtonWidget; @Mixin(OptionsScreen.class) public class OptionsScreenMixin extends Screen { - @Inject(method = "initVanillaScreen", at = @At("RETURN")) + @Inject(method = "init", at = @At("RETURN")) private void guiapi$init(CallbackInfo ci) { // TODO: This string needs to be localized, eventually. if (!SettingWidget.all.isEmpty()) this.buttons.add(new ButtonWidget(300, this.width / 2 - 200, this.height / 6 + 192, "GuiAPI's Global Mod Settings")); @@ -24,7 +24,7 @@ public class OptionsScreenMixin extends Screen { @Inject(method = "buttonClicked", at = @At("RETURN")) private void guiapi$buttonClicked(ButtonWidget par1, CallbackInfo ci) { if (par1.active && par1.id == 300) { - this.client.options.saveOptions(); + this.minecraft.options.save(); ModSettingScreen.guiContext = ""; SettingWidget.updateAll(); ModScreen.show(new ModSelect(this)); diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/DispenserBlockMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/DispenserBlockMixin.java index 03b6b0a5..a9f55a60 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/DispenserBlockMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/DispenserBlockMixin.java @@ -20,12 +20,12 @@ public abstract class DispenserBlockMixin { * @reason Implements {@link ModLoader#DispenseEntity(World, double, double, double, int, int, ItemStack) * ModLoader's dispense entity callback} */ - @Inject(method = "dispense", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/item/ItemStack;itemId:I", ordinal = 0)) + @Inject(method = "method_1774", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/item/ItemStack;itemId:I", ordinal = 0)) private void handleDispense(World i, int x, int y, int z, Random random, CallbackInfo ci, @Local(ordinal = 0) World world, @Local(ordinal = 0) double posX, @Local(ordinal = 1) double posY, @Local(ordinal = 2) double posZ, @Local(ordinal = 4) int j, @Local(ordinal = 5) int k, @Local(ordinal = 0) ItemStack itemStack) { if (ModLoader.DispenseEntity(world, posX, posY, posZ, j, k, itemStack)) { - world.playWorldEvent(2000, x, y, z, j + 1 + (k + 1) * 3); + world.method_230(2000, x, y, z, j + 1 + (k + 1) * 3); ci.cancel(); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceBlockEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceBlockEntityMixin.java index e102f171..8e6220a4 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceBlockEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceBlockEntityMixin.java @@ -1,20 +1,16 @@ package io.github.betterthanupdates.modloader.mixin; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; +import com.llamalad7.mixinextras.sugar.Local; import modloader.ModLoader; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.block.FurnaceBlock; -import net.minecraft.entity.BlockEntity; -import net.minecraft.entity.block.FurnaceBlockEntity; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.FurnaceBlockEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; @@ -23,21 +19,23 @@ public abstract class FurnaceBlockEntityMixin extends BlockEntity implements Inv @Shadow private ItemStack[] inventory; - @WrapWithCondition(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ItemStack;count:I", opcode = Opcodes.PUTFIELD)) + @WrapWithCondition(method = "method_1076", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ItemStack;count:I", opcode = Opcodes.PUTFIELD)) private boolean modloader$tick(ItemStack instance, int value) { - if (this.inventory[1].getItem().hasContainerItemType()) { - this.inventory[1] = new ItemStack(this.inventory[1].getItem().getContainerItemType()); + if (this.inventory[1].getItem().hasCraftingReturnItem()) { + this.inventory[1] = new ItemStack(this.inventory[1].getItem().getCraftingReturnItem()); return false; } return true; } - @Inject(method = "getFuelTime", cancellable = true, at = @At("RETURN")) - private void modloader$getFuelTime(ItemStack par1, CallbackInfoReturnable cir) { - if (par1 != null && cir.getReturnValue() == 0) { + @ModifyReturnValue(method = "getFuelTime", at = @At("RETURN")) + private int modloader$getFuelTime(int original, @Local(ordinal = 0, argsOnly = true) ItemStack par1) { + if (par1 != null && original == 0) { int j = par1.getItem().id; - cir.setReturnValue(ModLoader.AddAllFuel(j)); + return ModLoader.AddAllFuel(j); } + + return original; } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceOutputSlotMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceOutputSlotMixin.java index 45227631..eba51454 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceOutputSlotMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/FurnaceOutputSlotMixin.java @@ -6,17 +6,16 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.container.slot.FurnaceOutputSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.screen.slot.FurnaceOutputSlot; @Mixin(FurnaceOutputSlot.class) public abstract class FurnaceOutputSlotMixin { @Shadow private PlayerEntity player; - @Inject(method = "onCrafted", at = @At(value = "INVOKE", target = "Lnet/minecraft/container/slot/Slot;onCrafted(Lnet/minecraft/item/ItemStack;)V")) + @Inject(method = "onCrafted", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/slot/Slot;onCrafted(Lnet/minecraft/item/ItemStack;)V")) private void modloader$onCrafted(ItemStack par1, CallbackInfo ci) { ModLoader.TakenFromFurnace(this.player, par1); } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ClientPlayPacketHandlerMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ClientPlayPacketHandlerMixin.java index 672017e4..c86ec53a 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ClientPlayPacketHandlerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ClientPlayPacketHandlerMixin.java @@ -7,29 +7,28 @@ import modloadermp.NetClientHandlerEntity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_454; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.network.ClientNetworkHandler; import net.minecraft.entity.Entity; -import net.minecraft.network.ClientPlayPacketHandler; -import net.minecraft.network.PacketHandler; -import net.minecraft.packet.play.EntitySpawnS2CPacket; -import net.minecraft.packet.play.OpenContainerS2CPacket; +import net.minecraft.network.NetworkHandler; +import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket; +import net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket; import net.minecraft.world.World; @Environment(EnvType.CLIENT) -@Mixin(ClientPlayPacketHandler.class) -public abstract class ClientPlayPacketHandlerMixin extends PacketHandler { +@Mixin(ClientNetworkHandler.class) +public abstract class ClientPlayPacketHandlerMixin extends NetworkHandler { @Shadow - private ClientWorld world; + private class_454 field_1973; @Shadow - protected abstract Entity getEntity(int i); + protected abstract Entity method_1645(int i); /** * @author StationAPI @@ -47,13 +46,13 @@ public abstract class ClientPlayPacketHandlerMixin extends PacketHandler { double d1 = (double) packet.y / 32.0; double d2 = (double) packet.z / 32.0; - NetClientHandlerEntity netclienthandlerentity = ModLoaderMp.HandleNetClientHandlerEntities(packet.type); + NetClientHandlerEntity netclienthandlerentity = ModLoaderMp.HandleNetClientHandlerEntities(packet.entityType); if (netclienthandlerentity != null) { try { entity = netclienthandlerentity.entityClass .getConstructor(World.class, Double.TYPE, Double.TYPE, Double.TYPE) - .newInstance(this.world, d, d1, d2); + .newInstance(this.field_1973, d, d1, d2); if (netclienthandlerentity.entityHasOwner) { Field field = netclienthandlerentity.entityClass.getField("owner"); @@ -62,7 +61,7 @@ public abstract class ClientPlayPacketHandlerMixin extends PacketHandler { throw new Exception(String.format("Entity's owner field must be of type Entity, but it is of type %s.", field.getType())); } - Entity entity1 = this.getEntity(packet.flag); + Entity entity1 = this.method_1645(packet.entityData); if (entity1 == null) { ModLoaderMp.Log("Received spawn packet for entity with owner, but owner was not found."); @@ -78,7 +77,7 @@ public abstract class ClientPlayPacketHandlerMixin extends PacketHandler { } } catch (Exception e) { ModLoader.getLogger().throwing("NetClientHandler", "handleVehicleSpawn", e); - ModLoader.ThrowException(String.format("Error initializing entity of type %s.", packet.type), e); + ModLoader.ThrowException(String.format("Error initializing entity of type %s.", packet.entityType), e); } } @@ -89,9 +88,9 @@ public abstract class ClientPlayPacketHandlerMixin extends PacketHandler { * @author Risugami * @reason ModLoaderMP can handle custom container GUIs */ - @Inject(method = "onOpenContainer", at = @At("TAIL")) - private void modloader$openContainer(OpenContainerS2CPacket packet, CallbackInfo ci) { - int type = packet.inventoryType; + @Inject(method = "onOpenScreen", at = @At("TAIL")) + private void modloader$openContainer(OpenScreenS2CPacket packet, CallbackInfo ci) { + int type = packet.screenHandlerId; switch (type) { case 0: case 1: diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectPacketMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectPacketMixin.java index b0d65cfa..4717b4ee 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectPacketMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectPacketMixin.java @@ -1,11 +1,10 @@ package io.github.betterthanupdates.modloader.mixin.client; +import net.minecraft.network.packet.play.DisconnectPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; -import net.minecraft.packet.misc.DisconnectPacket; - @Mixin(DisconnectPacket.class) public abstract class DisconnectPacketMixin { /** diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectingScreenMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectingScreenMixin.java index 05314cb9..2627ab86 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectingScreenMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/DisconnectingScreenMixin.java @@ -7,15 +7,14 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.client.gui.screen.DisconnectingScreen; +import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; @Environment(EnvType.CLIENT) -@Mixin(DisconnectingScreen.class) +@Mixin(DisconnectedScreen.class) public abstract class DisconnectingScreenMixin extends Screen { @Shadow - private String line2; + private String reason; /** * @author Risugami @@ -23,12 +22,12 @@ public abstract class DisconnectingScreenMixin extends Screen { * and they need to be displayed correctly. */ @Inject(method = "render", cancellable = true, at = @At(value = "INVOKE", ordinal = 0, - target = "Lnet/minecraft/client/gui/screen/DisconnectingScreen;drawTextWithShadowCentred(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V")) + target = "Lnet/minecraft/client/gui/screen/DisconnectedScreen;drawCenteredTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;III)V")) private void modloader$render(int j, int f, float delta, CallbackInfo ci) { - String[] descriptionSplit = this.line2.split("\n"); + String[] descriptionSplit = this.reason.split("\n"); for (int k = 0; k < descriptionSplit.length; k++) { - this.drawTextWithShadowCentred(this.textRenderer, descriptionSplit[k], + this.drawCenteredTextWithShadow(this.textRenderer, descriptionSplit[k], this.width / 2, this.height / 2 - 10 + k * 10, 16777215); } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/GameStartupErrorPanelMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/GameStartupErrorPanelMixin.java index d415aa73..a0f7e5ee 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/GameStartupErrorPanelMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/GameStartupErrorPanelMixin.java @@ -10,16 +10,15 @@ import modloader.ModLoader; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_622; import org.lwjgl.Sys; import org.lwjgl.opengl.GL11; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -import net.minecraft.applet.GameStartupErrorPanel; - @Environment(EnvType.CLIENT) -@Mixin(GameStartupErrorPanel.class) +@Mixin(class_622.class) public abstract class GameStartupErrorPanelMixin extends Panel { private static StringWriter stringWriter = new StringWriter(); @@ -110,6 +109,6 @@ public abstract class GameStartupErrorPanelMixin extends Panel { str4 = str4 + "\n"; str4 = str4 + "\n"; - return str1; + return str4; } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ItemEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ItemEntityMixin.java index faf7dad4..a0844632 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ItemEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ItemEntityMixin.java @@ -22,7 +22,7 @@ public ItemEntityMixin(World arg) { super(arg); } - @Inject(method = "onPlayerCollision", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(Lnet/minecraft/entity/Entity;Ljava/lang/String;FF)V")) + @Inject(method = "onPlayerInteraction", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(Lnet/minecraft/entity/Entity;Ljava/lang/String;FF)V")) private void modloader$onPlayerCollision(PlayerEntity par1, CallbackInfo ci) { ModLoader.OnItemPickup(par1, this.stack); } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ServerChunkCacheMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ServerChunkCacheMixin.java index 616ff233..c0ca2417 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ServerChunkCacheMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/client/ServerChunkCacheMixin.java @@ -1,6 +1,8 @@ package io.github.betterthanupdates.modloader.mixin.client; import modloader.ModLoader; +import net.minecraft.class_326; +import net.minecraft.class_51; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -8,19 +10,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.world.World; -import net.minecraft.world.chunk.ServerChunkCache; -import net.minecraft.world.source.WorldSource; -@Mixin(ServerChunkCache.class) -public abstract class ServerChunkCacheMixin implements WorldSource { +@Mixin(class_326.class) +public abstract class ServerChunkCacheMixin implements class_51 { @Shadow - private WorldSource worldSource; + private class_51 field_1227; @Shadow - private World world; + private World field_1231; - @Inject(method = "decorate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;method_885()V")) - private void modloader$decorate(WorldSource i, int j, int par3, CallbackInfo ci) { - ModLoader.PopulateChunk(this.worldSource, j, par3, this.world); + @Inject(method = "method_1803", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;method_885()V")) + private void modloader$decorate(class_51 i, int j, int par3, CallbackInfo ci) { + ModLoader.PopulateChunk(this.field_1227, j, par3, this.field_1231); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/nostation/VanillaFurnaceBlockEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/nostation/VanillaFurnaceBlockEntityMixin.java index ca3eed5d..e1042da8 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/nostation/VanillaFurnaceBlockEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/nostation/VanillaFurnaceBlockEntityMixin.java @@ -6,19 +6,17 @@ import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.Inject; - -import net.minecraft.entity.BlockEntity; -import net.minecraft.entity.block.FurnaceBlockEntity; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.FurnaceBlockEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; -import net.minecraft.recipe.SmeltingRecipeRegistry; - +import net.minecraft.recipe.SmeltingRecipeManager; import io.github.betterthanupdates.reforged.recipe.ReforgedSmeltingRecipeRegistry; @Mixin(FurnaceBlockEntity.class) public abstract class VanillaFurnaceBlockEntityMixin extends BlockEntity implements Inventory { @Shadow - protected abstract boolean canAcceptRecipeOutput(); + protected abstract boolean method_1283(); @Shadow private ItemStack[] inventory; @@ -31,18 +29,18 @@ public abstract class VanillaFurnaceBlockEntityMixin extends BlockEntity impleme */ @Environment(EnvType.CLIENT) @Overwrite - public void craftRecipe() { - if (this.canAcceptRecipeOutput()) { - ItemStack itemstack = ((ReforgedSmeltingRecipeRegistry) SmeltingRecipeRegistry.getInstance()).getSmeltingResult(this.inventory[0]); + public void method_1282() { + if (this.method_1283()) { + ItemStack itemstack = ((ReforgedSmeltingRecipeRegistry) SmeltingRecipeManager.getInstance()).getSmeltingResult(this.inventory[0]); if (this.inventory[2] == null) { this.inventory[2] = itemstack.copy(); - } else if (this.inventory[2].isDamageAndIDIdentical(itemstack)) { + } else if (this.inventory[2].isItemEqual(itemstack)) { this.inventory[2].count += itemstack.count; } - if (this.inventory[0].getItem().hasContainerItemType()) { - this.inventory[0] = new ItemStack(this.inventory[0].getItem().getContainerItemType()); + if (this.inventory[0].getItem().hasCraftingReturnItem()) { + this.inventory[0] = new ItemStack(this.inventory[0].getItem().getCraftingReturnItem()); } else { --this.inventory[0].count; } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/CommandManagerMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/CommandManagerMixin.java index b40e360c..a12aa341 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/CommandManagerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/CommandManagerMixin.java @@ -2,18 +2,17 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_426; +import net.minecraft.class_73; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.world.ServerWorld; - @Environment(EnvType.SERVER) -@Mixin(CommandManager.class) +@Mixin(class_426.class) public abstract class CommandManagerMixin { - @Redirect(method = "processCommand", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;method_204(J)V")) - private void makeClientCompatibleIGuess(ServerWorld instance, long l) { - instance.setWorldTime(l); + @Redirect(method = "method_1411", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_73;method_204(J)V")) + private void makeClientCompatibleIGuess(class_73 instance, long l) { + instance.setTime(l); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/MinecraftServerMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/MinecraftServerMixin.java index 8f8ae849..f5fabe9d 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/MinecraftServerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/MinecraftServerMixin.java @@ -3,6 +3,7 @@ import modloader.ModLoader; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_39; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -10,13 +11,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.command.CommandSource; @Environment(EnvType.SERVER) @Mixin(MinecraftServer.class) -public abstract class MinecraftServerMixin implements Runnable, CommandSource { +public abstract class MinecraftServerMixin implements Runnable, class_39 { - @Inject(method = "start", at = @At(value = "INVOKE", target = "Ljava/util/logging/Logger;info(Ljava/lang/String;)V", remap = false)) + @Inject(method = "method_2166", at = @At(value = "INVOKE", target = "Ljava/util/logging/Logger;info(Ljava/lang/String;)V", remap = false)) private void modloader$start(CallbackInfoReturnable cir) { ModLoader.Init((MinecraftServer) (Object) this); } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerEntityTrackerMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerEntityTrackerMixin.java index d6f5696f..f8110994 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerEntityTrackerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerEntityTrackerMixin.java @@ -3,19 +3,19 @@ import modloadermp.ModLoaderMp; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_488; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.entity.Entity; -import net.minecraft.server.network.ServerEntityTracker; @Environment(EnvType.SERVER) -@Mixin(ServerEntityTracker.class) +@Mixin(class_488.class) public class ServerEntityTrackerMixin { - @Inject(method = "syncEntity", at = @At("RETURN")) + @Inject(method = "method_1665", at = @At("RETURN")) private void modloader$syncEntity(Entity entity, CallbackInfo ci) { - ModLoaderMp.HandleEntityTrackers((ServerEntityTracker) (Object) this, entity); + ModLoaderMp.HandleEntityTrackers((class_488) (Object) this, entity); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerLoginPacketHandlerMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerLoginPacketHandlerMixin.java index 155240f0..20bff7fe 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerLoginPacketHandlerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerLoginPacketHandlerMixin.java @@ -1,24 +1,23 @@ package io.github.betterthanupdates.modloader.mixin.server; +import com.llamalad7.mixinextras.sugar.Local; import modloadermp.ModLoaderMp; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.network.NetworkHandler; +import net.minecraft.network.packet.login.LoginHelloPacket; +import net.minecraft.server.network.ServerLoginNetworkHandler; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import net.minecraft.network.PacketHandler; -import net.minecraft.packet.login.LoginRequestPacket; -import net.minecraft.server.entity.player.ServerPlayerEntity; -import net.minecraft.server.network.ServerLoginPacketHandler; @Environment(EnvType.SERVER) -@Mixin(ServerLoginPacketHandler.class) -public abstract class ServerLoginPacketHandlerMixin extends PacketHandler { - @Inject(method = "complete", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD) - private void modloader$complete(LoginRequestPacket par1, CallbackInfo ci, ServerPlayerEntity entityplayermp) { +@Mixin(ServerLoginNetworkHandler.class) +public abstract class ServerLoginPacketHandlerMixin extends NetworkHandler { + @Inject(method = "accept", at = @At("RETURN")) + private void modloader$complete(LoginHelloPacket par1, CallbackInfo ci, @Local(ordinal = 0) ServerPlayerEntity entityplayermp) { if (entityplayermp != null) ModLoaderMp.HandleAllLogins(entityplayermp); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerWorldSourceMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerWorldSourceMixin.java index eaff17f8..8e191b39 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerWorldSourceMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/ServerWorldSourceMixin.java @@ -3,27 +3,26 @@ import modloader.ModLoader; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_51; +import net.minecraft.class_73; +import net.minecraft.class_79; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.server.world.ServerWorldSource; -import net.minecraft.world.source.WorldSource; - @Environment(EnvType.SERVER) -@Mixin(ServerWorldSource.class) -public abstract class ServerWorldSourceMixin implements WorldSource { +@Mixin(class_79.class) +public abstract class ServerWorldSourceMixin implements class_51 { @Shadow - private WorldSource parentLevelSource; + private class_51 field_936; @Shadow - private ServerWorld world; + private class_73 field_940; - @Inject(method = "decorate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;method_885()V")) - private void modloader$decorate(WorldSource ichunkprovider, int i, int j, CallbackInfo ci) { - ModLoader.PopulateChunk(this.parentLevelSource, i << 4, j << 4, this.world); + @Inject(method = "method_1803", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;method_885()V")) + private void modloader$decorate(class_51 ichunkprovider, int i, int j, CallbackInfo ci) { + ModLoader.PopulateChunk(this.field_936, i << 4, j << 4, this.field_940); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/TrackedEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/TrackedEntityMixin.java index c7e933c2..ed2ba383 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/TrackedEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modloader/mixin/server/TrackedEntityMixin.java @@ -9,6 +9,7 @@ import modloadermp.ModLoaderPacket; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.class_174; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -16,24 +17,23 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.entity.Entity; -import net.minecraft.packet.AbstractPacket; -import net.minecraft.packet.play.EntitySpawnS2CPacket; -import net.minecraft.server.network.TrackedEntity; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket; @Environment(EnvType.SERVER) -@Mixin(TrackedEntity.class) +@Mixin(class_174.class) public class TrackedEntityMixin { @Shadow - public Entity entityToSync; + public Entity field_597; @Inject(method = "method_600", at = @At("HEAD"), cancellable = true) - private void modloader$method_600(CallbackInfoReturnable cir) { - EntityTrackerEntry trackerEntry = ModLoaderMp.HandleEntityTrackerEntries(this.entityToSync); + private void modloader$method_600(CallbackInfoReturnable cir) { + EntityTrackerEntry trackerEntry = ModLoaderMp.HandleEntityTrackerEntries(this.field_597); if (trackerEntry != null) { try { - if (this.entityToSync instanceof ISpawnable) { - ModLoaderPacket packet = ((ISpawnable) this.entityToSync).getSpawnPacket(); + if (this.field_597 instanceof ISpawnable) { + ModLoaderPacket packet = ((ISpawnable) this.field_597).getSpawnPacket(); packet.modId = "Spawn".hashCode(); if (trackerEntry.entityId > 127) { @@ -44,14 +44,14 @@ public class TrackedEntityMixin { cir.setReturnValue(packet); } else if (!trackerEntry.entityHasOwner) { - cir.setReturnValue(new EntitySpawnS2CPacket(this.entityToSync, trackerEntry.entityId)); + cir.setReturnValue(new EntitySpawnS2CPacket(this.field_597, trackerEntry.entityId)); } else { - Field field = this.entityToSync.getClass().getField("owner"); + Field field = this.field_597.getClass().getField("owner"); if (Entity.class.isAssignableFrom(field.getType())) { - Entity entity = (Entity) field.get(this.entityToSync); + Entity entity = (Entity) field.get(this.field_597); cir.setReturnValue(new EntitySpawnS2CPacket( - this.entityToSync, trackerEntry.entityId, entity == null ? this.entityToSync.entityId : entity.entityId + this.field_597, trackerEntry.entityId, entity == null ? this.field_597.id : entity.id )); } else { throw new Exception(String.format("Entity's owner field must be of type Entity, but it is of type %s.", field.getType())); @@ -59,7 +59,7 @@ public class TrackedEntityMixin { } } catch (Exception e) { ModLoader.getLogger().throwing("EntityTrackerEntry", "getSpawnPacket", e); - ModLoader.ThrowException(String.format("Error sending spawn packet for entity of type %s.", this.entityToSync.getClass()), e); + ModLoader.ThrowException(String.format("Error sending spawn packet for entity of type %s.", this.field_597.getClass()), e); cir.setReturnValue(null); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/ConnectingScreenMixin.java b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/ConnectingScreenMixin.java index b07f1dd0..4beeabdf 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/ConnectingScreenMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/ConnectingScreenMixin.java @@ -7,9 +7,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screen.ConnectingScreen; +import net.minecraft.client.gui.screen.ConnectScreen; -@Mixin(ConnectingScreen.class) +@Mixin(ConnectScreen.class) public class ConnectingScreenMixin { @Inject(method = "", at = @At(value = "INVOKE", target = "Ljava/io/PrintStream;println(Ljava/lang/String;)V", remap = false)) private void modoptionsapi$init(Minecraft string, String s, int par3, CallbackInfo ci) { diff --git a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/OptionsScreenMixin.java b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/OptionsScreenMixin.java index 8175d8a7..266318db 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/OptionsScreenMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/OptionsScreenMixin.java @@ -8,12 +8,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.menu.OptionsScreen; +import net.minecraft.client.gui.screen.option.OptionsScreen; import net.minecraft.client.gui.widget.ButtonWidget; @Mixin(OptionsScreen.class) public class OptionsScreenMixin extends Screen { - @Inject(method = "initVanillaScreen", at = @At("RETURN")) + @Inject(method = "init", at = @At("RETURN")) private void modoptionsapi$init(CallbackInfo ci) { // TODO: This string needs to be localized, eventually. if (ModOptionsAPI.getAllMods().length > 0) this.buttons.add(new ButtonWidget(301, this.width / 2, this.height / 6 + 192, "ModOptionsAPI's Mod Options")); @@ -22,8 +22,8 @@ public class OptionsScreenMixin extends Screen { @Inject(method = "buttonClicked", at = @At("RETURN")) private void modoptionsapi$buttonClicked(ButtonWidget guibutton, CallbackInfo ci) { if (guibutton.active && guibutton.id == 301) { - this.client.options.saveOptions(); - this.client.openScreen(new ModMenu(this)); + this.minecraft.options.save(); + this.minecraft.setScreen(new ModMenu(this)); } } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/PauseMenuMixin.java b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/PauseMenuMixin.java index f372172a..2e5e370b 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/PauseMenuMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/PauseMenuMixin.java @@ -6,14 +6,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - +import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.PauseScreen; import net.minecraft.client.gui.widget.ButtonWidget; -@Mixin(PauseScreen.class) +@Mixin(GameMenuScreen.class) public class PauseMenuMixin extends Screen { - @Inject(method = "initVanillaScreen", at = @At("RETURN")) + @Inject(method = "init", at = @At("RETURN")) private void modoptionsapi$addButton(CallbackInfo ci) { if (ModOptionsAPI.getAllMods().length > 0) this.buttons.add(new ButtonWidget(30, this.width / 2 - 100, this.height / 4 + 148 + -16, "Mod World Options")); @@ -22,13 +21,13 @@ public class PauseMenuMixin extends Screen { @Inject(method = "buttonClicked", at = @At("RETURN")) private void modoptionsapi$buttonClicked(ButtonWidget guibutton, CallbackInfo ci) { if (guibutton.id == 30) { - if (this.client.hasWorld()) { - String[] parts = this.client.options.lastServer.split("_"); + if (this.minecraft.isWorldRemote()) { + String[] parts = this.minecraft.options.lastServer.split("_"); String name = parts[0]; - this.client.openScreen(new ModMenu((PauseScreen) (Object) this, name, true)); + this.minecraft.setScreen(new ModMenu((GameMenuScreen) (Object) this, name, true)); } else { - String name = this.client.world.getProperties().getName(); - this.client.openScreen(new ModMenu((PauseScreen) (Object) this, name, false)); + String name = this.minecraft.world.method_262().getName(); + this.minecraft.setScreen(new ModMenu((GameMenuScreen) (Object) this, name, false)); } } } diff --git a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/SelectWorldScreenMixin.java b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/SelectWorldScreenMixin.java index 7c57c3df..d16e599b 100644 --- a/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/SelectWorldScreenMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/modoptionsapi/mixin/client/SelectWorldScreenMixin.java @@ -1,21 +1,20 @@ package io.github.betterthanupdates.modoptionsapi.mixin.client; import modoptionsapi.ModOptionsAPI; +import net.minecraft.client.gui.screen.world.SelectWorldScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.gui.screen.SelectWorldScreen; - @Mixin(SelectWorldScreen.class) public abstract class SelectWorldScreenMixin { @Shadow - protected abstract String getWorldName(int i); + protected abstract String method_1889(int i); - @Inject(method = "loadWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;createOrLoadWorld(Ljava/lang/String;Ljava/lang/String;J)V")) + @Inject(method = "method_1891", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;method_2120(Ljava/lang/String;Ljava/lang/String;J)V")) private void modoptionsapi$loadWorld(int i, CallbackInfo ci) { - ModOptionsAPI.selectedWorld(this.getWorldName(i)); + ModOptionsAPI.selectedWorld(this.method_1889(i)); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/playerapi/client/entity/player/PlayerAPIClientPlayerEntity.java b/apron/src/main/java/io/github/betterthanupdates/playerapi/client/entity/player/PlayerAPIClientPlayerEntity.java index 32a2241d..61112169 100644 --- a/apron/src/main/java/io/github/betterthanupdates/playerapi/client/entity/player/PlayerAPIClientPlayerEntity.java +++ b/apron/src/main/java/io/github/betterthanupdates/playerapi/client/entity/player/PlayerAPIClientPlayerEntity.java @@ -3,14 +3,14 @@ import java.util.List; import java.util.Random; +import net.minecraft.class_141; import playerapi.PlayerBase; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; +import net.minecraft.block.Material; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; -import net.minecraft.util.SleepStatus; /** * Implements getter for public field patch in ClientPlayerEntity. @@ -22,7 +22,7 @@ public interface PlayerAPIClientPlayerEntity { void superOnUpdate(); - SleepStatus superSleepInBedAt(int i, int j, int k); + class_141 superSleepInBedAt(int i, int j, int k); Minecraft getMc(); diff --git a/apron/src/main/java/io/github/betterthanupdates/playerapi/mixin/client/AbstractClientPlayerEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/playerapi/mixin/client/AbstractClientPlayerEntityMixin.java index a7b2f9a6..01ac6ebc 100644 --- a/apron/src/main/java/io/github/betterthanupdates/playerapi/mixin/client/AbstractClientPlayerEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/playerapi/mixin/client/AbstractClientPlayerEntityMixin.java @@ -6,8 +6,10 @@ import fr.catcore.cursedmixinextensions.annotations.ShadowSuper; import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.class_141; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -16,69 +18,69 @@ import playerapi.PlayerBase; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; +import net.minecraft.block.Material; +import net.minecraft.block.entity.DispenserBlockEntity; +import net.minecraft.block.entity.FurnaceBlockEntity; +import net.minecraft.block.entity.SignBlockEntity; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.player.AbstractClientPlayerEntity; import net.minecraft.client.util.Session; import net.minecraft.entity.Entity; -import net.minecraft.entity.block.DispenserBlockEntity; -import net.minecraft.entity.block.FurnaceBlockEntity; -import net.minecraft.entity.block.SignBlockEntity; +import net.minecraft.entity.player.ClientPlayerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.SleepStatus; -import net.minecraft.util.io.CompoundTag; +import net.minecraft.nbt.NbtCompound; import net.minecraft.world.World; import io.github.betterthanupdates.playerapi.client.entity.player.PlayerAPIClientPlayerEntity; -@Mixin(AbstractClientPlayerEntity.class) +@Mixin(ClientPlayerEntity.class) public abstract class AbstractClientPlayerEntityMixin extends PlayerEntity implements PlayerAPIClientPlayerEntity { @Shadow - public Minecraft client; + public Minecraft minecraft; public AbstractClientPlayerEntityMixin(World arg) { super(arg); } + @Unique public List playerBases = new ArrayList<>(); @Inject(method = "", at = @At("RETURN")) private void papi$init(Minecraft arg, World arg2, Session i, int par4, CallbackInfo ci) { - this.playerBases = PlayerAPI.playerInit((AbstractClientPlayerEntity) (Object) this); + this.playerBases = PlayerAPI.playerInit((ClientPlayerEntity) (Object) this); } @Override public boolean damage(Entity entity, int i) { - return !PlayerAPI.attackEntityFrom((AbstractClientPlayerEntity) (Object) this, entity, i) && super.damage(entity, i); + return !PlayerAPI.attackEntityFrom((ClientPlayerEntity) (Object) this, entity, i) && super.damage(entity, i); } @Override - public void onKilledBy(Entity entity) { - if (!PlayerAPI.onDeath((AbstractClientPlayerEntity) (Object) this, entity)) { - super.onKilledBy(entity); + public void method_938(Entity entity) { + if (!PlayerAPI.onDeath((ClientPlayerEntity) (Object) this, entity)) { + super.method_938(entity); } } - @Inject(method = "tickHandSwing", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_910", at = @At("HEAD"), cancellable = true) private void papi$tickHandSwing(CallbackInfo ci) { - if (PlayerAPI.updatePlayerActionState((AbstractClientPlayerEntity) (Object) this)) ci.cancel(); + if (PlayerAPI.updatePlayerActionState((ClientPlayerEntity) (Object) this)) ci.cancel(); } @Override public void superUpdatePlayerActionState() { - super.tickHandSwing(); + super.method_910(); } - @Inject(method = "updateDespawnCounter", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_937", at = @At("HEAD"), cancellable = true) private void papi$updateDespawnCounter(CallbackInfo ci) { - if (PlayerAPI.onLivingUpdate((AbstractClientPlayerEntity) (Object) this)) ci.cancel(); + if (PlayerAPI.onLivingUpdate((ClientPlayerEntity) (Object) this)) ci.cancel(); } @Override public void superOnLivingUpdate() { - super.updateDespawnCounter(); + super.method_937(); } @Override @@ -87,129 +89,129 @@ public void superOnUpdate() { } @Override - public void movementInputToVelocity(float f, float f1, float f2) { - if (!PlayerAPI.moveFlying((AbstractClientPlayerEntity) (Object) this, f, f1, f2)) { - super.movementInputToVelocity(f, f1, f2); + public void method_1324(float f, float f1, float f2) { + if (!PlayerAPI.moveFlying((ClientPlayerEntity) (Object) this, f, f1, f2)) { + super.method_1324(f, f1, f2); } } @Override - protected boolean canClimb() { - return PlayerAPI.canTriggerWalking((AbstractClientPlayerEntity) (Object) this, true); + protected boolean bypassesSteppingEffects() { + return PlayerAPI.canTriggerWalking((ClientPlayerEntity) (Object) this, true); } @Inject(method = "method_136", at = @At("HEAD"), cancellable = true) private void papi$method_136(int i, boolean flag, CallbackInfo ci) { - if (PlayerAPI.handleKeyPress((AbstractClientPlayerEntity) (Object) this, i, flag)) ci.cancel(); + if (PlayerAPI.handleKeyPress((ClientPlayerEntity) (Object) this, i, flag)) ci.cancel(); } - @Inject(method = "writeAdditional", at = @At("HEAD"), cancellable = true) - private void papi$writeAdditional(CompoundTag par1, CallbackInfo ci) { - if (PlayerAPI.writeEntityToNBT((AbstractClientPlayerEntity) (Object) this, par1)) ci.cancel(); + @Inject(method = "writeNbt", at = @At("HEAD"), cancellable = true) + private void papi$writeAdditional(NbtCompound par1, CallbackInfo ci) { + if (PlayerAPI.writeEntityToNBT((ClientPlayerEntity) (Object) this, par1)) ci.cancel(); } - @Inject(method = "readAdditional", at = @At("HEAD"), cancellable = true) - private void papi$readAdditional(CompoundTag par1, CallbackInfo ci) { - if (PlayerAPI.readEntityFromNBT((AbstractClientPlayerEntity) (Object) this, par1)) ci.cancel(); + @Inject(method = "readNbt", at = @At("HEAD"), cancellable = true) + private void papi$readAdditional(NbtCompound par1, CallbackInfo ci) { + if (PlayerAPI.readEntityFromNBT((ClientPlayerEntity) (Object) this, par1)) ci.cancel(); } - @Inject(method = "closeContainer", at = @At("HEAD"), cancellable = true) + @Inject(method = "closeScreen", at = @At("HEAD"), cancellable = true) private void papi$closeContainer(CallbackInfo ci) { - if (PlayerAPI.onExitGUI((AbstractClientPlayerEntity) (Object) this)) ci.cancel(); + if (PlayerAPI.onExitGUI((ClientPlayerEntity) (Object) this)) ci.cancel(); } - @Inject(method = "openSignScreen", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_489", at = @At("HEAD"), cancellable = true) private void papi$openSignScreen(SignBlockEntity par1, CallbackInfo ci) { - if (PlayerAPI.displayGUIEditSign((AbstractClientPlayerEntity) (Object) this, par1)) ci.cancel(); + if (PlayerAPI.displayGUIEditSign((ClientPlayerEntity) (Object) this, par1)) ci.cancel(); } - @Inject(method = "openChestScreen", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_486", at = @At("HEAD"), cancellable = true) private void papi$openChestScreen(Inventory par1, CallbackInfo ci) { - if (PlayerAPI.displayGUIChest((AbstractClientPlayerEntity) (Object) this, par1)) ci.cancel(); + if (PlayerAPI.displayGUIChest((ClientPlayerEntity) (Object) this, par1)) ci.cancel(); } - @Inject(method = "openCraftingScreen", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_484", at = @At("HEAD"), cancellable = true) private void papi$openCraftingScreen(int i, int j, int k, CallbackInfo ci) { - if (PlayerAPI.displayWorkbenchGUI((AbstractClientPlayerEntity) (Object) this, i, j, k)) ci.cancel(); + if (PlayerAPI.displayWorkbenchGUI((ClientPlayerEntity) (Object) this, i, j, k)) ci.cancel(); } - @Inject(method = "openFurnaceScreen", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_487", at = @At("HEAD"), cancellable = true) private void papi$openFurnaceScreen(FurnaceBlockEntity par1, CallbackInfo ci) { - if (PlayerAPI.displayGUIFurnace((AbstractClientPlayerEntity) (Object) this, par1)) ci.cancel(); + if (PlayerAPI.displayGUIFurnace((ClientPlayerEntity) (Object) this, par1)) ci.cancel(); } - @Inject(method = "openDispenserScreen", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_485", at = @At("HEAD"), cancellable = true) private void papi$openDispenserScreen(DispenserBlockEntity par1, CallbackInfo ci) { - if (PlayerAPI.displayGUIDispenser((AbstractClientPlayerEntity) (Object) this, par1)) ci.cancel(); + if (PlayerAPI.displayGUIDispenser((ClientPlayerEntity) (Object) this, par1)) ci.cancel(); } - @Inject(method = "getArmorValue", at = @At("RETURN"), cancellable = true) + @Inject(method = "method_141", at = @At("RETURN"), cancellable = true) private void papi$getArmorValue(CallbackInfoReturnable cir) { - cir.setReturnValue(PlayerAPI.getPlayerArmorValue((AbstractClientPlayerEntity) (Object) this, cir.getReturnValue())); + cir.setReturnValue(PlayerAPI.getPlayerArmorValue((ClientPlayerEntity) (Object) this, cir.getReturnValue())); } @Override - public void remove() { - if (!PlayerAPI.setEntityDead((AbstractClientPlayerEntity) (Object) this)) { - super.remove(); + public void markDead() { + if (!PlayerAPI.setEntityDead((ClientPlayerEntity) (Object) this)) { + super.markDead(); } } @Override - public double squaredDistanceTo(double d, double d1, double d2) { - return PlayerAPI.getDistanceSq((AbstractClientPlayerEntity) (Object) this, d, d1, d2, super.squaredDistanceTo(d, d1, d2)); + public double method_1347(double d, double d1, double d2) { + return PlayerAPI.getDistanceSq((ClientPlayerEntity) (Object) this, d, d1, d2, super.method_1347(d, d1, d2)); } @Override public boolean method_1334() { - return PlayerAPI.isInWater((AbstractClientPlayerEntity) (Object) this, this.field_1612); + return PlayerAPI.isInWater((ClientPlayerEntity) (Object) this, this.field_1612); } @Inject(method = "method_1373", at = @At("RETURN"), cancellable = true) private void papi$isSneaking(CallbackInfoReturnable cir) { - cir.setReturnValue(PlayerAPI.isSneaking((AbstractClientPlayerEntity) (Object) this, cir.getReturnValue())); + cir.setReturnValue(PlayerAPI.isSneaking((ClientPlayerEntity) (Object) this, cir.getReturnValue())); } @Override - public float getStrengh(Block block) { - float f = this.inventory.getStrengthOnBlock(block); + public float method_511(Block block) { + float f = this.inventory.method_674(block); if (this.isInFluid(Material.WATER)) { f /= 5.0F; } - if (!this.onGround) { + if (!this.field_1623) { f /= 5.0F; } - return PlayerAPI.getCurrentPlayerStrVsBlock((AbstractClientPlayerEntity) (Object) this, block, f); + return PlayerAPI.getCurrentPlayerStrVsBlock((ClientPlayerEntity) (Object) this, block, f); } @Override - public void addHealth(int i) { - if (!PlayerAPI.heal((AbstractClientPlayerEntity) (Object) this, i)) { - super.addHealth(i); + public void method_939(int i) { + if (!PlayerAPI.heal((ClientPlayerEntity) (Object) this, i)) { + super.method_939(i); } } @Inject(method = "respawn", at = @At("HEAD"), cancellable = true) private void papi$respawn(CallbackInfo ci) { - if (PlayerAPI.respawn((AbstractClientPlayerEntity) (Object) this)) ci.cancel(); + if (PlayerAPI.respawn((ClientPlayerEntity) (Object) this)) ci.cancel(); } - @Inject(method = "method_1372", at = @At("HEAD"), cancellable = true) + @Inject(method = "pushOutOfBlock", at = @At("HEAD"), cancellable = true) private void papi$method_1372(double d, double d1, double d2, CallbackInfoReturnable cir) { - if (PlayerAPI.pushOutOfBlocks((AbstractClientPlayerEntity) (Object) this, d, d1, d2)) cir.setReturnValue(false); + if (PlayerAPI.pushOutOfBlocks((ClientPlayerEntity) (Object) this, d, d1, d2)) cir.setReturnValue(false); } @Override - public SleepStatus superSleepInBedAt(int i, int j, int k) { - return super.trySleep(i, j, k); + public class_141 superSleepInBedAt(int i, int j, int k) { + return super.method_495(i, j, k); } @Override public Minecraft getMc() { - return this.client; + return this.minecraft; } @Override @@ -219,12 +221,12 @@ public void superMoveEntity(double d, double d1, double d2) { @Override public void setMoveForward(float f) { - this.forwardVelocity = f; + this.field_1029 = f; } @Override public void setMoveStrafing(float f) { - this.horizontalVelocity = f; + this.field_1060 = f; } @Override @@ -233,63 +235,63 @@ public void setIsJumping(boolean flag) { } @Override - public float getBrightnessAtEyes(float f) { - return PlayerAPI.getEntityBrightness((AbstractClientPlayerEntity) (Object) this, f, super.getBrightnessAtEyes(f)); + public float method_1394(float f) { + return PlayerAPI.getEntityBrightness((ClientPlayerEntity) (Object) this, f, super.method_1394(f)); } @Override public void tick() { - PlayerAPI.beforeUpdate((AbstractClientPlayerEntity) (Object) this); + PlayerAPI.beforeUpdate((ClientPlayerEntity) (Object) this); - if (!PlayerAPI.onUpdate((AbstractClientPlayerEntity) (Object) this)) { + if (!PlayerAPI.onUpdate((ClientPlayerEntity) (Object) this)) { super.tick(); } - PlayerAPI.afterUpdate((AbstractClientPlayerEntity) (Object) this); + PlayerAPI.afterUpdate((ClientPlayerEntity) (Object) this); } @Override public void superMoveFlying(float f, float f1, float f2) { - super.movementInputToVelocity(f, f1, f2); + super.method_1324(f, f1, f2); } @Inject(method = "move", at = @At("HEAD")) private void papi$beforeMoveEntity(double d, double d1, double d2, CallbackInfo ci) { - PlayerAPI.beforeMoveEntity((AbstractClientPlayerEntity) (Object) this, d, d1, d2); + PlayerAPI.beforeMoveEntity((ClientPlayerEntity) (Object) this, d, d1, d2); } @Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;move(DDD)V"), cancellable = true) private void papi$moveEntity(double d, double d1, double d2, CallbackInfo ci) { - if (PlayerAPI.moveEntity((AbstractClientPlayerEntity) (Object) this, d, d1, d2)) { + if (PlayerAPI.moveEntity((ClientPlayerEntity) (Object) this, d, d1, d2)) { ci.cancel(); } } @Inject(method = "move", at = @At("RETURN")) private void papi$afterMoveEntity(double d, double d1, double d2, CallbackInfo ci) { - PlayerAPI.afterMoveEntity((AbstractClientPlayerEntity) (Object) this, d, d1, d2); + PlayerAPI.afterMoveEntity((ClientPlayerEntity) (Object) this, d, d1, d2); } @Override - public SleepStatus trySleep(int i, int j, int k) { - PlayerAPI.beforeSleepInBedAt((AbstractClientPlayerEntity) (Object) this, i, j, k); - SleepStatus sleepStatus = PlayerAPI.sleepInBedAt((AbstractClientPlayerEntity) (Object) this, i, j, k); - return sleepStatus == null ? super.trySleep(i, j, k) : sleepStatus; + public class_141 method_495(int i, int j, int k) { + PlayerAPI.beforeSleepInBedAt((ClientPlayerEntity) (Object) this, i, j, k); + class_141 sleepStatus = PlayerAPI.sleepInBedAt((ClientPlayerEntity) (Object) this, i, j, k); + return sleepStatus == null ? super.method_495(i, j, k) : sleepStatus; } @Override public void doFall(float fallDist) { - super.handleFallDamage(fallDist); + super.method_1389(fallDist); } @Override public float getFallDistance() { - return this.fallDistance; + return this.field_1636; } @Override public boolean getSleeping() { - return this.lyingOnBed; + return this.sleeping; } @Override @@ -299,17 +301,17 @@ public boolean getJumping() { @Override public void doJump() { - this.jump(); + this.method_944(); } @Override public Random getRandom() { - return this.rand; + return this.random; } @Override public void setFallDistance(float f) { - this.fallDistance = f; + this.field_1636 = f; } @Override @@ -318,39 +320,39 @@ public void setYSize(float f) { } @Override - public void travel(float f, float f1) { - if (!PlayerAPI.moveEntityWithHeading((AbstractClientPlayerEntity) (Object) this, f, f1)) { - super.travel(f, f1); + public void method_945(float f, float f1) { + if (!PlayerAPI.moveEntityWithHeading((ClientPlayerEntity) (Object) this, f, f1)) { + super.method_945(f, f1); } } @Override public boolean method_932() { - return PlayerAPI.isOnLadder((AbstractClientPlayerEntity) (Object) this, super.method_932()); + return PlayerAPI.isOnLadder((ClientPlayerEntity) (Object) this, super.method_932()); } @Override public void setActionState(float newMoveStrafing, float newMoveForward, boolean newIsJumping) { - this.horizontalVelocity = newMoveStrafing; - this.forwardVelocity = newMoveForward; + this.field_1060 = newMoveStrafing; + this.field_1029 = newMoveForward; this.jumping = newIsJumping; } @Override public boolean isInFluid(Material material) { - return PlayerAPI.isInsideOfMaterial((AbstractClientPlayerEntity) (Object) this, material, super.isInFluid(material)); + return PlayerAPI.isInsideOfMaterial((ClientPlayerEntity) (Object) this, material, super.isInFluid(material)); } @Override public void dropSelectedItem() { - if (!PlayerAPI.dropCurrentItem((AbstractClientPlayerEntity) (Object) this)) { + if (!PlayerAPI.dropCurrentItem((ClientPlayerEntity) (Object) this)) { super.dropSelectedItem(); } } @Override public void dropItem(ItemStack itemstack) { - if (!PlayerAPI.dropPlayerItem((AbstractClientPlayerEntity) (Object) this, itemstack)) { + if (!PlayerAPI.dropPlayerItem((ClientPlayerEntity) (Object) this, itemstack)) { super.dropItem(itemstack); } } @@ -362,69 +364,69 @@ public boolean superIsInsideOfMaterial(Material material) { @Override public float superGetEntityBrightness(float f) { - return super.getBrightnessAtEyes(f); + return super.method_1394(f); } @Inject(method = "sendChatMessage", at = @At("RETURN")) private void papi$sendChatMessage(String s, CallbackInfo ci) { - PlayerAPI.sendChatMessage((AbstractClientPlayerEntity) (Object) this, s); + PlayerAPI.sendChatMessage((ClientPlayerEntity) (Object) this, s); } @Override - protected String getHurtSound() { - String result = PlayerAPI.getHurtSound((AbstractClientPlayerEntity) (Object) this); - return result != null ? result : super.getHurtSound(); + protected String method_912() { + String result = PlayerAPI.getHurtSound((ClientPlayerEntity) (Object) this); + return result != null ? result : super.method_912(); } @Override public String superGetHurtSound() { - return super.getHurtSound(); + return super.method_912(); } @Override public float superGetCurrentPlayerStrVsBlock(Block block) { - return super.getStrengh(block); + return super.method_511(block); } @Override - public boolean canRemoveBlock(Block block) { - Boolean result = PlayerAPI.canHarvestBlock((AbstractClientPlayerEntity) (Object) this, block); - return result != null ? result : super.canRemoveBlock(block); + public boolean method_514(Block block) { + Boolean result = PlayerAPI.canHarvestBlock((ClientPlayerEntity) (Object) this, block); + return result != null ? result : super.method_514(block); } @Override public boolean superCanHarvestBlock(Block block) { - return super.canRemoveBlock(block); + return super.method_514(block); } @Override - protected void handleFallDamage(float f) { - if (!PlayerAPI.fall((AbstractClientPlayerEntity) (Object) this, f)) { - super.handleFallDamage(f); + protected void method_1389(float f) { + if (!PlayerAPI.fall((ClientPlayerEntity) (Object) this, f)) { + super.method_1389(f); } } @Override public void superFall(float f) { - super.handleFallDamage(f); + super.method_1389(f); } @Override - protected void jump() { - if (!PlayerAPI.jump((AbstractClientPlayerEntity) (Object) this)) { - super.jump(); + protected void method_944() { + if (!PlayerAPI.jump((ClientPlayerEntity) (Object) this)) { + super.method_944(); } } @Override public void superJump() { - super.jump(); + super.method_944(); } @Override - protected void applyDamage(int i) { - if (!PlayerAPI.damageEntity((AbstractClientPlayerEntity) (Object) this, i)) { - super.applyDamage(i); + protected void method_946(int i) { + if (!PlayerAPI.damageEntity((ClientPlayerEntity) (Object) this, i)) { + super.method_946(i); } } @@ -436,13 +438,13 @@ public void superDamageEntity(int i) { if (FabricLoader.getInstance().isModLoaded("station-player-api-v0")) { this.superSuperDamageEntity(i); } else { - super.applyDamage(i); + super.method_946(i); } } @Override public double method_1352(Entity entity) { - Double result = PlayerAPI.getDistanceSqToEntity((AbstractClientPlayerEntity) (Object) this, entity); + Double result = PlayerAPI.getDistanceSqToEntity((ClientPlayerEntity) (Object) this, entity); return result != null ? result : super.method_1352(entity); } @@ -453,7 +455,7 @@ public double superGetDistanceSqToEntity(Entity entity) { @Override public void attack(Entity entity) { - if (!PlayerAPI.attackTargetEntityWithCurrentItem((AbstractClientPlayerEntity) (Object) this, entity)) { + if (!PlayerAPI.attackTargetEntityWithCurrentItem((ClientPlayerEntity) (Object) this, entity)) { super.attack(entity); } } @@ -464,19 +466,19 @@ public void superAttackTargetEntityWithCurrentItem(Entity entity) { } @Override - public boolean method_1393() { - Boolean result = PlayerAPI.handleWaterMovement((AbstractClientPlayerEntity) (Object) this); - return result != null ? result : super.method_1393(); + public boolean isSubmergedInWater() { + Boolean result = PlayerAPI.handleWaterMovement((ClientPlayerEntity) (Object) this); + return result != null ? result : super.isSubmergedInWater(); } @Override public boolean superHandleWaterMovement() { - return super.method_1393(); + return super.isSubmergedInWater(); } @Override public boolean method_1335() { - Boolean result = PlayerAPI.handleLavaMovement((AbstractClientPlayerEntity) (Object) this); + Boolean result = PlayerAPI.handleLavaMovement((ClientPlayerEntity) (Object) this); return result != null ? result : super.method_1335(); } @@ -487,7 +489,7 @@ public boolean superHandleLavaMovement() { @Override public void dropItem(ItemStack itemstack, boolean flag) { - if (!PlayerAPI.dropPlayerItemWithRandomChoice((AbstractClientPlayerEntity) (Object) this, itemstack, flag)) { + if (!PlayerAPI.dropPlayerItemWithRandomChoice((ClientPlayerEntity) (Object) this, itemstack, flag)) { super.dropItem(itemstack, flag); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/BlockMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/BlockMixin.java index 89a8a010..e6f5e56f 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/BlockMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/BlockMixin.java @@ -4,30 +4,23 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import reforged.ICustomDrop; import net.minecraft.block.Block; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; import io.github.betterthanupdates.reforged.block.ReforgedBlock; @Mixin(Block.class) public abstract class BlockMixin implements ReforgedBlock { @Shadow - public abstract int getDropId(int i, Random random); + public abstract int getDroppedItemId(int i, Random random); @Shadow - public abstract int getDropCount(Random random); + public abstract int getDroppedItemCount(Random random); @Shadow - protected abstract int droppedMeta(int i); + protected abstract int getDroppedItemMeta(int i); // // // Reforged fields // @Unique @@ -35,7 +28,7 @@ public abstract class BlockMixin implements ReforgedBlock { @Override public int quantityDropped(int i, Random random) { - return this.getDropCount(random); + return this.getDroppedItemCount(random); } @Override @@ -47,14 +40,14 @@ public int quantityDropped(int i, Random random, ItemStack stack) { @Override public int damageDropped(int i, ItemStack stack) { - return stack != null && stack.getItem() instanceof ICustomDrop ? ((ICustomDrop) stack.getItem()).getDamageDropped((Block) (Object) this, i, stack) : this.droppedMeta(i); + return stack != null && stack.getItem() instanceof ICustomDrop ? ((ICustomDrop) stack.getItem()).getDamageDropped((Block) (Object) this, i, stack) : this.getDroppedItemMeta(i); } @Override public int idDropped(int i, Random random, ItemStack stack) { return stack != null && stack.getItem() instanceof ICustomDrop ? ((ICustomDrop) stack.getItem()).getIdDropped((Block) (Object) this, i, random, stack) - : this.getDropId(i, random); + : this.getDroppedItemId(i, random); } // int cachedL; diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/FurnaceBlockEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/FurnaceBlockEntityMixin.java index a207b7e2..25aefb81 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/FurnaceBlockEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/FurnaceBlockEntityMixin.java @@ -4,13 +4,11 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; - -import net.minecraft.entity.BlockEntity; -import net.minecraft.entity.block.FurnaceBlockEntity; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.FurnaceBlockEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; -import net.minecraft.recipe.SmeltingRecipeRegistry; - +import net.minecraft.recipe.SmeltingRecipeManager; import io.github.betterthanupdates.reforged.recipe.ReforgedSmeltingRecipeRegistry; @Mixin(FurnaceBlockEntity.class) @@ -18,8 +16,8 @@ public abstract class FurnaceBlockEntityMixin extends BlockEntity implements Inv @Shadow private ItemStack[] inventory; - @Redirect(method = "canAcceptRecipeOutput", at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/SmeltingRecipeRegistry;getResult(I)Lnet/minecraft/item/ItemStack;")) - private ItemStack reforged$canAcceptRecipeOutput(SmeltingRecipeRegistry instance, int i) { + @Redirect(method = "method_1283", at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/SmeltingRecipeManager;craft(I)Lnet/minecraft/item/ItemStack;")) + private ItemStack reforged$canAcceptRecipeOutput(SmeltingRecipeManager instance, int i) { return ((ReforgedSmeltingRecipeRegistry) instance).getSmeltingResult(this.inventory[0]); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/ShearsItemMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/ShearsItemMixin.java index 1363f26f..df3c9326 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/ShearsItemMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/ShearsItemMixin.java @@ -30,26 +30,26 @@ public ShearsItemMixin(int i) { @Inject(method = "postMine", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;postMine(Lnet/minecraft/item/ItemStack;IIIILnet/minecraft/entity/LivingEntity;)Z")) private void reforged$postMine(ItemStack itemstack, int i, int j, int k, int l, LivingEntity livingEntity, CallbackInfoReturnable cir) { if (i != Block.COBWEB.id && i != Block.LEAVES.id // Don't apply damage if it has already been applied before. - && Block.BY_ID[i] instanceof IShearable) { - itemstack.applyDamage(1, livingEntity); + && Block.BLOCKS[i] instanceof IShearable) { + itemstack.damage(1, livingEntity); } } @Override - public void interactWithEntity(ItemStack itemstack, LivingEntity entity) { - if (!entity.world.isClient) { + public void useOnEntity(ItemStack itemstack, LivingEntity entity) { + if (!entity.world.isRemote) { if (entity instanceof IShearable) { IShearable target = (IShearable) entity; if (target.isShearable(itemstack, entity.world, (int) entity.x, (int) entity.y, (int) entity.z)) { for (ItemStack stack : target.onSheared(itemstack, entity.world, (int) entity.x, (int) entity.y, (int) entity.z)) { - ItemEntity ent = entity.dropItem(stack, 1.0F); - ent.yVelocity += (double) (entity.rand.nextFloat() * 0.05F); - ent.xVelocity += (double) ((entity.rand.nextFloat() - entity.rand.nextFloat()) * 0.1F); - ent.zVelocity += (double) ((entity.rand.nextFloat() - entity.rand.nextFloat()) * 0.1F); + ItemEntity ent = entity.method_1327(stack, 1.0F); + ent.velocityY += (double) (entity.random.nextFloat() * 0.05F); + ent.velocityX += (double) ((entity.random.nextFloat() - entity.random.nextFloat()) * 0.1F); + ent.velocityZ += (double) ((entity.random.nextFloat() - entity.random.nextFloat()) * 0.1F); } - itemstack.applyDamage(1, entity); + itemstack.damage(1, entity); } } } @@ -57,25 +57,25 @@ public void interactWithEntity(ItemStack itemstack, LivingEntity entity) { @Override public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, PlayerEntity player) { - if (!player.world.isClient) { + if (!player.world.isRemote) { int id = player.world.getBlockId(x, y, z); - if (Block.BY_ID[id] != null && Block.BY_ID[id] instanceof IShearable) { - IShearable target = (IShearable) Block.BY_ID[id]; + if (Block.BLOCKS[id] != null && Block.BLOCKS[id] instanceof IShearable) { + IShearable target = (IShearable) Block.BLOCKS[id]; if (target.isShearable(itemstack, player.world, x, y, z)) { for (ItemStack stack : target.onSheared(itemstack, player.world, x, y, z)) { float f = 0.7F; - double d = (double) (player.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5; - double d1 = (double) (player.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5; - double d2 = (double) (player.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5; + double d = (double) (player.random.nextFloat() * f) + (double) (1.0F - f) * 0.5; + double d1 = (double) (player.random.nextFloat() * f) + (double) (1.0F - f) * 0.5; + double d2 = (double) (player.random.nextFloat() * f) + (double) (1.0F - f) * 0.5; ItemEntity entityitem = new ItemEntity(player.world, (double) x + d, (double) y + d1, (double) z + d2, stack); entityitem.pickupDelay = 10; - player.world.spawnEntity(entityitem); + player.world.method_210(entityitem); } - itemstack.applyDamage(1, player); - player.increaseStat(Stats.mineBlock[id], 1); + itemstack.damage(1, player); + player.increaseStat(Stats.MINE_BLOCK[id], 1); } } } diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SheepEntityMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SheepEntityMixin.java index 62759883..11b6d05d 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SheepEntityMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SheepEntityMixin.java @@ -4,20 +4,19 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.entity.AbstractAnimalEntity; -import net.minecraft.entity.animal.SheepEntity; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.SheepEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; @Mixin(SheepEntity.class) -public class SheepEntityMixin extends AbstractAnimalEntity { +public class SheepEntityMixin extends AnimalEntity { public SheepEntityMixin(World arg) { super(arg); } - @Inject(method = "interact", cancellable = true, at = @At("RETURN")) + @Inject(method = "method_1323", cancellable = true, at = @At("RETURN")) private void reforged$interact(PlayerEntity entityplayer, CallbackInfoReturnable cir) { - cir.setReturnValue(super.interact(entityplayer)); + cir.setReturnValue(super.method_1323(entityplayer)); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SmeltingRecipeRegistryMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SmeltingRecipeRegistryMixin.java index bd8c3347..a6004dd2 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SmeltingRecipeRegistryMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/SmeltingRecipeRegistryMixin.java @@ -11,11 +11,10 @@ import org.spongepowered.asm.mixin.Unique; import net.minecraft.item.ItemStack; -import net.minecraft.recipe.SmeltingRecipeRegistry; - +import net.minecraft.recipe.SmeltingRecipeManager; import io.github.betterthanupdates.reforged.recipe.ReforgedSmeltingRecipeRegistry; -@Mixin(SmeltingRecipeRegistry.class) +@Mixin(SmeltingRecipeManager.class) public class SmeltingRecipeRegistryMixin implements ReforgedSmeltingRecipeRegistry { @Shadow private Map recipes; @@ -36,7 +35,7 @@ public ItemStack getSmeltingResult(ItemStack item) { @Override public ItemStack reforged$getSmeltingResult(ItemStack itemStack) { if (itemStack != null) { - return this.metaSmeltingList.get(Arrays.asList(itemStack.itemId, itemStack.getMeta())); + return this.metaSmeltingList.get(Arrays.asList(itemStack.itemId, itemStack.getDamage())); } return null; diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/MultiplayerClientInteractionManagerMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/MultiplayerClientInteractionManagerMixin.java index 3ccfce0a..3303a2ae 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/MultiplayerClientInteractionManagerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/MultiplayerClientInteractionManagerMixin.java @@ -4,25 +4,24 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.client.ClientInteractionManager; +import net.minecraft.MultiplayerInteractionManager; +import net.minecraft.client.InteractionManager; import net.minecraft.client.Minecraft; -import net.minecraft.client.MultiplayerClientInteractionManager; import net.minecraft.item.ItemStack; import io.github.betterthanupdates.reforged.item.ReforgedItem; -@Mixin(MultiplayerClientInteractionManager.class) -public class MultiplayerClientInteractionManagerMixin extends ClientInteractionManager { +@Mixin(MultiplayerInteractionManager.class) +public class MultiplayerClientInteractionManagerMixin extends InteractionManager { private MultiplayerClientInteractionManagerMixin(Minecraft minecraft) { super(minecraft); } - @Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_1716", at = @At("HEAD"), cancellable = true) private void reforged$method_1716(int i, int j, int k, int l, CallbackInfoReturnable cir) { - ItemStack itemstack = this.client.player.getHeldItem(); + ItemStack itemstack = this.minecraft.player.getHand(); - if (itemstack != null && ((ReforgedItem) itemstack.getItem()).onBlockStartBreak(itemstack, i, j, k, this.client.player)) { + if (itemstack != null && ((ReforgedItem) itemstack.getItem()).onBlockStartBreak(itemstack, i, j, k, this.minecraft.player)) { cir.setReturnValue(false); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/SinglePlayerInteractionManagerMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/SinglePlayerInteractionManagerMixin.java index 886d48de..cb356564 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/SinglePlayerInteractionManagerMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/SinglePlayerInteractionManagerMixin.java @@ -4,25 +4,24 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.client.ClientInteractionManager; +import net.minecraft.SingleplayerInteractionManager; +import net.minecraft.client.InteractionManager; import net.minecraft.client.Minecraft; -import net.minecraft.client.SingleplayerInteractionManager; import net.minecraft.item.ItemStack; import io.github.betterthanupdates.reforged.item.ReforgedItem; @Mixin(SingleplayerInteractionManager.class) -public class SinglePlayerInteractionManagerMixin extends ClientInteractionManager { +public class SinglePlayerInteractionManagerMixin extends InteractionManager { public SinglePlayerInteractionManagerMixin(Minecraft minecraft) { super(minecraft); } - @Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true) + @Inject(method = "method_1716", at = @At("HEAD"), cancellable = true) private void reforged$method_1716(int i, int j, int k, int l, CallbackInfoReturnable cir) { - ItemStack itemstack = this.client.player.getHeldItem(); + ItemStack itemstack = this.minecraft.player.getHand(); - if (itemstack != null && ((ReforgedItem) itemstack.getItem()).onBlockStartBreak(itemstack, i, j, k, this.client.player)) { + if (itemstack != null && ((ReforgedItem) itemstack.getItem()).onBlockStartBreak(itemstack, i, j, k, this.minecraft.player)) { cir.setReturnValue(false); } } diff --git a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/nostation/GameRendererMixin.java b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/nostation/GameRendererMixin.java index 9387f43b..bba08b35 100644 --- a/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/nostation/GameRendererMixin.java +++ b/apron/src/main/java/io/github/betterthanupdates/reforged/mixin/client/nostation/GameRendererMixin.java @@ -1,5 +1,6 @@ package io.github.betterthanupdates.reforged.mixin.client.nostation; +import net.minecraft.class_555; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.Constant; @@ -7,12 +8,11 @@ import reforged.Reforged; import net.minecraft.client.Minecraft; -import net.minecraft.client.render.GameRenderer; -@Mixin(GameRenderer.class) +@Mixin(class_555.class) public class GameRendererMixin { @Shadow - private Minecraft client; + private Minecraft field_2349; /** * @return Reforged-modified reach @@ -21,6 +21,6 @@ public class GameRendererMixin { */ @ModifyConstant(method = "method_1838", constant = @Constant(doubleValue = 3.0d)) private double reforged$modifyReach(double constant) { - return Reforged.reachGetEntityPlayer(this.client.player); + return Reforged.reachGetEntityPlayer(this.field_2349.player); } }