-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
[SOLVED][1.7.10] Detect if event.entity is mc.thePlayer?
Ernio replied to Ernio's topic in Modder Support
Okay so this is kinda second thread after: http://www.minecraftforge.net/forum/index.php/topic,26990.0.html Which I marked as solved since I found a way to do what I want. If you would read thread above you would see the problem - server doesn't know if the client-side EntityPlayer has been constructed yet, and sending any kind of packet that would update client-side IEEP will result in that packet being not received. To overcome this I had to create client-side request packet that requests player data just after its constructed on client (server always constructs it 1st) and the send data from server. This way I don't have to check anything every tick (which saves some "power"). Basically next problem (this thread) was to not send request from every connected client and then send data to all client from server, but to send one packet from client that actualy is "himself" and then handle rest on server (some of that data is private and only accessible by this certain player, rest shouldn't know about it). This code seems to be working: @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer) { System.out.println("CONSTRUCTING"); if (ExtendedPlayer.get((EntityPlayer) event.entity) == null) ExtendedPlayer.register((EntityPlayer) event.entity); Side side = FMLCommonHandler.instance().getEffectiveSide(); if (side == Side.CLIENT) if ((EntityPlayer) event.entity instanceof EntityPlayerSP) { System.out.println("BAM, THIS IS YOU"); PacketDispatcher.sendToServer(new PacketRequestPlayerData()); } } } Works ofc. on Client-Server and Client-Dedic. Tested with 2 players connecter, everything seems like I expected diesieben07 - i know you hate Side.X but, it's NOT bad, when I tried using world.isRemote ANYWHERE in code regarding synchronization I literally ALWAYS had problems, Side is pretty straight forward (I am aware that there is one "bug", i am avoiding to use Side with it). P.S I will also check EntityOtherPlayerMP, it might be better. -
[SOLVED][1.7.10] Detect if event.entity is mc.thePlayer?
Ernio replied to Ernio's topic in Modder Support
Not sure, but - is this what I am looking for? ((EntityPlayer) event.entity) instanceof EntityPlayerSP Will work in any situation? Thanks. -
@SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer) { Side side = FMLCommonHandler.instance().getEffectiveSide(); if (side == Side.CLIENT) { System.out.println(((EntityPlayer) event.entity) == Minecraft.getMinecraft().thePlayer); } } } == - nope .equals - nope It's either impossible inside EntityConstructing or I am doing it wrong. This print is always false. At that point (constructing) entity doesn't have id, they are probably not the same as an Objects, so basically - what can i do to compare them?
-
[SOLVED, coders mistake][1.7.10] How to open Gui with packet?
Ernio replied to Ernio's topic in Modder Support
Well that's what I did: 1. Tried sending with packed with code on clientHandler: Minecraft.getMinecraft().displayGuiScreen(new GuiIntroduction()); 2. Worked on Client-Integrated, when i launched dedic, it crashed since GuiScreen doesn't exist there. 3. Started using openGui 4. Was frustrated <magic happens> <Ernio realizes he's retarded and writing this topic and Syso in code was a waste of good 30min> BAM case 1: player.openGui(RoAMain.instance, 100, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); case -1: player.closeScreen(); break; <Ernio notices he forgot break; after 1st case> <Facepalms himself for not even providing full code in this thread (i removed case -1 to not make too long code)> DAMN I am... Thanks -
[SOLVED, coders mistake][1.7.10] How to open Gui with packet?
Ernio replied to Ernio's topic in Modder Support
This is literally same thing? (For convinience tried it, not working) Edit: case 100: return new GuiIntroduction(); Is getting called (on Client ofc). -
[SOLVED, coders mistake][1.7.10] How to open Gui with packet?
Ernio posted a topic in Modder Support
I am doing something wrong here, lore: Server - an Integrated Server-thread Client - a Client-thread Dedic - A Dedicated Server-thread public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch (ID) { case 100: return null; } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (world instanceof WorldClient) { switch (ID) { case 100: return new GuiIntroduction(); } } return null; } } @SubscribeEvent public void playerLoggedInEvent (PlayerEvent.PlayerLoggedInEvent event) { System.out.println("LOGGED IN"); PlayerStats ps = ExtendedPlayer.get(event.player).getStats(); if (ps.getRace() == null || ps.getSubRace() == null || ps.getOrigin() == null) { System.out.println("SHOULD OPEN"); event.player.openGui(RoAMain.instance, 100, event.player.worldObj, (int) event.player.posX, (int) event.player.posY, (int) event.player.posZ); PacketDispatcher.sendTo(new PacketOpenCloseGui((byte) 1), (EntityPlayerMP) event.player); } } public class PacketOpenCloseGui implements IMessage { byte b = 0; public PacketOpenCloseGui() {} public PacketOpenCloseGui(byte b) { System.out.println("SENDING OPEN CLOSE GUI PACKET"); this.b = b; } @Override public void toBytes(ByteBuf buffer) { buffer.writeByte(this.b); } @Override public void fromBytes(ByteBuf buffer) { this.b = buffer.readByte(); } public static class PacketOpenCloseGuiHandler extends AbstractClientMessageHandler<PacketOpenCloseGui> { @Override public IMessage handleClientMessage(EntityPlayer player, PacketOpenCloseGui message, MessageContext ctx) { System.out.println("RECEIVED OPEN CLOSE GUI PACKET"); switch(message.b) { case 1: player.openGui(RoAMain.instance, 100, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); } return null; } } } On Client-Server: [22:11:37] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:playerLoggedInEvent:28]: LOGGED IN [22:11:37] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:playerLoggedInEvent:32]: SHOULD OPEN [22:11:37] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.network.server.PacketOpenCloseGui:<init>:23]: SENDING OPEN CLOSE GUI PACKET [22:19:25] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.network.server.PacketOpenCloseGui$PacketOpenCloseGuiHandler:handleClientMessage:44]: RECEIVED OPEN CLOSE GUI PACKET On Client-Dedic: [22:12:15] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:playerLoggedInEvent:28]: LOGGED IN [22:12:15] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:playerLoggedInEvent:32]: SHOULD OPEN [22:12:15] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.network.server.PacketOpenCloseGui:<init>:23]: SENDING OPEN CLOSE GUI PACKET And client gets: [22:12:16] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.network.server.PacketOpenCloseGui$PacketOpenCloseGuiHandler:handleClientMessage:44]: RECEIVED OPEN CLOSE GUI PACKET Bam... nothing happens, no matter if its client or server or dedi... Situation 2: I tries putting: @Override public IMessage handleClientMessage(EntityPlayer player, PacketOpenCloseGui message, MessageContext ctx) { System.out.println("RECEIVED OPEN CLOSE GUI PACKET"); switch(message.b) { case 1: Minecraft.getMinecraft().displayGuiScreen(new GuiIntroduction()); } return null; } Then it works on Client-Server, but on Client-Dedic crashes with no GuiScreen found (which is obvious since it doesn't exist). Question: How do I make code that works for all? -
So I was kinda hoping I'll be like "EUREKA!" by now... but I am not. For convinience: @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer) { System.out.println("CONSTRUCTING"); if (ExtendedPlayer.get((EntityPlayer) event.entity) == null) ExtendedPlayer.register((EntityPlayer) event.entity); } } @SubscribeEvent public void onPlayerClonning(PlayerEvent.Clone event) { System.out.println("COPYING"); ExtendedPlayer epNew = ExtendedPlayer.get(event.entityPlayer); ExtendedPlayer epOld = ExtendedPlayer.get(event.original); epNew.setStats(epOld.getStats()); epNew.setInventory(epOld.getInventory()); } @SubscribeEvent public void join(EntityJoinWorldEvent event) { if (event.entity instanceof EntityPlayer) { System.out.println("JOINED"); } } Data on server presists and on client not (since Clonning is server-side). I am looking for something that's called ONCE after both EntityPlayers (client and server) are constructed, can't find anything. Will I really have to add additional boolean and check it client-side every tick then make requesting packet to server to send data? Anyone had similar problem? I need that data right after player is constructed (used by GUI).
-
Ewe Loon 1. When calling getEntityData() you are getting NBTTagCompound with key of "ForgeData". Using it is not THAT risky, but if used with too generic key names might cause 2 mods put same key and corrupt data. 2. Accessig getEntityData() and getting data in it uses very INEFFICIENT process (byte-reading, comparable to String reading) and shouldn't be ever used beside one-time accessing. In this thread author pointed out he wants to use data that presists (not pointed out but probably had in mind). It's MUCH better to store IEEP with single value that ise loaded once per construcing and saved once a while (on entity save) than reading it every time server-side wants to use it - e.g damaging enemy. In more complicated cases, like IEEP being synchronized to client and used in renderer (GUI for e.g) those calls would be made on FPS-timing, on my comp it could get to about 500 calls if not more. Kinda stupid to read NBT 500 times per second, don't you think? And one last thing - I stated: "saving and loading uses IO operations (interacting with hard-drive)", how is this not correct? Saving NBT uses IO, reading it is just very inefficient. #noHate
-
Get graphics level(fast, fancy) for custom leaves
Ernio replied to Matthbo's topic in Modder Support
Minecraft.isFancyGraphicsEnabled() is perfectly good way to do this. To get this boolean on server side you will need to make request-answer system using packets. Server -> askForBoolean -> Client gets it -> sendAnswer -> Server does stuff. Or other way around. Note that anything that makes server dependent on client is cheatable (not that anyone would write cheat to mods... ) Btw. i have no idea why would you need Fancy graphics to do it..., proper way would be make block with custom renderer and value stored inside metadata. Let's say meta == 0 render this, else render other, where one is opaque, second is not. If you need player-dependent view then you will ofc need IExtendedEntityProperties. At this point I have no idea what exacly you want, so please write when and why should leaves display differently. -
There would be 2 approaches here: Save property to weapon when it's crafted, which is not what you want. Save property to player and check it when you use certain custom item. IEntityExtendedProperties - saving stuff to player in runtime memory AND saving it to disk whenever MC normally saves/loads player. You won't need packets since everything happens on server side. here tutorial how to do it: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and (2nd post) Edit: Ewe Loon idea is NOT good here, saving and loading uses IO operations (interacting with hard-drive) you DON'T want that. Use IEEP to keep data loaded all the time and save/loaded only when MC does.
-
Just want to reassure - cursor or crosshair? Crosshair is derived from Gui.icons (texturepack) and rendered using GuiIngame (you can cancel it with events). As to cursor - that's strictly Java stuff and operating on Frame stuff. You would need to edit something at very-beggining of launching client. Since windows-cursor is rendered over the application using events to render custom cursor will leave you with 2 cursors on top of each other (windows one on top). I guess you could try accessing it somehow during game rendering, but I have no idea how you would do it smart way (mainly because I don't know what MC uses to build program frame).
-
From Item: public boolean hitEntity(ItemStack p_77644_1_, EntityLivingBase p_77644_2_, EntityLivingBase p_77644_3_) { return false; } One of the EntityLivingBase is attacker and one is entity hit. Any mod that is correctly written for Forge will be using EntityLivingBase as base for their ANY monsters. Next step is just to get entity hit and set health to 0 (there might be event method setDead() but I don't really remember).
-
We all know that after death PlayerEntity is being dissolved and new one is created. By subscribing to events: EntityConstructing ("CONSTRUCTING") EntityJoinWorldEvent ("JOINED") PlayerEvent.Clone ("COPYING") I've analised process and have no idea (in proper way) how to archieve my goal, here's process: [20:01:03] [server thread/INFO]: 2 fell from a high place [20:01:03] [Client thread/INFO]: [CHAT] 2 fell from a high place [20:01:05] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:06] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:08] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:09] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:11] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityConstructing:33]: CONSTRUCTING [20:01:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onPlayerClonning:42]: COPYING [20:01:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED [20:01:11] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityConstructing:33]: CONSTRUCTING [20:01:11] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:join:54]: JOINED So basically: 1. You die. 2. Client launches JOINED every 1-2sec attempting to join (idk why) 3. When you press respawn server makes new EntityPlayer, copies old entity data to new one and joins the world. 4. Client Makes new player and joins the world. My goal 1: Make Client data presist, as seen on event - impossible since Clonning is only server-side. So when my "goal 1" turned out to be impossible here's goal 2: Make Server send synchro packet right after Player is reconstructed. Now the problem is that as you can see - I can't send ANY packet just after neither of "CONSTRUCTING", "COPYING" or even "JOINED" since at that moment Client doesn't even have NEW Player constructed. Normally I was doing it in PlayerLoggedInEvent, but that is only called just after you log in, never when you respawn. So basically - what do I do? Best options, tools? (I know I could send request packet from client after "JOINED" but that's next ton of making sure all player will get what the should). ------ Edit: Regarding the idea of "sending request packet" after client finishes creating new PlayerEntity: That's again - how? I'd need some event that gets called only once just after new entity joins world, and as you can see in log above the EntityJoinWorldEvent is spamming clint-side every those 1-2sec when you are viewing Death-screen (before you push "respawn" button). So basically I would need to somehow check if the "request packet" should be sent, but to do that I would again need some boolean inside IEEP which at that time might aswell not exist. I just DON'T belive that stuff like this can be SO damn difficult, I must be missing something... ------- Thx for help
-
[SOLVED] java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
Ernio replied to Ernio's topic in Modder Support
Works like charm (totally forgot about this). -
[code [16:29:16] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [16:29:16] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [16:29:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [16:29:16] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1286 for Minecraft 1.7.10 loading [16:29:16] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_11, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre8 [16:29:16] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [16:29:16] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [16:29:16] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [16:29:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [16:29:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [16:29:16] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [16:29:16] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [16:29:17] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [16:29:17] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [16:29:17] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [16:29:17] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker [16:29:17] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker [16:29:17] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [16:29:17] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11] 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:?] Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[?:1.8.0_11] at java.lang.Runtime.loadLibrary0(Unknown Source) ~[?:1.8.0_11] at java.lang.System.loadLibrary(Unknown Source) ~[?:1.8.0_11] at org.lwjgl.Sys$1.run(Sys.java:73) ~[lwjgl-2.9.1.jar:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_11] at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) ~[lwjgl-2.9.1.jar:?] at org.lwjgl.Sys.loadLibrary(Sys.java:95) ~[lwjgl-2.9.1.jar:?] at org.lwjgl.Sys.<clinit>(Sys.java:112) ~[lwjgl-2.9.1.jar:?] at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:2807) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:79) ~[Main.class:?] ... 6 more Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release I just update from 1222 to 7.10.85.1286 and basically this happened after I removed old builPath (you know, when you do gradlew.bat eclipse you will end up with 2 buildPaths and have to remove old one) My lwjgl-2.9.1.jar of given buildPath is: C:/Users/Me/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl/2.9.1/ccedb5b6f96913c6f78bc10249e747ded90baa51/lwjgl-2.9.1-sources.jar
-
"Btw, in your setInventorySlotContents implementation, you should check first if the current stack in the slot is not null and call onUnequipped for it, otherwise you could easily end up with permanent buffs/debuffs." -coolAlias I'd eventually notice it, but nice catch thx
-
I'd like to know when I should consider caching stuff instead of counting it every tick for player. I am mostly worried about ExtendedInventory items. Every tick, there is a loop through all ItemStacks, their NBT being read and the value inside ExtendedPlayer is being updated, most of the time it's literally not changed (same as in tick before) There are also a lot more values applied to main value, player can have effects (buffs/defuffs). Finally if I'd have to count there would be about 100 if's, few thousands iterations (sum/multiply), and some string-scanning (worst case I would compare it to few houndred nbt.getInteger("something") operations). That's not huge amount for computer, but when you get 50 players+ it might mean SOMETHING. Should I be worried about anything here? Anyway, I've been considering reading NBT of ItemStacks inside inventory ONLY when you place/remove them and move that NBT to object values and store them ready-to-use in ExtendedPlayer, but again - I am worried that there might be some errors? Is there any possibility that SOMEHOW game will remove ItemStack from slot without slot knowing it (so the ready-to-use list wont get updated). This is how I sync it: this is ofc IInventory of player (size of slot is always 1) @Override public ItemStack decrStackSize(int index, int quantity) { if (this.stackList[index] != null) { ItemStack itemstack; if (this.stackList[index].stackSize <= quantity) { itemstack = this.stackList[index]; this.stackList[index] = null; if (itemstack != null && itemstack.getItem() instanceof IItemCore) { ((IItemCore) itemstack.getItem()).onUnequipped(itemstack, player.get()); } } else { itemstack = this.stackList[index].splitStack(quantity); if (this.stackList[index].stackSize == 0) { this.stackList[index] = null; } if (itemstack != null && itemstack.getItem() instanceof IItemCore) { ((IItemCore) itemstack.getItem()).onUnequipped(itemstack, player.get()); } } if (inventoryHandler != null) this.inventoryHandler.onCraftMatrixChanged(this); syncSlotToClients(index); return itemstack; } else { return null; } } @Override public void setInventorySlotContents(int index, ItemStack stack) { this.stackList[index] = stack; if (stack != null && stack.getItem() instanceof IItemCore) { ((IItemCore) stack.getItem()).onEquipped(stack, player.get()); } if (inventoryHandler != null) this.inventoryHandler.onCraftMatrixChanged(this); syncSlotToClients(index); } P.S - yeah, I have those weird habits to optimize everything everywhere, so I might be overreacting. Edit: As for bolded question - if you know something (situation it might occur) please write so I can handle it.
-
[1.7.10] IEEP saveNBTData and how to... <insert right word here>?
Ernio replied to Ernio's topic in Modder Support
[21:12:09] [server thread/INFO]: Saving and pausing game... [21:12:09] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@543510ee [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.Exception [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.midstcraft.ernio.RoA.common.player.ExtendedPlayer.saveNBTData(ExtendedPlayer.java:49) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.Entity.writeToNBT(Entity.java:1527) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:33) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.saveAllPlayerData(ServerConfigurationManager.java:949) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:112) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [21:12:09] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@543510ee [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.Exception [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.midstcraft.ernio.RoA.common.player.ExtendedPlayer.saveNBTData(ExtendedPlayer.java:49) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.Entity.writeToNBT(Entity.java:1527) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.storage.SaveHandler.writePlayerData(SaveHandler.java:274) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.writePlayerData(ServerConfigurationManager.java:291) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:36) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.saveAllPlayerData(ServerConfigurationManager.java:949) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:112) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [21:12:09] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [21:12:09] [server thread/INFO]: Saving chunks for level 'New World'/Overworld [21:12:09] [server thread/INFO]: Saving chunks for level 'New World'/Nether [21:12:09] [server thread/INFO]: Saving chunks for level 'New World'/The End [21:12:11] [server thread/INFO]: Stopping server [21:12:11] [server thread/INFO]: Saving players [21:12:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@543510ee [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.Exception [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.midstcraft.ernio.RoA.common.player.ExtendedPlayer.saveNBTData(ExtendedPlayer.java:49) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.Entity.writeToNBT(Entity.java:1527) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:33) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.saveAllPlayerData(ServerConfigurationManager.java:949) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:398) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:266) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:538) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [21:12:11] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@543510ee [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.Exception [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.midstcraft.ernio.RoA.common.player.ExtendedPlayer.saveNBTData(ExtendedPlayer.java:49) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.Entity.writeToNBT(Entity.java:1527) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.storage.SaveHandler.writePlayerData(SaveHandler.java:274) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.writePlayerData(ServerConfigurationManager.java:291) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:36) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.saveAllPlayerData(ServerConfigurationManager.java:949) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:398) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:266) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:538) [21:12:11] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) First 2 on pause, second on quit game, both on SinglePlayer. And btw - when runnning on Dedicated server its only called once, so I guess its fine. [21:09:58] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@255bdb40 [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.Exception [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at com.midstcraft.ernio.RoA.common.player.ExtendedPlayer.saveNBTData(ExtendedPlayer.java:49) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.Entity.writeToNBT(Entity.java:1527) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.storage.SaveHandler.writePlayerData(SaveHandler.java:274) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.writePlayerData(ServerConfigurationManager.java:291) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.playerLoggedOut(ServerConfigurationManager.java:334) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.NetHandlerPlayServer.onDisconnect(NetHandlerPlayServer.java:673) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:175) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [21:09:58] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) Final question - why Dedicated server calls it once and Integrated twice? -
[1.7.10] IEEP saveNBTData and how to... <insert right word here>?
Ernio replied to Ernio's topic in Modder Support
Exacly the same: [19:20:10] [server thread/INFO] [sTDOUT]: [com.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@49ef1bbb [19:20:10] [server thread/INFO] [sTDOUT]: [com.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVINGcom.midstcraft.ernio.RoA.common.player.ExtendedPlayer@49ef1bbb I searched my code for anything matching ExtendedPlayer, there is nothing that could cause it, also - there is only one caller methor (superclass) for saveNBTData. I am not dumb but at this point I am really like WUT? -
[1.7.10] IEEP saveNBTData and how to... <insert right word here>?
Ernio replied to Ernio's topic in Modder Support
I've been using this code for like... few months, and just debugged and turned out to be called twie every time it's being saved. There is not much to show. @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer) { if (ExtendedPlayer.get((EntityPlayer) event.entity) == null) ExtendedPlayer.register((EntityPlayer) event.entity); } } public class ExtendedPlayer implements IExtendedEntityProperties { public final static String KEY = "RoAEP"; public ExtendedPlayer(EntityPlayer player) {} public static final void register(EntityPlayer player) { player.registerExtendedProperties(KEY, new ExtendedPlayer(player)); } public static final ExtendedPlayer get(EntityPlayer player) { return (ExtendedPlayer) player.getExtendedProperties(KEY); } @Override public void saveNBTData(NBTTagCompound compound) { System.out.println("SAVING"); } @Override public void loadNBTData(NBTTagCompound compound) { System.out.println("LOADING"); } @Override public void init(Entity entity, World world) {} } Every damn time on esc or any other save-calls [19:14:35] [server thread/INFO]: Saving and pausing game... [19:14:35] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVING [19:14:35] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVING [19:14:35] [server thread/INFO]: Saving chunks for level 'New World'/Overworld [19:14:35] [server thread/INFO]: Saving chunks for level 'New World'/Nether [19:14:35] [server thread/INFO]: Saving chunks for level 'New World'/The End -
I've been wondering: In my class using IEEP, why is this called twice? @Override public void saveNBTData(NBTTagCompound compound) { System.out.println("SAVING"); } [13:27:32] [server thread/INFO] [sTDOUT]: [com.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVING [13:27:32] [server thread/INFO] [sTDOUT]: [com.ernio.RoA.common.player.ExtendedPlayer:saveNBTData:48]: SAVING Also - when exacly are those called, because for me it looks totally random. And as to <insert right word here>: I want to store a data to player, but I don't want it loaded all the time, just when I need it, how would I do it?
-
GuiListExtended operates on array of IGuiListEntry that you can put there. To do so: You need to extend this class and override getListEntry to return an object that uses IGuiListEntry (implement your own). Then override some other methods like getListWidth(), etc. for customization. As to IGuiListEntry, there you have drawEntry(...) and some others. It's pretty simple if you understand parent'child relations. I got it all done in about 3 hours. Look at GuiResourcePackList - very helpful
-
"Hentai" - Dat Mod I am guessing you are executing this class in preInit? There are 3 ways: 1. Subscribe to PlayerLoggedInEvent. - This even is only fired by Server thread. - Send packet that tells player to display his LOCAL version. 2. Subscribe to PlayerLoggedInEvent. - This even is only fired by Server thread. - Send ChatComponent containing mod version this Server thread is running on (you know, client must have same version as server, so it's right to assume that client will have same as server). Note: doesn't matter is you are SP or MP. 3. Do everything on Client thread: - Subscribe to EntityJoinedWorld and make it run only Client side (world.isRemote) - Check if entity == mc.thePlayer (your player entity) - Print ChatComonent client-side. #3rd one is best.
-
private final ResourceLocation texture = new ResourceLocation("DC" + ":" + "textures/entities/DEATH.png"); I only know this will work (works for me). Always used this constructor, just saying. Also - use lowercase maybe? If it doesn't - what does (the fox say) the error log say (the path missing)?
-
ItemStack has 3 props: Item reference it uses, damage and NBT. Trying to improve your system will bring you probably nothing since this: (ItemStack) public boolean isItemStackDamageable() { return this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable"); } It's hardcoded for only one type of special effect (unbreakable). You can't set maxDamage for one item since it's stored inside Item instance. What you can do is only and only add new NBT or use "repairCost" to affect price/maxRepairValue. Still - it will never work well with anvil, not without ASM or replacing whole Anvil with your own CustomAnvil that will be able to read your system.