I want to do the shield slot I do not know where to start from a tutor.
Sorry I've been using Google Translate.
No worries
To make an extra inventory slot, follow the Custom Inventory Tutorial. Getting your custom item slot to provide a real shield-like behavior, however, is a fairly complex endeavor, and you will need to be pretty good with Java and know your way around Minecraft packets and rendering. This is far more than I can cover in a tutorial, but you may be able to find someone to help you or take a peek at either Zelda Sword Skills or Battlegear2, both of which are open source mods that have shields.
Hmm, there is something that I'm not getting in this tutorial but perhaps I missed it. I see you define a class 'ItemStore' but that class is not used anywhere else (except with an 'instandeof'). So how are items of that type ever created?
Author of RFTools, RFTools Control, RFTools Dimensions, Deep Resonance, Immersive Craft, CombatHelp, NICE, Aqua Munda, Ariente, XNet, Interaction Wheel, The Lost Cities, Lost Souls, Need To Breathe, EFab, The One Probe and co-author of Not Enough Wands and RF Lux.
Don't try to create multiple instances of your mod; GUIs are controlled by IGuiHandler, which works best when each GUI has its own ID. If you have two GUIs but they use the same ID, they will open the same GUI, and I see you only have one ID:
public static final int GUI_ITEM_INV = modGuiIndex++; // you need one more of these
As for not storing items, check your IInventory implementation and make sure it is saving the data to the ItemStack's NBT tag. Take your time going through the tutorial and be sure to read everything so you have a better understanding of how things are supposed to be working and why it is done the way it is; you may need to read it several times, depending on your level of Java/Minecraft knowledge. If you still can't get it, check my Github for the 1.7.2 tutorial demo mod for a full implementation and go from there.
Excellent tutorial Alias, to be honest the inv, gui, container and the slots aren't the big issue really. I like how you somewhat explained more in depth of packet sending. I do have a question though, do you happen to know whether there is or where I can find a tutorial about rendering custom armor for these custom slots? I tried going through the vanilla classes and the battlegear2 src, but without luck. Even if I had found something about it I still wouldn't understand for future reference. So could you please help me with this question?
It comes down to two steps, basically: keep the client up-to-date about what ItemStacks are (or aren't) in the custom slots, and if there is an ItemStack in the slot, render it.
The first step can be accomplished by sending the ItemStack (or null) to the client in a packet each time the slot changes on the server. That's pretty straightforward.
The second step requires that you listen for the RenderPlayerEvent, run through each of your custom inventory slots, and render as appropriate based on what's in there. I can't really help you with the rendering code, as that is very specific and can get pretty complicated, but it's no more complicated than any other rendering at that point.
This sums it up in pseudo-code:
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Pre event) { // I chose Pre for no particular reason in this case
ExtProps props = getExtProps(event.entityPlayer);
foreach (ItemStack stack : props.inventory) {
render(stack);
}
}
RenderPlayerEvents entity is always going to be an EntityPlayer, so no need to check for instanceof in this case, and that's a pretty roundabout way of getting the stack in the inventory slot - why not just use getStackInSlot(i)? Much simpler than getting the Slot first, and I don't see any point in making a copy of the ItemStack.
Also, where is your 'newPlayerInv' object coming from? You should be retrieving the extended properties for the player in the method, unless you have somehow stored them as a class field and made an instance of your class for every single player.
It's really this simple:
// get your extended properties for the player currently rendering:
YourExtendedPlayerClass props = YourExtendedPlayerClass.get(event.entityPlayer);
// null check it, just in case, and then iterate through the inventory:
if (props != null) {
IInventory inv = props.inventory;
// either iterate through the inventory (if every slot is renderable) or select specific slots instead
for (int i = 0; i < inv.getSizeInventory(); ++i) {
ItemStack stack = inv.getStackInSlot(i); // no copies here
// you should be able to render any itemstack in your custom inventory, because
// you would have limited what can be put in each slot already, right?
if (stack != null) {
yourRenderMethod(stack, event.entityPlayer); // maybe toss in the partial tick time if you think you'll need it
}
}
}
The only thing you need to figure out is how exactly you want to render each one, and I've already told you that you are on your own for that. Sorry, but I am just not able to assist you with that detailed of a situation.
Yeah thank you, I kinda forgot that we actually pulled and stored the contents of the slots in the player properties. Instead of just leaching of ur code I wanted to give this a shot on my own. Anyways really appreciate the help here, Don't worry I'll figure it out some day. and when I do, I'll share it with you
No worries - always good to give it a go xD That code is a pretty generic way of iterating through any IInventory, btw, as IInventory is sort of an interface between you and the Slots; unless you are directly writing code in an IInventory or a Container class, you should not ever need to make a call to a Slot class method.
As for the rendering, it's not that I don't know how to do it, it's that each situation will be unique. There are some general types of things you can do, such as using ItemRenderer to render the item in 2D, at which point you just need to glRotate and glTranslate it into the right position, or if you are using a Model, call your model's render method after rotating and translating, but that's exactly why it's so much work - unless you know your way around rotation matrix mathematics (I don't), then you are going to be spending a lot of blood, sweat, and tears for all the trial and error it will take to get your objects rendering in the right position.
model.render(entity (e.g. the player), 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
But those will almost certainly not be in the right position, and possibly not even visible at all (it might be behind you, for example), so you need to figure out how to rotate and translate it first to where you can at least see it, then to the correct position, and you usually need different calculations for 1st person vs. 3rd person view, and sometimes also for on the ground or held by another entity.
If you don't know anything about openGL or matrices, you're likely in for a rough ride (it was for me, at least). Good places to start are looking at the vanilla rendering code, as well as any open source render code you can get your hands on that you know for sure works. Doesn't do any good to study crappy code
Anyway, good luck with it - I've given you all the help I can; the rest is up to you.
Make the wings a child part of the body, something like 'body.addChild(wing)', iirc. Jabelar has some pretty good information on rendering, if you search for his posts here or he's got a blog about it. Sorry I don't have the link.
I've followed this awesome tutorial however how would I make it that if I equip a (custom) chestplate, it will grant the player some extra space in the player inventory but when the chestplate is taken off, the extra space will be removed?
I'm thinking of making my own function to do this but I'm not sure where to start.
I've followed this awesome tutorial however how would I make it that if I equip a (custom) chestplate, it will grant the player some extra space in the player inventory but when the chestplate is taken off, the extra space will be removed?
I'm thinking of making my own function to do this but I'm not sure where to start.
1. Make your chestplate a standard 'inventory-storing item'
2. Require the player to be wearing it in order to open the GUI (so in your KeyHandler or however you open your GUI, check if the player is wearing the chestplate)
3. Don't allow the armor to be removed while in your custom inventory GUI, just like in my tutorial the magic bag cannot be moved from its inventory slot while it is open - otherwise bad things happen.
2. Require the player to be wearing it in order to open the GUI (so in your KeyHandler or however you open your GUI, check if the player is wearing the chestplate)
How would I check if the player is wearing the chestplate in the KeyHandler?
I tried to call the function from EntityPlayer: getEquipmentInSlot but it doesn't work the way I wrote it in my KeyHandler.
How would I check if the player is wearing the chestplate in the KeyHandler?
I tried to call the function from EntityPlayer: getEquipmentInSlot but it doesn't work the way I wrote it in my KeyHandler.
player.getEquipmentInSlot[armor_slot+1] or player.getCurrentArmor[armor_slot] both work fine on both client and server, though the check should really be on the server anyway when you receive the packet saying 'open the GUI'.
Here's a tip: if you are asking for help with code, just saying 'it doesn't work' will never get you a real answer; why? Because we cannot divine what mistake you made writing your code without seeing it - always post your code when asking for help.
player.getEquipmentInSlot[armor_slot+1] or player.getCurrentArmor[armor_slot] both work fine on both client and server, though the check should really be on the server anyway when you receive the packet saying 'open the GUI'.
Here's a tip: if you are asking for help with code, just saying 'it doesn't work' will never get you a real answer; why? Because we cannot divine what mistake you made writing your code without seeing it - always post your code when asking for help.
/** Make this public or provide a getter if you'll need access to the key bindings from elsewhere */
public static final KeyBinding[] keys = new KeyBinding[desc.length];
public static Item chest = ModernWorldMod.chest;
public static EntityLivingBase base;
public MWKeyHandler()
{
mc = Minecraft.getMinecraft();
for (int i = 0; i < desc.length; ++i)
{
keys[i] = new KeyBinding(desc[i], keyValues[i], StatCollector.translateToLocal("key.armor.label"));
ClientRegistry.registerKeyBinding(keys[i]);
}
}
/**
* KeyInputEvent is in the FML package, so we must register to the FML event bus
*/
@SubscribeEvent
public void onKeyInput(KeyInputEvent event)
{
// checking inGameHasFocus prevents your keys from firing when the player is typing a chat message
// NOTE that the KeyInputEvent will NOT be posted when a gui screen such as the inventory is open
// so we cannot close an inventory screen from here; that should be done in the GUI itself
if (mc.inGameHasFocus)
{
if (keys[CUSTOM_INV].getIsKeyPressed())
{
if (base.getEquipmentInSlot(3) != null && base.getEquipmentInSlot(3).getItem() instanceof ItemMilitaryArmor)
{
ItemMilitaryArmor armor = (ItemMilitaryArmor)base.getEquipmentInSlot(3).getItem();
java.lang.NullPointerException: Unexpected error
at com.projectx.modernworld.MWKeyHandler.onKeyInput(MWKeyHandler.java:64)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_85_MWKeyHandler_onKeyInput_KeyInputEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1823)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:917)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:835)
at net.minecraft.client.main.Main.main(SourceFile:103)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at com.projectx.modernworld.MWKeyHandler.onKeyInput(MWKeyHandler.java:64)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_85_MWKeyHandler_onKeyInput_KeyInputEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['HelloAndGoodbye'/55, l='MpServer', x=797,64, y=5,62, z=458,36]]
Chunk stats: MultiplayerChunkCache: 225, 234
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (773,4,505), Chunk: (at 5,0,9 in 48,31; contains blocks 768,0,496 to 783,255,511), Region: (1,0; contains chunks 32,0 to 63,31, blocks 512,0,0 to 1023,255,511)
Level time: 7432 game time, 7432 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Forced entities: 15 total; [EntitySheep['Sheep'/33, l='MpServer', x=828,16, y=4,00, z=398,16], EntitySheep['Sheep'/34, l='MpServer', x=826,81, y=4,00, z=396,81], EntitySheep['Sheep'/35, l='MpServer', x=821,22, y=4,00, z=391,38], EntityChicken['Chicken'/36, l='MpServer', x=830,50, y=4,00, z=391,50], EntitySheep['Sheep'/40, l='MpServer', x=838,50, y=4,00, z=524,50], EntitySheep['Sheep'/41, l='MpServer', x=838,50, y=4,00, z=522,78], EntitySheep['Sheep'/42, l='MpServer', x=834,97, y=4,00, z=514,13], EntitySheep['Sheep'/43, l='MpServer', x=835,56, y=4,00, z=527,78], EntityHorse['Horse'/46, l='MpServer', x=875,44, y=4,00, z=413,41], EntityCow['Cow'/48, l='MpServer', x=865,59, y=4,00, z=424,75], EntityClientPlayerMP['HelloAndGoodbye'/55, l='MpServer', x=797,64, y=5,62, z=458,36], EntitySheep['Sheep'/27, l='MpServer', x=753,75, y=4,00, z=457,56], EntitySheep['Sheep'/28, l='MpServer', x=750,94, y=4,00, z=473,22], EntitySheep['Sheep'/29, l='MpServer', x=744,94, y=4,00, z=486,88], EntitySheep['Sheep'/30, l='MpServer', x=750,22, y=4,00, z=482,34]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:368)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2383)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:864)
at net.minecraft.client.main.Main.main(SourceFile:103)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
public static Item chest = ModernWorldMod.chest;
public static EntityLivingBase base;
Okay, you need to learn Java first. I'm sure you expect those two lines to give you something useful, but I can assure you they don't. You didn't even use the first one in your code at all, and the second, what is that supposed to be, the player? You never initialize it, and declared it as static. Google that term, 'static,' as well as 'null pointer exception' and 'initialize variable.'
In the meantime, remove all the code involving 'base' and just send the packet, then in your packet, check if the player is wearing your armor before opening the gui.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNo worries
To make an extra inventory slot, follow the Custom Inventory Tutorial. Getting your custom item slot to provide a real shield-like behavior, however, is a fairly complex endeavor, and you will need to be pretty good with Java and know your way around Minecraft packets and rendering. This is far more than I can cover in a tutorial, but you may be able to find someone to help you or take a peek at either Zelda Sword Skills or Battlegear2, both of which are open source mods that have shields.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNever mind, missed it :-)
Thanks
Author of RFTools, RFTools Control, RFTools Dimensions, Deep Resonance, Immersive Craft, CombatHelp, NICE, Aqua Munda, Ariente, XNet, Interaction Wheel, The Lost Cities, Lost Souls, Need To Breathe, EFab, The One Probe and co-author of Not Enough Wands and RF Lux.
YouTube Channel: https://www.youtube.com/channel/UCYMg1JQw3syJBgPeW6m68lA?view_as=subscriber
Support me at my Patreon page (http://www.patreon.com/McJty) or directly on my Paypal account ([email protected]). Thanks
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSame instance, different ID.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumAs for not storing items, check your IInventory implementation and make sure it is saving the data to the ItemStack's NBT tag. Take your time going through the tutorial and be sure to read everything so you have a better understanding of how things are supposed to be working and why it is done the way it is; you may need to read it several times, depending on your level of Java/Minecraft knowledge. If you still can't get it, check my Github for the 1.7.2 tutorial demo mod for a full implementation and go from there.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIt comes down to two steps, basically: keep the client up-to-date about what ItemStacks are (or aren't) in the custom slots, and if there is an ItemStack in the slot, render it.
The first step can be accomplished by sending the ItemStack (or null) to the client in a packet each time the slot changes on the server. That's pretty straightforward.
The second step requires that you listen for the RenderPlayerEvent, run through each of your custom inventory slots, and render as appropriate based on what's in there. I can't really help you with the rendering code, as that is very specific and can get pretty complicated, but it's no more complicated than any other rendering at that point.
This sums it up in pseudo-code:
@SubscribeEvent public void onRenderPlayer(RenderPlayerEvent.Pre event) { // I chose Pre for no particular reason in this case ExtProps props = getExtProps(event.entityPlayer); foreach (ItemStack stack : props.inventory) { render(stack); } }-
View User Profile
-
View Posts
-
Send Message
Curse PremiumAlso, where is your 'newPlayerInv' object coming from? You should be retrieving the extended properties for the player in the method, unless you have somehow stored them as a class field and made an instance of your class for every single player.
It's really this simple:
// get your extended properties for the player currently rendering: YourExtendedPlayerClass props = YourExtendedPlayerClass.get(event.entityPlayer); // null check it, just in case, and then iterate through the inventory: if (props != null) { IInventory inv = props.inventory; // either iterate through the inventory (if every slot is renderable) or select specific slots instead for (int i = 0; i < inv.getSizeInventory(); ++i) { ItemStack stack = inv.getStackInSlot(i); // no copies here // you should be able to render any itemstack in your custom inventory, because // you would have limited what can be put in each slot already, right? if (stack != null) { yourRenderMethod(stack, event.entityPlayer); // maybe toss in the partial tick time if you think you'll need it } } }The only thing you need to figure out is how exactly you want to render each one, and I've already told you that you are on your own for that. Sorry, but I am just not able to assist you with that detailed of a situation.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNo worries - always good to give it a go xD That code is a pretty generic way of iterating through any IInventory, btw, as IInventory is sort of an interface between you and the Slots; unless you are directly writing code in an IInventory or a Container class, you should not ever need to make a call to a Slot class method.
As for the rendering, it's not that I don't know how to do it, it's that each situation will be unique. There are some general types of things you can do, such as using ItemRenderer to render the item in 2D, at which point you just need to glRotate and glTranslate it into the right position, or if you are using a Model, call your model's render method after rotating and translating, but that's exactly why it's so much work - unless you know your way around rotation matrix mathematics (I don't), then you are going to be spending a lot of blood, sweat, and tears for all the trial and error it will take to get your objects rendering in the right position.
For example, a generic 2D rendering:
IIcon icon = stack.getItem().getIcon(stack, 0); if (icon != null) { ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); }For an item model, it may be as simple as:
But those will almost certainly not be in the right position, and possibly not even visible at all (it might be behind you, for example), so you need to figure out how to rotate and translate it first to where you can at least see it, then to the correct position, and you usually need different calculations for 1st person vs. 3rd person view, and sometimes also for on the ground or held by another entity.
If you don't know anything about openGL or matrices, you're likely in for a rough ride (it was for me, at least). Good places to start are looking at the vanilla rendering code, as well as any open source render code you can get your hands on that you know for sure works. Doesn't do any good to study crappy code
Anyway, good luck with it - I've given you all the help I can; the rest is up to you.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI'm thinking of making my own function to do this but I'm not sure where to start.
-
View User Profile
-
View Posts
-
Send Message
Curse Premium1. Make your chestplate a standard 'inventory-storing item'
2. Require the player to be wearing it in order to open the GUI (so in your KeyHandler or however you open your GUI, check if the player is wearing the chestplate)
3. Don't allow the armor to be removed while in your custom inventory GUI, just like in my tutorial the magic bag cannot be moved from its inventory slot while it is open - otherwise bad things happen.
How would I check if the player is wearing the chestplate in the KeyHandler?
I tried to call the function from EntityPlayer: getEquipmentInSlot but it doesn't work the way I wrote it in my KeyHandler.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumplayer.getEquipmentInSlot[armor_slot+1] or player.getCurrentArmor[armor_slot] both work fine on both client and server, though the check should really be on the server anyway when you receive the packet saying 'open the GUI'.
Here's a tip: if you are asking for help with code, just saying 'it doesn't work' will never get you a real answer; why? Because we cannot divine what mistake you made writing your code without seeing it - always post your code when asking for help.
Sorry, here's my code in my KeyHandler:
package com.projectx.modernworld;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard;
import com.projectx.modernworld.ModernWorldMod;
import com.projectx.modernworld.items.ItemMilitaryArmor;
import com.projectx.modernworld.network.OpenGuiPacket;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
public class MWKeyHandler
{
/** Storing an instance of Minecraft in a local variable saves having to get it every time */
private final Minecraft mc;
/** Key index for easy handling */
public static final int CUSTOM_INV = 0;
/** Key descriptions; use a language file to localize the description later */
private static final String[] desc = {"key.armor_inventory.desc"};
/** Default key values */
private static final int[] keyValues = {Keyboard.KEY_B};
/** Make this public or provide a getter if you'll need access to the key bindings from elsewhere */
public static final KeyBinding[] keys = new KeyBinding[desc.length];
public static Item chest = ModernWorldMod.chest;
public static EntityLivingBase base;
public MWKeyHandler()
{
mc = Minecraft.getMinecraft();
for (int i = 0; i < desc.length; ++i)
{
keys[i] = new KeyBinding(desc[i], keyValues[i], StatCollector.translateToLocal("key.armor.label"));
ClientRegistry.registerKeyBinding(keys[i]);
}
}
/**
* KeyInputEvent is in the FML package, so we must register to the FML event bus
*/
@SubscribeEvent
public void onKeyInput(KeyInputEvent event)
{
// checking inGameHasFocus prevents your keys from firing when the player is typing a chat message
// NOTE that the KeyInputEvent will NOT be posted when a gui screen such as the inventory is open
// so we cannot close an inventory screen from here; that should be done in the GUI itself
if (mc.inGameHasFocus)
{
if (keys[CUSTOM_INV].getIsKeyPressed())
{
if (base.getEquipmentInSlot(3) != null && base.getEquipmentInSlot(3).getItem() instanceof ItemMilitaryArmor)
{
ItemMilitaryArmor armor = (ItemMilitaryArmor)base.getEquipmentInSlot(3).getItem();
ModernWorldMod.packetPipeline.sendToServer(new OpenGuiPacket(ModernWorldMod.GUI_ITEM_INV));
}
}
}
}
}
---- Minecraft Crash Report ----
// I feel sad now
Time: 21:25 10/08/2014
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at com.projectx.modernworld.MWKeyHandler.onKeyInput(MWKeyHandler.java:64)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_85_MWKeyHandler_onKeyInput_KeyInputEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1823)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:917)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:835)
at net.minecraft.client.main.Main.main(SourceFile:103)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at com.projectx.modernworld.MWKeyHandler.onKeyInput(MWKeyHandler.java:64)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_85_MWKeyHandler_onKeyInput_KeyInputEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['HelloAndGoodbye'/55, l='MpServer', x=797,64, y=5,62, z=458,36]]
Chunk stats: MultiplayerChunkCache: 225, 234
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (773,4,505), Chunk: (at 5,0,9 in 48,31; contains blocks 768,0,496 to 783,255,511), Region: (1,0; contains chunks 32,0 to 63,31, blocks 512,0,0 to 1023,255,511)
Level time: 7432 game time, 7432 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Forced entities: 15 total; [EntitySheep['Sheep'/33, l='MpServer', x=828,16, y=4,00, z=398,16], EntitySheep['Sheep'/34, l='MpServer', x=826,81, y=4,00, z=396,81], EntitySheep['Sheep'/35, l='MpServer', x=821,22, y=4,00, z=391,38], EntityChicken['Chicken'/36, l='MpServer', x=830,50, y=4,00, z=391,50], EntitySheep['Sheep'/40, l='MpServer', x=838,50, y=4,00, z=524,50], EntitySheep['Sheep'/41, l='MpServer', x=838,50, y=4,00, z=522,78], EntitySheep['Sheep'/42, l='MpServer', x=834,97, y=4,00, z=514,13], EntitySheep['Sheep'/43, l='MpServer', x=835,56, y=4,00, z=527,78], EntityHorse['Horse'/46, l='MpServer', x=875,44, y=4,00, z=413,41], EntityCow['Cow'/48, l='MpServer', x=865,59, y=4,00, z=424,75], EntityClientPlayerMP['HelloAndGoodbye'/55, l='MpServer', x=797,64, y=5,62, z=458,36], EntitySheep['Sheep'/27, l='MpServer', x=753,75, y=4,00, z=457,56], EntitySheep['Sheep'/28, l='MpServer', x=750,94, y=4,00, z=473,22], EntitySheep['Sheep'/29, l='MpServer', x=744,94, y=4,00, z=486,88], EntitySheep['Sheep'/30, l='MpServer', x=750,22, y=4,00, z=482,34]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:368)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2383)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:864)
at net.minecraft.client.main.Main.main(SourceFile:103)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.8.0_11, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 74586184 bytes (71 MB) / 246247424 bytes (234 MB) up to 518979584 bytes (494 MB)
JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx512M
AABB Pool Size: 1050 (58800 bytes; 0 MB) allocated, 2 (112 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.03 FML v7.2.217.1147 Minecraft Forge 10.12.2.1147 Optifine OptiFine_1.7.2_HD_U_D3 23 mods loaded, 23 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.217.1147} [Forge Mod Loader] (forge-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.2.1147} [Minecraft Forge] (forge-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
CodeChickenCore{1.0.2.10} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
NotEnoughItems{1.0.2.14} [Not Enough Items] (NotEnoughItems-1.7.2-1.0.2.14-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
furnace3d{1.2.0} [Furnace 3D] ([1.7.2] 3D Furnace-1.3a.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
bspkrsCore{6.9} [bspkrsCore] ([1.7.2]bspkrsCore-universal-6.9.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
ArmorStatusHUD{1.26} [ArmorStatusHUD] ([1.7.2]ArmorStatusHUD-client-1.26.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
betterstorage{0.9.3.109} [BetterStorage] (BetterStorage-1.7.10-0.9.3.109.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
BuildCraft|Core{6.0.16} [BuildCraft] (buildcraft-6.0.16.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
BuildCraft|Builders{6.0.16} [BC Builders] (buildcraft-6.0.16.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
BuildCraft|Energy{6.0.16} [BC Energy] (buildcraft-6.0.16.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
BuildCraft|Factory{6.0.16} [BC Factory] (buildcraft-6.0.16.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
BuildCraft|Transport{6.0.16} [BC Transport] (buildcraft-6.0.16.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
BuildCraft|Silicon{6.0.16} [BC Silicon] (buildcraft-6.0.16.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
CoroAI{v1.0} [CoroAI] (CoroUtil-1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
ExtendedRenderer{v1.0} [Extended Renderer] (CoroUtil-1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
ConfigMod{v1.0} [Extended Mod Config] (CoroUtil-1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
iChunUtil{3.3.0} [iChunUtil] (iChunUtil-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
MineMenu{1.0.5} [MineMenu] (MineMenu-1.7.2-1.0.5.14-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
MobAmputation{3.0.1} [MobAmputation] (MobAmputation-3.0.1.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
modernworld{1.7.2-0.12} [Modern World Mod] (ModernWorld-1.7.2-0.12.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
ZAMod{v1.9.2} [Zombie Awareness] (ZombieAwareness-1.9.2.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.2-Forge10.12.2.1147
LWJGL: 2.9.0
OpenGL: Mobile Intel(R) 4 Series Express Chipset Family GL version 2.1.0 - Build 8.15.10.2869, Intel
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 254 (14224 bytes; 0 MB) allocated, 24 (1344 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOkay, you need to learn Java first. I'm sure you expect those two lines to give you something useful, but I can assure you they don't. You didn't even use the first one in your code at all, and the second, what is that supposed to be, the player? You never initialize it, and declared it as static. Google that term, 'static,' as well as 'null pointer exception' and 'initialize variable.'
In the meantime, remove all the code involving 'base' and just send the packet, then in your packet, check if the player is wearing your armor before opening the gui.