Jump to content

TANDEROID

Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TANDEROID's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I solve the problem with fail if (entity.capabilities.isCreativeMode) { if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_expand1.block) { if (true) { if (entity instanceof EntityPlayer) ((EntityPlayer) entity).inventory.setInventorySlotContents(selSlot, new ItemS(mcreator_expand50.block, 1)); ((EntityPlayer) entity).inventory.markDirty(); } } } but it isn`t help with my problem...
  2. If I use markDirty() to save inventory changes, it get me fail. What can make problems? May be I must import library, or something else? Part of code where I use it if (entity.capabilities.isCreativeMode) { if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_expand1.block) { if (true) { if (entity instanceof EntityPlayer) ((EntityPlayer) entity).inventory.setInventorySlotContents(selSlot, new ItemStack(mcreator_expand50.block, 1)); stopExpand = 1; markDirty(); } } }
  3. Sorry, but the most of this code isn`t mine, I use ModCreator, so I understend not more the 20% of that. I just want to solve this problem. So, my problem was called by reaching across logical sides, or the reason not here?
  4. Bigger code slice public class KeyHandlerClass { private static final String desc = "Previous range"; private static final int keyValues = Keyboard.KEY_LBRACKET; private final KeyBinding keys; public KeyHandlerClass() { keys = new KeyBinding(desc, keyValues, "World Edit helpers"); ClientRegistry.registerKeyBinding(keys); } @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) { if (keys.isPressed()) { EntityPlayer entity = Minecraft.getMinecraft().thePlayer; MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); World world = server.worldServers[0]; int selSlot = ((EntityPlayer) entity).inventory.currentItem ; if (entity.capabilities.isCreativeMode) { if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == expand20.block) { if (true) { if (entity instanceof EntityPlayer) ((EntityPlayer) entity).inventory.setInventorySlotContents(selSlot, new ItemStack(expand10.block, 1)); } } } } } } } }
  5. int selSlot = ((EntityPlayer) entity).inventory.currentItem ; if (entity.capabilities.isCreativeMode) { if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == expand20.block) { if (true) { if (entity instanceof EntityPlayer) ((EntityPlayer) entity).inventory.setInventorySlotContents(selSlot, new ItemStack(expand10.block, 1)); } } }
  6. I use this code to replace item in hotbar slot ((EntityPlayer) entity).inventory.setInventorySlotContents(5, new ItemStack(example.block, 1)); and this works, but if I use this item(RClick) it go back to the previous state. But! If I open inventory and pick it and put in any slot it won`t go back to the previous state after RClick.
  7. I was not sure that I would succeed and therefore asked for help. But this code works ! ((EntityPlayer) entity).inventory.setInventorySlotContents(5, null); Thank you!
  8. Could you write me example of this code? I'm new to modding
  9. For example I want remove item from 5th slot of toolbar. How I can do this?
×
×
  • Create New...

Important Information

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