From b94bd5a10b44786322ddb2a99b5a9c593c785f95 Mon Sep 17 00:00:00 2001 From: darkevilmac Date: Tue, 14 Mar 2017 03:36:21 -0700 Subject: [PATCH] I'm going to hell for this. --- build.gradle | 3 + .../experiments/EntityPlayerSPProxy.java | 86 +--- .../experiments/MobileRegionWorldClient.java | 25 +- .../experiments/interact/ContainerChecks.java | 35 ++ .../interact/ContainerInterceptor.java | 82 ++++ .../interact/ContainerWrapper.java | 167 ------- .../interact/EntityPlayerMPProxy.java | 37 -- .../mixin/MixinEntityPlayerMP.java | 7 +- .../mixin/MixinEntityPlayerSP.java | 48 +-- .../mixin/MixinPlayerContainerEvent.java | 6 +- .../messages/client/MessagePlayerDigging.java | 2 +- .../client/MessageTryUseItemOnBlock.java | 2 +- .../world/MobileRegionWorldServer.java | 407 +++++++++--------- 13 files changed, 362 insertions(+), 545 deletions(-) create mode 100644 src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerChecks.java create mode 100644 src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerInterceptor.java delete mode 100644 src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerWrapper.java diff --git a/build.gradle b/build.gradle index 3d1a335b..0871f486 100644 --- a/build.gradle +++ b/build.gradle @@ -64,6 +64,9 @@ dependencies { compile 'com.elytradev:concrete:0.1.0' shadow 'com.elytradev:concrete:0.1.0' + + compile 'cglib:cglib:3.2.5' + compile 'org.objenesis:objenesis:2.5.1' } shadowJar { diff --git a/src/test/java/com/elytradev/movingworld/client/experiments/EntityPlayerSPProxy.java b/src/test/java/com/elytradev/movingworld/client/experiments/EntityPlayerSPProxy.java index 13a352fd..e0b53158 100644 --- a/src/test/java/com/elytradev/movingworld/client/experiments/EntityPlayerSPProxy.java +++ b/src/test/java/com/elytradev/movingworld/client/experiments/EntityPlayerSPProxy.java @@ -1,18 +1,10 @@ package com.elytradev.movingworld.client.experiments; -import com.elytradev.movingworld.common.experiments.interact.ContainerWrapper; import com.elytradev.movingworld.common.experiments.entity.EntityMobileRegion; import com.mojang.authlib.GameProfile; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiEnchantment; -import net.minecraft.client.gui.GuiHopper; -import net.minecraft.client.gui.GuiRepair; -import net.minecraft.client.gui.inventory.*; import net.minecraft.entity.MoverType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ContainerPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.stats.StatBase; import net.minecraft.util.math.Vec3d; @@ -59,20 +51,6 @@ public EntityPlayerSPProxy(EntityPlayerSP playerSP, EntityMobileRegion region) { this.motionZ = parent.motionZ; } - public static void onUpdateHook(EntityPlayerSP realPlayer) { - EntityPlayer proxy = null; - - if (EntityPlayerSPProxy.PROXIES.containsKey(realPlayer.getGameProfile())) { - proxy = EntityPlayerSPProxy.PROXIES.get(realPlayer.getGameProfile()); - } - - if (proxy != null && proxy.openContainer instanceof ContainerWrapper) { - realPlayer.openContainer = proxy.openContainer; - } else if (proxy != null) { - proxy.openContainer = realPlayer.openContainer; - } - } - public void setRegion(EntityMobileRegion region) { this.region = region; } @@ -111,22 +89,13 @@ public void addStat(StatBase stat, int amount) { @Override public void displayGUIChest(IInventory chestInventory) { - Container lastContainer = this.openContainer; super.displayGUIChest(chestInventory); - Container currentContainer = this.openContainer; - - validateWrapping(lastContainer, currentContainer); - parent.displayGUIChest(chestInventory); } @Override public void displayGui(IInteractionObject guiOwner) { - Container lastContainer = this.openContainer; - displayGuiSuper(guiOwner); - Container currentContainer = this.openContainer; - - validateWrapping(lastContainer, currentContainer); + super.displayGui(guiOwner); parent.displayGui(guiOwner); } @@ -135,67 +104,14 @@ public void move(MoverType type, double x, double y, double z) { parent.move(type, x, y, z); } - public void displayGUIChestSuper(IInventory chestInventory) { - String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject) chestInventory).getGuiID() : "minecraft:container"; - - if ("minecraft:chest".equals(s)) { - this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory)); - } else if ("minecraft:hopper".equals(s)) { - this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory)); - } else if ("minecraft:furnace".equals(s)) { - this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory)); - } else if ("minecraft:brewing_stand".equals(s)) { - this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory)); - } else if ("minecraft:beacon".equals(s)) { - this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory)); - } else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s)) { - if ("minecraft:shulker_box".equals(s)) { - this.mc.displayGuiScreen(new GuiShulkerBox(this.inventory, chestInventory)); - } else { - this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory)); - } - } else { - this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory)); - } - } - - public void displayGuiSuper(IInteractionObject guiOwner) { - String s = guiOwner.getGuiID(); - - if ("minecraft:crafting_table".equals(s)) { - this.mc.displayGuiScreen(new GuiCrafting(this.inventory, this.world)); - } else if ("minecraft:enchanting_table".equals(s)) { - this.mc.displayGuiScreen(new GuiEnchantment(this.inventory, this.world, guiOwner)); - } else if ("minecraft:anvil".equals(s)) { - this.mc.displayGuiScreen(new GuiRepair(this.inventory, this.world)); - } - } - @Override public void setPositionAndUpdate(double x, double y, double z) { super.setPositionAndUpdate(x, y, z); } - public void validateWrapping(Container lastContainer, Container currentContainer) { - if (lastContainer != currentContainer && !(currentContainer instanceof ContainerPlayer)) { - if (currentContainer instanceof ContainerWrapper) - return; - - this.openContainer = new ContainerWrapper(this.openContainer); - } - } - - public void openGuiSuper(Object mod, int modGuiId, World world, int x, int y, int z) { - net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); - } - @Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) { - Container lastContainer = this.openContainer; super.openGui(mod, modGuiId, world, x, y, z); - Container currentContainer = this.openContainer; - - validateWrapping(lastContainer, currentContainer); parent.openGui(mod, modGuiId, world, x, y, z); } } diff --git a/src/test/java/com/elytradev/movingworld/client/experiments/MobileRegionWorldClient.java b/src/test/java/com/elytradev/movingworld/client/experiments/MobileRegionWorldClient.java index 186013ad..423a475d 100644 --- a/src/test/java/com/elytradev/movingworld/client/experiments/MobileRegionWorldClient.java +++ b/src/test/java/com/elytradev/movingworld/client/experiments/MobileRegionWorldClient.java @@ -72,6 +72,11 @@ public boolean isPosWithinRegion(BlockPos pos) { @Override public void tick() { parentWorld.tick(); + } + + @Override + public void invalidateBlockReceiveRegion(int x1, int y1, int z1, int x2, int y2, int z2) { + parentWorld.invalidateBlockReceiveRegion(x1, y1, z1, x2, y2, z2); } @Override public void initCapabilities() { if (initCapabilities == null) { @@ -84,11 +89,6 @@ public void initCapabilities() { super.initCapabilities(); } - @Override - public void invalidateBlockReceiveRegion(int x1, int y1, int z1, int x2, int y2, int z2) { - parentWorld.invalidateBlockReceiveRegion(x1, y1, z1, x2, y2, z2); - } - @Override public IChunkProvider createChunkProvider() { if (parentWorld != null) @@ -249,9 +249,6 @@ public Biome getBiome(BlockPos pos) { public Biome getBiomeForCoordsBody(BlockPos pos) { pos = region.convertRegionPosToRealWorld(pos); return getRealWorld().getBiomeForCoordsBody(pos); - } @Override - public ChunkProviderClient getChunkProvider() { - return parentWorld.getChunkProvider(); } @Override @@ -262,6 +259,9 @@ public BiomeProvider getBiomeProvider() { @Override public void initialize(WorldSettings settings) { parentWorld.initialize(settings); + } @Override + public ChunkProviderClient getChunkProvider() { + return parentWorld.getChunkProvider(); } @Nullable @@ -1147,6 +1147,9 @@ public void checkSessionLock() throws MinecraftException { parentWorld.checkSessionLock(); } + public WorldClient getRealWorld() { + return Minecraft.getMinecraft().world; + } @@ -1470,8 +1473,6 @@ public BlockPos findNearestStructure(String p_190528_1_, BlockPos pos, boolean p return getRealWorld().findNearestStructure(p_190528_1_, pos, p_190528_3_); } - - public WorldClient getRealWorld(){ - return Minecraft.getMinecraft().world; - } + + } diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerChecks.java b/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerChecks.java new file mode 100644 index 00000000..0087cec5 --- /dev/null +++ b/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerChecks.java @@ -0,0 +1,35 @@ +package com.elytradev.movingworld.common.experiments.interact; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import net.sf.cglib.proxy.Enhancer; + +/** + * Created by darkevilmac on 3/14/2017. + */ +public class ContainerChecks { + + @SideOnly(Side.CLIENT) + public static void checkCurrentScreen(EntityPlayer player, Minecraft mc) { + if (mc.currentScreen != null && mc.currentScreen instanceof GuiContainer) { + if (player.openContainer != null && !Enhancer.isEnhanced(player.openContainer.getClass())) { + System.out.println("Setting current screen slots."); + ((GuiContainer) mc.currentScreen).inventorySlots = player.openContainer; + } + } + } + + public static void checkContainer(EntityPlayer player) { + if (player.openContainer != null + && player.openContainer != player.inventoryContainer + && !Enhancer.isEnhanced(player.openContainer.getClass())) { + System.out.println("Making container proxy... " + player.openContainer); + player.openContainer = (Container) ContainerInterceptor.createProxy(player.openContainer); + System.out.println("Proxy made... " + player.openContainer); + } + } +} diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerInterceptor.java b/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerInterceptor.java new file mode 100644 index 00000000..d65ef8b2 --- /dev/null +++ b/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerInterceptor.java @@ -0,0 +1,82 @@ +package com.elytradev.movingworld.common.experiments.interact; + +import com.elytradev.movingworld.client.experiments.EntityPlayerSPProxy; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Container; +import net.sf.cglib.proxy.Callback; +import net.sf.cglib.proxy.Enhancer; +import net.sf.cglib.proxy.MethodInterceptor; +import net.sf.cglib.proxy.MethodProxy; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.objenesis.ObjenesisHelper; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +/** + * Pretty much entirely magic, really horrible code that + */ +public class ContainerInterceptor implements MethodInterceptor { + + public static Object createProxy(Object realObject) { + MethodInterceptor interceptor = new ContainerInterceptor(); + Enhancer e = new Enhancer(); + e.setUseCache(false); + e.setSuperclass(realObject.getClass()); + e.setCallbackType(interceptor.getClass()); + Class classForProxy = e.createClass(); + Enhancer.registerCallbacks(classForProxy, new Callback[]{interceptor}); + Object createdProxy = ObjenesisHelper.newInstance(classForProxy); + + // Attempt to move data to prevent inital NPEs. We're also instantiating from absolutely nothing so this is probably the best thing we can do... + try { + for (Field realField : FieldUtils.getAllFieldsList(realObject.getClass())) { + realField.setAccessible(true); + Field proxyField = FieldUtils.getField(createdProxy.getClass(), realField.getName(), true); + proxyField.set(createdProxy, realField.get(realObject)); + } + } catch (Throwable t) { + t.printStackTrace(); + } + // Done. + + return createdProxy; + } + + private EntityPlayer getProxy(Object[] args) { + Object arg0 = null; + if (args.length != 0) { + arg0 = args[0]; + } + + if (arg0 != null && arg0 instanceof EntityPlayer) { + EntityPlayer playerProxy = null; + + EntityPlayer playerIn = (EntityPlayer) arg0; + if (playerIn instanceof EntityPlayerMP && EntityPlayerMPProxy.PROXIES.containsKey(playerIn.getGameProfile())) { + playerProxy = (EntityPlayerMPProxy.PROXIES.get(playerIn.getGameProfile())); + } else if (playerIn instanceof EntityPlayerSP && EntityPlayerSPProxy.PROXIES.containsKey(playerIn.getGameProfile())) { + playerProxy = (EntityPlayerSPProxy.PROXIES.get(playerIn.getGameProfile())); + } + + return playerProxy; + } + + return null; + } + + @Override + public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { + if (obj instanceof Container && ( + method.getName().equals("canInteractWith") + || method.getName().equals("func_75145_c"))) { + EntityPlayer proxyPlayer = getProxy(args); + Boolean proxyCan = proxyPlayer != null ? (Boolean) methodProxy.invokeSuper(obj, new Object[]{proxyPlayer}) : false; + return proxyCan || (Boolean) methodProxy.invokeSuper(obj, args); + } + + return methodProxy.invokeSuper(obj, args); + } +} diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerWrapper.java b/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerWrapper.java deleted file mode 100644 index 9a161a3d..00000000 --- a/src/test/java/com/elytradev/movingworld/common/experiments/interact/ContainerWrapper.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.elytradev.movingworld.common.experiments.interact; - -import com.elytradev.concrete.reflect.invoker.Invoker; -import com.elytradev.concrete.reflect.invoker.Invokers; -import com.elytradev.movingworld.client.experiments.EntityPlayerSPProxy; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - -import javax.annotation.Nullable; -import java.util.List; - -/** - * Created by darkevilmac on 3/9/2017. - */ -public class ContainerWrapper extends Container { - - public final Container realContainer; - - private Invoker addSlotToContainer; - private Invoker retrySlotClick; - private Invoker mergeItemStack; - private Invoker resetDrag; - - public ContainerWrapper(Container realContainer) { - this.realContainer = realContainer; - - addSlotToContainer = Invokers.findMethod(Container.class, realContainer, new String[]{"addSlotToContainer", "func_75146_a", "a"}, Slot.class); - retrySlotClick = Invokers.findMethod(Container.class, realContainer, new String[]{"retrySlotClick", "func_75133_b", "a"}, int.class, int.class, boolean.class, EntityPlayer.class); - mergeItemStack = Invokers.findMethod(Container.class, realContainer, new String[]{"mergeItemStack", "func_75135_a", "a"}, ItemStack.class, int.class, int.class, boolean.class); - resetDrag = Invokers.findMethod(Container.class, realContainer, new String[]{"resetDrag", "func_94533_d", "d"}); - } - - @Override - protected Slot addSlotToContainer(Slot slotIn) { - return (Slot) addSlotToContainer.invoke(realContainer, slotIn); - } - - @Override - public void addListener(IContainerListener listener) { - realContainer.addListener(listener); - } - - @Override - public NonNullList getInventory() { - return realContainer.getInventory(); - } - - @Override - public void removeListener(IContainerListener listener) { - realContainer.removeListener(listener); - } - - @Override - public void detectAndSendChanges() { - realContainer.detectAndSendChanges(); - } - - @Override - public boolean enchantItem(EntityPlayer playerIn, int id) { - return realContainer.enchantItem(playerIn, id); - } - - @Nullable - @Override - public Slot getSlotFromInventory(IInventory inv, int slotIn) { - return realContainer.getSlotFromInventory(inv, slotIn); - } - - @Override - public Slot getSlot(int slotId) { - return realContainer.getSlot(slotId); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { - return realContainer.transferStackInSlot(playerIn, index); - } - - @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { - return realContainer.slotClick(slotId, dragType, clickTypeIn, player); - } - - @Override - public boolean canMergeSlot(ItemStack stack, Slot slotIn) { - return realContainer.canMergeSlot(stack, slotIn); - } - - @Override - protected void retrySlotClick(int slotId, int clickedButton, boolean mode, EntityPlayer playerIn) { - retrySlotClick.invoke(realContainer, slotId, clickedButton, mode, playerIn); - } - - @Override - public void onContainerClosed(EntityPlayer playerIn) { - realContainer.onContainerClosed(playerIn); - } - - @Override - public void onCraftMatrixChanged(IInventory inventoryIn) { - realContainer.onCraftMatrixChanged(inventoryIn); - } - - @Override - public void putStackInSlot(int slotID, ItemStack stack) { - realContainer.putStackInSlot(slotID, stack); - } - - @Override - public void setAll(List p_190896_1_) { - realContainer.setAll(p_190896_1_); - } - - @Override - public void updateProgressBar(int id, int data) { - realContainer.updateProgressBar(id, data); - } - - @Override - public short getNextTransactionID(InventoryPlayer invPlayer) { - return realContainer.getNextTransactionID(invPlayer); - } - - @Override - public boolean getCanCraft(EntityPlayer player) { - return realContainer.getCanCraft(player); - } - - @Override - public void setCanCraft(EntityPlayer player, boolean canCraft) { - realContainer.setCanCraft(player, canCraft); - } - - @Override - public boolean canInteractWith(EntityPlayer playerIn) { - EntityPlayer proxy = null; - if (playerIn instanceof EntityPlayerMP && EntityPlayerMPProxy.PROXIES.containsKey(playerIn.getGameProfile())) { - proxy = (EntityPlayerMPProxy.PROXIES.get(playerIn.getGameProfile())); - } else if (playerIn instanceof EntityPlayerSP && EntityPlayerSPProxy.PROXIES.containsKey(playerIn.getGameProfile())) { - proxy = (EntityPlayerSPProxy.PROXIES.get(playerIn.getGameProfile())); - } - - boolean proxyCan = proxy != null ? realContainer.canInteractWith(proxy) : false; - - return proxyCan || realContainer.canInteractWith(playerIn); - } - - @Override - protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) { - return (boolean) mergeItemStack.invoke(realContainer, stack, startIndex, endIndex, reverseDirection); - } - - @Override - protected void resetDrag() { - resetDrag.invoke(realContainer); - } - - @Override - public boolean canDragIntoSlot(Slot slotIn) { - return realContainer.canDragIntoSlot(slotIn); - } -} diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/interact/EntityPlayerMPProxy.java b/src/test/java/com/elytradev/movingworld/common/experiments/interact/EntityPlayerMPProxy.java index bb1f9999..ecb35d7d 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/interact/EntityPlayerMPProxy.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/interact/EntityPlayerMPProxy.java @@ -3,10 +3,7 @@ import com.elytradev.movingworld.common.experiments.entity.EntityMobileRegion; import com.mojang.authlib.GameProfile; import net.minecraft.entity.MoverType; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ContainerPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.stats.StatBase; import net.minecraft.util.math.Vec3d; @@ -50,20 +47,6 @@ public EntityPlayerMPProxy(EntityPlayerMP playerMP, EntityMobileRegion region) { this.motionZ = parent.motionZ; } - public static void onUpdateHook(EntityPlayerMP realPlayer) { - EntityPlayer proxy = null; - - if (EntityPlayerMPProxy.PROXIES.containsKey(realPlayer.getGameProfile())) { - proxy = EntityPlayerMPProxy.PROXIES.get(realPlayer.getGameProfile()); - } - - if (proxy != null && proxy.openContainer instanceof ContainerWrapper) { - realPlayer.openContainer = proxy.openContainer; - } else if (proxy != null) { - proxy.openContainer = realPlayer.openContainer; - } - } - public void setRegion(EntityMobileRegion region) { this.region = region; } @@ -93,21 +76,13 @@ public void onUpdate() { @Override public void displayGui(IInteractionObject guiOwner) { - Container lastContainer = this.openContainer; super.displayGui(guiOwner); - Container currentContainer = this.openContainer; - - validateWrapping(lastContainer, currentContainer); parent.displayGui(guiOwner); } @Override public void displayGUIChest(IInventory chestInventory) { - Container lastContainer = this.openContainer; super.displayGUIChest(chestInventory); - Container currentContainer = this.openContainer; - - validateWrapping(lastContainer, currentContainer); parent.displayGUIChest(chestInventory); } @@ -127,22 +102,10 @@ public void setPositionAndUpdate(double x, double y, double z) { super.setPositionAndUpdate(x, y, z); } - private void validateWrapping(Container lastContainer, Container currentContainer) { - if (lastContainer != currentContainer && !(currentContainer instanceof ContainerPlayer)) { - if (currentContainer instanceof ContainerWrapper) - return; - - this.openContainer = new ContainerWrapper(this.openContainer); - } - } @Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) { - Container lastContainer = this.openContainer; super.openGui(mod, modGuiId, world, x, y, z); - Container currentContainer = this.openContainer; - - validateWrapping(lastContainer, currentContainer); parent.openGui(mod, modGuiId, world, x, y, z); } diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerMP.java b/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerMP.java index 95b6bc2c..35e29d35 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerMP.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerMP.java @@ -1,6 +1,6 @@ package com.elytradev.movingworld.common.experiments.mixin; -import com.elytradev.movingworld.common.experiments.interact.ContainerWrapper; +import com.elytradev.movingworld.common.experiments.interact.ContainerChecks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import org.spongepowered.asm.mixin.Mixin; @@ -14,10 +14,7 @@ public class MixinEntityPlayerMP { @Inject(method = "Lnet/minecraft/entity/player/EntityPlayerMP;onUpdate()V", at = @At(value = "INVOKE")) public void onUpdateHook(CallbackInfo cbi) { - if (getThis().openContainer != getThis().inventoryContainer - && !(getThis().openContainer instanceof ContainerWrapper)) { - getThis().openContainer = new ContainerWrapper(getThis().openContainer); - } + ContainerChecks.checkContainer(getThis()); } public EntityPlayer getThis() { diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerSP.java b/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerSP.java index d9faa864..a5ab02b8 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerSP.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinEntityPlayerSP.java @@ -1,12 +1,13 @@ package com.elytradev.movingworld.common.experiments.mixin; -import com.elytradev.movingworld.client.experiments.EntityPlayerSPProxy; +import com.elytradev.movingworld.common.experiments.interact.ContainerChecks; +import com.elytradev.movingworld.common.experiments.interact.ContainerInterceptor; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.world.IInteractionObject; +import net.minecraft.inventory.ContainerPlayer; +import net.sf.cglib.proxy.Enhancer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -22,51 +23,14 @@ public abstract class MixinEntityPlayerSP { @Shadow protected Minecraft mc; - @Inject(method = "Lnet/minecraft/client/entity/EntityPlayerSP;onUpdate()V", at = @At(value = "INVOKE")) public void onUpdateHook(CallbackInfo cbi) { - EntityPlayerSPProxy.onUpdateHook((EntityPlayerSP) getThis()); + ContainerChecks.checkContainer(getThis()); + ContainerChecks.checkCurrentScreen(getThis(), mc); } - @Inject(method = "Lnet/minecraft/client/entity/EntityPlayerSP;displayGUIChest(Lnet/minecraft/inventory/IInventory;)V", at = @At(value = "INVOKE")) - public void displayGUIChestHook(IInventory chestInventory, CallbackInfo cbi) { - if (EntityPlayerSPProxy.PROXIES.containsKey(getThis().getGameProfile())) { - EntityPlayerSPProxy proxy = EntityPlayerSPProxy.PROXIES.get(getThis().getGameProfile()); - Container lastContainer = proxy.openContainer; - proxy.displayGUIChestSuper(chestInventory); - Container currentContainer = proxy.openContainer; - - proxy.validateWrapping(lastContainer, currentContainer); - } - } - - @Inject(method = "Lnet/minecraft/client/entity/EntityPlayerSP;displayGui(Lnet/minecraft/world/IInteractionObject;)V", at = @At(value = "INVOKE")) - public void displayGuiHook(IInteractionObject guiOwner, CallbackInfo cbi) { - if (EntityPlayerSPProxy.PROXIES.containsKey(getThis().getGameProfile())) { - EntityPlayerSPProxy proxy = EntityPlayerSPProxy.PROXIES.get(getThis().getGameProfile()); - Container lastContainer = proxy.openContainer; - proxy.displayGuiSuper(guiOwner); - Container currentContainer = proxy.openContainer; - - proxy.validateWrapping(lastContainer, currentContainer); - } - } - - //@Inject(method = "Lnet/minecraft/entity/player/EntityPlayer;openGui(Ljava/lang/Object;ILnet/minecraft/world/World;III)V", at = @At(value = "INVOKE")) - //public void openGuiHook(CallbackInfo cbi, Object mod, int modGuiId, World world, int x, int y, int z) { - // if (EntityPlayerSPProxy.PROXIES.containsKey(getThis().getGameProfile())) { - // EntityPlayerSPProxy proxy = EntityPlayerSPProxy.PROXIES.get(getThis().getGameProfile()); - // Container lastContainer = proxy.openContainer; - // proxy.openGuiSuper(mod, modGuiId, world, x, y, z); - // Container currentContainer = proxy.openContainer; -// - // proxy.validateWrapping(lastContainer, currentContainer); - // } - //} - public EntityPlayer getThis() { return ((EntityPlayer) (Object) this); } - } diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinPlayerContainerEvent.java b/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinPlayerContainerEvent.java index 55818920..f76868f8 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinPlayerContainerEvent.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/mixin/MixinPlayerContainerEvent.java @@ -1,8 +1,8 @@ package com.elytradev.movingworld.common.experiments.mixin; -import com.elytradev.movingworld.common.experiments.interact.ContainerWrapper; import net.minecraft.inventory.Container; import net.minecraftforge.event.entity.player.PlayerContainerEvent; +import net.sf.cglib.proxy.Enhancer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -16,8 +16,8 @@ public class MixinPlayerContainerEvent { @Inject(method = "Lnet/minecraftforge/event/entity/player/PlayerContainerEvent;getContainer()Lnet/minecraft/inventory/Container;", at = @At(value = "RETURN")) public void getContainer(CallbackInfoReturnable cbir) { - if (cbir != null && cbir.getReturnValue() instanceof ContainerWrapper) { - cbir.setReturnValue(((ContainerWrapper) cbir.getReturnValue()).realContainer); + if (cbir != null && Enhancer.isEnhanced(cbir.getReturnValue().getClass())) { + //cbir.setReturnValue(E); } } } diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessagePlayerDigging.java b/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessagePlayerDigging.java index 3211c599..8e0eb1d8 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessagePlayerDigging.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessagePlayerDigging.java @@ -4,8 +4,8 @@ import com.elytradev.concrete.NetworkContext; import com.elytradev.concrete.annotation.field.MarshalledAs; import com.elytradev.concrete.annotation.type.ReceivedOn; -import com.elytradev.movingworld.common.experiments.interact.MWPlayerInteractionManager; import com.elytradev.movingworld.common.experiments.entity.EntityMobileRegion; +import com.elytradev.movingworld.common.experiments.interact.MWPlayerInteractionManager; import com.elytradev.movingworld.common.experiments.network.MovingWorldExperimentsNetworking; import com.elytradev.movingworld.common.experiments.network.messages.server.MessageBlockChange; import com.elytradev.movingworld.common.network.marshallers.EntityMarshaller; diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessageTryUseItemOnBlock.java b/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessageTryUseItemOnBlock.java index 92581102..b4803fd8 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessageTryUseItemOnBlock.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/network/messages/client/MessageTryUseItemOnBlock.java @@ -6,9 +6,9 @@ import com.elytradev.concrete.annotation.type.ReceivedOn; import com.elytradev.concrete.reflect.accessor.Accessor; import com.elytradev.concrete.reflect.accessor.Accessors; -import com.elytradev.movingworld.common.experiments.interact.MWPlayerInteractionManager; import com.elytradev.movingworld.common.experiments.MovingWorldExperimentsMod; import com.elytradev.movingworld.common.experiments.entity.EntityMobileRegion; +import com.elytradev.movingworld.common.experiments.interact.MWPlayerInteractionManager; import com.elytradev.movingworld.common.experiments.network.MovingWorldExperimentsNetworking; import com.elytradev.movingworld.common.experiments.network.messages.server.MessageBlockChange; import com.elytradev.movingworld.common.network.marshallers.EntityMarshaller; diff --git a/src/test/java/com/elytradev/movingworld/common/experiments/world/MobileRegionWorldServer.java b/src/test/java/com/elytradev/movingworld/common/experiments/world/MobileRegionWorldServer.java index a0a70043..72d64886 100644 --- a/src/test/java/com/elytradev/movingworld/common/experiments/world/MobileRegionWorldServer.java +++ b/src/test/java/com/elytradev/movingworld/common/experiments/world/MobileRegionWorldServer.java @@ -152,9 +152,6 @@ public BlockPos adjustPosToNearbyEntity(BlockPos pos) { @Override public boolean isBlockTickPending(BlockPos pos, Block blockType) { return parentWorld.isBlockTickPending(pos, blockType); - } @Override - public CrashReportCategory addWorldInfoToCrashReport(CrashReport report) { - return parentWorld.addWorldInfoToCrashReport(report); } @Override @@ -170,19 +167,11 @@ public void scheduleUpdate(BlockPos pos, Block blockIn, int delay) { @Override public void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority) { parentWorld.updateBlockTick(pos, blockIn, delay, priority); - } @Override - public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, @Nullable NBTTagCompound compund) { - Vec3d pos = new Vec3d(x, y, z); - pos = region.convertRegionPosToRealWorld(pos); - parentWorld.makeFireworks(pos.xCoord, pos.yCoord, pos.zCoord, motionX, motionY, motionZ, compund); } @Override public void scheduleBlockUpdate(BlockPos pos, Block blockIn, int delay, int priority) { parentWorld.scheduleBlockUpdate(pos, blockIn, delay, priority); - } @Override - public void sendPacketToServer(Packet packetIn) { - parentWorld.sendPacketToServer(packetIn); } @Override @@ -196,6 +185,9 @@ public void tickPlayers() { @Override public void resetUpdateEntityTick() { parentWorld.resetUpdateEntityTick(); + } @Override + public CrashReportCategory addWorldInfoToCrashReport(CrashReport report) { + return parentWorld.addWorldInfoToCrashReport(report); } @Override @@ -251,6 +243,11 @@ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) { @Override public void initialize(WorldSettings settings) { parentWorld.initialize(settings); + } @Override + public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, @Nullable NBTTagCompound compund) { + Vec3d pos = new Vec3d(x, y, z); + pos = region.convertRegionPosToRealWorld(pos); + parentWorld.makeFireworks(pos.xCoord, pos.yCoord, pos.zCoord, motionX, motionY, motionZ, compund); } @Override @@ -292,6 +289,9 @@ public void saveLevel() throws MinecraftException { @Override public boolean spawnEntity(Entity entityIn) { return parentWorld.spawnEntity(entityIn); + } @Override + public void sendPacketToServer(Packet packetIn) { + parentWorld.sendPacketToServer(packetIn); } @Override @@ -1084,12 +1084,6 @@ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) { } else { return false; } - } @Override - public long getSeed() { - if (parentWorld != null) - return parentWorld.getSeed(); - else - return super.getSeed(); } @Override @@ -1098,9 +1092,6 @@ public boolean checkLight(BlockPos pos) { return parentWorld.checkLight(pos); else return false; - } @Override - public long getTotalWorldTime() { - return realWorld.getTotalWorldTime(); } @Override @@ -1109,52 +1100,31 @@ public boolean checkLightFor(EnumSkyBlock lightType, BlockPos pos) { return parentWorld.checkLightFor(lightType, pos); else return false; - } @Override - public void setTotalWorldTime(long worldTime) { - realWorld.setTotalWorldTime(worldTime); } @Override public List getEntitiesWithinAABBExcludingEntity(@Nullable Entity entityIn, AxisAlignedBB bb) { return realWorld.getEntitiesWithinAABBExcludingEntity(entityIn, region.convertRegionBBToRealWorld(bb)); - } @Override - public long getWorldTime() { - return realWorld.getWorldTime(); } @Override public List getEntitiesInAABBexcluding(@Nullable Entity entityIn, AxisAlignedBB bb, @Nullable Predicate predicate) { return realWorld.getEntitiesInAABBexcluding(entityIn, region.convertRegionBBToRealWorld(bb), predicate); - } @Override - public void setWorldTime(long time) { - realWorld.setWorldTime(time); } @Override public List getEntities(Class entityType, Predicate filter) { return realWorld.getEntities(entityType, filter); - } @Override - public BlockPos getSpawnPoint() { - return parentWorld.getSpawnPoint(); } @Override public List getPlayers(Class playerType, Predicate filter) { return realWorld.getPlayers(playerType, filter); - } @Override - public void setSpawnPoint(BlockPos pos) { - parentWorld.setSpawnPoint(pos); } @Override public List getEntitiesWithinAABB(Class classEntity, AxisAlignedBB bb) { return realWorld.getEntitiesWithinAABB(classEntity, region.convertRegionBBToRealWorld(bb)); - } @Override - public void joinEntityInSurroundings(Entity entityIn) { - Vec3d entityPos = new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ); - entityPos = region.convertRegionPosToRealWorld(entityPos); - entityIn.setPosition(entityPos.xCoord, entityPos.yCoord, entityPos.zCoord); - realWorld.joinEntityInSurroundings(entityIn); } @Override @@ -1182,28 +1152,16 @@ public List getLoadedEntityList() { @Override public void markChunkDirty(BlockPos pos, TileEntity unusedTileEntity) { parentWorld.markChunkDirty(pos, unusedTileEntity); - } @Override - public ISaveHandler getSaveHandler() { - return parentWorld.getSaveHandler(); } @Override public int countEntities(Class entityType) { return realWorld.countEntities(entityType); - } @Override - public WorldInfo getWorldInfo() { - if (parentWorld != null) - return parentWorld.getWorldInfo(); - else - return worldInfo; } @Override public void unloadEntities(Collection entityCollection) { realWorld.unloadEntities(entityCollection); - } @Override - public GameRules getGameRules() { - return realWorld.getGameRules(); } @Override @@ -1217,103 +1175,58 @@ public boolean mayPlace(Block p_190527_1_, BlockPos pos, boolean p_190527_3_, En @Override public int getSeaLevel() { return parentWorld.getSeaLevel(); - } @Override - public float getThunderStrength(float delta) { - if (realWorld != null) - return realWorld.getThunderStrength(delta); - else - return super.getThunderStrength(delta); } @Override public void setSeaLevel(int seaLevelIn) { parentWorld.setSeaLevel(seaLevelIn); - } @Override - public void setThunderStrength(float strength) { - realWorld.setThunderStrength(strength); } @Override public int getStrongPower(BlockPos pos, EnumFacing direction) { return parentWorld.getStrongPower(pos, direction); - } @Override - public float getRainStrength(float delta) { - if (realWorld != null) - return realWorld.getRainStrength(delta); - else - return super.getRainStrength(delta); } @Override public WorldType getWorldType() { return parentWorld.getWorldType(); - } @Override - public void setRainStrength(float strength) { - realWorld.setRainStrength(strength); } @Override public int getStrongPower(BlockPos pos) { return parentWorld.getStrongPower(pos); - } @Override - public boolean isThundering() { - return realWorld.isThundering(); } @Override public boolean isSidePowered(BlockPos pos, EnumFacing side) { return parentWorld.isSidePowered(pos, side); - } @Override - public boolean isRaining() { - return realWorld.isRaining(); } @Override public int getRedstonePower(BlockPos pos, EnumFacing facing) { return parentWorld.getRedstonePower(pos, facing); - } @Override - public boolean isRainingAt(BlockPos strikePosition) { - strikePosition = region.convertRegionPosToRealWorld(strikePosition); - - return realWorld.isRainingAt(strikePosition); } @Override public boolean isBlockPowered(BlockPos pos) { return parentWorld.isBlockPowered(pos); - } @Override - public boolean isBlockinHighHumidity(BlockPos pos) { - pos = region.convertRegionPosToRealWorld(pos); - - return realWorld.isBlockinHighHumidity(pos); } @Override public int isBlockIndirectlyGettingPowered(BlockPos pos) { return parentWorld.isBlockIndirectlyGettingPowered(pos); - } @Nullable - @Override - public MapStorage getMapStorage() { - return parentWorld.getMapStorage(); } @Nullable @Override public EntityPlayer getClosestPlayerToEntity(Entity entityIn, double distance) { return realWorld.getClosestPlayerToEntity(entityIn, distance); - } @Override - public void setData(String dataID, WorldSavedData worldSavedDataIn) { - parentWorld.setData(dataID, worldSavedDataIn); } @Nullable @Override public EntityPlayer getNearestPlayerNotCreative(Entity entityIn, double distance) { return realWorld.getNearestPlayerNotCreative(entityIn, distance); - } @Nullable - @Override - public WorldSavedData loadData(Class clazz, String dataID) { - return parentWorld.loadData(clazz, dataID); } @Nullable @@ -1323,9 +1236,6 @@ public EntityPlayer getClosestPlayer(double posX, double posY, double posZ, doub pos = region.convertRegionPosToRealWorld(pos); return realWorld.getClosestPlayer(pos.xCoord, pos.yCoord, pos.zCoord, distance, spectator); - } @Override - public int getUniqueDataId(String key) { - return parentWorld.getUniqueDataId(key); } @Nullable @@ -1336,8 +1246,11 @@ public EntityPlayer getClosestPlayer(double x, double y, double z, double distan return realWorld.getClosestPlayer(pos.xCoord, pos.yCoord, pos.zCoord, distance, predicate); } @Override - public void playBroadcastSound(int id, BlockPos pos, int data) { - parentWorld.playBroadcastSound(id, pos, data); + public long getSeed() { + if (parentWorld != null) + return parentWorld.getSeed(); + else + return super.getSeed(); } @Override @@ -1346,27 +1259,18 @@ public boolean isAnyPlayerWithinRangeAt(double x, double y, double z, double ran pos = region.convertRegionPosToRealWorld(pos); return realWorld.isAnyPlayerWithinRangeAt(pos.xCoord, pos.yCoord, pos.zCoord, range); - } @Override - public void playEvent(int type, BlockPos pos, int data) { - parentWorld.playEvent(type, pos, data); } @Nullable @Override public EntityPlayer getNearestAttackablePlayer(Entity entityIn, double maxXZDistance, double maxYDistance) { return realWorld.getNearestAttackablePlayer(entityIn, maxXZDistance, maxYDistance); - } @Override - public void playEvent(@Nullable EntityPlayer player, int type, BlockPos pos, int data) { - parentWorld.playEvent(player, type, pos, data); } @Nullable @Override public EntityPlayer getNearestAttackablePlayer(BlockPos pos, double maxXZDistance, double maxYDistance) { return realWorld.getNearestAttackablePlayer(region.convertRegionPosToRealWorld(pos), maxXZDistance, maxYDistance); - } @Override - public int getHeight() { - return parentWorld.getHeight(); } @Nullable @@ -1375,40 +1279,227 @@ public EntityPlayer getNearestAttackablePlayer(double x, double y, double z, dou Vec3d pos = new Vec3d(x, y, z); pos = region.convertRegionPosToRealWorld(pos); return parentWorld.getNearestAttackablePlayer(pos.xCoord, pos.yCoord, pos.zCoord, maxXZDistance, maxYDistance, playerToDouble, p_184150_12_); - } @Override - public int getActualHeight() { - return parentWorld.getActualHeight(); } @Nullable @Override public EntityPlayer getPlayerEntityByName(String name) { return realWorld.getPlayerEntityByName(name); - } @Override - public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) { - return realWorld.setRandomSeed(p_72843_1_, p_72843_2_, p_72843_3_); } @Nullable @Override public EntityPlayer getPlayerEntityByUUID(UUID uuid) { return realWorld.getPlayerEntityByUUID(uuid); - } @Override + } + + @Override + public void sendQuittingDisconnectingPacket() { + } + + @Override + public void checkSessionLock() throws MinecraftException { + parentWorld.checkSessionLock(); + } + + @Override + public long getTotalWorldTime() { + return realWorld.getTotalWorldTime(); + } + + @Override + public void setTotalWorldTime(long worldTime) { + realWorld.setTotalWorldTime(worldTime); + } + + @Override + public long getWorldTime() { + if (realWorld != null) + return realWorld.getWorldTime(); + else + return 0; + } + + @Override + public void setWorldTime(long time) { + realWorld.setWorldTime(time); + } + + + @Override + public BlockPos getSpawnPoint() { + return parentWorld.getSpawnPoint(); + } + + + @Override + public void setSpawnPoint(BlockPos pos) { + parentWorld.setSpawnPoint(pos); + } + + @Override + public void joinEntityInSurroundings(Entity entityIn) { + Vec3d entityPos = new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ); + entityPos = region.convertRegionPosToRealWorld(entityPos); + entityIn.setPosition(entityPos.xCoord, entityPos.yCoord, entityPos.zCoord); + realWorld.joinEntityInSurroundings(entityIn); + } + + + @Override + public ISaveHandler getSaveHandler() { + return parentWorld.getSaveHandler(); + } + + + @Override + public WorldInfo getWorldInfo() { + if (parentWorld != null) + return parentWorld.getWorldInfo(); + else + return worldInfo; + } + + + @Override + public GameRules getGameRules() { + return realWorld.getGameRules(); + } + + + @Override + public float getThunderStrength(float delta) { + if (realWorld != null) + return realWorld.getThunderStrength(delta); + else + return super.getThunderStrength(delta); + } + + + @Override + public void setThunderStrength(float strength) { + realWorld.setThunderStrength(strength); + } + + + @Override + public float getRainStrength(float delta) { + if (realWorld != null) + return realWorld.getRainStrength(delta); + else + return super.getRainStrength(delta); + } + + + @Override + public void setRainStrength(float strength) { + realWorld.setRainStrength(strength); + } + + + @Override + public boolean isThundering() { + return realWorld.isThundering(); + } + + + @Override + public boolean isRaining() { + return realWorld.isRaining(); + } + + + @Override + public boolean isRainingAt(BlockPos strikePosition) { + strikePosition = region.convertRegionPosToRealWorld(strikePosition); + + return realWorld.isRainingAt(strikePosition); + } + + + @Override + public boolean isBlockinHighHumidity(BlockPos pos) { + pos = region.convertRegionPosToRealWorld(pos); + + return realWorld.isBlockinHighHumidity(pos); + } + + + @Nullable + @Override + public MapStorage getMapStorage() { + return parentWorld.getMapStorage(); + } + + + @Override + public void setData(String dataID, WorldSavedData worldSavedDataIn) { + parentWorld.setData(dataID, worldSavedDataIn); + } + + + @Nullable + @Override + public WorldSavedData loadData(Class clazz, String dataID) { + return parentWorld.loadData(clazz, dataID); + } + + + @Override + public int getUniqueDataId(String key) { + return parentWorld.getUniqueDataId(key); + } + + + @Override + public void playBroadcastSound(int id, BlockPos pos, int data) { + parentWorld.playBroadcastSound(id, pos, data); + } + + + @Override + public void playEvent(int type, BlockPos pos, int data) { + parentWorld.playEvent(type, pos, data); + } + + + @Override + public void playEvent(@Nullable EntityPlayer player, int type, BlockPos pos, int data) { + parentWorld.playEvent(player, type, pos, data); + } + + + @Override + public int getHeight() { + return parentWorld.getHeight(); + } + + + @Override + public int getActualHeight() { + return parentWorld.getActualHeight(); + } + + + @Override + public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) { + return realWorld.setRandomSeed(p_72843_1_, p_72843_2_, p_72843_3_); + } + + + @Override public double getHorizon() { return realWorld.getHorizon(); } + @Override - public void sendQuittingDisconnectingPacket() { - } @Override public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) { parentWorld.sendBlockBreakProgress(breakerId, pos, progress); } + @Override - public void checkSessionLock() throws MinecraftException { - parentWorld.checkSessionLock(); - } @Override public Calendar getCurrentDate() { return realWorld.getCurrentDate(); } @@ -1525,7 +1616,6 @@ public LootTableManager getLootTableManager() { } - @Override public void initCapabilities() { if (initCapabilities == null) { @@ -1539,71 +1629,4 @@ public void initCapabilities() { } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } \ No newline at end of file