-
Posts
884 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Jay Avery
-
Use EntityPlayer#getCapability. It takes a capability instance (for yours that would be CapabilityEnviroData.enviroDataCapability) and an EnumFacing side (or null).
-
The Minecraft class doesn't exist on the server (it's @SideOnly(Side.Client)). To reference it, you need to make methods in your proxies which return the objects you need (i.e. the player) in the client proxy, and throw an exception in the server proxy (because they should never be called from there). I just had (and solved) this problem today - link!
-
IndexOutOfBoundsException in client->server packet
Jay Avery replied to Jay Avery's topic in Modder Support
Ah, yes I was making a mistake with my registration - I was doing it on one side only, but it needs to be on both, so the IDs were messed up. But now I have a different crash, because most of my server->client packets call client-only things like Minecraft.getMinecraft(), resulting in NoClassDefFoundErrors. What should I do about that? -
Subscribe to RenderGameOverlayEvent, and draw your information in whatever form you want it.
-
I'm trying to run my mod as a server and connect to it as a client (it's been running fine when I just run it as a client and play singleplayer), and I'm getting this exception when I try to connect. The full console output: The class of the packet which the error refers to: The exception seems to suggest I'm doing something wrong in the read/write methods, but they seem to be perfect mirrors of each other like they should be. Can anyone help?
-
I have a mod with a config file, and sometimes when I update there's no way to get around renaming/moving/changing/etc some of the options in the config file. This leaves the old options behind so they are still visible in the GUI but don't actually do anything. The solution is to delete the config file, but telling the user to delete their config means they also have to adjust all their other settings from scratch even if they haven't changed. Is there any more user-friendly way to handle this?
-
[Solved] Blockstates and item model for TileEntity
Jay Avery replied to Jay Avery's topic in Modder Support
Thanks - do you know of a tutorial or example for using IStateMapper? Edit: nevermind, I figured it out! This has removed the console error of problem #1, but the item is still not working. Edit again: turns out I had just made a mistake and wasn't registering the item model at all, so that's fixed #2, oop. -
I have a block which is rendered as ENTITYBLOCK_ANIMATED like a chest. The block is rendering in the world as expected, but there are two problems: 1. [Solved with custom IStateMapper] I get this console error, because it's looking for a blockstates json, even though it doesn't need one because it doesn't need a block model at all. 2. [Solved, I was just forgetting to register the item model at all] The itemblock is rendering with the missing model texture in the inventory, even though I have an item model json (and there's no corresponding console error). My item model is at models/item/block_box.json:
-
[Solved] Define inventory model in blockstates file
Jay Avery replied to Jay Avery's topic in Modder Support
Sorry, the error for this was getting buried under all my other broken models so I wasn't able to see it at first. I've found the problem, it's automatically looking for the model in the block folder: Caused by: java.io.FileNotFoundException: minecraft:models/block/item/generated.json Is there any way to override that? I tried changing the string to "minecraft:item/generated" and "minecraft:models/item/generated", but it stills keeps looking inside the block folder. Edit: I guess I could just make a copy of the item/generated file and put it in my own block folder? Edit again: well, that method works! It feels like maybe it's bad practise to have an item model in the block folder, but I can't find another way to make it work, so.. -
[Solved] Define inventory model in blockstates file
Jay Avery replied to Jay Avery's topic in Modder Support
With that change, the inventory model is now broken in a slightly different way: The block models are still fine. Edit: I have no idea what this thing with floating in front of the crosshair is, is that something from a recent update?! -
Is it possible to define a model from its parent and textures (rather than just specifying the path to an existing model) inside the blockstates file? I have a block which uses a different block model based on a few states, and a special item model in the inventory (rather than just the standard inventory block model). I'm wondering if there's a way for me to define all of this within the blockstates file, instead of needing to make a separate item model. This is what I've tried so far, and the block models are working fine but in the inventory it's the purple-black checkered cube. Have I made a mistake with my formatting, or is it just not possible to do this way?
-
Yes, but you haven't said anything about whether it is *actually* working, or what happens when you try to use it. Why are you not sure if you've set it up correctly?
-
Can you tell us what is and isn't working with what you've got so far?
-
How to make block drop a 3d block item, like cobble stone?
Jay Avery replied to clowcadia's topic in Modder Support
{ "parent": "tutorial:tutorial_block_json" } { "parent": "tutorial:block/tutorial_block_json" } Spot the difference- "tutorial:block/tutorial_block_json" -
How to make block drop a 3d block item, like cobble stone?
Jay Avery replied to clowcadia's topic in Modder Support
Post your item model file. What exactly does it look like in the game? -
How to make block drop a 3d block item, like cobble stone?
Jay Avery replied to clowcadia's topic in Modder Support
Almost. { "parent": "tutorial:block/tutorial_block_json" } -
How to make block drop a 3d block item, like cobble stone?
Jay Avery replied to clowcadia's topic in Modder Support
The reason your item is flat is that your item model extends item/generated, which is the standard flat item model. If you want it to render like a block, set the parent to the block model, and remove the textures part (because it is not needed). -
[1.11] Destroy dropped item and a question about event handlers
Jay Avery replied to Frost2779's topic in Modder Support
There's ItemTossEvent, which is fired whenever a player drops an item from their inventory. If you cancel the event, the item won't spawn as an entity. Edit: although if it's your item, you could override onEntityItemUpdate to kill the entity as soon as it exists. -
(I hope there's no daily post limit on this forum...) I'm working on an ItemStack capability which is given to stackable (max stack size > 1) items. Stacks with the capability can be in one of several defined states. I want stacks of the same item to be able to be combined if they are in the same state, but not if they are different. The trouble is that Forge's areCapsCompatible is called in most places, but not quite everywhere. One obvious spot where it's missing is in Container#slotClick, which refers to Container.canAddItemToSlot. And that method checks that the items and stackTagCompounds are equal, but ignores capability tags. But it's static, so I can't override it to add my own functionality. I could try to override slotClick (I'm already overriding the player container anyway), but it's a huge method and it also refers to a bunch of private fields, and seems like it would be generally a bad idea. I could try to add my capability's tags to the stackTagCompound, but that's not the intended use so I'm guessing it would have other messy effects or wouldn't work (the doc comment says that Minecraft validates only non-stackable items can use it, although I haven't found where that happens in the code). Does anyone have any suggestions? Is there any way for me to edit a static method (if I could just add one areCapsCompatible check to Container.canAddItemToSlot...!)? Is there some other workaround I can use to force Minecraft to check capabilities when attempting to combine stacks? Forge is great, but times like this make me wish I could just edit the vanilla classes myself!
-
Okay I see. It's working now because when the stack is copied/split/etc it then gets read from NBT anyway - so if it's *not* a brand new stack it gets its birth time from its parent stack straight away. I guess that's not the best way to do it though. But the alternative is to manually hook into every place where a new stack of my decayable item might be created, and set the capability data there?
-
Because I need to get the world time when I construct the capability.
-
It's true that vanilla uses the exact same variants as OP in the blockstates for melon and pumpkin stems, though. Does vanilla allow skipped variants in some way that Forge doesn't?
-
[HELP]Progress bar does not work as intended
Jay Avery replied to Pingubro's topic in Modder Support
Can you describe in some more detail what you intend to happen? Are you wanting to fill in the arrow white from left-right like a vanilla furnace does, or something else?