@Nonnull @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.getBlockState(pos).getBlock() instanceof BlockCake) { worldIn.setBlockState(pos, FoodCraftReloaded.getLoader(FruitEnumLoader.class).get().getInstanceMap(BlockFruitCake.class).get(fruitType).getDefaultState().withProperty(BlockCake.BITES, worldIn.getBlockState(pos).getValue(BlockCake.BITES))); player.setHeldItem(hand, new ItemStack(FCRItems.GLASS_BOTTLE)); return EnumActionResult.SUCCESS; } return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); }
@Nonnull @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.getBlockState(pos).getBlock() instanceof BlockCake) { worldIn.setBlockState(pos, FoodCraftReloaded.getLoader(VegetableEnumLoader.class).get().getInstanceMap(BlockVegetableCake.class).get(vegetableType).getDefaultState().withProperty(BlockCake.BITES, worldIn.getBlockState(pos).getValue(BlockCake.BITES))); player.setHeldItem(hand, new ItemStack(FCRItems.GLASS_BOTTLE)); return EnumActionResult.SUCCESS; } return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); }
@Nonnull @Override public Map<IBlockState, ModelResourceLocation> getStateModelLocations() { Map<IBlockState, ModelResourceLocation> map = new HashMap<>(); map.put(getDefaultState().withProperty(BlockCake.BITES, 0), new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "fruit_cake"), "bites=0")); for (int j = 1; j <= 6; j++) map.put(getDefaultState().withProperty(BlockCake.BITES, j), new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "fruit_cake"), "bites=" + j)); return map; }
public BlockVegetableCake(VegetableType vegetableType) { super(); setDefaultState(getDefaultState().withProperty(BlockCake.BITES, 0)); setRegistryName(FoodCraftReloaded.MODID, NameBuilder.buildRegistryName(vegetableType.toString(), "cake")); this.vegetableType = vegetableType; }