Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SirJshreder

Members
  • Joined

  • Last visited

Everything posted by SirJshreder

  1. protected void actionPerformed(GuiButton guibutton) { // if (this.inventorySlots.getSlot(0).getHasStack()) { Packet108EnchantItem packet = new Packet108EnchantItem(0, 1); PacketDispatcher.sendPacketToServer(packet); // } }
  2. I've overridden the method, but it isn't being called when the button is pressed.
  3. 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!
  4. 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!
  5. 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
  6. 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
  7. 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
  8. 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); } } }
  9. 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.
  10. 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.
  11. 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?
  12. 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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.