-
Posts
884 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Jay Avery
-
[1.11.2] [Unsolved] Accessing an entity's gui container
Jay Avery replied to OrangeVillager61's topic in Modder Support
Yep, that's right. -
[1.11.2] [Unsolved] Accessing an entity's gui container
Jay Avery replied to OrangeVillager61's topic in Modder Support
Like choonster said, you need to cast it in the return statement instead of using (T), not change the if statement. -
[1.11.2] [Unsolved] Accessing an entity's gui container
Jay Avery replied to OrangeVillager61's topic in Modder Support
No, you are trying to call cast on your item_handler. The method is called from CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, with your item_handler as the argument. -
Please post your most up to date code and error logs. A screenshot of your resources folder structure will probably help too.
-
Personally I use custom packets more because I find it easier to understand what's going on when I've created it from scratch, rather than adapting vanilla things.
-
First you need to create and register a packet according to the docs. The packet should contain the position of the TE and the data that needs to be updated, and the handler should process the packet by updating the TE at the given location with the given data. Then inside the TE, when the data changes that needs to be displayed on the GUI, you send a packet. It only needs to go from server->client, so check for !world.isRemote (sending from the server), then create a packet and sendToAll (every client needs to have their TE information updated). Here is an example from my mod: Here is the method where I send the packet, inside the TE. Here is the class where I register packets and network channel. Here is the packet and handler.
-
Problem using "gradlew setupDecompWorkspace" Forge 1.7.10
Jay Avery replied to Cmonster's topic in Modder Support
1.7.10 is no longer supported on this forum, your thread will be closed. If you're just starting modding, you should use the most up-to-date version. -
Why do you want your fog density to be zero? That's essentially the same as there being no fog (minus the buggy sky), so if you want density zero why not just remove the fog?
-
[1.8.9] Slabs dropping their item when doubled
Jay Avery replied to blahblahbal's topic in Modder Support
This is nothing to do with your custom slabs/blocks, it will be a problem with your HarvestDropsEvent. Step through in the debugger to see what's going wrong. Edit: I was wrong! And beaten to it. -
Sounds like a problem with server/client syncing. Assuming you do your main TE behaviour on the server side (!world.isRemote) as recommended, you'll need to send packets to the client whenever the values that need to be displayed are changed. The forge docs cover the basics of using packets which should get you started.
-
What do you mean by 'it did not work'? What happens that's different from what you want/expect?
-
[1.8.9] Slabs dropping their item when doubled
Jay Avery replied to blahblahbal's topic in Modder Support
You can't use the == operator to check whether these strings match. == only checks for object identity, which will always be false when you're comparing a substring to a test string. To do what you're trying to do, you can use String#startsWith. With that said, your entire approach to finding the block type seems incredibly flawed. Whatever tutorial you used.. it was terrible. There's a whole mess of inefficient and unnecessary things going on. This entire method is completely excessive. It's "Stringly typing" and will be very error prone. All you need to do is directly associate the item with the block somehow, like using a single instance method which returns each block's own item. In that method, you use Block.getIdFromBlock as an instance method, but it's static. Any IDE worth its salt should be able to warn you about doing this. ItemStack i = new ItemStack(GameRegistry.findItem("blahmod", blockId.substring(7)), 2); In this line you pointlessly create a new ItemStack only to use getItem on it. The result is identical to simply returning the Item parameter you use in the stack constructor, which ignores stack size (presumably that was an attempt to get it to drop two when doubled). In these two methods you are using raw types when you should be using a type parameter. -
Are you sure? Can you post the whole console output? Also, where and how do you register you item model?
-
Error with the event itemInteractionForEntity
Jay Avery replied to HexNation's topic in Modder Support
You use an instanceof check. -
Error with the event itemInteractionForEntity
Jay Avery replied to HexNation's topic in Modder Support
That's because EntityCow is not a variable, it's a class. If you don't understand what this means, you need to learn more Java fundamentals before you will be able to make a mod. -
For an item you can use itemInteractionForEntity - the way ItemShears works on sheep.
-
PlayerInteractEvent.EntityInteract is fired when the player right-clicks any entity, and has a target field.
-
[1.11.2] Blockstate resets on world reload
Jay Avery replied to BeardlessBrady's topic in Modder Support
Your to and from meta methods don't store the state properly. When reading from meta, you always set the TWOTALL property to ONE, and when writing to meta you ignore the TWOTALL property anyway. If you want that property to be stored, you need to save its value in metadata and then read it back the same way. -
Assigning different models to different blockstates of a block
Jay Avery replied to Poseidon5001's topic in Modder Support
Oh yes, it's the way the variants are defined. I wrote a post here about the way forge distinguishes partially- and fully-defined variants. -
Assigning different models to different blockstates of a block
Jay Avery replied to Poseidon5001's topic in Modder Support
Actually I think the lowercase restriction might only be enforced in 1.11+, my mistake. What are the latest error logs? -
Assigning different models to different blockstates of a block
Jay Avery replied to Poseidon5001's topic in Modder Support
Your blockstates file itself still has capital letters in the name. If that doesn't solve the issue, post the latest error logs. -
[1.11.2] [Unsolved] Accessing an entity's gui container
Jay Avery replied to OrangeVillager61's topic in Modder Support
>= compares numbers, you can't compare ItemStacks with it. -
Yes, ItemSword is a vanilla class in minecraft. The constructor for that class requires parameters, so you need to manually call super in your own constructor and pass the parameters to it.
-
Your class needs to extend ItemSword, not Item.
-
[1.11.2] Removing creative flying 'drift'?
Jay Avery replied to Isabellav253's topic in Modder Support
The motionX and motionZ fields you delcare in your event handler will have no effect on the player. You can't declare a method inside another method. Even if you moved that method out on its own, it's completely invalid - method parameters go in brackets. These are pretty basic Java issues. I'd recommend you learn some Java fundamentals or you will struggle with modding.