Everything posted by HappyKiller1O1
-
[1.8] Where to get the WorldServer instance during packet handling?
Just wondering how to get the WorldServer instance for the IThreadListener during Simpleimpl packet handling.
-
[1.8.8]Rotating the Player's Arm?
Wow, I never realized there was something like this.
-
[1.8] Just wondering something about DataWatcher
I understand that, thanks. I will be switching over to updating the client manually as to not conflict with other mods. I just really want to understand why, when setting the value to 150, it becomes 0 when saved to NBT. I am probably missing something you have stated, but I just find this so confusing that it bugs me. Is the Object simply just telling DataWatcher that we will be storing this certain Object (int, byte, float, etc.)?
-
[1.8.8]Rotating the Player's Arm?
I'm pretty sure there is a mod (Maybe battlegear?) that has a shield in it. I noticed they rotated the player's arm when holding the shield. You could try running through their code to find out how they did it.
-
[1.8] Just wondering something about DataWatcher
Also, I will be switching to just my own packet sync. This has just been bothering me for quite some time.
-
[1.8] Just wondering something about DataWatcher
Alright, that explains a lot. But here's something that I don't seem to get. Here is where I set the Object for DataWatcher, which I got by following coolAlias's tutorial on IEEP: public static final int WEIGHT_WATCHER = 20; private int maxWeight; private final EntityPlayer player; public final InventoryWeightLimit inv = new InventoryWeightLimit(); public ExtendedPlayer(EntityPlayer player) { this.player = player; this.maxWeight = 150; this.player.getDataWatcher().addObject(WEIGHT_WATCHER, this.maxWeight); } Now see, he says to save the maxMana (maxWeight in my case) as the Object. But, here is how I save it to NBT: public void saveNBTData(NBTTagCompound compound) { NBTTagCompound props = new NBTTagCompound(); props.setInteger("CurrentWeight", this.player.getDataWatcher().getWatchableObjectInt(WEIGHT_WATCHER)); compound.setTag(EXT_PROP_NAME, props); this.inv.writeToNBT(compound); } I am setting the Integer of "CurrentWeight" to be the value of the Object I saved to DataWatcher. Now, when I go in game to test it, the Objects value is 0 (which is what I want). But, considering I set it to be the value of the maxWeight int, wouldn't the value be 150? And, I actually know what an Object is. I'm just confused about what I stated above. It just seems like it should be 150, right?
-
[1.8] Just wondering something about DataWatcher
So, I am using DataWatcher to sync some ExtendedPlayer values between server and client. Along with the ease it provides. But, I was wondering if anyone could point me to an explanation of it in general. The main part I am wondering about is, when adding an Object, you have the ID of course. But, the actual object you add, what is that used for? Is that just the type of Object, or a certain cap of some sort? Just never quite understood that when I decided to switch to DataWatcher.
-
[SOLVED][1.8][FORGE] Ability to close a gui with a custom key?
That's what I did. I posted the fix to the code that was conflicting (reopening the gui after closing it). When I'd attempt to close the gui, I never checked in my KeyHandler if the key was down. So, when the key was released, it would send the packet to reopen the gui. Thus, constantly reopening it after closing it.
-
[SOLVED][1.8][FORGE] Ability to close a gui with a custom key?
@diesieben07 Basically, I close the screen in my gui because KeyInputEvent doesn't fire in a gui (I don't know if that is normal, but that's what I found). @coolAlias Thank you! I now check if the custom key is down, and if the current container is not my own before sending the packet to open the gui. Here's an example for those experiencing something similar: int kb = Keyboard.getEventKey(); boolean isDown = Keyboard.getEventKeyState(); if(kb == keys[CUSTOM_INV].getKeyCode() && isDown && !(player.openContainer instanceof YourContainer)) { System.out.println(player.openContainer); if(player.openContainer instanceof YourContainer) { //Unused }else { PacketHandler.network.sendToServer(new PacketOpenGui(CUSTOM_INV)); System.out.println("Packet was sent"); } }
-
[SOLVED][1.8][FORGE] Ability to close a gui with a custom key?
Thank you for that, so, I put that in the keyTyped method in my GUI class. The only problem seems to be that, it will close and re-open. I find this to be that the KeyInputEvent gets called multiple times per press. Is there a way to counter this?
-
[SOLVED][1.8][FORGE] Ability to close a gui with a custom key?
So, after getting my custom inventory to work, I find it a tad bit annoying not having the ability to close it with my custom key ®. I have tried sending a packet to close the container (which I believe would tell the client to close the gui also), but the KeyInputEvent is not called while in a gui. Here is my key handler class: http://pastebin.com/jA9eTDub And my Packet to close the container: http://pastebin.com/uNNQyzVp
-
[SOLVED][1.8][FORGE] GuiHandler not firing
Thank you very much for that Choon! Seems to be working flawlessly after changing my network to the correct format. Thanks for the help everyone!
-
[SOLVED][1.8][FORGE] GuiHandler not firing
Ah! Simply forgot to add a base constructor for the packet. Now, I need to open the gui in the packet. But, I completely forgot how I would be able to grab the playerEntity to do that. Any suggestions?
-
[SOLVED][1.8][FORGE] GuiHandler not firing
I was using the one for IEEP. I changed it to this simpler way, but am getting a "NoSuchMethodFound" error when attempting to send it to the server. I'm sure I'll figure it out, but if this is common, any solution?
-
[SOLVED][1.8][FORGE] GuiHandler not firing
Hm, I'll get to remaking my network. I feel it would be smart to update the Forge wiki networking tutorial with this. A lot of newcomers would be appreciative of this!
-
[SOLVED][1.8][FORGE] GuiHandler not firing
I was actually following your tutorial for Packets Alias. Currently, I would like to make it work first then change my PacketHandling methods. Here is the Network code, the Packet is sent to the server (used print outs in keyhandler). PacketPipeline: http://pastebin.com/UseR7Nan OpenGuiPacket: http://pastebin.com/qKiJUNmC
-
[SOLVED][1.8][FORGE] GuiHandler not firing
So, I am creating a custom inventory and such for my mod. Now, I finished the KeyHandler, Container, Gui, IInventory, and GuiHandler classes. But, the GuiHandler methods seem to not be firing off as they are suppose to. I thought I screwed up my instance, but I see nothing wrong. Here are the classes that may be affecting it: ModMain: http://pastebin.com/MHLQVs1N KeyHandler: http://pastebin.com/WEZC7Hm2 GuiHandler: http://pastebin.com/mWd5jT6u Inventory Class: http://pastebin.com/L2cQ85BC Gui: http://pastebin.com/LQLj5852 Container: http://pastebin.com/1yu6XxDv ModReference: http://pastebin.com/p4sw2B9b If you need anything else, just ask! Any help will be greatly appreciated.
-
[FORGE][1.8] Adding an additional slot to the player's inventory?
No problem! Merry Christmas to you, and have a Happy New Year!
-
[FORGE][1.8] Adding an additional slot to the player's inventory?
I was actually thinking that over, and am going to add a simple button that will display the extra slot when needed. I would add an entirely separate menu, but I am only adding one slot, so I feel it's a waste of time. Thank you though Alias, you are a great help to this community, and I believe you aren't appreciated enough.
-
[FORGE][1.8] Adding an additional slot to the player's inventory?
My question is rather simple, I would like to add an additional slot the the vanilla player inventory. I looked through a tutorial on creating your own inventory, and am thinking about using a Tick handler to replace the vanilla inventory with my own when opened. Is there a more efficient way of doing this? Or, is what I have planned the best one?
-
Where to find a changelog?
Thank you so very much!
-
Where to find a changelog?
I remember finding on the Minecraft forge github, something that lists what they changed func_... methods to. I have recently switched computers, and lost the link. It gets quite frustrating attempting to figure them out on my own. Any help will be appreciated!
-
[1.7.10] Can't mine blocks while setting stack NBT
Well, I used what Ernio said and it works. World time would probably be more efficient but, I think the way I have it now is fine too. Thanks for all the help guys! Couldn't of done it without you.
-
[1.7.10] Can't mine blocks while setting stack NBT
That seemed to work. @Draco18s I would do that but, considering it takes twenty minutes for a full day and night cycle more or less. Wouldn't it only run every twenty minutes?
-
[1.7.10] Can't mine blocks while setting stack NBT
So, I found this example of reflection here: http://examples.javacodegeeks.com/core-java/reflection/java-reflection-example/ My two questions are, do I have to do EVERYTHING shown in order to retrieve the field and set it accessible? Or, can I just set the class and make it accessible? And, do I have to make a separate reflection class or, can I put the reflection in my Item class?
IPS spam blocked by CleanTalk.