-
Inventory Change Not "Sticking"
protected void actionPerformed(GuiButton guibutton) { // if (this.inventorySlots.getSlot(0).getHasStack()) { Packet108EnchantItem packet = new Packet108EnchantItem(0, 1); PacketDispatcher.sendPacketToServer(packet); // } }
-
Inventory Change Not "Sticking"
I've overridden the method, but it isn't being called when the button is pressed.
-
Inventory Change Not "Sticking"
So, how exactly would I go about implementing this packethandler/packet system? Can you supply some example code, or perhaps link me to a tutorial? I've looked at the one of the Forge wiki, but I'm still confused. Thanks!
-
Inventory Change Not "Sticking"
Hello, all. I've been trying to code an unenchantment table, but I'm having some problems actually getting the inventory changes to "stick", so to speak. Here is the code for my gui's button action: protected void actionPerformed(GuiButton guibutton) { //id is the id you give your button if (this.inventorySlots.getSlot(0).getHasStack()) { ItemStack stackInSlot = this.inventorySlots.getSlot(0).getStack(); EntityPlayer player = this.mc.thePlayer; if (stackInSlot.isItemEnchanted()) { ItemStack tempItemStack = new ItemStack(stackInSlot.getItem()); tempItemStack.setItemDamage(stackInSlot.getItemDamage()); System.out.println(((ItemStack) this.inventorySlots.getInventory().get(0)).getDisplayName()); this.inventorySlots.getSlot(0).putStack(tempItemStack); this.inventorySlots.detectAndSendChanges(); player.inventoryContainer.detectAndSendChanges(); } this.inventorySlots.detectAndSendChanges(); player.inventoryContainer.detectAndSendChanges(); } } The item simply reverts to it's previous state after it I click on it. Any ideas? Thanks!
-
Tell Whether an Item is Enchanted...
Hey! So, I've been trying to add some custom enchantments, and I need to be able to tell whether an item has on such enchantment or not. Could anyone be of help? Thanks, jshreder
-
Tell Whether an Item is Enchanted...
Hey! So, I've been trying to add some custom enchantments, and I need to be able to tell whether an item has on such enchantment or not. Could anyone be of help? Thanks, jshreder
-
Why isn't my mod working in SMP?
Thank you so much! It seems to be working now . I'll pm you a link to the mod on mcforums when I have it up, if you wouldn't mind taking a look at it. Thanks again, jshreder
-
Why isn't my mod working in SMP?
That's the problem. That is what I do, but I use the Minecraft class to get the player. How else would I do it? Here is my code for the item class: package in.joegold.flyingring; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class FlyingRingItem extends Item { private Minecraft mc = Minecraft.getMinecraft(); public FlyingRingItem(int id) { super(id); // Constructor Configuration setMaxStackSize(1); setCreativeTab(CreativeTabs.tabTools); setIconIndex(0); setItemName("flyingRingItem"); } @Override public String getTextureFile() { return CommonProxy.ITEMS_PNG; } @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); if (mc.thePlayer.inventory.hasItem(24537)) { mc.thePlayer.capabilities.allowFlying = true; } if (mc.thePlayer.capabilities.isFlying == true) { this.setIconIndex(1); } else { this.setIconIndex(0); } } }
-
Why isn't my mod working in SMP?
No, the idea is that you can craft a ring that lets only you fly. It fully works in SSP, but it crashes, as I said, in SMP.
-
Why isn't my mod working in SMP?
I'm still having some trouble, would you mind being a bit more specific? I understand what you're saying, just not how to implement it, considering the ring that makes you fly affects only one player. Thanks.
-
Why isn't my mod working in SMP?
I have this line private Minecraft mc = Minecraft.getMinecraft(); in my main class, because I use mc.thePlayer.capabilities.isFlying == true to check whether the player is flying, among other things. How would I change this?
-
Why isn't my mod working in SMP?
I have a mod that makes a flying ring. I think it should be SMP compatible, but I get this error upon loading a forge server: java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft at in.joegold.flyingring.FlyingRingItem.<init>(FlyingRingItem.java:24) at in.joegold.flyingring.FlyingRing.<clinit>(FlyingRing.java:36) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:416) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) Anyone have any suggestions? I'll post any code if requested, but here's a list of my classes: Thanks, jshreder
IPS spam blocked by CleanTalk.