I'm little confused about the IExtendedEntityProperties, or we can say the mechanic of minecraft's properties.
Does it run over the ram when minecraft normal running and save as NBT when minecraft closing?
Or running in some other ways?
Also about the packet, is that means after you register a packet, the minecraft will manage when the packet should be sent?
If a mod have a function changing the exp of player, do we need a extra packet to syn the exp again?
Yes, IEEP is saved whenever Minecraft naturally saves player / entity NBT, which is both when Minecraft closes, and every 5 minutes or so (I think). At any rate, it is more than sufficient to ensure your data is saved.
Custom packets are NEVER handled by Minecraft - if you have a custom packet, it is up to you to send, receive, and process it.
Some things are automatically synchronized to the client side, though, so you don't need any packet. These include things like ItemStack NBT, player health, current item, etc. I'm not 100% sure about XP, but I bet it is also automatically synchronized to the client.
Just remember that synchronization can only happen if you make the changes on the server.
I've managed to edit values inside of my IEEP, but it doesn't save when I save and quit the game.
IEEP class
public class ExtendedPlayer implements IExtendedEntityProperties
{
/*
Here I create a constant EXT_PROP_NAME for this class of properties. You need a unique name for every instance of IExtendedEntityProperties you make, and doing it at the top of each class as a constant makes
it very easy to organize and avoid typos. It's easiest to keep the same constant name in every class, as it will be distinguished by the class name: ExtendedPlayer.EXT_PROP_NAME vs. ExtendedEntity.EXT_PROP_NAME
Note that a single entity can have multiple extended properties, so each property should have a unique name. Try to come up with something more unique than the tutorial example.
*/
public final static String EXT_PROP_NAME = "PlayerSkillStats";
// I always include the entity to which the properties belong for easy access
// It's final because we won't be changing which player it is
private final EntityPlayer player;
// Declare other variables you want to add here
private int woodCuttingLevel;
/*
The default constructor takes no arguments, but I put in the Entity so I can initialize the above variable 'player'
Also, it's best to initialize any other variables you may have added, just like in any constructor.
*/
public ExtendedPlayer(EntityPlayer player)
{
this.player = player;
// Start with Level 1
this.woodCuttingLevel = 1;
}
/**
* Used to register these extended properties for the player during EntityConstructing event
* This method is for convenience only; it will make your code look nicer
*/
public static final void register(EntityPlayer player)
{
player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player));
}
/**
* Returns ExtendedPlayer properties for player
* This method is for convenience only; it will make your code look nicer
*/
public static final ExtendedPlayer get(EntityPlayer player)
{
return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME);
}
// Save any custom data that needs saving here
@Override
public void saveNBTData(NBTTagCompound compound)
{
// We need to create a new tag compound that will save everything for our Extended Properties
NBTTagCompound SkillLevels = new NBTTagCompound();
// We only have 1 variables currently; save them to the new tag
SkillLevels.setInteger("WoodCutting", this.woodCuttingLevel);
/**
Now add our custom tag to the player's tag with a unique name (our property's name). This will allow you to save multiple types of properties and distinguish between them
If you only have one type, it isn't as important, but it will still avoid conflicts between your tag names and vanilla tag names. For instance, if you add some "Items" tag,
that will conflict with vanilla. Not good. So just use a unique tag name.
*/
compound.setTag(EXT_PROP_NAME, SkillLevels);
}
// Load whatever data you saved
@Override
public void loadNBTData(NBTTagCompound compound)
{
// Here we fetch the unique tag compound we set for this class of Extended Properties
NBTTagCompound SkillLevels = (NBTTagCompound) compound.getTag(EXT_PROP_NAME);
// Get our data from the custom tag compound
this.woodCuttingLevel = SkillLevels.getInteger("woodCuttingLevel");
// Just so you know it's working, add this line:
System.out.println("[TUT PROPS] WoodCuttingLevel from NBT: " + this.woodCuttingLevel);
}
/*
I personally have yet to find a use for this method. If you know of any,
please let me know and I'll add it in!
*/
@Override
public void init(Entity entity, World world)
{
}
/*
That's it for the IExtendedEntityProperties methods, but we need to add a few of our own in order to interact with our new variables. For now, let's make one method to consume mana and one to replenish it.
*/
public int getWoodCuttingLevel(){
return woodCuttingLevel;
}
public void WoodCuttingLevelUp(){
this.woodCuttingLevel++;
}
}
Class that edits values inside IEEP
public class WoodCutting{
public static int level;
private static int xp = 0;
private static IExtendedEntityProperties props;
private static ExtendedPlayer data;
public static void init(Entity player){
props = player.getExtendedProperties("PlayerSkillStats");
data = (ExtendedPlayer) player.getExtendedProperties(ExtendedPlayer.EXT_PROP_NAME);
level = data.getWoodCuttingLevel();
}
public static void giveXp(int amount){
xp += amount;
... I hate to say it, but you are really in need of some Java learning, specifically the meaning of the 'static' keyword. You are misusing and abusing the holy heck out of it, to say the least, and that is no doubt the cause of some of your issues.
Next, why do you store an IExtendedEntityProperties type? That's an interface, not a class, and I highly doubt you have any need of storing that type. You should only need YOUR implementation of said interface, i.e. ExtendedPlayer, and actually you generally do not want to be storing a reference to that anywhere.
When you need to access your properties, use the ExtendedPlayer.get(player) method to retrieve the correct instance, and go from there.
Hi, in the class Open Gui Packet, I am having a problem of what to replace TutorialMain.instance with:
@Override
public void handleServerSide(EntityPlayer player) {
// because we sent the gui's id with the packet, we can handle all cases with one line:
player.openGui(TutorialMain.instance, id, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
}
You replace it with your mod instance. If you don't know what that means, please look up a basic modding tutorial that covers setting up the main mod class.
I have come back with a little more knowledge on the subject. Thank you for making me aware of my overuse on the term static. I have fixed that and am now using classes as they should be used... Hopefully:)
I had one question about step 5 on the Extended Entity Properties Tutorial.
The whole section on persisting data through death is deprecated, and I haven't gotten around to updating it. You do not need saveProxyData or anything of that nature any more; instead, use PlayerEvent.Clone to copy your IEEP data from the old player instance to the new one.
IEEP data saves automatically whenever the player / parent entity saves its data - that's half the beauty of it. So no, you don't need to manually save or load data.
I thought so. When I reload my single player game, all the stats reset. I believe it is happening because the class is being instantiated again when it should check if the player has any nbttags. Would this be my best guess?
ill be home in a couple hours and will work on it.
Edit:
I am getting a null exception error when this bit of code is ran from my EventHandler class
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) {
PacketDispatcher.sendTo(new SyncPlayerPropsMessage((EntityPlayer) event.entity), ((EntityPlayerMP) event.entity));
}
}
Inside SyncPlayerPropsMessage Method
public SyncPlayerPropsMessage(EntityPlayer player) {
// create a new tag compound
data = new NBTTagCompound();
// and save our player's data into it
WoodCutting.get(player).saveNBTData(data);
}
Inside WoodCutting.get(EntityPlayer player)
public static final WoodCutting get(EntityPlayer player){
return (WoodCutting) player.getExtendedProperties(EXT_PROP_NAME);
}
Inside saveNBTData(NBTTagCompound)
public void saveNBTData(NBTTagCompound compound){
NBTTagCompound properties = new NBTTagCompound();
properties.setShort("level", (short) 1);
properties.setInteger("xp", 0);
compound.setTag(EXT_PROP_NAME, properties);
}
A ton of error messages
[06:44:22] [Netty Local Client IO #0/ERROR] [FML]: SimpleChannelHandlerWrapper exception
java.lang.NullPointerException
at MCA.Player.Skills.WoodCutting.get(WoodCutting.java:28) ~[WoodCutting.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:74) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:1) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.AbstractMessageHandler.onMessage(AbstractMessageHandler.java:54) ~[AbstractMessageHandler.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:377) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:244) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final]
at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
[06:44:22] [Netty Local Client IO #0/ERROR] [FML]: There was a critical exception handling a packet on channel gui
java.lang.NullPointerException
at MCA.Player.Skills.WoodCutting.get(WoodCutting.java:28) ~[WoodCutting.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:74) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:1) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.AbstractMessageHandler.onMessage(AbstractMessageHandler.java:54) ~[AbstractMessageHandler.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:377) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:244) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final]
at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleJoinGame(NetHandlerPlayClient.java:276) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S01PacketJoinGame.processPacket(S01PacketJoinGame.java:89) ~[S01PacketJoinGame.class:?]
at net.minecraft.network.play.server.S01PacketJoinGame.processPacket(S01PacketJoinGame.java:103) ~[S01PacketJoinGame.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleCustomPayload(NetHandlerPlayClient.java:1860) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S3FPacketCustomPayload.process(S3FPacketCustomPayload.java:64) ~[S3FPacketCustomPayload.class:?]
at net.minecraft.network.play.server.S3FPacketCustomPayload.processPacket(S3FPacketCustomPayload.java:78) ~[S3FPacketCustomPayload.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleServerDifficulty(NetHandlerPlayClient.java:1549) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S41PacketServerDifficulty.func_179829_a(S41PacketServerDifficulty.java:28) ~[S41PacketServerDifficulty.class:?]
at net.minecraft.network.play.server.S41PacketServerDifficulty.processPacket(S41PacketServerDifficulty.java:58) ~[S41PacketServerDifficulty.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleSpawnPosition(NetHandlerPlayClient.java:963) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S05PacketSpawnPosition.func_180752_a(S05PacketSpawnPosition.java:42) ~[S05PacketSpawnPosition.class:?]
at net.minecraft.network.play.server.S05PacketSpawnPosition.processPacket(S05PacketSpawnPosition.java:56) ~[S05PacketSpawnPosition.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handlePlayerAbilities(NetHandlerPlayClient.java:1674) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S39PacketPlayerAbilities.func_180742_a(S39PacketPlayerAbilities.java:82) ~[S39PacketPlayerAbilities.class:?]
at net.minecraft.network.play.server.S39PacketPlayerAbilities.processPacket(S39PacketPlayerAbilities.java:152) ~[S39PacketPlayerAbilities.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleHeldItemChange(NetHandlerPlayClient.java:600) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S09PacketHeldItemChange.func_180746_a(S09PacketHeldItemChange.java:41) ~[S09PacketHeldItemChange.class:?]
at net.minecraft.network.play.server.S09PacketHeldItemChange.processPacket(S09PacketHeldItemChange.java:55) ~[S09PacketHeldItemChange.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:23] [Server thread/INFO]: Player653 lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
[06:44:23] [Server thread/INFO]: Player653 left the game
[06:44:23] [Server thread/INFO]: Stopping singleplayer server as player logged out
[06:44:23] [Server thread/INFO]: Stopping server
[06:44:23] [Server thread/INFO]: Saving players
[06:44:23] [Server thread/INFO]: Saving worlds
[06:44:23] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[06:44:25] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[06:44:25] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[06:44:27] [Server thread/INFO] [FML]: Unloading dimension 0
[06:44:27] [Server thread/INFO] [FML]: Unloading dimension -1
[06:44:27] [Server thread/INFO] [FML]: Unloading dimension 1
[06:44:27] [Server thread/INFO] [FML]: Applying holder lookups
[06:44:27] [Server thread/INFO] [FML]: Holder lookups applied
Here is my entire WoodCutting class
public class WoodCutting implements IExtendedEntityProperties{
public final static String EXT_PROP_NAME = "WoodCutting";
private final EntityPlayer player;
private int xp;
private short level;
public void setLvl(short value){
this.level = value;
}
}
please understand that I will have many other skills, but am currently learning how to save such levels and xp with this testing code. I will rewrite and relearn much of this code in one class to store many other things as well. This is just a learning experience at the moment.
I just wanted to say that I am extremely grateful for your help and for helping many other people, as I am sure they are grateful too. You're helping me become what I am passionate of, and for that, I don't think I could ever repay you for how this is changing my life. If there is any way I could support you, please let me know.
Thank you for doing what you don't have to and let me know if I need to provide any other information.
Did you register your IEEP properties during EntityConstructing? That's the only reason I can think of that it would be null; that, or you are coding for 1.8 and didn't wait for the main thread to process your packet.
Did you register your IEEP properties during EntityConstructing? That's the only reason I can think of that it would be null; that, or you are coding for 1.8 and didn't wait for the main thread to process your packet.
I am coding for 1.8 and what you said makes total sense.
as I was debugging, everything worked just fine as I stepped through each line. If I let it run without debugging, it would crash.
How would I wait for the main thread to process my packet?
Rollback Post to RevisionRollBack
I complicate easy problems, come begging for help, and leave with a simple solution.
I was going to refer you to my packet tutorial, but since I haven't updated the main post to reflect what I actually use (which is better than the original approach I took), take a look at the demo on Github instead. It is basically doing what vanilla is doing, and I have that as the default for all of my packets since 90% of the time you are going to want your packet to process in sync with the rest of the world, and that other 10% of the time it doesn't really hurt anything to wait for the main thread.
Thank you! That seemed to fix the crash. However, I am still not able to load my player's skill level and xp, or even find the player's data.
I've walked through most of the code while debugging finding that every time I load the game, WoodCutting.get((EntityPlayer) event.entity) is always null.
The first time, event.entity is equal to 81. So it registers with that number. The second time I load it, that number is the same, but WoodCutting.get((EntityPlayer) event.entity) is still null.
Rollback Post to RevisionRollBack
I complicate easy problems, come begging for help, and leave with a simple solution.
WoodCutting.get(player) will ALWAYS be null the first time you load the game because the properties haven't been registered until the entity is constructed, provided you register the properties during EntityConstructingEvent. Check that you actually register your properties.
Thanks for all of that information! Turns out that I was using older variables/placeholders for storing what level or xp I was. So it would always store level 1 and 0 xp XD
Silly mistakes by me.
Everything is working well now all thanks to you. I appreciate all the help you've given me as well as everything you have taught me.
Oh lol thank you very much for your fast reply and for solving my problem i think you are doing on of the best tutorials out there for modding keep it up
if(inflictor instanceof EntityPlayerMP)
System.out.println("catch attack event. mp fires this event. Now mp strength is "+playerSt.getCurrent());
if (inflictor instanceof EntityPlayerMP)
System.out.println("catch attack event. sp fires this event. Now sp strength is " +playerSt.getCurrent());
if(player.getHeldItem()!=null)
{
//TODO make this '20' and '10' dynamic
if(playerSt.getCurrent() <= 20 )
{
Yes, IEEP is saved whenever Minecraft naturally saves player / entity NBT, which is both when Minecraft closes, and every 5 minutes or so (I think). At any rate, it is more than sufficient to ensure your data is saved.
Custom packets are NEVER handled by Minecraft - if you have a custom packet, it is up to you to send, receive, and process it.
Some things are automatically synchronized to the client side, though, so you don't need any packet. These include things like ItemStack NBT, player health, current item, etc. I'm not 100% sure about XP, but I bet it is also automatically synchronized to the client.
Just remember that synchronization can only happen if you make the changes on the server.
I've managed to edit values inside of my IEEP, but it doesn't save when I save and quit the game.
IEEP class
public class ExtendedPlayer implements IExtendedEntityProperties
{
/*
Here I create a constant EXT_PROP_NAME for this class of properties. You need a unique name for every instance of IExtendedEntityProperties you make, and doing it at the top of each class as a constant makes
it very easy to organize and avoid typos. It's easiest to keep the same constant name in every class, as it will be distinguished by the class name: ExtendedPlayer.EXT_PROP_NAME vs. ExtendedEntity.EXT_PROP_NAME
Note that a single entity can have multiple extended properties, so each property should have a unique name. Try to come up with something more unique than the tutorial example.
*/
public final static String EXT_PROP_NAME = "PlayerSkillStats";
// I always include the entity to which the properties belong for easy access
// It's final because we won't be changing which player it is
private final EntityPlayer player;
// Declare other variables you want to add here
private int woodCuttingLevel;
/*
The default constructor takes no arguments, but I put in the Entity so I can initialize the above variable 'player'
Also, it's best to initialize any other variables you may have added, just like in any constructor.
*/
public ExtendedPlayer(EntityPlayer player)
{
this.player = player;
// Start with Level 1
this.woodCuttingLevel = 1;
}
/**
* Used to register these extended properties for the player during EntityConstructing event
* This method is for convenience only; it will make your code look nicer
*/
public static final void register(EntityPlayer player)
{
player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player));
}
/**
* Returns ExtendedPlayer properties for player
* This method is for convenience only; it will make your code look nicer
*/
public static final ExtendedPlayer get(EntityPlayer player)
{
return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME);
}
// Save any custom data that needs saving here
@Override
public void saveNBTData(NBTTagCompound compound)
{
// We need to create a new tag compound that will save everything for our Extended Properties
NBTTagCompound SkillLevels = new NBTTagCompound();
// We only have 1 variables currently; save them to the new tag
SkillLevels.setInteger("WoodCutting", this.woodCuttingLevel);
/**
Now add our custom tag to the player's tag with a unique name (our property's name). This will allow you to save multiple types of properties and distinguish between them
If you only have one type, it isn't as important, but it will still avoid conflicts between your tag names and vanilla tag names. For instance, if you add some "Items" tag,
that will conflict with vanilla. Not good. So just use a unique tag name.
*/
compound.setTag(EXT_PROP_NAME, SkillLevels);
}
// Load whatever data you saved
@Override
public void loadNBTData(NBTTagCompound compound)
{
// Here we fetch the unique tag compound we set for this class of Extended Properties
NBTTagCompound SkillLevels = (NBTTagCompound) compound.getTag(EXT_PROP_NAME);
// Get our data from the custom tag compound
this.woodCuttingLevel = SkillLevels.getInteger("woodCuttingLevel");
// Just so you know it's working, add this line:
System.out.println("[TUT PROPS] WoodCuttingLevel from NBT: " + this.woodCuttingLevel);
}
/*
I personally have yet to find a use for this method. If you know of any,
please let me know and I'll add it in!
*/
@Override
public void init(Entity entity, World world)
{
}
/*
That's it for the IExtendedEntityProperties methods, but we need to add a few of our own in order to interact with our new variables. For now, let's make one method to consume mana and one to replenish it.
*/
public int getWoodCuttingLevel(){
return woodCuttingLevel;
}
public void WoodCuttingLevelUp(){
this.woodCuttingLevel++;
}
}
Class that edits values inside IEEP
public class WoodCutting{
public static int level;
private static int xp = 0;
private static IExtendedEntityProperties props;
private static ExtendedPlayer data;
public static void init(Entity player){
props = player.getExtendedProperties("PlayerSkillStats");
data = (ExtendedPlayer) player.getExtendedProperties(ExtendedPlayer.EXT_PROP_NAME);
level = data.getWoodCuttingLevel();
}
public static void giveXp(int amount){
xp += amount;
while(Experience.RequiredXp(level, xp)){
data.WoodCuttingLevelUp();
level = data.getWoodCuttingLevel();
}
}
}
Thanks for helping out a noob like me!
I complicate easy problems, come begging for help, and leave with a simple solution.
... I hate to say it, but you are really in need of some Java learning, specifically the meaning of the 'static' keyword. You are misusing and abusing the holy heck out of it, to say the least, and that is no doubt the cause of some of your issues.
Next, why do you store an IExtendedEntityProperties type? That's an interface, not a class, and I highly doubt you have any need of storing that type. You should only need YOUR implementation of said interface, i.e. ExtendedPlayer, and actually you generally do not want to be storing a reference to that anywhere.
When you need to access your properties, use the ExtendedPlayer.get(player) method to retrieve the correct instance, and go from there.
Hi, in the class Open Gui Packet, I am having a problem of what to replace TutorialMain.instance with:
@Override
public void handleServerSide(EntityPlayer player) {
// because we sent the gui's id with the packet, we can handle all cases with one line:
player.openGui(TutorialMain.instance, id, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
}
Help?
You replace it with your mod instance. If you don't know what that means, please look up a basic modding tutorial that covers setting up the main mod class.
I have come back with a little more knowledge on the subject. Thank you for making me aware of my overuse on the term static. I have fixed that and am now using classes as they should be used... Hopefully:)
I had one question about step 5 on the Extended Entity Properties Tutorial.
Your code
I have no method saveProxyData and am not finding it anywhere.
Did I miss something?
I'm coding for Minecraft 1.8
Thanks for all the help so far!
I complicate easy problems, come begging for help, and leave with a simple solution.
The whole section on persisting data through death is deprecated, and I haven't gotten around to updating it. You do not need saveProxyData or anything of that nature any more; instead, use PlayerEvent.Clone to copy your IEEP data from the old player instance to the new one.
See here for more information.
Worked like charm! Each player has their own set of experience and levels!
Is this data suppose to save when the player quits and rejoins the server. Do I have to manually tell it to save?
Thanks again!
I complicate easy problems, come begging for help, and leave with a simple solution.
IEEP data saves automatically whenever the player / parent entity saves its data - that's half the beauty of it. So no, you don't need to manually save or load data.
I thought so. When I reload my single player game, all the stats reset. I believe it is happening because the class is being instantiated again when it should check if the player has any nbttags. Would this be my best guess?
ill be home in a couple hours and will work on it.
Edit:
I am getting a null exception error when this bit of code is ran from my EventHandler class
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer) {
PacketDispatcher.sendTo(new SyncPlayerPropsMessage((EntityPlayer) event.entity), ((EntityPlayerMP) event.entity));
}
}
Inside SyncPlayerPropsMessage Method
public SyncPlayerPropsMessage(EntityPlayer player) {
// create a new tag compound
data = new NBTTagCompound();
// and save our player's data into it
WoodCutting.get(player).saveNBTData(data);
}
Inside WoodCutting.get(EntityPlayer player)
public static final WoodCutting get(EntityPlayer player){
return (WoodCutting) player.getExtendedProperties(EXT_PROP_NAME);
}
Inside saveNBTData(NBTTagCompound)
public void saveNBTData(NBTTagCompound compound){
NBTTagCompound properties = new NBTTagCompound();
properties.setShort("level", (short) 1);
properties.setInteger("xp", 0);
compound.setTag(EXT_PROP_NAME, properties);
}
A ton of error messages
[06:44:22] [Netty Local Client IO #0/ERROR] [FML]: SimpleChannelHandlerWrapper exception
java.lang.NullPointerException
at MCA.Player.Skills.WoodCutting.get(WoodCutting.java:28) ~[WoodCutting.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:74) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:1) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.AbstractMessageHandler.onMessage(AbstractMessageHandler.java:54) ~[AbstractMessageHandler.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:377) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:244) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final]
at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
[06:44:22] [Netty Local Client IO #0/ERROR] [FML]: There was a critical exception handling a packet on channel gui
java.lang.NullPointerException
at MCA.Player.Skills.WoodCutting.get(WoodCutting.java:28) ~[WoodCutting.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:74) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.client.SyncPlayerPropsMessage$Handler.handleClientMessage(SyncPlayerPropsMessage.java:1) ~[SyncPlayerPropsMessage$Handler.class:?]
at MCA.network.packet.AbstractMessageHandler.onMessage(AbstractMessageHandler.java:54) ~[AbstractMessageHandler.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) ~[SimpleChannelHandlerWrapper.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) ~[SimpleChannelHandlerWrapper.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) ~[SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:4.0.15.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:377) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:244) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:50) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [SimpleChannelInboundHandler.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final]
at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final]
at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleJoinGame(NetHandlerPlayClient.java:276) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S01PacketJoinGame.processPacket(S01PacketJoinGame.java:89) ~[S01PacketJoinGame.class:?]
at net.minecraft.network.play.server.S01PacketJoinGame.processPacket(S01PacketJoinGame.java:103) ~[S01PacketJoinGame.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleCustomPayload(NetHandlerPlayClient.java:1860) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S3FPacketCustomPayload.process(S3FPacketCustomPayload.java:64) ~[S3FPacketCustomPayload.class:?]
at net.minecraft.network.play.server.S3FPacketCustomPayload.processPacket(S3FPacketCustomPayload.java:78) ~[S3FPacketCustomPayload.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleServerDifficulty(NetHandlerPlayClient.java:1549) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S41PacketServerDifficulty.func_179829_a(S41PacketServerDifficulty.java:28) ~[S41PacketServerDifficulty.class:?]
at net.minecraft.network.play.server.S41PacketServerDifficulty.processPacket(S41PacketServerDifficulty.java:58) ~[S41PacketServerDifficulty.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleSpawnPosition(NetHandlerPlayClient.java:963) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S05PacketSpawnPosition.func_180752_a(S05PacketSpawnPosition.java:42) ~[S05PacketSpawnPosition.class:?]
at net.minecraft.network.play.server.S05PacketSpawnPosition.processPacket(S05PacketSpawnPosition.java:56) ~[S05PacketSpawnPosition.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handlePlayerAbilities(NetHandlerPlayClient.java:1674) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S39PacketPlayerAbilities.func_180742_a(S39PacketPlayerAbilities.java:82) ~[S39PacketPlayerAbilities.class:?]
at net.minecraft.network.play.server.S39PacketPlayerAbilities.processPacket(S39PacketPlayerAbilities.java:152) ~[S39PacketPlayerAbilities.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:22] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.handleHeldItemChange(NetHandlerPlayClient.java:600) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S09PacketHeldItemChange.func_180746_a(S09PacketHeldItemChange.java:41) ~[S09PacketHeldItemChange.class:?]
at net.minecraft.network.play.server.S09PacketHeldItemChange.processPacket(S09PacketHeldItemChange.java:55) ~[S09PacketHeldItemChange.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
... 11 more
[06:44:23] [Server thread/INFO]: Player653 lost connection: TextComponent{text='Disconnected', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
[06:44:23] [Server thread/INFO]: Player653 left the game
[06:44:23] [Server thread/INFO]: Stopping singleplayer server as player logged out
[06:44:23] [Server thread/INFO]: Stopping server
[06:44:23] [Server thread/INFO]: Saving players
[06:44:23] [Server thread/INFO]: Saving worlds
[06:44:23] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[06:44:25] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[06:44:25] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[06:44:27] [Server thread/INFO] [FML]: Unloading dimension 0
[06:44:27] [Server thread/INFO] [FML]: Unloading dimension -1
[06:44:27] [Server thread/INFO] [FML]: Unloading dimension 1
[06:44:27] [Server thread/INFO] [FML]: Applying holder lookups
[06:44:27] [Server thread/INFO] [FML]: Holder lookups applied
Here is my entire WoodCutting class
public class WoodCutting implements IExtendedEntityProperties{
public final static String EXT_PROP_NAME = "WoodCutting";
private final EntityPlayer player;
private int xp;
private short level;
public WoodCutting(EntityPlayer player){
this.player = player;
this.level = 1;
this.xp = 0;
}
public static final void register(EntityPlayer player){
player.registerExtendedProperties(WoodCutting.EXT_PROP_NAME, new WoodCutting(player));
}
public static final WoodCutting get(EntityPlayer player){
return (WoodCutting) player.getExtendedProperties(EXT_PROP_NAME);
}
public void copy(WoodCutting props){
xp = props.xp;
level = props.level;
}
public void onUpdate(){
}
@Override
public void saveNBTData(NBTTagCompound compound){
NBTTagCompound properties = new NBTTagCompound();
properties.setShort("level", (short) 1);
properties.setInteger("xp", 0);
compound.setTag(EXT_PROP_NAME, properties);
}
@Override
public void loadNBTData(NBTTagCompound compound) {
NBTTagCompound properties = (NBTTagCompound) compound.getTag(EXT_PROP_NAME);
this.level = properties.getShort("level");
this.xp = properties.getInteger("xp");
}
@Override
public void init(Entity entity, World world) {
// TODO Auto-generated method stub
}
public void addXp(int amount){
this.xp += amount;
}
public void giveXp(int amount, EntityPlayer player){
addXp(amount);
while(Experience.RequiredXp(this.level, this.xp)){
this.level++;
CustomMessage.SendPlayerLevelUpMessage(level, "WoodCutting", player);
}
}
public short getLvl(){
return this.level;
}
public int getXp(){
return this.xp;
}
public void setLvl(short value){
this.level = value;
}
}
please understand that I will have many other skills, but am currently learning how to save such levels and xp with this testing code. I will rewrite and relearn much of this code in one class to store many other things as well. This is just a learning experience at the moment.
I just wanted to say that I am extremely grateful for your help and for helping many other people, as I am sure they are grateful too. You're helping me become what I am passionate of, and for that, I don't think I could ever repay you for how this is changing my life. If there is any way I could support you, please let me know.
Thank you for doing what you don't have to and let me know if I need to provide any other information.
I complicate easy problems, come begging for help, and leave with a simple solution.
Did you register your IEEP properties during EntityConstructing? That's the only reason I can think of that it would be null; that, or you are coding for 1.8 and didn't wait for the main thread to process your packet.
I am coding for 1.8 and what you said makes total sense.
as I was debugging, everything worked just fine as I stepped through each line. If I let it run without debugging, it would crash.
How would I wait for the main thread to process my packet?
I complicate easy problems, come begging for help, and leave with a simple solution.
I was going to refer you to my packet tutorial, but since I haven't updated the main post to reflect what I actually use (which is better than the original approach I took), take a look at the demo on Github instead. It is basically doing what vanilla is doing, and I have that as the default for all of my packets since 90% of the time you are going to want your packet to process in sync with the rest of the world, and that other 10% of the time it doesn't really hurt anything to wait for the main thread.
Thank you! That seemed to fix the crash. However, I am still not able to load my player's skill level and xp, or even find the player's data.
I've walked through most of the code while debugging finding that every time I load the game, WoodCutting.get((EntityPlayer) event.entity) is always null.
The first time, event.entity is equal to 81. So it registers with that number. The second time I load it, that number is the same, but WoodCutting.get((EntityPlayer) event.entity) is still null.
I complicate easy problems, come begging for help, and leave with a simple solution.
WoodCutting.get(player) will ALWAYS be null the first time you load the game because the properties haven't been registered until the entity is constructed, provided you register the properties during EntityConstructingEvent. Check that you actually register your properties.
Thanks for all of that information! Turns out that I was using older variables/placeholders for storing what level or xp I was. So it would always store level 1 and 0 xp XD
Silly mistakes by me.
Everything is working well now all thanks to you. I appreciate all the help you've given me as well as everything you have taught me.
HAPPY CODING!:)
I complicate easy problems, come begging for help, and leave with a simple solution.
So my ExtendedPlayerProperties wont work either ... it does work but when i reset the game then its doing weard stuff ...
registering entity properties in enittyContrusting event :
@SubscribeEvent
public void onEntityConstructing(EntityConstructing event) {
if (event.entity instanceof EntityPlayer && PlayerClassHandler.get((EntityPlayer) event.entity) == null)
PlayerClassHandler.register((EntityPlayer) event.entity);
if (event.entity instanceof EntityPlayer && event.entity.getExtendedProperties(PlayerClassHandler.Name) == null)
event.entity.registerExtendedProperties(PlayerClassHandler.getPropertyName(), new PlayerClassHandler((EntityPlayer) event.entity));
}
+ my playerclasshandler
package cz.grossik.projektwow.handler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
/**
@Author KakesRevenge
*/
public class PlayerClassHandler implements IExtendedEntityProperties {
public static final int Unset = 10;
public static final int Warrior = 20;
public static final int Thief = 30;
public static final int Wizard = 40;
public int CurrentClass;
private final EntityPlayer player;
public final static String Name = "PlayerClass";
public PlayerClassHandler(EntityPlayer player) {
this.player = player;
this.CurrentClass = Unset;
}
@Override
public void saveNBTData(NBTTagCompound compound) {
NBTTagCompound playerclass = new NBTTagCompound();
playerclass.setInteger("CurrentPlayerClass", this.CurrentClass);
compound.setTag(Name, playerclass);
}
@Override
public void loadNBTData(NBTTagCompound compound) {
NBTTagCompound properties = (NBTTagCompound) compound.getTag(Name);
CurrentClass = properties.getInteger("CurrentClass");
}
@Override
public void init(Entity entity, World world) {
}
public static final PlayerClassHandler get(EntityPlayer player) {
return (PlayerClassHandler) player.getExtendedProperties(Name);
}
public static String getPropertyName() {
return Name;
}
public static final void register(EntityPlayer player) {
player.registerExtendedProperties(Name, new PlayerClassHandler(player));
}
public int getPlayerClass () {
return CurrentClass;
}
}
Oh lol thank you very much for your fast reply and for solving my problem i think you are doing on of the best tutorials out there for modding keep it up
PS: Sorry for my english
I'm still a little bit confused about the mechanic of the dataWatcher.
I have these code
It works for the single player. I write the gui part as this tutorial has.
I print the string on screen by
The string on screen show the correct value of the prop. But when I get the prop value in my attack event:
It just doesn't work. Both sp and mp get 0 value..... I don't know why....
Here is a part of console:
[19:09:38] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:39] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:39] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:39] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:39] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:39] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:40] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:40] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:41] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:41] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:42] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:42] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:42] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:42] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:42] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:43] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:43] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:43] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:43] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:43] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:44] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:44] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:44] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:44] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:44] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:45] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:45] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:45] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:45] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:46] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:46] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:47] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:47] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:47] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:47] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:47] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:48] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:48] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:49] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:49] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:49] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:49] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:49] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:50] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:50] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:50] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:50] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:50] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:51] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:51] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:132]: catch attack event. mp fires this event. Now mp strength is 0
[19:09:51] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:134]: catch attack event. sp fires this event. Now sp strength is 0
[19:09:51] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:attackEvent:155]: canceled lower than 10 (0
[19:09:51] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5
[19:09:52] [Server thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:196]: try to recover 10
[19:09:52] [Client thread/INFO] [STDOUT]: [net.ci010.attributesmod.handler.CommonHandler:LivingUpdate:202]: try to recover 5