-
Posts
884 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Jay Avery
-
I've never used packets with an Entity. I assume the process is more or less the same as for TIleEntities and suchlike, but you should probably ask someone who has direct experience if you need more help!
-
That code all looks fine and like it should be working. The problem is likely to do with server/client syncing - you are updating your entity data on the server side (where !world.isRemote), but the GUI is drawn on the client side, where the data isn't changed. I think you'll need to use packets to send the updated stomach value to the client side when it gets changed on the server, so that it can be used in the GUI.
-
Whatever is happening when you make stomach static, it is not going to be what you want to happen - even if it seems that way at first glance. Post your most up-to-date code (with non-static stomach) and we'll see if we can fix the GUI issue.
-
[1.11.2] Schematic to .java & research crafting
Jay Avery replied to nexusrightsi's topic in Modder Support
For player research, you can use Capabilities. -
This line is meaningless because 1. You never initialise or use it, and 2. Your entity is not a singleton class. Every time one of your entity spawns in the world (however that happens), a new instance of the class is created - you can't use static fields or instances for this. It'd be like trying to apply damage to a particular zombie in the world by saying "Give all zombies 1/2 health". Anything that involves your entity needs to relate to the particular instance that is involved - in this case, the particular instance that the player clicked on to open the GUI. Creating a new Basic is not at all what you need to do - you need the specific Basic instance that the player clicked on. You were on the right track before when you were using getEntityByID. This is on the right track, too. Once you get your basic field pointing to the correct instance of the entity, this line should work. If your entity data is being reset when the world is saved/loaded, that's not a problem with GUIs and Containers - it's to do with the entity itself (probably something to do with NBT). If that's still a problem, it's probably best to post a new thread about that specific topic to get more help.
-
Add a non-static method to your entity class that returns the stomach value, then call that method on the entity (this.entity) from your container. You will first need to cast the entity to your entity class to be able to call the method (although it probably makes more sense to change the declared type of the entity field and the constructor parameter and cast it earlier on in the process). Edit: and don't forget to post your updated code!
-
A static method is not going to do what you want it to do. You need to get the stomach value from the instance of your entity that's associated with the container, not statically from the entity class.
-
What do you mean by reload - do you mean when you save and quit the game and open it again? Post your updated code. The value definitely should not be static, because it relates to an instance of the entity/container.
-
Post your whole GUI and Container classes. How are you getting the entity?
-
Instead of setting stomach in the GUI constructor, replace it with a call to the stomach information directly from the entity inside drawGuiContainerForegroundLayer.
-
Now step into that method and see where it gets stuck in the constructor.
-
ItemStack capabilities behaving oddly when playing on server
Jay Avery replied to Jay Avery's topic in Modder Support
I just remembered the reason I hadn't used stackTagCompound before is because the doc comments say it can only be used for non-stackable items - whereas mine are stackable. Is that going to cause problems if I try it? -
ItemStack capabilities behaving oddly when playing on server
Jay Avery replied to Jay Avery's topic in Modder Support
The confusing thing is that the data stored in my capability should never change - once it's initialised it just stores its birth time, and I don't see why it should be getting reset or lost somehow (especially why it's getting lost while connected to a server but not singleplayer - surely if data is mistakenly getting deleted or overwritten at a certain point it would happen regardless?). If I add the capability data to getNBTShareTag, do I need to override something else to make sure it gets read correctly? I am only using internal items from my mod, so at least that simplifies it slightly. -
java.lang.NullPointerException at com.TheRPGAdventurer.items.ItemDragonBreedEgg.getItemStackDisplayName(ItemDragonBreedEgg.java:27) Something in that method (at line 27 of the class) is null where it shouldn't be. Use printlns or step through with your debugger to find it.
-
I have some items which I give a 'decay' capability. It stores the time the item was created, and compares that against the current time and a predefined shelf-life to give different effects. All of these things are working exactly as expected when I play in single player. The item's durability bar is coloured in a shade between green and red representing its decay level (more red = more rotten). When the item is fully rotten: The player can't eat it The model changes to a 'rot' texture using a property override The display name of the stack becomes "Rotten ____" But some weird things are happening when I run a server and connect to it, and I have no idea why: When a decayable item is a dropped entity in the world, it always renders as rotten - whether it actually is or not. (In singleplayer, they render correctly when they're dropped entities). Decayable items in my inventory have their durability bar completely green until fully rotten (In singleplayer they fade progressively from green to red). When I click on an item in a slot of my inventory, it immediately 'becomes' rotten (displays the rot texture, name, and red durability bar). It stays that way when I put it down into a slot. But, these stacks will revert back to their correct state when: I eat one from a stack of items (and if they were truly rotten I wouldn't be able to eat them in the first place) I drop part or all of the stack using Q or clicking outside the inventory GUI. These problems are so weirdly specific, and I have no idea how they can be different between singleplayer and connected to a server. Can anyone help? My code is all on github. Probably-relevant classes: ItemEdibleDecayable (all decaying food items) DefaultCapDecay (the implementation of my decay capability) My ContainerInventory (which replaces the vanilla container)
-
What do you want to accomplish with your item model (why do you want to use blockstates)?
-
(Solved) Packet not sending properly when in SinglePlayer.
Jay Avery replied to Kriptikz's topic in Modder Support
Post your packet and handler classes. Do you use Minecraft#addScheduledTask to process the message? -
MultiModel minecraft:builtin/missing is empty
Jay Avery replied to Jay Avery's topic in Modder Support
Bump, anyone have any ideas? -
[1.11.2] Crazy rendering glitch on normal block
Jay Avery replied to dwilby's topic in Modder Support
Which block is it? Post/link the block class, blockstates file, and block model(s) for it. -
Caused by: java.io.FileNotFoundException: turbin:models/item/itemcheese.json It's searching for the model in domain turbin, but your files are in domain ezpvp
-
MultiModel minecraft:builtin/missing is empty
Jay Avery replied to Jay Avery's topic in Modder Support
Do you know what kind of problem it's caused by? I'm just confused because nothing is actually wrong in the game. -
MultiModel minecraft:builtin/missing is empty
Jay Avery replied to Jay Avery's topic in Modder Support
Yes, in some. I also use vanilla multipart in some. -
MultiModel minecraft:builtin/missing is empty
Jay Avery replied to Jay Avery's topic in Modder Support
I have about 200 block models (github). If the only way to find the problem is to individually rule them out and then reintroduce them, I don't think I'll bother unless there's a real chance of it causing unanticipated problems later. -
I'm getting this console error when I run my mod (it actually outputs 10-15 copies of the same line): [17:05:10] [Client thread/ERROR] [FML]: MultiModel minecraft:builtin/missing is empty (no base model or parts were provided/resolved) It's obviously something to do with models, but I don't have any in-game problems - no missing models or textures etc. Does anyone know what causes this and how to prevent it? Or is it safe to ignore it, since I don't have any actual problems?