diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index 88f2ea0f7..5cf9ef7e6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -56,8 +56,8 @@ public class BlockWildPlant extends BlockBushBase{ @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){ - BlockPlant wild = (BlockPlant) state.getValue(TYPE).wildVersionOf; - return new ItemStack(wild.seedItem); + BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion(); + return new ItemStack(normal.seedItem); } @Override @@ -69,7 +69,8 @@ public class BlockWildPlant extends BlockBushBase{ @Override public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ - state.getValue(TYPE).wildVersionOf.getDrops(drops, world, pos, state.getValue(TYPE).wildVersionOf.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune); + Block normal = state.getValue(TYPE).getNormalVersion(); + normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune); } @Override @@ -90,7 +91,7 @@ public class BlockWildPlant extends BlockBushBase{ @Override public void registerRendering(){ for(int i = 0; i < ALL_WILD_PLANTS.length; i++){ - ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName()+"="+ALL_WILD_PLANTS[i].name); + ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName()+"="+ALL_WILD_PLANTS[i].getName()); } } @@ -111,7 +112,7 @@ public class BlockWildPlant extends BlockBushBase{ @Override public EnumRarity getRarity(ItemStack stack){ - return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].rarity; + return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity(); } public static class TheItemBlock extends ItemBlockBase{ @@ -125,7 +126,7 @@ public class BlockWildPlant extends BlockBushBase{ @Override public String getTranslationKey(ItemStack stack){ - return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].name; + return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].getName(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java index 70b69afbc..1bd899323 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java @@ -10,30 +10,40 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists; +import com.google.common.base.Preconditions; + import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import net.minecraft.block.Block; import net.minecraft.item.EnumRarity; import net.minecraft.util.IStringSerializable; -public enum TheWildPlants implements IStringSerializable{ +public enum TheWildPlants implements IStringSerializable { CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola), FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax), RICE("rice", EnumRarity.RARE, InitBlocks.blockRice), COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee); - public final String name; - public final EnumRarity rarity; - public final Block wildVersionOf; + final String name; + final EnumRarity rarity; + final Block normal; - TheWildPlants(String name, EnumRarity rarity, Block wildVersionOf){ + TheWildPlants(String name, EnumRarity rarity, Block normal) { this.name = name; this.rarity = rarity; - this.wildVersionOf = wildVersionOf; + this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!"); } @Override - public String getName(){ + public String getName() { return this.name; } + + public EnumRarity getRarity() { + return rarity; + } + + public Block getNormalVersion() { + return normal; + } } \ No newline at end of file