Eliminate the IRegisterCallback shim

This commit is contained in:
Vincent Lee committed 2016-08-28 10:33:29 -05:00
1 parent e5ec84e040
commit f6a68a0d83
66 files changed
+328 -194

No files matched your search

@@ -39,7 +39,6 @@ public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable
super(Material.WOOD, LibBlockNames.ALF_PORTAL);
setHardness(10F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF));
}
@Nonnull
@@ -62,6 +61,11 @@ public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable
return state.getValue(BotaniaStateProps.ALFPORTAL_STATE).ordinal();
}
@Override
public IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF);
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
@@ -51,7 +51,6 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
super(Material.GRASS, LibBlockNames.ALT_GRASS);
setHardness(0.6F);
setSoundType(SoundType.PLANT);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.DRY));
setTickRandomly(true);
}
@@ -61,6 +60,11 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.ALTGRASS_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.DRY);
}
@Override
public boolean isToolEffective(String type, @Nonnull IBlockState state) {
return type.equals("shovel");
@@ -65,9 +65,6 @@ public class BlockAltar extends BlockMod implements ILexiconable {
super(Material.ROCK, LibBlockNames.ALTAR);
setHardness(3.5F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.DEFAULT)
);
}
@Nonnull
@@ -82,6 +79,12 @@ public class BlockAltar extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.ALTAR_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.DEFAULT);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.ALTAR_VARIANT).ordinal();
@@ -56,7 +56,6 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.AVATAR);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH));
}
@Nonnull
@@ -73,6 +72,11 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -34,7 +34,6 @@ public class BlockCacophonium extends BlockMod {
protected BlockCacophonium() {
super(Material.WOOD, LibBlockNames.CACOPHONIUM);
setHardness(0.8F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -43,6 +42,11 @@ public class BlockCacophonium extends BlockMod {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -37,7 +37,6 @@ public class BlockEnderEye extends BlockMod implements ILexiconable {
setHardness(3F);
setResistance(10F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -46,6 +45,11 @@ public class BlockEnderEye extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
@@ -47,7 +47,6 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
setHardness(1F);
setSoundType(SoundType.WOOD);
MinecraftForge.EVENT_BUS.register(BlockFelPumpkin.class);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -56,6 +55,11 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getHorizontalIndex();
@@ -64,7 +64,6 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
GameRegistry.addRecipe(new SpecialFloatingFlowerRecipe());
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, Category.SHAPELESS, "");
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -38,11 +38,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BlockGaiaHead extends BlockSkull implements IModelRegister, IRegisterCallback {
public class BlockGaiaHead extends BlockSkull implements IModelRegister {
public BlockGaiaHead() {
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD));
GameRegistry.register(this);
setUnlocalizedName(LibBlockNames.GAIA_HEAD);
setHardness(1.0F);
}
@@ -91,9 +91,4 @@ public class BlockGaiaHead extends BlockSkull implements IModelRegister, IRegist
public void registerModels() {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(FACING, NODROP).build());
}
@Override
public void register() {
GameRegistry.register(this);
}
}
@@ -40,18 +40,19 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class BlockGhostRail extends BlockRailBase implements ILexiconable, IRegisterCallback, IModelRegister {
public class BlockGhostRail extends BlockRailBase implements ILexiconable, IModelRegister {
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
public BlockGhostRail() {
super(true);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
MinecraftForge.EVENT_BUS.register(BlockGhostRail.class);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
}
@Nonnull
@@ -113,12 +114,6 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable, IRegi
return BlockRailPowered.SHAPE;
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -62,7 +62,6 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
super(Material.IRON, LibBlockNames.HOURGLASS);
setHardness(2.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -77,6 +76,11 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -44,7 +44,6 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.INCENSE_PLATE);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -53,6 +52,11 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -45,7 +45,6 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.LIGHT_LAUNCHER);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -60,6 +59,11 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -49,7 +49,6 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
protected BlockLightRelay() {
super(Material.GLASS, LibBlockNames.LIGHT_RELAY);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.DEFAULT).withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -64,6 +63,11 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
return new BlockStateContainer(this, BotaniaStateProps.LUMINIZER_VARIANT, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.DEFAULT).withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DETECTOR ? 1 : 0;
@@ -43,7 +43,6 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGROCK_VARIANT, LivingRockVariant.DEFAULT));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.LIVINGROCK_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGROCK_VARIANT, LivingRockVariant.DEFAULT);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.LIVINGROCK_VARIANT).ordinal();
@@ -47,7 +47,6 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
super(Material.WOOD, name);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.DEFAULT));
}
@Nonnull
@@ -56,6 +55,11 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.LIVINGWOOD_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.DEFAULT);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.LIVINGWOOD_VARIANT).ordinal();
@@ -12,6 +12,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
@@ -25,19 +26,23 @@ import vazkii.botania.common.item.block.ItemBlockElven;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class BlockMod extends Block implements IModelRegister, IRegisterCallback {
public abstract class BlockMod extends Block implements IModelRegister {
public BlockMod(Material par2Material, String name) {
super(par2Material);
setUnlocalizedName(name);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(pickDefaultState()); // This MUST happen before registering the block
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
registerItemForm();
if(registerInCreative())
setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
protected IBlockState pickDefaultState() {
return blockState.getBaseState();
}
public void registerItemForm() {
GameRegistry.register(this instanceof IElvenItem ? new ItemBlockElven(this) : new ItemBlockMod(this), getRegistryName());
}
@@ -52,10 +57,4 @@ public class BlockMod extends Block implements IModelRegister, IRegisterCallback
if(Item.getItemFromBlock(this) != null)
ModelHandler.registerBlockToState(this, 0, getDefaultState());
}
@Override
public void register() {
GameRegistry.register(this);
registerItemForm();
}
}
@@ -52,7 +52,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable, IRegisterCallback, IModelRegister {
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable, IModelRegister {
private static final int COUNT = 8;
private final boolean second;
@@ -62,8 +62,10 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
this.setHardness(0.0F);
this.setSoundType(SoundType.PLANT);
String name = LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(pickDefaultState());
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
setUnlocalizedName(name);
setHardness(0F);
setTickRandomly(false);
@@ -74,6 +76,8 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
@Override
public abstract BlockStateContainer createBlockState();
protected abstract IBlockState pickDefaultState();
@Override
public abstract int getMetaFromState(IBlockState state);
@@ -221,12 +225,6 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
return new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getValue(prop).ordinal() - (second ? 8 : 0));
}
@Override
public final void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -16,11 +16,6 @@ import javax.annotation.Nonnull;
public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
public BlockModDoubleFlower1() {
super(false);
setDefaultState(blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.WHITE));
}
@Nonnull
@@ -29,6 +24,15 @@ public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
return new BlockStateContainer(this, FACING, VARIANT, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_1);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getMetadata();
@@ -17,11 +17,6 @@ public class BlockModDoubleFlower2 extends BlockModDoubleFlower {
public BlockModDoubleFlower2() {
super(true);
setDefaultState(blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.SILVER));
}
@Nonnull
@@ -30,6 +25,15 @@ public class BlockModDoubleFlower2 extends BlockModDoubleFlower {
return new BlockStateContainer(this, FACING, VARIANT, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_2);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.SILVER);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2).getMetadata() - 8;
@@ -53,7 +53,7 @@ import javax.annotation.Nonnull;
import java.util.List;
import java.util.Random;
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IRegisterCallback, IModelRegister {
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IModelRegister {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
@@ -63,13 +63,14 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
protected BlockModFlower(String name) {
setUnlocalizedName(name);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
registerItemForm();
setHardness(0F);
setSoundType(SoundType.PLANT);
setTickRandomly(false);
setCreativeTab(registerInCreative() ? BotaniaCreativeTab.INSTANCE : null);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
}
public void registerItemForm() {
@@ -173,12 +174,6 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
world.setBlockState(pos.up(), flower.getDefaultState().withProperty(color.getMetadata() >= 8 ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, color).withProperty(BlockDoublePlant.HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags);
}
@Override
public void register() {
GameRegistry.register(this);
registerItemForm();
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -58,9 +58,6 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
super(Material.WOOD, LibBlockNames.OPEN_CRATE);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.CRATE_VARIANT, CrateVariant.OPEN)
.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE));
}
@Nonnull
@@ -69,6 +66,13 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
return new BlockStateContainer(this, BotaniaStateProps.CRATE_VARIANT, BotaniaStateProps.CRATE_PATTERN);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.CRATE_VARIANT, CrateVariant.OPEN)
.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CRATE_VARIANT).ordinal();
@@ -58,7 +58,6 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PLATFORM_VARIANT, PlatformVariant.ABSTRUSE));
}
@Nonnull
@@ -68,6 +67,11 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
new IUnlistedProperty[] { BotaniaStateProps.HELD_STATE, BotaniaStateProps.HELD_WORLD, BotaniaStateProps.HELD_POS });
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.PLATFORM_VARIANT, PlatformVariant.ABSTRUSE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.PLATFORM_VARIANT).ordinal();
@@ -53,8 +53,6 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
setHardness(5.5F);
setSoundType(SoundType.METAL);
setLightLevel(0.5F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PYLON_VARIANT, PylonVariant.MANA));
}
@Nonnull
@@ -69,6 +67,11 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
return new BlockStateContainer(this, BotaniaStateProps.PYLON_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.PYLON_VARIANT, PylonVariant.MANA);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.PYLON_VARIANT).ordinal();
@@ -32,11 +32,11 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockSolidVines extends BlockVine implements ILexiconable, IRegisterCallback {
public class BlockSolidVines extends BlockVine implements ILexiconable {
public BlockSolidVines() {
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
GameRegistry.register(this);
setUnlocalizedName(LibBlockNames.SOLID_VINE);
setHardness(0.5F);
setSoundType(SoundType.PLANT);
@@ -66,9 +66,4 @@ public class BlockSolidVines extends BlockVine implements ILexiconable, IRegiste
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.vineBall;
}
@Override
public void register() {
GameRegistry.register(this);
}
}
@@ -48,7 +48,6 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, true));
}
@Nonnull
@@ -63,6 +62,11 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, true);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -65,7 +65,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD, IRegisterCallback, IModelRegister {
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD, IModelRegister {
static {
BotaniaAPI.subtilesForCreativeMenu.addAll(Arrays.asList(
@@ -121,15 +121,15 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
protected BlockSpecialFlower() {
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockSpecialFlower(this), getRegistryName());
setUnlocalizedName(LibBlockNames.SPECIAL_FLOWER);
setHardness(0.1F);
setSoundType(SoundType.PLANT);
setTickRandomly(false);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY)
);
}
@Nonnull
@@ -344,12 +344,6 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockSpecialFlower(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -43,7 +43,6 @@ public class BlockStorage extends BlockMod implements ILexiconable {
setHardness(3F);
setResistance(10F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.MANASTEEL));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockStorage extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.STORAGE_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.MANASTEEL);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.STORAGE_VARIANT).ordinal();
@@ -1,8 +0,0 @@
package vazkii.botania.common.block;
public interface IRegisterCallback {
/**
* Register block and any itemblocks
*/
void register();
}
@@ -180,7 +180,6 @@ import java.util.Set;
public final class ModBlocks {
public static final Set<Block> ALL_BLOCKS = new HashSet<>();
public static Block flower;
public static Block altar;
public static Block livingrock;
@@ -356,14 +355,6 @@ public final class ModBlocks {
ModFluffBlocks.init();
for (Block b : ALL_BLOCKS) {
if (b instanceof IRegisterCallback) {
((IRegisterCallback) b).register();
} else {
throw new RuntimeException(b.getRegistryName() + " doesn't have register callbacks!");
}
}
for(int i = 0; i < 16; i++)
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i));
@@ -49,7 +49,6 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
super(Material.IRON, LibBlockNames.CORPOREA_CRYSTAL_CUBE);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(Properties.StaticProperty, true));
}
@Nonnull
@@ -58,6 +57,11 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
return new ExtendedBlockState(this, new IProperty[] { Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty } );
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(Properties.StaticProperty, true);
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
@@ -35,7 +35,6 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
super(Material.IRON, LibBlockNames.CORPOREA_FUNNEL);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -44,6 +43,11 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -37,7 +37,6 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexi
super(Material.IRON, LibBlockNames.CORPOREA_INTERCEPTOR);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -46,6 +45,11 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexi
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -40,7 +40,6 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable, ICr
super(Material.IRON, LibBlockNames.CORPOREA_RETAINER);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -49,6 +48,11 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable, ICr
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -44,7 +44,6 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CUSTOMBRICK_VARIANT, CustomBrickVariant.HELLISH_BRICK));
}
@Nonnull
@@ -53,6 +52,11 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CUSTOMBRICK_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CUSTOMBRICK_VARIANT, CustomBrickVariant.HELLISH_BRICK);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CUSTOMBRICK_VARIANT).ordinal();
@@ -75,8 +75,6 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
setHardness(0.5F);
setSoundType(SoundType.GROUND);
setLightLevel(1F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -103,6 +101,11 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.ISLAND_TYPE });
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -51,7 +51,6 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
setHardness(5.0F);
setResistance(10.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -60,6 +59,11 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -54,12 +54,11 @@ import java.util.List;
import java.util.Random;
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IRegisterCallback, IModelRegister {
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IModelRegister {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
public BlockModMushroom() {
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.MUSHROOM));
setUnlocalizedName(LibBlockNames.MUSHROOM);
setLightLevel(0.2F);
@@ -68,6 +67,8 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
setTickRandomly(false);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@Nonnull
@@ -157,12 +158,6 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
@Override
public void harvestByHorn(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -43,7 +43,6 @@ public class BlockPavement extends BlockMod {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PAVEMENT_COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockPavement extends BlockMod {
return new BlockStateContainer(this, BotaniaStateProps.PAVEMENT_COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.PAVEMENT_COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.PAVEMENT_COLOR)) {
@@ -44,7 +44,6 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
super(Material.PLANTS, LibBlockNames.PETAL_BLOCK);
setHardness(0.4F);
setSoundType(SoundType.PLANT);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -53,6 +52,11 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -43,7 +43,6 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
setHardness(5F);
setResistance(2000F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -65,6 +64,11 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -47,9 +47,6 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
public BlockTinyPotato() {
super(Material.CLOTH, LibBlockNames.TINY_POTATO);
setHardness(0.25F);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH)
);
}
@Nonnull
@@ -58,6 +55,12 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.CARDINALS)) {
@@ -54,7 +54,6 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
setHardness(5.0F);
setResistance(10.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -63,6 +62,11 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -25,7 +25,6 @@ public class BlockBiomeStoneA extends BlockBiomeStone {
public BlockBiomeStoneA() {
super(LibBlockNames.BIOME_STONE_A);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.FOREST));
}
@Nonnull
@@ -34,6 +33,11 @@ public class BlockBiomeStoneA extends BlockBiomeStone {
return new BlockStateContainer(this, BotaniaStateProps.BIOMESTONE_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.FOREST);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.BIOMESTONE_VARIANT).ordinal();
@@ -25,7 +25,6 @@ public class BlockBiomeStoneB extends BlockBiomeStone {
public BlockBiomeStoneB() {
super(LibBlockNames.BIOME_STONE_B);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMEBRICK_VARIANT, BiomeBrickVariant.FOREST));
}
@Nonnull
@@ -34,6 +33,11 @@ public class BlockBiomeStoneB extends BlockBiomeStone {
return new BlockStateContainer(this, BotaniaStateProps.BIOMEBRICK_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.BIOMEBRICK_VARIANT, BiomeBrickVariant.FOREST);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.BIOMEBRICK_VARIANT).ordinal();
@@ -28,14 +28,15 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class BlockModPane extends BlockPane implements IRegisterCallback, IModelRegister {
public class BlockModPane extends BlockPane implements IModelRegister {
public BlockModPane(Block source) {
super(Material.GLASS, false);
// Backward compat don't kill me
String name = source.getUnlocalizedName().replaceAll("tile.", "") + "Pane";
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
ModBlocks.ALL_BLOCKS.add(this);
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
setUnlocalizedName(name);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setHardness(0.3F);
@@ -55,12 +56,6 @@ public class BlockModPane extends BlockPane implements IRegisterCallback, IModel
return block == ModBlocks.elfGlass || block == ModBlocks.manaGlass || block == ModBlocks.bifrostPerm || super.canPaneConnectTo(world, pos, dir);
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
@Override
public void registerModels() {}
}
@@ -46,7 +46,6 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
this.type = type;
setHardness(0.8F);
setResistance(10F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.QUARTZ_VARIANT, QuartzVariant.NORMAL));
}
@Nonnull
@@ -55,6 +54,11 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.QUARTZ_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.QUARTZ_VARIANT, QuartzVariant.NORMAL);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.QUARTZ_VARIANT).ordinal();
@@ -35,7 +35,7 @@ import javax.annotation.Nonnull;
import java.util.Locale;
import java.util.Random;
public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IModelRegister, IRegisterCallback {
public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IModelRegister {
private final String name;
private final boolean doubleSlab;
@@ -46,13 +46,15 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
this.name = name;
setUnlocalizedName(name);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
ModBlocks.ALL_BLOCKS.add(this);
doubleSlab = full;
if(!full) {
setCreativeTab(BotaniaCreativeTab.INSTANCE);
useNeighborBrightness = true;
}
setDefaultState(blockState.getBaseState().withProperty(HALF, EnumBlockHalf.BOTTOM).withProperty(DUMMY, DummyEnum.SINGLETON));
GameRegistry.register(this);
if (!isDouble())
GameRegistry.register(new ItemBlockModSlab(this), getRegistryName());
}
@Nonnull
@@ -100,13 +102,6 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
return new ItemStack(getSingleBlock());
}
@Override
public void register() {
GameRegistry.register(this);
if (!isDouble())
GameRegistry.register(new ItemBlockModSlab(this), getRegistryName());
}
@Nonnull
@Override
public String getUnlocalizedName(int i) {
@@ -23,12 +23,13 @@ import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
public class BlockModStairs extends BlockStairs implements ILexiconable, IModelRegister, IRegisterCallback {
public class BlockModStairs extends BlockStairs implements ILexiconable, IModelRegister {
public BlockModStairs(IBlockState state, String name) {
super(state);
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
setUnlocalizedName(name);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
useNeighborBrightness = true;
@@ -44,10 +45,4 @@ public class BlockModStairs extends BlockStairs implements ILexiconable, IModelR
public void registerModels() {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
}
@@ -43,7 +43,6 @@ public class BlockBiomeStoneWall extends BlockModWall {
super(ModFluffBlocks.biomeStoneA, 0);
setHardness(1.5F);
setResistance(10F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.FOREST_COBBLE).withProperty(VARIANT, EnumType.NORMAL));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockBiomeStoneWall extends BlockModWall {
return new BlockStateContainer(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST, BotaniaStateProps.BIOMESTONEWALL_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return super.pickDefaultState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.FOREST_COBBLE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.BIOMESTONEWALL_VARIANT).ordinal() - 8;
@@ -40,23 +40,16 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.List;
public abstract class BlockModWall extends BlockWall implements ILexiconable, IModelRegister, IRegisterCallback {
public abstract class BlockModWall extends BlockWall implements ILexiconable, IModelRegister {
public BlockModWall(Block block, int meta) {
super(block);
// For backward compat don't kill me
String name = block.getUnlocalizedName().replaceAll("tile.", "") + meta + "Wall";
setRegistryName(name);
ModBlocks.ALL_BLOCKS.add(this);
setUnlocalizedName(name);
setDefaultState(blockState.getBaseState()
.withProperty(UP, false)
.withProperty(NORTH, false)
.withProperty(SOUTH, false)
.withProperty(WEST, false)
.withProperty(EAST, false)
.withProperty(VARIANT, EnumType.NORMAL)
);
setDefaultState(pickDefaultState());
register();
setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
@@ -77,6 +70,16 @@ public abstract class BlockModWall extends BlockWall implements ILexiconable, IM
return new BlockStateContainer(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST);
}
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(UP, false)
.withProperty(NORTH, false)
.withProperty(SOUTH, false)
.withProperty(WEST, false)
.withProperty(EAST, false)
.withProperty(VARIANT, EnumType.NORMAL);
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
@@ -93,7 +96,6 @@ public abstract class BlockModWall extends BlockWall implements ILexiconable, IM
return true;
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
@@ -51,7 +51,6 @@ public class BlockBellows extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.BELLOWS);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -60,6 +59,11 @@ public class BlockBellows extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -58,7 +58,6 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -67,6 +66,11 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -58,7 +58,6 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
setResistance(5.0F);
setLightLevel(1.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ENCHANTER_DIRECTION, EnumFacing.Axis.X));
}
@Nonnull
@@ -67,6 +66,11 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
return new BlockStateContainer(this, BotaniaStateProps.ENCHANTER_DIRECTION);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.ENCHANTER_DIRECTION, EnumFacing.Axis.X);
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.ENCHANTER_DIRECTION)) {
@@ -59,7 +59,6 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
super(Material.WOOD, LibBlockNames.FOREST_DRUM);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.WILD));
}
@Nonnull
@@ -74,6 +73,11 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
return new BlockStateContainer(this, BotaniaStateProps.DRUM_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.WILD);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.DRUM_VARIANT).ordinal();
@@ -43,7 +43,6 @@ public class BlockManaDetector extends BlockMod implements ILexiconable, IManaCo
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockManaDetector extends BlockMod implements ILexiconable, IManaCo
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -69,9 +69,6 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.POOL_VARIANT, PoolVariant.DEFAULT)
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
BotaniaAPI.blacklistBlockFromMagnet(this, Short.MAX_VALUE);
}
@@ -81,6 +78,13 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
return new BlockStateContainer(this, BotaniaStateProps.POOL_VARIANT, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.POOL_VARIANT, PoolVariant.DEFAULT)
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POOL_VARIANT).ordinal();
@@ -57,10 +57,6 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
setHardness(0.3F);
setSoundType(SoundType.GLASS);
setLightLevel(1.0F);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.POWERED, false)
.withProperty(BotaniaStateProps.HAS_LENS, false)
);
}
@Nonnull
@@ -75,6 +71,13 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
return new BlockStateContainer(this, BotaniaStateProps.POWERED, BotaniaStateProps.HAS_LENS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.POWERED, false)
.withProperty(BotaniaStateProps.HAS_LENS, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return (state.getValue(BotaniaStateProps.POWERED) ? 8 : 0)
@@ -50,7 +50,6 @@ public class BlockPump extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(Properties.StaticProperty, true).withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -59,6 +58,11 @@ public class BlockPump extends BlockMod implements ILexiconable {
return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.CARDINALS, Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty });
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(Properties.StaticProperty, true).withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -59,7 +59,6 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, ILex
super(Material.WOOD, LibBlockNames.SPREADER);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.SPREADER_VARIANT, SpreaderVariant.MANA));
}
@Nonnull
@@ -68,6 +67,11 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, ILex
return new BlockStateContainer(this, BotaniaStateProps.SPREADER_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.SPREADER_VARIANT, SpreaderVariant.MANA);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.SPREADER_VARIANT).ordinal();
@@ -25,7 +25,11 @@ public class BlockRedStringComparator extends BlockRedString {
public BlockRedStringComparator() {
super(LibBlockNames.RED_STRING_COMPARATOR);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN));
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN);
}
@Override
@@ -24,7 +24,11 @@ public class BlockRedStringContainer extends BlockRedString {
public BlockRedStringContainer() {
super(LibBlockNames.RED_STRING_CONTAINER);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN));
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN);
}
@Nonnull
@@ -31,7 +31,6 @@ public class BlockRedStringDispenser extends BlockRedString {
public BlockRedStringDispenser() {
super(LibBlockNames.RED_STRING_DISPENSER);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN).withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -40,6 +39,11 @@ public class BlockRedStringDispenser extends BlockRedString {
return new BlockStateContainer(this, BotaniaStateProps.FACING, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN).withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.FACING).getIndex();
@@ -27,7 +27,11 @@ public class BlockRedStringFertilizer extends BlockRedString implements IGrowabl
public BlockRedStringFertilizer() {
super(LibBlockNames.RED_STRING_FERTILIZER);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN));
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN);
}
@Override
@@ -36,7 +36,6 @@ public class BlockRedStringInterceptor extends BlockRedString {
public BlockRedStringInterceptor() {
super(LibBlockNames.RED_STRING_INTERCEPTOR);
MinecraftForge.EVENT_BUS.register(BlockRedStringInterceptor.class);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN).withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -45,6 +44,11 @@ public class BlockRedStringInterceptor extends BlockRedString {
return new BlockStateContainer(this, BotaniaStateProps.FACING, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN).withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.FACING).getIndex();
@@ -24,7 +24,11 @@ public class BlockRedStringRelay extends BlockRedString {
public BlockRedStringRelay() {
super(LibBlockNames.RED_STRING_RELAY);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN));
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.FACING, EnumFacing.DOWN);
}
@Nonnull