mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Closes #1156
This commit is contained in:
parent
08d0e8b7fb
commit
f7bebeec7b
2 changed files with 24 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue