Everything posted by Jay Avery
-
[1.11] Get Capability stored in the player
Use EntityPlayer#getCapability. It takes a capability instance (for yours that would be CapabilityEnviroData.enviroDataCapability) and an EnumFacing side (or null).
-
Registering Messages [1.11.2]
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
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?
-
[1.11] How do I add a HUD?
Subscribe to RenderGameOverlayEvent, and draw your information in whatever form you want it.
-
IndexOutOfBoundsException in client->server packet
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?
-
Handling config file with updates
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
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.
-
[Solved] Blockstates and item model for TileEntity
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
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
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?!
-
[Solved] Define inventory model in blockstates file
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?
-
Storing per-player data in capability
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?
-
Storing per-player data in capability
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?
{ "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?
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?
Almost. { "parent": "tutorial:block/tutorial_block_json" }
-
How to make block drop a 3d block item, like cobble stone?
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
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.
-
Combining ItemStacks which have capabilities
(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!
-
FIXED:Crashing on Tutorial Item Mod(dealing with texture problems too)
Post your updated code and error log! We can't help if we can't see what's wrong.
-
Add ticking to vanilla chest
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?
-
Add ticking to vanilla chest
Because I need to get the world time when I construct the capability.
-
[1.11.2] model not loading
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
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?
-
FIXED:Crashing on Tutorial Item Mod(dealing with texture problems too)
Post your updated code.
IPS spam blocked by CleanTalk.