Jump to content

Sawii00

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by Sawii00

  1. Wow! I'll study that! I have not studied capabilities yet, but I'll try to understand it quickly. Thanks
  2. Actually there must be a way. I just remebered that the MInechem does have something similar for radioactive elements. They decay when outside and "freeze" in the lead chest. Sadly it is not up to date with 1.11 so I cannot find how they did it.. I'll keep looking.
  3. I guess you are right! Did not think of that.... I'm so pissed off right now. I had cool ideas.
  4. I mean, if I can find a way to check the container the item is in, I can just say (if it is not in the fridge) --> rots. This rotten thing is just a variable slowly decreasing its value
  5. Hi, I am proceeding with some more advanced and cool stuff. I am now working on a system where food decays if it is kept in fresh air, and to prevent that you need to place if in a fridge (custom block I made). When the food is rotten, its gonna give almost no food and it poisons the player. My question is: what method can I use to check if it is in that fridge ( it is basically a simple chest (for now)).
  6. Ok, I fixed my problems. I just followed a couple of tutorials and changed the layout of my blockstate. I also worked on the rendering and it is working pretty well.
  7. Mh... I think i'll have to study a little more before doing that. I have no idea how to do what you suggested yet.
  8. I wasn't using any model, I'll replicate and post it in a minute
  9. mhh, makes sense i guess. I understand the itemBlock, but should't the block render at least? or is it all linked?
  10. Ok, I see it's looking for my model in the Item folder, but I do not understand why. I did not set anything...
  11. this is the error I get: [14:25:44] [Client thread/ERROR] [FML]: Exception loading model for variant food:stove#inventory for item "food:stove", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model food:item/stove with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:336) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:156) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_80] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_80] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_80] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_80] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.io.FileNotFoundException: food:models/item/stove.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:126) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:937) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [14:25:44] [Client thread/ERROR] [FML]: Exception loading model for variant food:stove#inventory for item "food:stove", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model food:stove#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:344) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:156) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_80] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_80] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_80] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_80] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [14:25:44] [Client thread/ERROR] [FML]: Exception loading model for variant food:stove#normal for blockstate "food:stove" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model food:stove#normal with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:260) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:248) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:155) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_80] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_80] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_80] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_80] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more I'll try to post something more readable.
  12. Ok makes sense, but I do not think that's is gonna affect the texture. It should not give an error for that, should it??
  13. I was trying to work with blockstates in order to get the block placed depending on the player's facing, but I am having problem s with textures. It looks like I am doing wrong something with models, because If you jsut use blockstates and place the textures in there, I can see the block, although it places always facing north. If I try to use models, I always get the purple/black texture. stove.json(model) { "parent": "block/cube", "textures": { "particle": "blocks/stove/2", "side": "blocks/stove/3", "top": "blocks/stove/1", "front": "blocks/stove/2" } } stove.json(blockstate) { "variants": { "facing=south": { "model": "stove"}, "facing=west": { "model": "stove"}, "facing=north": { "model": "stove"}, "facing=east": { "model": "stove"} } } I tried to look up the vanilla code, and I don't see particular differences in model/blockstate. Thank you for your patience
  14. perfect, I'll try that too. For now this method works because I have just one Item I want to check, but Is there a way to add the pan (or any other item that goes in that single slot) inside a recipe? I that case I would not have to check for the content of the slot but I would just check the whole recipe. I will have probably to change the addRecipe method so that I can consider that extra slot.
  15. you are perfectly right, I am trying to read some of the code, sometimes it is hard to find something in all that mess xD. Thanks for the clarification
  16. Apprently it's working! Thank you really much for your time. Do you have any idea how to change the place behavior for blocks? At this point, My texture is always oriented in a certain way independently of how you place the block. When you place a furnace, the front face is always facing you, but with my oven, it always faces north. I heard there is some kind of method to implement?
  17. Silly me... thanks for your patience.
  18. I made some progress. I tried to extract the ItemStack, and if I try to println what's inside the slot, i see this. (1xitem.pan@0) which I think is my pan. The problem is that if I try to put it in this if statement, it doesn't work. if(craftMatrixSingleSlot.getStackInSlot(0) == new ItemStack(ItemHandler.pan)){ System.out.println("PAN IN SLOT"); this.craftResult.setInventorySlotContents(0, StoveCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix,this.craftMatrixSingleSlot, this.world)); } Not even the println works Am I doing anything wrong?
  19. Do you have any idea how to extract the content of that single slot?
  20. I mean, I know what a field is, but do you mean a Slot field??
  21. package com.sawii00.food.container; import com.sawii00.food.crafting.StoveCraftingManager; import com.sawii00.food.handlers.BlockHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerStove extends Container{ public InventoryCrafting craftMatrix; public IInventory craftResult; public World world; private final BlockPos pos; public ContainerStove(InventoryPlayer playerInv, World world, BlockPos pos) { this.world = world; craftMatrix = new InventoryCrafting(this,3,3); craftResult = new InventoryCraftResult(); this.pos = pos; this.addSlotToContainer(new SlotCrafting(playerInv.player,craftMatrix, craftResult, 0,124,35 )); this.addSlotToContainer(new Slot(new InventoryCrafting(this, 1,1),0,8,35)); //crafting table, slot 36-44 for (int y = 0; y < 3; ++y) { for (int x = 0; x < 3; ++x) { this.addSlotToContainer(new Slot(craftMatrix, (x + y * 3), 36 + x * 18, 17 + y * 18)); } } // Player Inventory, Slot 9-35, Slot IDs 9-35 for (int y = 0; y < 3; ++y) { for (int x = 0; x < 9; ++x) { this.addSlotToContainer(new Slot(playerInv, x + y * 9 + 9, 8 + x * 18, 84 + y * 18)); } } // Player Inventory, Slot 0-8, Slot IDs 36-44 for (int x = 0; x < 9; ++x) { this.addSlotToContainer(new Slot(playerInv, x, 8 + x * 18, 142)); } onCraftMatrixChanged(craftMatrix); } @Override public boolean canInteractWith(EntityPlayer playerIn) { if(world.getBlockState(pos).getBlock()!= BlockHandler.stove){ return false; }else{return playerIn.getDistanceSq(pos)<= 64.00;} } public void onCraftMatrixChanged(IInventory inventoryIn) { // this.craftResult.setInventorySlotContents(0, StoveCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.world)); } public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = (Slot)this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index == 0) { itemstack1.getItem().onCreated(itemstack1, this.world, playerIn); if (!this.mergeItemStack(itemstack1, 10, 46, true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if (index >= 10 && index < 37) { if (!this.mergeItemStack(itemstack1, 37, 46, false)) { return ItemStack.EMPTY; } } else if (index >= 37 && index < 46) { if (!this.mergeItemStack(itemstack1, 10, 37, false)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 10, 46, false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } ItemStack itemstack2 = slot.onTake(playerIn, itemstack1); if (index == 0) { playerIn.dropItem(itemstack2, false); } } return itemstack; } public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); if (!this.world.isRemote) { for (int i = 0; i < 9; ++i) { ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i); if (!itemstack.isEmpty()) { playerIn.dropItem(itemstack, false); } } } } } this is my container. My problem is that I don't really know how to work with that extra slot. Did I declare it right? I think it is stupid to declare it as acrafting grid 1x1. What is the first parameter in the slot constructor?
  22. Wow thank you very much for this quick answer! I'll try to do as you said, but still I haven't understood very well how I can handle that extra slot.
  23. Hey, thank you for opening my post. I started playing with mods a couple of weeks ago, and I still have a ton to learn. My last project was a basic food mod, but I also wanted to add some cool machinery. The first block I'd like to add is an oven, where you would be able to cook food. (smart isn't it!). I have already made all the block and, in theory I also have the gui and container working, although I am not sure about that implementation. My crafting interface would be a normal 3x3 crafting table but with an extra slot where you can place different items such as a frying pan. My issue is that I have no idea how to make my own craftingManager with a 3x3 and an extra slot. I would greatly appreciate any help. If you need some of my code let me know. p.s that extra slot would only accept a few items, so maybe there is a way to check that separately. I really do not know.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.