Everything posted by Roboguy99
-
[1.7.10] Getting ItemStack from Slot.
A better method might be to use a setter in your render class and call it from your entity class.
-
[1.7.10] Recipe remover mod
- [1.7.10] Recipe remover mod
- [1.7.10] Recipe remover mod
I put a print line in the beginning of the loop and at the end of every if statement. Only the ones in the loop are visible (either they're so dominant there is no room for the if statement ones or the ifs are returning false). I get spammed with the same result from the loop every time. At least 1 part is working.- [1.7.10] Recipe remover mod
Hmmm... resultStack is set to 1xtile.workbench@0, as expected. recipeResult is set to 1xitem.dyePowder@0. That's obviously not correct.- [1.7.10] Recipe remover mod
Well my code (I've included the entire class below) outputs nothing and doesn't disable the recipe. I've also placed the config file below. Code: Config:- [1.7.10] Recipe remover mod
Ok thanks. I think I've got that working. 1 last thing though (hopefully) - I'm a bit confused with getting the itemstack to compare the stacks. I've got the item using the method you put above but I don't know how to properly compare the stacks. Here is my method:- [1.7.10] Recipe remover mod
Will that work for items too? If not, how can I differentiate?- [1.7.10] Recipe remover mod
Ok I've managed to get the config file working and I have each string from inside of it readily available, and I've got the code to remove the recipe, my problem now is getting the string array from the config file and locating the block associated with it. I'm not really sure how to do this.- [1.7.10] Recipe remover mod
Even better! So does the user just separate each value with a comma in the config?- [1.7.10] Recipe remover mod
Use textual IDs in the form of "minecraft:stone" / "modid:item". It was directed at Draco who just threw a wall of code into his post as an "answer". Ok thanks I should be able to get this to work now, assuming I can figure out how to have an array in a config file (I assume it can't be that hard). Thanks for the help and I'll report back if I need more. EDIT: I can just use a string config and split it into an array.- [1.7.10] Recipe remover mod
Ok so what do I use instead now, especially because I want this to be universal and support all mods? Also, I'm not copying any code (or did you mean you did?)- [1.7.10] Recipe remover mod
Ok thanks. I can probably get a config system working if I look into it (completely new to config files at the moment). Can I still use IDs to remove recipes?- [1.7.10] Recipe remover mod
Sorry my computer freaked out and posted the post before I finished. I've edited it now.- [1.7.10] Recipe remover mod
I want to make a tiny mod which allows you to put a list of IDs (or probably a new system thanks to 1.7) into a config file and then removes the recipe from the game. I'd also really like this to work with mods. How do I set up a config file and how can I remove both vanilla and mod recipes? Any help is appreciated.- Rendering multiple separate GUI elements at once
What I want to is render one GUI background layer which extends GuiContainer with all the slots in the correct place and no other features. I then want any progress bars, gauges, tanks, etc to be their own texture file rendered on top at the given co-ordinates. It's not working as I would like though, as you can see from this image: What should be happening is a grey rectangle box in the middle of the screen somewhere (I haven't been able to fine-tune the location yet because of this bug), which is partially yellow depending on the progress values you give it (haven't coded this in properly so you have to hard-code it). No matter what co-ordinates I specify and no matter what progress I specify the result is always the same as in that image. I've been trying to get this system to work with my generator block first, trying to render the inventory screen and a power bar. I have quite a lot of code so here are the links to each one on my Github repo: Generator GUI class: https://github.com/Roboguy99/Food-Tech/blob/master/src/main/java/roboguy99/foodTech/client/gui/GuiGeneratorBasic.java Base GUI class: https://github.com/Roboguy99/Food-Tech/blob/master/src/main/java/roboguy99/foodTech/client/gui/GuiBase.java Power bar class: https://github.com/Roboguy99/Food-Tech/blob/master/src/main/java/roboguy99/foodTech/client/gui/element/GuiElementPowerHorizontalLarge.java Element base class: https://github.com/Roboguy99/Food-Tech/blob/master/src/main/java/roboguy99/foodTech/client/gui/element/GuiElement.java Power bar texture: https://github.com/Roboguy99/Food-Tech/blob/master/src/main/resources/assets/roboguy99/textures/gui/elements/powerHorizontalLarge.png Inventory screen texture: https://github.com/Roboguy99/Food-Tech/blob/master/src/main/resources/assets/roboguy99/textures/gui/blank.png Sorry about the amount of links there, but I thought it would be easier than uploading all the code into spoilers. If anybody can help, that will be great. Thanks in advance.- Change item damage to represent value
Got it all working now, thanks.- Change item damage to represent value
This bit: public class ItemToolGas extends Item { private int storedGas = 0; That variable is effectively static because ItemToolGas is only ever instantiated once (its a singleton class). Each copy of it that exists in your in-game inventory is actually an instance of ItemStack which references the shared[/s] singleton. Ok so here come the stupid questions from me, starting with how do I fix it? Do I create the field and initiate it in the constructor?- Change item damage to represent value
Ok I'll try and fix those points you put. As for the crash, I don't think it's on startup because it occurs when I right click. Here's my main class anyway: EDIT: I've updated my code to match what it looks like now, and I think I've changed damageItem() to setItemDamage() and overridden the durability bar correctly. I'm unsure what you meant by "The "storedGas" field must not be in your Item class. There will only be one instance of that class. You must always use the damage value." though.- Change item damage to represent value
I'm trying to create an item which, when you right click on a specific block (gas blocks), the block gets removed and the item damage value changes accordingly (like how powered items work). I've got a system which slightly works, except the damage bar goes the wrong way (starts full and empties as you collect gas) and when you fill it with gas the game crashes, giving this obscure error: My item class is as follows: And here's the block class: Does anybody know how I could do this? Thanks.- Creating GUI Slot filter
Ok this looks good, thanks. I haven't had a chance yet but I'll try and get this working.- Creating GUI Slot filter
Hmm ok. I suppose it would make sense to have a look at the code for the furnace container and see how it does that then. I'll have a look and come back here if I need any more help.- Creating GUI Slot filter
Would I use the getItem() function or use .equals() or something else please?- Creating GUI Slot filter
I'm trying to make it so that my GUI slot can only accept certain items. I have created a new class, extended Slot and overwritten isItemValid() to try and do this, however I'm sorta stuck on how to actually set up a filter. My code (below) crashes the game on the line inside the first for loop with a nullPointerException. Any help would be appriciated. Thanks. Code: package roboguy99.foodTech.client.gui; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class FilteredSlot extends Slot { private ItemStack[] allowedItems; private boolean[] filterResponses; public FilteredSlot(IInventory inventory, int id, int x, int y, ItemStack[] allowedItems) { super(inventory, id, x, y); this.allowedItems = allowedItems; } @Override public boolean isItemValid(ItemStack itemstack) { this.filterResponses = new boolean[this.allowedItems.length]; if(this.allowedItems != null) { for(int i = 0; i < this.allowedItems.length; i++) { this.filterResponses[i] = this.allowedItems[i] == itemstack ? true : false; } } if(this.filterResponses != null) { for(int i = 0; i < this.filterResponses.length; i++) { if (this.filterResponses[i] == true) return true; } } return false; } }- Checking emtpty item stack crashes with null pointer exception
Ok, would that just be if(slotBucketOut != null) - [1.7.10] Recipe remover mod
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.