Jump to content

dakamojo

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by dakamojo

  1. That explains a lot. Based on this I learned that itemStack.getItem() returns an item with no NBT? Because this works... stack.getItem().getHarvestLevel(stack, "pickaxe", null, null); but this doesn't... isToolValid(stack.getItem()); private boolean isToolValid(Item tool) { tool.getHarvestLevel(new ItemStack(tool), "pickaxe", null, null); ... }
  2. Correct. I tried supplying an ItemStack with the tool also but still get a harvest level of zero.
  3. When my gui is open, there are no tool tips, not even on the items in the player inventory. I don't want to add anything to the tool tips, they are just missing. Is there something basic I need to do to enable tool tips? Why isn't it on by default?
  4. This may be a Tinkers Construct specific question, but maybe not. My machine accepts a pickaxe (similar to a Ender IO Farming Station). I want to limit the harvest level of the pickaxes that are inserted into it. I get the tool harvest level like this. tool.getHarvestLevel(ItemStack.EMPTY, "pickaxe", null, null) This works for all vanilla pickaxes and many mod pickaxes. However all Tinker's pickaxes return a harvest level of 0. Is there a way I can get the true harvest level of a Tinker's tool? I would prefer to not have to add the Tinkers API.
  5. I'm not completely able to follow the logic in your helper class. Here is what I think you are doing. Please correct me where I am wrong. I'm using the ores in your mod as an example. 1) You have an ItemRawOre that implements subtypes. I didn't create a ItemMiner because the generic BlockItem seems to work fine. When each of the three variants of my block are mined, I get BlockItems of the three variants. Is creating a custom Item required? 2) You register all the ItemRawOre variants by calling EasyRegistry#registerItemWithVariants. 3) This loops through each of the subTypes of ItemRawOre calling ModelLoader#setCustomModelResourceLocation for each one. 4) Each one of the subTypes has its own blockState json file. Assuming all that is correct, here's what I don't understand. Why can I define one blockState json file for all the variants of my block in world, but I would need a different blockState json file for each of the variants in inventory?
  6. Here is my current blockstates file. { "forge_marker": 1, "defaults": { "model": "earlygameminer:miner" }, "variants": { "inventory": { "model": "cube_all", "textures": { "all": "blocks/dirt" } }, "variant": { "stone": { "textures": { "top": "blocks/stone", "side": "earlygameminer:blocks/miner_stone_side" } }, "iron": { "textures": { "top": "blocks/iron_block", "side": "earlygameminer:blocks/miner_iron_side" } }, "diamond": { "textures": { "top": "blocks/diamond_block", "side": "earlygameminer:blocks/miner_diamond_side" } } } } } My block has three versions (stone, iron, and diamond) which is indicated by an iProperty named "variant". All three varients render correctly in world. However in inventory only the "inventory" section is used. I set it as dirt so that I could see it is actually working. What is the syntax to have the inventory use the exact same logic as when placed? My block code is modeled after BlockPlanks. However I can't seem to understand where BlockPlanks sets up its blockstates file.
  7. Thanks. Saw ItemColored but dismissed it because of the name "color". But after looking at the implementation it makes sense. Thanks again.
  8. I have a block that has three levels, stone, iron, and diamond. I have been coding this as one block with a PropertyInteger to specify the level. Then I noticed hasSubtypes. This sounds like something I maybe should be using. What are subtypes for?
  9. Right now I have a generic ItemBlock registered for my Block. event.getRegistry().register(new ItemBlock(Blocks.miner).setRegistryName(Blocks.miner.getRegistryName())); My Block makes use of a PropertyInteger. When my Block is broken I need the dropped item to preserve that value so that when it is placed again the new block will have the same value. How do I do this? Do I need to create my own ItemBlock? Does anyone have an easy example of this that I can look at?
  10. What are the possible keys in the texture section of a model json file? Is it documented anywhere? For example I want all side to use the same texture (not not top and bottom). Is there a cleaner way than this? I tired the key "side" but it didn't work. { "parent": "block/cube_all", "textures": { "up": "blocks/stone", "down": "blocks/stone", "east": "earlygameminer:blocks/miner_stone_side", "west": "earlygameminer:blocks/miner_stone_side", "north": "earlygameminer:blocks/miner_stone_side", "south": "earlygameminer:blocks/miner_stone_side" } }
  11. I'm considering making a machine that slowly scans for a stronghold. I am thinking that the machine will be powered by eyes of ender. It would replace the act of throwing the eye of ender. Sit the machine down in your base and feed it and slowly it scans chunks to fid the stronghold. My question is how should it actually find the stronghold? I scanned the World code but I don't see anything that tells me where the stronghold is. Would I need to load each chunk and scan block by block to find end portal blocks? Any recommendations?
  12. This seems like something I can do rather than spawning the drops and capturing them. What are the recommendations against this?
  13. Let me clarify further. I don't want to change what happens when the block breaks. I don't want to break the block at all. I want to know what would drop if the block were to break.
  14. My bad. I guess the correct thing to say is a class that is registered for the HarvestDropsEvent event. MinecraftForge.EVENT_BUS.register(new BlockBreakHandler()); public class BlockBreakHandler { @SubscribeEvent public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) { if (!event.isSilkTouching() && OreDictUtils.isOre(event.getState(), "oreRuby")) { event.getDrops().add(ItemGems.getGemByName("red_garnet").copy()); } } }
  15. My machine harvests the drop from a block without breaking it. I'm using Block#getDrops to figure out what drops from each block. However, some blocks implement a BlockBreakHandler (TechReborn for oreRuby is an example). The drops from this are not getting return in getDrops. How should I be getting the drops from a block as if it were broken?
  16. Thanks that was exactly what I needed.
  17. I have a machine with a slot that I want to only allow pickaxes. When the user attempts to insert into the slot I test if the item extends ItemPickaxe. This works with vanilla and some mod pickaxes. However some mods (Actually Additions and Mekanism are two examples) create pickaxes that just extend ItemTool. Is there a better mostly universal way to tell if an item is a pickaxe?
  18. So if I understand both of you, the trick is in getCapability to return one version of the ItemStackHandler if it is a player accessing it, and another if it is not. From Draco's code... if(facing == null) { return (T) new CombinedInvWrapper(inputSlot, outputSlotWrapper); } if(facing == EnumFacing.UP) { return (T) inputSlot; } if(facing == EnumFacing.DOWN) { return (T) outputSlotWrapper; } So if facing is null that is the indication that it is a player accessing it?
  19. I'm creating a te that has a slot for a pickaxe. I want a hopper or other automation to be able to insert into the slot, but I don't want a hopper underneath to pull the tool out of the slot. But the player should be able to pull the tool out. So I considered overriding extractItem on my ItemStackHandler to return false. But I don't see how to tell if it is automation or the player that is trying to extract. Basically slot 0 needs to allow automation in, but not out. Allow player in and out. Slot 1 needs to allow automation out, but not in. Allow player out but not in.
  20. I haven't been modding it quite a while. I think the last time I worked on a mod was for MC version 1.3.2. I'm getting the itch again and want to get back into it. I see a lot of mod developers have created their own helper libraries, but the best I can tell these are rarely used by other developers. Are there any helper libraries that are generally used and recommended? And specifically is there any library that aids in the gui side? Something that has support for tabs, configuring sides (like ThermalExpansion, EnderIO, so forth), and a library of widgets?
×
×
  • Create New...

Important Information

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