Jump to content

Codakid

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Codakid

  1. Well, I ended up figuring it out. Thank you for your help, especially with the predicate.
  2. { "parent": "item/handheld", "textures": { "layer0": "fundamentals:items/myPickaxe" }, "overrides": [ { "predicate": { "fundamentals:dayTime": 0 }, "model": "fundamentals:item/myPickaxe" }, { "predicate": { "fundamentals:dayTime": 1 }, "model": "fundamentals:item/myPickaxe2" } ] } Still getting a purple block. Maybe I am not registering the textures right? Located in Init() in MyMod.java ModelBakery.registerItemVariants(myPickaxe, PickaxeHelper.getModel("myPickaxe"), PickaxeHelper.getModel("myPickaxe2")); GetModel's declaration. public static ModelResourceLocation getModel(String name) { return new ModelResourceLocation(MyMod.MODID + ":"+name, "inventory"); }
  3. I have a mod where a pickaxe changes its textures between night and day. It worked in 1.8 but I am converting it to 1.10. The old methods don't work and I currently am trying to find a way to do so. This was the code responsible for doing this in 1.8. @Override public void onUpdate(ItemStack item, World world, Entity player, int num, boolean bool) { if (world.getWorldTime() % 24000 < 12000) { dayTime = true; } else { dayTime = false; } } @Override public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int usesLeft) { if (dayTime) return new ModelResourceLocation(MyMod.MODID + "myPickaxe", "inventory"); else return new ModelResourceLocation(MyMod.MODID + "myPickaxe2", "inventory"); } Here is my first try at it. public CustomPickaxe() { super(MyMod.myToolMaterial); this.setCreativeTab(CreativeTabs.COMBAT); this.setUnlocalizedName("myPickaxe"); this.addPropertyOverride(new ResourceLocation(MyMod.MODID,"dayTime"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { if(entityIn == null){ return 0.0F; } if(worldIn == null){ worldIn = entityIn.worldObj; } if (PickaxeHelper.isDayTime(worldIn)) { return 0.0F; }else { return 1.0F; } } }); } } And the model file is. { "parent": "item/handheld", "textures": { "layer0": "fundamentals:items/myPickaxe" }, "overrides": [ { "predicate": { "dayTime": 0 }, "model": "fundamentals:item/myPickaxe" }, { "predicate": { "dayTime": 1 }, "model": "fundamentals:item/myPickaxe2" } ] }
×
×
  • Create New...

Important Information

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