
EscapeMC
Forge Modder-
Posts
337 -
Joined
-
Last visited
Everything posted by EscapeMC
-
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
I did this while waiting. As to your code you posted: I copy-pasta that, and I get several errors all saying "The constructor is undefined" The constructor ContainerTestChest(EntityPlayer, TileEntityTestChest) is undefined The constructor ContainerTestBag(EntityPlayer) is undefined then in client The constructor ContainerTestChest(EntityPlayer, TileEntityTestChest) is undefined The constructor ContainerTestBag(EntityPlayer) is undefined -
[1.11.2] [SOLVED] Destroy Item after right click
EscapeMC replied to Bektor's topic in Modder Support
In my opinion, I would give it 2 durability, and then onItemRightClick, make it take 1 damage. But that's just me. I guess this isn't exactly the right thing for what you're looking for but I just saw this and thought about this answer -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
When I right click my item it disappears and clones the item in the first hotbar slot to the top left and bottom left slots of the inventory and the side hand, and no Gui appears on the screen. -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
Ok wait. After looking over everything. I cannot figure out everything I need to do to. Here is everything I think so far: 1) Make it so when I right click my test_bag it opens the Gui. 2) Get my container right (This does relate to #1) If you could tell me what is wrong with everything/anything, and tell me how to fix it, that would be great? -
"* Where: Build file 'C:\Users\sirleinad\Downloads\[Mods]\Minecraft\[Modding]\1.10.2\forge-1.10.2-12.18.2.2099-mdk\build.gradle' line: 80 * What went wrong: A problem occurred evaluating root project 'forge-1.10.2-12.18.2.2099-mdk'." Go to line 80 of your build.gradle. Also, I noticed "> No signature of method: org.gradle.api.JavaVersion.call() is applicable for argument types: (org.gradle.api.JavaVersion) values: [1.8]" values: [1.8] Lastly, run the full command "gradlew setupDevWorkspace eclipse" It eliminates the need to run gradlew eclipse too
-
[1.10.2] How to set a block to unbreakable [SOLVED]
EscapeMC replied to bongotezz's topic in Modder Support
Hey, if you'd like you can reference my OpenSource test-things mod for making your chest. https://github.com/EscapeMC/Things-Mod-1.10.2/tree/master/src/main/java/com/github/escapemc/thingsmod Good luck! -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
So to fix this would you say don't use/use a different parent class? (Copy the 9x5, say, and edit it accordingly?) -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
So what must I do to fix this all? -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
Oh, and one more thing, when I right click the bag, along with this error: [17:11:17] [Client thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46 at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_101] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_101] at net.minecraft.util.Util.runTask(SourceFile:46) [util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1045) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:371) [Minecraft.class:?] at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46 at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[?:1.8.0_101] at java.util.ArrayList.get(ArrayList.java:429) ~[?:1.8.0_101] at net.minecraft.inventory.Container.getSlot(Container.java:113) ~[Container.class:?] at net.minecraft.inventory.Container.putStacksInSlots(Container.java:554) ~[Container.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1146) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SourceFile:49) ~[sPacketWindowItems.class:?] at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SourceFile:11) ~[sPacketWindowItems.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_101] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_101] at net.minecraft.util.Util.runTask(SourceFile:45) ~[util.class:?] ... 15 more It also puts the item to my offhand, and duplicates it to top left inventory slot, and bottom left inventory slot. -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
So yes, the chest is fixed. Not the bag. Any advice? ALSO! I had to re-do my GitHub repositories, so the link to my GitHub is now https://github.com/EscapeMC/Things-Mod-1.10.2/tree/master/src/main/java/com/github/escapemc/thingsmod I believe the only difference is the - -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
I have this for my Chest and it worked, so I am not sure right now about that. I will wait for Draco or someone, but thanks! You've helped a lot -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
Ah, I must have changed the chest part when I was angry with my bag, and not realizing it was actually my chest. Thanks for that! Now, I need someone *cough Draco, animefan or diesse* to help me with this other part.. -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
I just edited last message, but no Gui opens EDIT: I ran the game again to grab the console for both again: -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
EDIT: I think i have fixed the onItemRightClicked. I have been tinkering around, but no success with this. And now my chest isn't working either! If I right click the test_bag, it disappears. Right clicking a normal item now does nothing (good), and I can't use my chest. It gives me this error in console: [14:59:26] [server thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_101] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_101] at net.minecraft.util.Util.runTask(Util.java:26) [util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:742) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101] Caused by: java.lang.NullPointerException at com.github.escapemc.thingsmod.container.ContainerTestChest.<init>(ContainerTestChest.java:19) ~[ContainerTestChest.class:?] at com.github.escapemc.thingsmod.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:29) ~[GuiHandler.class:?] at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:251) ~[NetworkRegistry.class:?] at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:87) ~[FMLNetworkHandler.class:?] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2723) ~[EntityPlayer.class:?] at com.github.escapemc.thingsmod.blocks.test_chest.onBlockActivated(test_chest.java:64) ~[test_chest.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:477) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processRightClickBlock(NetHandlerPlayServer.java:706) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_101] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_101] at net.minecraft.util.Util.runTask(Util.java:25) ~[util.class:?] ... 5 more Right clicking test_bag gives same error as earlier GitHub updated. https://github.com/EscapeMC/ThingsMod-1.10.2/tree/master/src/main/java/com/github/escapemc/thingsmod -
You say you have an error but give no log of any sort? Also, what are you EXACTLY trying to do? You just say you were trying to log.
-
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
Yes, I notice this now -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
So I fixed that, and ran the game. I right click it, and it just goes to my off hand. ALso, the console says [14:19:03] [Client thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46 at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_101] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_101] at net.minecraft.util.Util.runTask(Util.java:26) [util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1108) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46 at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[?:1.8.0_101] at java.util.ArrayList.get(ArrayList.java:429) ~[?:1.8.0_101] at net.minecraft.inventory.Container.getSlot(Container.java:127) ~[Container.class:?] at net.minecraft.inventory.Container.putStacksInSlots(Container.java:590) ~[Container.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1268) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SPacketWindowItems.java:67) ~[sPacketWindowItems.class:?] at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SPacketWindowItems.java:12) ~[sPacketWindowItems.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_101] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_101] at net.minecraft.util.Util.runTask(Util.java:25) ~[util.class:?] ... 15 more I also realize this: @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { playerIn.openGui(Main.instance, GuiHandler.TEST_BAG, worldIn, 0, 0, 0); return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); } WHat do i need to change any of this to to fix it? (I forgot to rid the code of that second one with return super... And I do not know what to change all of this to) -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
You need to call getHeldItem on the player. You could pass the player to the constructor of your container, or get the player from the InventoryPlayer which is already in the constructor - inventory.player . Ok ok, so public ContainerTestBag(InventoryPlayer inventory) { super(inventory, inventory, null); IItemHandler inven = inventory.getCurrentItem().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); for (int j = 0; j < this.numRows; ++j) { for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new SlotItem(inven, k + j * 9, 8 + k * 18, 12 + j * 18)); } } is this right? -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
With that info, what do I need to make IItemHandler inven = getHeldItem(EnumHand.MAIN_HAND).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); Into? (Yes, I know what is far from correct right now. Iw as editing it and I forgot to go back) -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
I am doing this already! (I think) No you're not. IItemHandler inven = TestBagCapabilities.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); You're calling it (statically) on TestBagCapabilities , not on an ItemStack . That is not an item stack, that is TestBagCapabilities which is an ICapabilitySerializable. And again, TestBagCapabilities.getCapability() doesn't exist, TestBagCapabilities#getCapability() does. If you want an item stack, pass the item stack from your GUI handler to your container, or get it from the player's active item. Ok, this clarifies several things. Thank you Draco. Yet still, I do not understand where my ItemStack is I need to use, and the more I look, the more confused I get. Could you potentially go through my GitHub, highlight lines, and tell me what I need to do? I would appreciate it if you could. If not, hint me toward my next step...? -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
I am doing this already! (I think) No, you're not. You're trying to call TestBagCapabilities.getCapability , as if it is a static method (which it isn't). *is tearing out hair* Wait??? So then what is my itemstack? And would I use .getCapability to get the capability? -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
I am doing this already! (I think) package com.github.escapemc.thingsmod.container; import com.github.escapemc.thingsmod.hardlib.api.internal.CommonContainer9x5; import com.github.escapemc.thingsmod.hardlib.api.inventory.SlotItem; import com.github.escapemc.thingsmod.items.TestBagCapabilities; import com.github.escapemc.thingsmod.tileentity.TileEntityTestChest; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class ContainerTestBag extends CommonContainer9x5 { private int numRows = 2; public ContainerTestBag(InventoryPlayer inventory) { super(inventory, inventory, null); IItemHandler inven = TestBagCapabilities.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); for (int j = 0; j < this.numRows; ++j) { for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new SlotItem(inven, k + j * 9, 8 + k * 18, 12 + j * 18)); } } } } Is my Container. package com.github.escapemc.thingsmod.items; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.ItemStackHandler; public class TestBagCapabilities implements ICapabilitySerializable { protected ItemStackHandler inputSlot; public TestBagCapabilities() { inputSlot = new ItemStackHandler(18); } @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { return this.getCapability(capability, facing) != null; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) inputSlot; } return null; } @Override public NBTBase serializeNBT() { NBTTagCompound NBTBase = new NBTTagCompound(); ((NBTTagCompound)NBTBase).setTag("inputSlot", inputSlot.serializeNBT()); return NBTBase; } @Override public void deserializeNBT(NBTBase nbt) { inputSlot.deserializeNBT(((NBTTagCompound) nbt).getCompoundTag("inputSlot")); } } My ItemStack -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
So what do I do here IItemHandler inven = TestBagCapabilities.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); to fix this? (Or am I looking at the wrong line?) -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
So, you realized you don't have a TE. But something has to hold the capability. Let's think, what could that be... If only there was something that represented an item... How would I use and ItemStack here? -
[1.10.2] {Solved!!!} Right-Click Item for Chest-like GUI
EscapeMC replied to EscapeMC's topic in Modder Support
Alright. That makes me think. Since it is not a block, I don't need position, hm? So I change them to 0s. Second: I realize that I was using tileentity in my ContainerTestBag. I changed all the TE stuff to my capability class, but I not have this error: "Cannot make a static reference to the non-static method getCapability(Capability<IItemHandler>, EnumFacing) from the type TestBagCapabilities" https://github.com/EscapeMC/ThingsMod-1.10.2/blob/master/src/main/java/com/github/escapemc/thingsmod/container/ContainerTestBag.java#L18 at there. How can I fix this as well?