mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +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
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
|
||||||
BlockPlant wild = (BlockPlant) state.getValue(TYPE).wildVersionOf;
|
BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion();
|
||||||
return new ItemStack(wild.seedItem);
|
return new ItemStack(normal.seedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,7 +69,8 @@ public class BlockWildPlant extends BlockBushBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
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
|
@Override
|
||||||
|
@ -90,7 +91,7 @@ public class BlockWildPlant extends BlockBushBase{
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering(){
|
||||||
for(int i = 0; i < ALL_WILD_PLANTS.length; i++){
|
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
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
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{
|
public static class TheItemBlock extends ItemBlockBase{
|
||||||
|
@ -125,7 +126,7 @@ public class BlockWildPlant extends BlockBushBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
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;
|
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheWildPlants implements IStringSerializable{
|
public enum TheWildPlants implements IStringSerializable {
|
||||||
|
|
||||||
CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola),
|
CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola),
|
||||||
FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax),
|
FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax),
|
||||||
RICE("rice", EnumRarity.RARE, InitBlocks.blockRice),
|
RICE("rice", EnumRarity.RARE, InitBlocks.blockRice),
|
||||||
COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee);
|
COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee);
|
||||||
|
|
||||||
public final String name;
|
final String name;
|
||||||
public final EnumRarity rarity;
|
final EnumRarity rarity;
|
||||||
public final Block wildVersionOf;
|
final Block normal;
|
||||||
|
|
||||||
TheWildPlants(String name, EnumRarity rarity, Block wildVersionOf){
|
TheWildPlants(String name, EnumRarity rarity, Block normal) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
this.wildVersionOf = wildVersionOf;
|
this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(){
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EnumRarity getRarity() {
|
||||||
|
return rarity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getNormalVersion() {
|
||||||
|
return normal;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue