This commit is contained in:
Shadows_of_Fire 2018-08-03 22:34:52 -04:00
parent 08d0e8b7fb
commit f7bebeec7b
2 changed files with 24 additions and 13 deletions

View file

@ -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<ItemStack> 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();
}
}
}

View file

@ -10,6 +10,8 @@
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;
@ -22,18 +24,26 @@ public enum TheWildPlants implements IStringSerializable{
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() {
return this.name;
}
public EnumRarity getRarity() {
return rarity;
}
public Block getNormalVersion() {
return normal;
}
}