Jump to content

American2050

Members
  • Posts

    553
  • Joined

Everything posted by American2050

  1. This will only do it if the player can hold it, otherway it will drop the items to the floor. I was trying to prevent that, but I guess I can implement my of checks in order to determine if the player will be able to hold it.
  2. So I was using addItemStackToInventory on the player inventory. However I noticed it only returns true if there is an empty slot. But it doesn't return true in the case there is already some stack with that item and still room for it. (Or it's returning true, but not actually adding the stack) Doing some testing still. Is there other method that would do this?
  3. THANKS YOU!!! Finally a fix Calling it from the ModelRegistryEvent did the trick. Thanks you very very very much!!!
  4. We need the crashlog. But probably it's due to this: EntityLivingBase target = (EntityLivingBase) Minecraft.getMinecraft().pointedEntity; offhand.hitEntity(target, player); You need to make sure that is not null. (As you mention, that would be the case when you not facing an entity) Now in Minecraft, you are able to swing weapons even without facing entities, so that's something you should look into.
  5. So, if you walk across you don't receive damage, but if you fall from the top yo do? Could it be possible to check where the entity is moving towards (or coming from) and use that to determine damage? Not sure if that could go on the block itself, or if it would have to be on some event.
  6. Do the other mods that add this recipes have a common outcome? Like an OreDictionary thing? Then in those cases you could add your recipes using oredictionary and remove your recipe in case X mod is also running on the pack. Other idea could be create an intermediate block, like Soul Sand + Gravel + Sand and use that block to smelt into your item.
  7. I believe you have to override the onBlockDestroyed method and destroy the 8 blocks around the one that the hammer itself broke. You need to know somehow what side did the player break this block from to determine in which direction you going to destroy the other 8. Back in 1.8.9 MovingObjectPosition was one way to do it. Not sure on 1.10.2 what works.
  8. Ok gonna give that a try and see how it goes. Thanks
  9. Tried like: LogHelper.info("Model Bakery & Model Loader"); ModelBakery.registerItemVariants(ModItems.ANOTHER_DUMMY, new ModelResourceLocation(ModInfo.MODID + ":another_dummy_on", "inventory"), new ModelResourceLocation(ModInfo.MODID + ":another_dummy_off", "inventory")); ModelBakery.registerItemVariants(ModItems.DUMMY, new ModelResourceLocation(ModInfo.MODID + ":dummy_on", "inventory"), new ModelResourceLocation(ModInfo.MODID + ":dummy_off", "inventory")); ItemMeshDefinition modelsHandler = new ModelsHandler(); ModelLoader.setCustomMeshDefinition(ModItems.ANOTHER_DUMMY, modelsHandler); ModelLoader.setCustomMeshDefinition(ModItems.DUMMY, modelsHandler); All of that in preInit. Still same issue, the first item renders correctly, the 2nd does not. I believe I already tried, but... It's ok that the handler is the same? This is the ItemDummy class. Just in case, I don't know if the problem could be here... public class ItemDummy extends ItemGenericNoModel{ public static final String TAG = "dummy"; public static final String STATE = "dummy.state"; public ItemDummy(String name, boolean andRegister) { super(name, andRegister); this.setMaxStackSize(1); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn){ ItemStack stack = playerIn.getHeldItem(handIn); if(!worldIn.isRemote && playerIn.isSneaking()){ MCHelper.setBooleanToStackNBT(stack, TAG, STATE, !MCHelper.getBooleanFromStackNBT(stack, TAG, STATE)); } return new ActionResult<ItemStack>(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); } @Override public void onCreated(ItemStack itemStack, World worldIn, EntityPlayer playerIn){ MCHelper.createNBTData(itemStack, TAG, STATE, false); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { tooltip.add("Sneak Right Click to change state"); if(MCHelper.getBooleanFromStackNBT(stack, TAG, STATE)) { tooltip.add("Active"); } else { tooltip.add("Inactive"); } } } Thanks a lot for the help. I'm really confuse about this, specially with no error showing on console to help decode where the error is.
  10. They are items, so no blockstates. But the .json files on models/item look like another_dummy_off.json { "parent": "item/generated", "textures": { "layer0": "machinecards:items/dummy_off" } } another_dummy_on.json & another_dummy.json { "parent": "item/generated", "textures": { "layer0": "machinecards:items/dummy_on" } } dummy_off.json { "parent": "item/generated", "textures": { "layer0": "machinecards:items/dummy_off" } } dummy_on.json & dummy.json { "parent": "item/generated", "textures": { "layer0": "machinecards:items/dummy_on" } } Could the problem be in this files? That's something I haven't thought of, as the textures works if I change the order I register them. PS: One thing I noticed is that the items with broken textures aren't even calling the Model Handler class. No idea why
  11. Ohh thanks, gonna look into that. I can't believe I missed that detail after all the times I checked over and over
  12. Usually don't like to bump stuff but anyone? Still can't figure out what's going on here and what I'm doing wrong. Thanks and Merry XMas to everyone
  13. Try with something like @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { if(slotChanged){ return true; } return false; } Or adjust it to return true whenever you consider it necessary. I have it like @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { if(slotChanged || (oldStack.getItem() != newStack.getItem())){ return true; } return false; } On my last example the mistake it that it wont case the animation if I change between 2 slots with the same item checked. (But that's fixable)
  14. So I remember I read somewhere last week that we shouldn't BlockContainer when out block has a TileEntity and that we should Overrider instead this 2 methods. hasTileEntity and createTileEntity Which worked perfectly. But today I was doing the exact same I did on the other mod I was trying it, but it didn't worked. After triple checking everything I was thinking... nothing changed, so why the hell this is not working... All the sudden I thought to check the Super Implementation and I saw that in one of my environments it was Deprecated. Reading one of the descriptions I see: (Not 100% sure what the last line means) But yes, then I went and implement ITileEntityProvider and added only the method createNewTileEntity And everything works. Now sadly I don't remember where I read about not using extends BlockContainer, but I believe they also mentioned there to not implement ITileEntityProvider but just override the 2 methods I mention above. So not my question is, why it changed back to the use of ITileEntityProvider. Are we ok implementing that? Why were the other 2 methods Deprecated? PS: Finally I think I need to find the way to let my software warm me somehow when I'm overriding deprecated methods
  15. By adding all this on the item json it's working now... , "display": { "gui": { "rotation": [ 30, 225, 0 ], "translation": [ 0, 0, 0], "scale":[ 0.625, 0.625, 0.625 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0], "scale":[ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 0, 0], "scale":[ 0.5, 0.5, 0.5 ] }, "thirdperson_righthand": { "rotation": [ 75, 45, 0 ], "translation": [ 0, 2.5, 0], "scale": [ 0.375, 0.375, 0.375 ] }, "firstperson_righthand": { "rotation": [ 0, 45, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.40, 0.40, 0.40 ] }, "firstperson_lefthand": { "rotation": [ 0, 225, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.40, 0.40, 0.40 ] } } } I wonder why when I added the 3rd person view it wasn't reading it. I guess I was using old MC version one or probably some error somewhere.
  16. Sorry I know this has been asked many times in the past, including from me back in 1.8.9 but since stuff has changed I have to ask it again. I don't know the reason on why this just isn't working. I have a custom model block, it renders ok on the world, in render "kinda" ok on players hand (Just too big) but on inventory in renders flat. I believe the json file on "item" inside models isn't even been called for some reason, as apparently even adding 3rd person display values there got ignored. This is the block class: package com.mramericanmike.aim.blocks; import com.mramericanmike.aim.AIM; import com.mramericanmike.aim.ModInfo; import com.mramericanmike.aim.init.ModBlocks; import com.mramericanmike.aim.init.ModItems; import com.mramericanmike.aim.util.IHasModel; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockChamber extends GenericModBlock implements IHasModel{ public BlockChamber(Material materialIn, String name) { super(materialIn, name); this.setSoundType(SoundType.METAL); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { return false; } @Override public void registerModels() { AIM.proxy.registerItemRenderer(Item.getItemFromBlock(this ), 0); } /** * Used to determine ambient occlusion and culling when rebuilding chunks for render */ public boolean isOpaqueCube(IBlockState state) { return false; } public boolean isFullCube(IBlockState state) { return false; } @SideOnly(Side.CLIENT) @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } } This is what registerItemRenderer on Client Proxy is doing: @Override public void registerItemRenderer(Item item, int meta) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); } And all that is been called from a Registry Handler @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event){ event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event){ event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } The jsons are: blockstates: chamber.json { "variants": { "normal": { "model": "aim:chamber" } } } models/block: chamber.json { "textures": { "particle": "aim:blocks/chamber", "0": "aim:blocks/amaringo_block", "1": "aim:blocks/negringo_block", "2": "blocks/obsidian", "3": "aim:blocks/verdingo_block" }, "elements": [ { "name": "Cube", "from": [ 0.0, 1.0, 0.0 ], "to": [ 16.0, 3.0, 16.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 1.0, 16.0, 3.0 ] }, "east": { "texture": "#0", "uv": [ 0.0, 1.0, 16.0, 3.0 ] }, "south": { "texture": "#0", "uv": [ 0.0, 1.0, 16.0, 3.0 ] }, "west": { "texture": "#0", "uv": [ 0.0, 1.0, 16.0, 3.0 ] }, "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } }, { "name": "Cube", "from": [ 2.0, 0.0, 1.0 ], "to": [ 14.0, 1.0, 2.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] } } }, { "name": "Cube", "from": [ 2.0, 0.0, 14.0 ], "to": [ 14.0, 1.0, 15.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] } } }, { "name": "Cube", "from": [ 1.0, 0.0, 2.0 ], "to": [ 2.0, 1.0, 14.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "up": { "texture": "#1", "uv": [ 1.0, 0.0, 2.0, 12.0 ] }, "down": { "texture": "#1", "uv": [ 1.0, 0.0, 2.0, 12.0 ] } } }, { "name": "Cube", "from": [ 14.0, 0.0, 2.0 ], "to": [ 15.0, 1.0, 14.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 1.0, 12.0, 2.0 ] }, "up": { "texture": "#1", "uv": [ 1.0, 0.0, 2.0, 12.0 ] }, "down": { "texture": "#1", "uv": [ 1.0, 0.0, 2.0, 12.0 ] } } }, { "name": "Cube", "from": [ 1.0, 3.0, 1.0 ], "to": [ 3.0, 11.0, 3.0 ], "faces": { "north": { "texture": "#2", "uv": [ 14.0, 0.0, 16.0, 8.0 ] }, "east": { "texture": "#2", "uv": [ 12.0, 0.0, 14.0, 8.0 ] }, "south": { "texture": "#2", "uv": [ 10.0, 0.0, 12.0, 8.0 ] }, "west": { "texture": "#2", "uv": [ 8.0, 0.0, 10.0, 8.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } } }, { "name": "Cube", "from": [ 13.0, 3.0, 1.0 ], "to": [ 15.0, 11.0, 3.0 ], "faces": { "north": { "texture": "#2", "uv": [ 14.0, 0.0, 16.0, 8.0 ] }, "east": { "texture": "#2", "uv": [ 12.0, 0.0, 14.0, 8.0 ] }, "south": { "texture": "#2", "uv": [ 10.0, 0.0, 12.0, 8.0 ] }, "west": { "texture": "#2", "uv": [ 8.0, 0.0, 10.0, 8.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } } }, { "name": "Cube", "from": [ 13.0, 3.0, 13.0 ], "to": [ 15.0, 11.0, 15.0 ], "faces": { "north": { "texture": "#2", "uv": [ 6.0, 0.0, 8.0, 8.0 ] }, "east": { "texture": "#2", "uv": [ 4.0, 0.0, 6.0, 8.0 ] }, "south": { "texture": "#2", "uv": [ 2.0, 0.0, 4.0, 8.0 ] }, "west": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 8.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } } }, { "name": "Cube", "from": [ 1.0, 3.0, 13.0 ], "to": [ 3.0, 11.0, 15.0 ], "faces": { "north": { "texture": "#2", "uv": [ 6.0, 0.0, 8.0, 8.0 ] }, "east": { "texture": "#2", "uv": [ 4.0, 0.0, 6.0, 8.0 ] }, "south": { "texture": "#2", "uv": [ 2.0, 0.0, 4.0, 8.0 ] }, "west": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 8.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } } }, { "name": "Cube", "from": [ 0.0, 15.0, 0.0 ], "to": [ 16.0, 16.0, 16.0 ], "faces": { "north": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, "east": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, "south": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, "west": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }, "up": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } }, { "name": "Cube", "from": [ 0.0, 11.0, 0.0 ], "to": [ 16.0, 14.0, 16.0 ], "faces": { "north": { "texture": "#3", "uv": [ 0.0, 9.0, 16.0, 12.0 ] }, "east": { "texture": "#3", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, "south": { "texture": "#3", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, "west": { "texture": "#3", "uv": [ 0.0, 9.0, 16.0, 12.0 ] }, "up": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "#3", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } }, { "name": "Cube", "from": [ 1.0, 14.0, 1.0 ], "to": [ 2.0, 15.0, 2.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Cube", "from": [ 14.0, 14.0, 1.0 ], "to": [ 15.0, 15.0, 2.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Cube", "from": [ 14.0, 14.0, 14.0 ], "to": [ 15.0, 15.0, 15.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Cube", "from": [ 1.0, 14.0, 14.0 ], "to": [ 2.0, 15.0, 15.0 ], "faces": { "north": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } } ] } models/item: chamber.json { "parent": "aim:block/chamber" } The last log: https://pastebin.com/sTTJLjUA
  17. Let me add: I tried now creating separate Mesh handlers for each item (Not the problem) What I do notice is that whatever the 2nd items created is. That texture breaks. LogHelper.info("Model Bakery"); ModelBakery.registerItemVariants(ModItems.DUMMY, new ResourceLocation(ModInfo.MODID, "dummy_on"), new ResourceLocation(ModInfo.MODID, "dummy_off")); ModelBakery.registerItemVariants(ModItems.ANOTHER_DUMMY, new ResourceLocation(ModInfo.MODID, "another_dummy_on"), new ResourceLocation(ModInfo.MODID, "another_dummy_off")); LogHelper.info("Model Loader"); ModelLoader.setCustomMeshDefinition(ModItems.DUMMY, new MeshHandlerDummy()); ModelLoader.setCustomMeshDefinition(ModItems.ANOTHER_DUMMY, new MeshHandlerAnotherDummy()); I got rid of the errors on console by leaving dummy.json and another_dummy.json files on the models (Even they shouldn't be called or used) So not sure what's the problem. I invert the order I call each item and both work, but only the 1st one, the 2nd always show missing textures ingame. The class that manages the textures: (The unified one from OP) public class ItemMeshDefinitionHandler implements ItemMeshDefinition{ @Override public ModelResourceLocation getModelLocation(ItemStack stack) { if(stack.getItem() == ModItems.DUMMY) { if(MCHelper.getBooleanFromStackNBT(stack, ItemDummy.TAG, ItemDummy.STATE)) { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_on", "inventory"); } else { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_off", "inventory"); } } else if(stack.getItem() == ModItems.ANOTHER_DUMMY) { if(MCHelper.getBooleanFromStackNBT(stack, ItemAnotherDummy.TAG, ItemAnotherDummy.STATE)) { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_on", "inventory"); } else { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_off", "inventory"); } } return null; } }
  18. I am having problems when using the ModelBakery.registerItemVariants for more than 1 item. In my main class I have on preInit ModelBakery.registerItemVariants(ModItems.DUMMY, new ResourceLocation(ModInfo.MODID, "dummy_on"), new ResourceLocation(ModInfo.MODID, "dummy_off")); ItemMeshDefinition customMeshDefinition = new ItemMeshDefinitionHandler(); ModelLoader.setCustomMeshDefinition(ModItems.DUMMY, customMeshDefinition); Problem is, when I add one more, for example: ModelBakery.registerItemVariants(ModItems.ANOTHER_DUMMY, new ResourceLocation(ModInfo.MODID, "another_dummy_on"), new ResourceLocation(ModInfo.MODID, "another_dummy_off")); ModelLoader.setCustomMeshDefinition(ModItems.ANOTHER_DUMMY, customMeshDefinition); I get this error on console and the texture breaks. Exception loading model for variant machinecards:dummy#inventory for item "machinecards:dummy", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model machinecards:dummy#inventory with loader VariantLoader.INSTANCE, skipping Why is this happening? Thanks a lot.
  19. Ohh ok. Thanks you.
  20. I have a question, not sure how to handle this. I have an item that opens a GUI when right clicked. The "problem" is... What happens when the player right clicks while holding 1 of this item on each hand? I guess I opening 2 GUI one on top of the other. What would be the best fix? Check for this cases and give priority to one hand over the other?
  21. I need to display a message in players chat with the name of the block.
  22. Thanks. Yes now that you mention it I think that's when it actually broke, when I made the constructor take the int value to define the specific cooldown for each case. Thanks for the advice.
  23. Hey by the way. Thanks for the help, after reading the post and jabelar recommendations I finally got this working. Thanks a lot.
  24. So I'm trying to code a Cobblestone Generator, but after having some problems, I decided to clean up everything and start again from scratch with a TE. I noticed that when placed the update() on the TE works correctly, however when I exit and reload the world, the TE wont start updating until I right click it. (Had it working earlier, not sure how I broke it) What could the problem be? import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ITickable; public class TECobblestoneGenerator extends TileEntity implements ITickable { private int cooldown; private int speed; public TECobblestoneGenerator(int speed){ this.speed = speed; this.cooldown = 0; } public int getCooldown(){ return this.cooldown; } @Override public void update() { if (!this.world.isRemote) { this.cooldown++; System.out.println(cooldown); if(this.cooldown >= this.speed) { this.cooldown = 0; } } } } On the Block class I have: public class CobblestoneGenerator extends GenericModBlock implements ITileEntityProvider{ public CobblestoneGenerator(String name) { super(Material.ROCK, name); this.setUnlocalizedName(ModInfo.MODID + ":" + name); this.setHardness(2.0F); this.setSoundType(SoundType.STONE); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity te = worldIn.getTileEntity(pos); if (te instanceof TECobblestoneGenerator) { TECobblestoneGenerator tileentity = (TECobblestoneGenerator) worldIn.getTileEntity(pos); playerIn.sendMessage(new TextComponentString("Cooldown: " + tileentity.getCooldown())); } return true; } } @Nullable @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TECobblestoneGenerator(128); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } } And for the registry I have: public class ModTE { public static void registerTE() { GameRegistry.registerTileEntity(TECobblestoneGenerator.class, ModInfo.MODID + ":cobblestone_generator"); } } that gets called on the main class at preInit PS: I was having other issues, like not been sure how to save the stack of generated cobbles upon closing the world. But that may come later, as I believe some of the problems were probably caused by this first issue.
  25. Thanks a lot. That worked. Didn't know I could call that from the ItemStack itself Thanks.
×
×
  • Create New...

Important Information

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