Jump to content

Schleim_time

Members
  • Posts

    103
  • Joined

  • Last visited

Everything posted by Schleim_time

  1. Yes but i cant do for x < 8 because i have for every recipe a own getInputX
  2. @Override public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { if(slotId == 9) { ItemStack result = tileentity.getStackInSlot(9); if(result.getItem() != Items.AIR) { for(int x = 0; x < 9; x++) { ItemStack stack = tileentity.getStackInSlot(x); if(stack.getCount() > 0 && stack.getItem() != Items.AIR) { stack.setCount(stack.getCount()-1); } } player.dropItem(result.splitStack(1), true); return super.slotClick(slotId, dragType, clickTypeIn, player); } } return super.slotClick(slotId, dragType, clickTypeIn, player); } that line i marked is not that i want, is it possible to set instead ot that the item stack in the drag slot?
  3. all okay its solved, btw how can i ask if player takes item out of a slot?
  4. Ok im tryed it now with an Override method that worked if i do that manully but for some reason it will not work and also the for loop will not work i dont get why
  5. thats it the sysout give me my message and the item is there but its buggy and i will only see the item if i click on the slot im sorry, i am responding when i got the mail and sometimes im not at home XD
  6. Its only a problem in a container, i do an input, it finds the input but the output is set in the right field, only problem is it is invisible. So is there a way to uptade the inv?
  7. I already deleted it but i did everytime the same its tileentity.setSlotcontent(index, new Itemstack(items.(blabla))
  8. Thank you david, i will try my best but as first i copied the crafting table one because i also want to do something like that
  9. I tried out to set items in my container if i place something in the right place but the problem i got is that i cant see the item until i click on the slot and than it will appear. I tried detectandsendchanges, getslot and putiteminslot and tried to set an itemstack to my slot, i also tried to use .update or something but it all dont worked, i recieve the item but the are not visible until you interact with the right slot, how can i fix that problem? Also i tried to use oncraftmatrixchanged but that dont even return me a sysout
  10. oh im sorry i solved it for myself i did up in my class something very stupid XD private List blala;
  11. @Override public void onContainerClosed(EntityPlayer playerIn) { for(int x = 0; x < 9; x++) { if(tyleentity.getStackInSlot(x)!=null||tyleentity.getStackInSlot(x)!= new ItemStack(Items.AIR).EMPTY) { itemlist.add(tyleentity.getStackInSlot(x)); } } if(!itemlist.isEmpty()) { for(ItemStack item : itemlist) { playerIn.inventory.addItemStackToInventory(item); } } tyleentity.clear(); itemlist.clear(); } i want to let the player get the items back on closing the table but for some reson its crashes because of an null pointer on the line i marked, idk why because i already asked if it is null bevore
  12. So im only tring to do that shift will not crash, shift dont need a function but i have no plan how to do this, im not understanding the method
  13. I did empty, return null stoops server and crash and return empty do crash without error
  14. Ok i found out how to use that, i have to use that in the container bit o dont understand the syntax of that because its returning an itemstack, why will it still crash on return null instead of doing nothing on shift? Shift isnt important for me, so is it easy to only make that it return nothing? Or what can i do in there? Return an itemstack is weird i also tried return air but it still crashes instead of replacing the slot with air
  15. Its only a construktor with containers and a gui
  16. Funny thing is there is no crash and are nor errors, its seems to do an infinity loop or something but idk why, i heard you need to override transferstack or something but i have no plan how to use that. Can you see the minecraft workbench transferstack?
  17. My game crashes by using shift click in my custom container, is there a way to fix that? i readed about @Override the transferStackinslot but i cant fint that anymore, maybe its gotten removed or got an other name?
  18. solved it formyself the inventory had to less slots
  19. @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == reference.GUI_FORGEBENCH) { forgebenchcontainer con = new forgebenchcontainer(player.inventory, new forgebenchinventory()); return con; } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == reference.GUI_FORGEBENCH) { forgebenchgui gui = new forgebenchgui(player.inventory, new forgebenchinventory()); return gui; } return null; } this is my guihandler now but it crashes when i open the gui :C i dont uses tileentitys because i think i dont need them because i dont want my block starage anything
  20. ok okay i did something completly whrong at end, but the game still crashes for the same reason, now i extended with a tileentity and registered it and addet to the block and all that stuff
  21. public class guihandler implements IGuiHandler{ @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == reference.GUI_FORGEBENCH) { forgebenchcontainer con = new forgebenchcontainer(player.inventory, new forgebenchinventory()); return con; } else {return null;} } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if(ID == reference.GUI_FORGEBENCH) { forgebenchgui gui = new forgebenchgui(player.inventory, new forgebenchinventory()); return gui; } else {return null;} } } and thats my handler
  22. i looked around the internet to create an GUI and i tried my best to create an gui that shouldnt be able to do anything right now, i only wanted to test out if it will work but my minecraft crashed all the time and i dont know the mistakeforgebench.javaforgebenchcontainer.javaforgebenchgui.javaforgebenchinventory.java thats my code and here the crash log, it seems all caused by one null pointer but why and how? [17:43:48] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException: The validated object is null at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_211] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_211] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] Caused by: java.lang.NullPointerException: The validated object is null at org.apache.commons.lang3.Validate.notNull(Validate.java:225) ~[commons-lang3-3.5.jar:3.5] at org.apache.commons.lang3.Validate.notNull(Validate.java:206) ~[commons-lang3-3.5.jar:3.5] at net.minecraft.util.NonNullList.add(NonNullList.java:62) ~[NonNullList.class:?] at java.util.AbstractList.add(Unknown Source) ~[?:1.8.0_211] at net.minecraft.inventory.Container.getInventory(Container.java:75) ~[Container.class:?] at net.minecraft.inventory.Container.addListener(Container.java:61) ~[Container.class:?] at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:101) ~[FMLNetworkHandler.class:?] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?] at com.Schleimtime.Wasteland.blocks.castfurnace.forgebench.onBlockActivated(forgebench.java:56) ~[forgebench.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[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:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_211] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_211] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 5 more [17:43:48] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking player at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:848) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] Caused by: java.lang.NullPointerException at net.minecraft.item.ItemStack.areItemStacksEqual(ItemStack.java:495) ~[ItemStack.class:?] at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:100) ~[Container.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:365) ~[EntityPlayerMP.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2171) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) ~[WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2130) ~[World.class:?] at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:672) ~[WorldServer.class:?] at net.minecraft.world.World.updateEntities(World.java:1906) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) ~[MinecraftServer.class:?] ... 4 more
  23. @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Items.COAL; } thats my code, but i cant figure out how to drop that item with metadata, i tried an new item stack and getitem but than it was also normal coal and there is nothing like .set to set a metadata :C
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.