
Kwibble
Forge Modder-
Posts
340 -
Joined
-
Last visited
Everything posted by Kwibble
-
Oh - I derped so bad. I had an event that was setting it to null accidentally... Thanks for the help delpi!
-
I have already tried that. When I log off and back on, the item has been set to null again. Also, that saves an ITEMSTACK - I just want to save an item... Here is the code: package com.kwibble.dendri.entity.player; import com.kwibble.dendri.item.ItemDendrikBelt; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import com.kwibble.dendri.ModDendri; public class PlayerInformation implements IExtendedEntityProperties { public static final String IDENTIFIER = ModDendri.MODID + "_playerProperties"; private static final String IS_OVERLAY_MINIMIZED_IDENTIFIER = IDENTIFIER + "_isOverlayMinimized"; private static final String CURRENT_DENDRIK_BELT_IDENTIFIER = IDENTIFIER + "_currentDendrikbelt"; public static PlayerInformation forPlayer(Entity player) { return (PlayerInformation) player.getExtendedProperties(IDENTIFIER); } private EntityPlayer player; private ItemStack currentDendrikBelt; private boolean isOverlayMinimized; public PlayerInformation(EntityPlayer player) { this.player = player; } @Override public void init(Entity entity, World world) { } @Override public void saveNBTData(NBTTagCompound compound) { System.out.println("Saving NBT Data:"); compound.setBoolean(IS_OVERLAY_MINIMIZED_IDENTIFIER, this.isOverlayMinimized); System.out.println("Saved isOverlayMinimized with value of: " + this.isOverlayMinimized); if (this.currentDendrikBelt != null) { compound.setTag(CURRENT_DENDRIK_BELT_IDENTIFIER, this.currentDendrikBelt.writeToNBT(new NBTTagCompound())); System.out.println("Saved currentDendrikbelt with value of: " + this.currentDendrikBelt); } System.out.println("NBT Data Saved"); } @Override public void loadNBTData(NBTTagCompound compound) { System.out.println("Loading NBT Data:"); this.isOverlayMinimized = compound.getBoolean(IS_OVERLAY_MINIMIZED_IDENTIFIER); System.out.println("Loaded isOverlayMinimized with value of: " + this.isOverlayMinimized); this.currentDendrikBelt = ItemStack.loadItemStackFromNBT(compound.getCompoundTag(CURRENT_DENDRIK_BELT_IDENTIFIER)); System.out.println("Loaded currentDendrikBelt with value of: " + this.currentDendrikBelt); System.out.println("Loaded NBT Data"); } public void setCurrentDendrikBelt(Item belt) { if (belt instanceof ItemDendrikBelt) this.currentDendrikBelt = new ItemStack(belt); else System.out.println("A Dendrik Belt was not passed in"); } public Item getCurrentDendrikBelt() { return this.currentDendrikBelt != null ? this.currentDendrikBelt.getItem() : new ItemStack(Blocks.stone).getItem(); } public void setIsOverlayMinimized(boolean isOverlayMinimized) { this.isOverlayMinimized = isOverlayMinimized; } public boolean getIsOverlayMinimized() { return this.isOverlayMinimized; } } Thanks delpi
-
I have an Item in an IExtendedEntityProperties that I want to save into the NBT.... how would I go about doing this? I have absolutely no clue what so ever on how to do this, so all help is appreciated.
-
You could always use GL11.glDisable(GL11.GL_LIGHTING); before your drawing and GL11.glEnable(GL11.GL_LIGHTING); after. This would help you figure out if your textures are there or not.
-
[1.7.2] IIconRegistry Seems to Not be Working as Intended
Kwibble replied to Malkuthe's topic in Modder Support
@diesieben07 I have already sorted this out with him. I have helped him find his errors A) he wasn't registering his items via GameRegistry.registerItem() and he was getting weird crashes because of it. And other things besides. But its all good now -
Bind one texture at a time as you need it... Not all at once. (that is what I got from that) Also, it's: new ResourceLocation("modid", "textures/blocks/block_front.png") That could well solve your problem.
-
Like I said... bind textures via minecraftInstance.getTextureManager().bindTexture(resourcelocation);
-
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
Wow... Thanks. I feel a little... low on brain cells after that -
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
Oh, okay. Still a little confused, but good to go! Also... Noob gradle man is me. I know you can update forge without destroying ones workspace, but how do you do it??? -
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
Oops, forgot to supply my IMessage + IMessageHandler and registry... Here it is: IMessage/IMessageHandler: package com.kwibble.dendri.network.message; import com.kwibble.dendri.entity.player.PlayerInformation; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; /** * Created by 102676 on 18/06/14. */ public class MessagePlayerInfo implements IMessage { private boolean isOverlayMinimized; public MessagePlayerInfo(){} public MessagePlayerInfo(PlayerInformation playerinfo) { this.isOverlayMinimized = playerinfo.getIsOverlayMinimized(); } @Override public void fromBytes(ByteBuf buf) { this.isOverlayMinimized = buf.readBoolean(); } @Override public void toBytes(ByteBuf buf) { buf.writeBoolean(this.isOverlayMinimized); } public static class Handler implements IMessageHandler<MessagePlayerInfo, IMessage> { @Override public IMessage onMessage(MessagePlayerInfo message, MessageContext ctx) { System.out.println("Test recieve: " + message.isOverlayMinimized); return null; } } } DendriNetwork: package com.kwibble.dendri.network; import com.kwibble.dendri.ModDendri; import com.kwibble.dendri.network.message.MessagePlayerInfo; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; /** * Created by 102676 on 19/06/14. */ public class DendriNetwork { private static final String CHANNEL_NAME = ModDendri.MODID; public static SimpleNetworkWrapper dendriNetwork; public static void registerNetwork() { dendriNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(CHANNEL_NAME); dendriNetwork.registerMessage(MessagePlayerInfo.class, MessagePlayerInfo.class, 0, Side.CLIENT); } } And in my main mod, in the preInit method, I call DendriNetwork.registerNetwork() -
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
Also... I am trying to register a testing packet, and it isn't working and throwing this error: java.lang.IllegalStateException: cannot determine the type of the type parameter 'REQ': class cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper at io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171) ~[TypeParameterMatcher.class:?] at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165) ~[TypeParameterMatcher.class:?] at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93) ~[TypeParameterMatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60) ~[simpleChannelInboundHandler.class:?] at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50) ~[simpleChannelInboundHandler.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17) ~[simpleChannelHandlerWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85) ~[simpleNetworkWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addClientHandlerAfter(SimpleNetworkWrapper.java:79) ~[simpleNetworkWrapper.class:?] at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:67) ~[simpleNetworkWrapper.class:?] at com.kwibble.dendri.network.DendriNetwork.registerNetwork(DendriNetwork.java:22) ~[DendriNetwork.class:?] at com.kwibble.dendri.ModDendri.preInit(ModDendri.java:31) ~[ModDendri.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[?:1.6.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[?:1.6.0_65] at java.lang.reflect.Method.invoke(Method.java:597) ~[?:1.6.0_65] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[?:1.6.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[?:1.6.0_65] at java.lang.reflect.Method.invoke(Method.java:597) ~[?:1.6.0_65] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) ~[LoadController.class:?] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) ~[LoadController.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[?:1.6.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[?:1.6.0_65] at java.lang.reflect.Method.invoke(Method.java:597) ~[?:1.6.0_65] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?] at cpw.mods.fml.common.Loader.loadMods(Loader.java:500) [Loader.class:?] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:202) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:520) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:890) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[?:1.6.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[?:1.6.0_65] at java.lang.reflect.Method.invoke(Method.java:597) ~[?:1.6.0_65] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] ---- Minecraft Crash Report ---- // I just don't know what went wrong Time: 6/19/14 7:22 AM Description: Initializing game java.lang.IllegalStateException: cannot determine the type of the type parameter 'REQ': class cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper at io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171) at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165) at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50) at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addClientHandlerAfter(SimpleNetworkWrapper.java:79) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:67) at com.kwibble.dendri.network.DendriNetwork.registerNetwork(DendriNetwork.java:22) at com.kwibble.dendri.ModDendri.preInit(ModDendri.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at cpw.mods.fml.common.Loader.loadMods(Loader.java:500) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:202) at net.minecraft.client.Minecraft.startGame(Minecraft.java:520) at net.minecraft.client.Minecraft.run(Minecraft.java:890) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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 io.netty.util.internal.TypeParameterMatcher.fail(TypeParameterMatcher.java:171) at io.netty.util.internal.TypeParameterMatcher.find0(TypeParameterMatcher.java:165) at io.netty.util.internal.TypeParameterMatcher.find(TypeParameterMatcher.java:93) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:60) at io.netty.channel.SimpleChannelInboundHandler.<init>(SimpleChannelInboundHandler.java:50) at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.<init>(SimpleChannelHandlerWrapper.java:17) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.getHandlerWrapper(SimpleNetworkWrapper.java:85) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.addClientHandlerAfter(SimpleNetworkWrapper.java:79) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:67) at com.kwibble.dendri.network.DendriNetwork.registerNetwork(DendriNetwork.java:22) at com.kwibble.dendri.ModDendri.preInit(ModDendri.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at cpw.mods.fml.common.Loader.loadMods(Loader.java:500) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:202) at net.minecraft.client.Minecraft.startGame(Minecraft.java:520) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:890) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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: Mac OS X (x86_64) version 10.8.5 Java Version: 1.6.0_65, Apple Inc. Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Apple Inc. Memory: 921977528 bytes (879 MB) / 1065025536 bytes (1015 MB) up to 1065025536 bytes (1015 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.01-pre FML v7.2.156.1060 Minecraft Forge 10.12.1.1060 4 mods loaded, 4 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.2.156.1060} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized Forge{10.12.1.1060} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized dendri{1.7.2_0.1} [Dendri] (Dendri) Unloaded->Constructed->Errored Launched Version: 1.7 LWJGL: 2.9.1 OpenGL: Intel HD Graphics 4000 OpenGL Engine GL version 2.1 INTEL-8.16.74, Intel Inc. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: ~~ERROR~~ NullPointerException: null Anisotropic Filtering: Off (1) #@!@# Game crashed! Crash report saved to: #@!@# /Volumes/Data/Users/102676/Developer/IDEA/MinecraftModding/MCMOD/./crash-reports/crash-2014-06-19_07.22.09-client.txt -
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
Okay, thanks. The "anti-hacking" packet makes sense, but I am not sure how to go about it. Could you steer me in the right direction please? -
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
That makes sense. But what if I have say a GUI that updates something in the IExtendedEntityPrroperties? Do I have to create a nee IMessage to sync the data to the server? -
Packet Handling - How to send an item with IMessage classes (packets)
Kwibble replied to Kwibble's topic in Modder Support
So I have solved question one. I discovered that using ByteBufUtils you can send an ItemStack. That was easier than I thought it would be. Question 2 still stands though. -
1. Is it possible to send an item via a message (I am following the SimpleNetworkWrapper tutorial by diesieben07)? If so, how would one do it? 2. If I want to have a bit of information (not a bit bit, just a small amount of information) that I want to be synced, how do I go about this? I have an IExtendedEntityProperties that has stuff I want synced for me, but I am not entirely sure how to go about it. For reference, here is my PlayerInformation class: package com.kwibble.dendri.entity.player; import com.kwibble.dendri.item.ItemDendrikBelt; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import com.kwibble.dendri.ModDendri; import com.kwibble.dendri.item.ItemDendri; public class PlayerInformation implements IExtendedEntityProperties { public static final String IDENTIFIER = ModDendri.MODID + "_playerProperties"; private static final String IS_OVERLAY_MINIMIZED_IDENTIFIER = IDENTIFIER + "_isOverlayMinimized"; public static PlayerInformation forPlayer(Entity player) { return (PlayerInformation) player.getExtendedProperties(IDENTIFIER); } private EntityPlayer player; private ItemDendrikBelt currentDendrikBelt; private boolean isOverlayMinimized; public PlayerInformation(EntityPlayer player) { this.player = player; } @Override public void init(Entity entity, World world) { } @Override public void saveNBTData(NBTTagCompound compound) { System.out.println("Saving NBT Data:"); compound.setBoolean(IS_OVERLAY_MINIMIZED_IDENTIFIER, this.isOverlayMinimized); System.out.println("Saved isOverlayMinimized with value of: " + this.isOverlayMinimized); System.out.println("NBT Data Saved"); } @Override public void loadNBTData(NBTTagCompound compound) { System.out.println("Loading NBT Data:"); this.isOverlayMinimized = compound.getBoolean(IS_OVERLAY_MINIMIZED_IDENTIFIER); System.out.println("Loaded isOverlayMinimized with value of: " + this.isOverlayMinimized); System.out.println("Loaded NBT Data"); } public void setCurrentDendrikBelt(ItemDendri belt) { if (belt instanceof ItemDendrikBelt) this.currentDendrikBelt = (ItemDendrikBelt) belt; else System.out.println("A Dendrik Belt was not passed in"); } public ItemDendrikBelt getCurrentDendrikBelt() { return this.currentDendrikBelt; } public void setIsOverlayMinimized(boolean isOverlayMinimized) { this.isOverlayMinimized = isOverlayMinimized; } public boolean getIsOverlayMinimized() { return this.isOverlayMinimized; } } [EDIT] Now I know that I need an IMessage, and I have that. It's more a question of do I need a packet for sending from the server to the client, and another from the client to the server? Or can it be done in one IMessage/ImessageHandler.
-
Forge isn't really an API per-se. The only real API stuff is the Registries (GameRegistry, NetworkRegistry etc.), and the Event Buses (MinecraftForge.EVENT_BUS, FMLCommonHandler.instance().bus() [i think]). Aside from that... Javadocs mainly, that's what we use. And just guessing by what things are named... But that can lead to interesting results sometimes
-
Well... Funny you should ask that. There isn't really that much documentation sorry. There is some great Forge documentation, but then again... You'll have to keep searching for good in-depth stuff.
-
Try looking up ScratchForFun on youtube. He has some great tutorials for 1.7.x (as well as a very cool accent). Then there is also TheGrovesyProject101, another very good *tutorialer*
-
uhh... What? You set your showTail variable to false, then call setShowTail(true). What is this supposed to achieve? You managed to make it sound redundant.
-
Please, if you are posting code, put it inside code tags [ code ] and [/ code ] (NOTE: do not use spaces) example: public void doNothing() { // What? You were expecting something? } Also, please use the spoiler [ spoiler ] and [/ spoiler ] (NOTE: also with no spaces) for your crash reports. It just makes things A LOT easier to read.
-
Oh most definitely call super. If you don't call super, the entity's position and rotation and those sorts of things aren't saved
-
They are very simply called, and they readFromNBT and writeToNBT with an NBTTagCompound as the parameter
-
A) umm... Why are you using a method called getMaxHealth() when it is clearly acting as the current health?
-
Try using the other read/write nbt methods. Those two you are using are documented as being used to load *sub* classes of the entity.
-
How can I change a hardcoded number (noob here)
Kwibble replied to Greenhound's topic in Modder Support
Reflection could also be used (I think). Don't ask me how, but you could. It all depends on how often you are wanting to access that one variable.