Safety guards for blockstates, remove all useless casts

This commit is contained in:
Vincent Lee committed 2016-01-07 19:55:54 -06:00
1 parent e58eb1b345
commit 20b5743221
45 files changed
+93 -67

No files matched your search

@@ -60,7 +60,7 @@ public class BlockAlfPortal extends BlockModContainer implements IWandable, ILex
@Override
public int getMetaFromState(IBlockState state) {
return ((AlfPortalState) state.getValue(BotaniaStateProps.ALFPORTAL_STATE)).ordinal();
return state.getValue(BotaniaStateProps.ALFPORTAL_STATE).ordinal();
}
@Override
@@ -83,7 +83,7 @@ public class BlockAlfPortal extends BlockModContainer implements IWandable, ILex
@Override
public int getLightValue(IBlockAccess world, BlockPos pos) {
return world.getBlockState(pos).getValue(BotaniaStateProps.ALFPORTAL_STATE) == AlfPortalState.OFF ? 0 : 15;
return world.getBlockState(pos).getBlock() == this && world.getBlockState(pos).getValue(BotaniaStateProps.ALFPORTAL_STATE) != AlfPortalState.OFF ? 15 : 0;
}
}
@@ -56,7 +56,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((AltGrassVariant) state.getValue(BotaniaStateProps.ALTGRASS_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.ALTGRASS_VARIANT).ordinal();
}
@Override
@@ -83,8 +83,8 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if(!world.isRemote && world.getLight(pos.up()) >= 9) {
AltGrassVariant variant = ((AltGrassVariant) state.getValue(BotaniaStateProps.ALTGRASS_VARIANT));
if(!world.isRemote && state.getBlock() == this && world.getLight(pos.up()) >= 9) {
AltGrassVariant variant = state.getValue(BotaniaStateProps.ALTGRASS_VARIANT);
for(int l = 0; l < 4; ++l) {
BlockPos pos1 = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);
@@ -113,7 +113,9 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
@Override
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random r) {
AltGrassVariant variant = ((AltGrassVariant) state.getValue(BotaniaStateProps.ALTGRASS_VARIANT));
if (state.getBlock() != this)
return;
AltGrassVariant variant = state.getValue(BotaniaStateProps.ALTGRASS_VARIANT);
switch(variant) {
case DRY: // Dry
break;
@@ -52,7 +52,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(BotaniaStateProps.CARDINALS)).getHorizontalIndex();
return state.getValue(BotaniaStateProps.CARDINALS).getHorizontalIndex();
}
@Override
@@ -50,7 +50,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((LivingRockVariant) state.getValue(BotaniaStateProps.LIVINGROCK_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.LIVINGROCK_VARIANT).ordinal();
}
@Override
@@ -54,7 +54,7 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((LivingWoodVariant) state.getValue(BotaniaStateProps.LIVINGWOOD_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.LIVINGWOOD_VARIANT).ordinal();
}
@Override
@@ -70,7 +70,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
@Override
@@ -146,7 +146,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
@Override
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
placeDoubleFlower(world, pos, ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)), 1 | 2);
placeDoubleFlower(world, pos, state.getValue(BotaniaStateProps.COLOR), 1 | 2);
}
public static void placeDoubleFlower(World world, BlockPos pos, EnumDyeColor color, int flags) {
@@ -73,7 +73,7 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
@Override
public int getMetaFromState(IBlockState state) {
return ((CrateVariant) state.getValue(BotaniaStateProps.CRATE_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.CRATE_VARIANT).ordinal();
}
@Override
@@ -57,7 +57,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
@Override
public int getMetaFromState(IBlockState state) {
return ((PlatformVariant) state.getValue(BotaniaStateProps.PLATFORM_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.PLATFORM_VARIANT).ordinal();
}
@Override
@@ -92,14 +92,14 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
@Override
public void addCollisionBoxesToList(World par1World, BlockPos pos, IBlockState state, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
PlatformVariant variant = ((PlatformVariant) state.getValue(BotaniaStateProps.PLATFORM_VARIANT));
PlatformVariant variant = state.getValue(BotaniaStateProps.PLATFORM_VARIANT);
if(variant == PlatformVariant.INFRANGIBLE || variant == PlatformVariant.ABSTRUSE && par7Entity != null && par7Entity.posY > pos.getY() + (par7Entity instanceof EntityPlayer ? 2 : 0) && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
super.addCollisionBoxesToList(par1World, pos, state, par5AxisAlignedBB, par6List, par7Entity);
}
@Override
public float getBlockHardness(World par1World, BlockPos pos) {
PlatformVariant variant = ((PlatformVariant) par1World.getBlockState(pos).getValue(BotaniaStateProps.PLATFORM_VARIANT));
PlatformVariant variant = par1World.getBlockState(pos).getValue(BotaniaStateProps.PLATFORM_VARIANT);
return variant == PlatformVariant.INFRANGIBLE ? -1F : super.getBlockHardness(par1World, pos);
}
@@ -110,7 +110,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
PlatformVariant variant = ((PlatformVariant) world.getBlockState(pos).getValue(BotaniaStateProps.PLATFORM_VARIANT));
PlatformVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.PLATFORM_VARIANT);
return variant == PlatformVariant.ABSTRUSE ? LexiconData.platform : variant == PlatformVariant.INFRANGIBLE ? null : LexiconData.spectralPlatform;
}
@@ -61,7 +61,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
@Override
public int getMetaFromState(IBlockState state) {
return ((PylonVariant) state.getValue(BotaniaStateProps.PYLON_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.PYLON_VARIANT).ordinal();
}
@Override
@@ -126,7 +126,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable, IInfu
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
PylonVariant variant = ((PylonVariant) world.getBlockState(pos).getValue(BotaniaStateProps.PYLON_VARIANT));
PylonVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.PYLON_VARIANT);
return variant == PylonVariant.MANA ? LexiconData.pylon : variant == PylonVariant.NATURA ? LexiconData.alfhomancyIntro : LexiconData.gaiaRitual;
}
@@ -147,7 +147,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
@Override
@@ -163,7 +163,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
int currentLight = ((TileSpecialFlower) world.getTileEntity(pos)).getLightValue();
if(currentLight == -1)
currentLight = 0;
return LightHelper.getPackedColor(((EnumDyeColor) world.getBlockState(pos).getValue(BotaniaStateProps.COLOR)), currentLight);
return LightHelper.getPackedColor(world.getBlockState(pos).getValue(BotaniaStateProps.COLOR), currentLight);
}
@Override
@@ -283,7 +283,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
@Override
public int getRenderColor(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR))
return state.getValue(BotaniaStateProps.COLOR)
.getMapColor().colorValue;
}
@@ -297,7 +297,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && stack.getItem() == ModItems.dye) {
EnumDyeColor newColor = EnumDyeColor.byMetadata(stack.getItemDamage());
EnumDyeColor oldColor = ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR));
EnumDyeColor oldColor = state.getValue(BotaniaStateProps.COLOR);
if(newColor != oldColor)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.COLOR, newColor), 1 | 2);
}
@@ -53,7 +53,7 @@ public class BlockStorage extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((Enum) state.getValue(BotaniaStateProps.STORAGE_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.STORAGE_VARIANT).ordinal();
}
@Override
@@ -93,7 +93,7 @@ public class BlockStorage extends BlockMod implements ILexiconable {
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
StorageVariant variant = ((StorageVariant) world.getBlockState(pos).getValue(BotaniaStateProps.STORAGE_VARIANT));
StorageVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.STORAGE_VARIANT);
return variant == StorageVariant.MANASTEEL ? LexiconData.pool : LexiconData.terrasteel;
}
@@ -347,7 +347,7 @@ public final class ModFluffBlocks {
stoneWall = new Block18StoneWall();
count = 0;
for (EnumDyeColor color : ((Collection<EnumDyeColor>) BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues())) {
for (EnumDyeColor color : BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues()) {
pavementStairs[count] = new BlockPavementStairs(color);
pavementSlabs[count] = new BlockPavementSlab(false, color, count);
pavementFullSlabs[count] = new BlockPavementSlab(true, color, count);
@@ -52,7 +52,7 @@ public class Block18Stone extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((FutureStoneVariant) state.getValue(BotaniaStateProps.FUTURESTONE_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.FUTURESTONE_VARIANT).ordinal();
}
@Override
@@ -40,12 +40,12 @@ public class BlockBuriedPetals extends BlockModFlower {
@Override
@Optional.Method(modid = "easycoloredlights")
public int getLightValue(IBlockAccess world, BlockPos pos) {
return ColoredLightHelper.getPackedColor(((EnumDyeColor) world.getBlockState(pos).getValue(BotaniaStateProps.COLOR)), originalLight);
return ColoredLightHelper.getPackedColor(world.getBlockState(pos).getValue(BotaniaStateProps.COLOR), originalLight);
}
@Override
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
EnumDyeColor color = ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR));
EnumDyeColor color = state.getValue(BotaniaStateProps.COLOR);
int hex = color.getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
@@ -52,7 +52,7 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((CustomBrickVariant) state.getValue(BotaniaStateProps.CUSTOMBRICK_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.CUSTOMBRICK_VARIANT).ordinal();
}
@Override
@@ -92,7 +92,7 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
CustomBrickVariant variant = ((CustomBrickVariant) world.getBlockState(pos).getValue(BotaniaStateProps.CUSTOMBRICK_VARIANT));
CustomBrickVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.CUSTOMBRICK_VARIANT);
return variant.getName().contains("azulejo") ? LexiconData.azulejo : LexiconData.decorativeBlocks;
}
@@ -52,7 +52,7 @@ public class BlockEndStoneBrick extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EndBrickVariant) state.getValue(BotaniaStateProps.ENDBRICK_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.ENDBRICK_VARIANT).ordinal();
}
@Override
@@ -59,7 +59,7 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
@Override
@@ -104,7 +104,7 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
@Override
public int getRenderColor(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
@Override
@@ -70,7 +70,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
@Override
@@ -117,7 +117,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
@Override
@Optional.Method(modid = "easycoloredlights")
public int getLightValue(IBlockAccess world, BlockPos pos) {
return ColoredLightHelper.getPackedColor(((EnumDyeColor) world.getBlockState(pos).getValue(BotaniaStateProps.COLOR)), originalLight);
return ColoredLightHelper.getPackedColor(world.getBlockState(pos).getValue(BotaniaStateProps.COLOR), originalLight);
}
@Override
@@ -127,7 +127,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
@Override
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
int hex = ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
int hex = state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
@@ -53,7 +53,7 @@ public class BlockPavement extends BlockMod {
@Override
public int getMetaFromState(IBlockState state) {
switch ((EnumDyeColor) state.getValue(BotaniaStateProps.PAVEMENT_COLOR)) {
switch (state.getValue(BotaniaStateProps.PAVEMENT_COLOR)) {
case GREEN: return 5;
case YELLOW: return 4;
case RED: return 3;
@@ -53,7 +53,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
@Override
@@ -83,7 +83,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
@Override
public int getRenderColor(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
@Override
@@ -53,7 +53,7 @@ public class BlockPrismarine extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((PrismarineVariant) state.getValue(BotaniaStateProps.PRISMARINE_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.PRISMARINE_VARIANT).ordinal();
}
@Override
@@ -42,7 +42,7 @@ public class BlockShinyFlower extends BlockModFlower implements IInfusionStabili
@Override
@Optional.Method(modid = "easycoloredlights")
public int getLightValue(IBlockAccess world, BlockPos pos) {
return ColoredLightHelper.getPackedColor(((EnumDyeColor) world.getBlockState(pos).getValue(BotaniaStateProps.COLOR)), originalLight);
return ColoredLightHelper.getPackedColor(world.getBlockState(pos).getValue(BotaniaStateProps.COLOR), originalLight);
}
@Override
@@ -58,7 +58,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMetadata();
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
@Override
@@ -114,7 +114,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
@Override
public int getRenderColor(IBlockState state) {
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
@Override
@@ -30,7 +30,7 @@ public class BlockBiomeStoneA extends BlockBiomeStone {
@Override
public int getMetaFromState(IBlockState state) {
return ((BiomeStoneVariant) state.getValue(BotaniaStateProps.BIOMESTONE_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.BIOMESTONE_VARIANT).ordinal();
}
@Override
@@ -31,7 +31,7 @@ public class BlockBiomeStoneB extends BlockBiomeStone {
@Override
public int getMetaFromState(IBlockState state) {
return ((BiomeBrickVariant) state.getValue(BotaniaStateProps.BIOMEBRICK_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.BIOMEBRICK_VARIANT).ordinal();
}
@Override
@@ -45,7 +45,7 @@ public class Block18StoneWall extends BlockModWall {
@Override
public int getMetaFromState(IBlockState state) {
return ((Enum) state.getValue(BotaniaStateProps.FUTURESTONEWALL_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.FUTURESTONEWALL_VARIANT).ordinal();
}
@Override
@@ -45,7 +45,7 @@ public class BlockBiomeStoneWall extends BlockModWall {
@Override
public int getMetaFromState(IBlockState state) {
return ((Enum) state.getValue(BotaniaStateProps.BIOMESTONEWALL_VARIANT)).ordinal() - 8;
return state.getValue(BotaniaStateProps.BIOMESTONEWALL_VARIANT).ordinal() - 8;
}
@Override
@@ -52,7 +52,7 @@ public class BlockBellows extends BlockModContainer implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(BotaniaStateProps.CARDINALS)).getIndex();
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
}
@Override
@@ -65,7 +65,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
@Override
public int getMetaFromState(IBlockState state) {
return ((DrumVariant) state.getValue(BotaniaStateProps.DRUM_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.DRUM_VARIANT).ordinal();
}
@Override
@@ -112,7 +112,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
if(burst.isFake())
return;
DrumVariant variant = ((DrumVariant) world.getBlockState(pos).getValue(BotaniaStateProps.DRUM_VARIANT));
DrumVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.DRUM_VARIANT);
if(variant == DrumVariant.WILD)
ItemGrassHorn.breakGrass(world, null, 0, pos);
else if(variant == DrumVariant.CANOPY)
@@ -172,7 +172,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
DrumVariant variant = ((DrumVariant) world.getBlockState(pos).getValue(BotaniaStateProps.DRUM_VARIANT));
DrumVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.DRUM_VARIANT);
switch(variant) {
case GATHERING:
@@ -68,7 +68,7 @@ public class BlockPump extends BlockModContainer implements ILexiconable {
@Override
public void setBlockBoundsBasedOnState(IBlockAccess w, BlockPos pos) {
EnumFacing facing = ((EnumFacing) w.getBlockState(pos).getValue(BotaniaStateProps.CARDINALS));
EnumFacing facing = w.getBlockState(pos).getValue(BotaniaStateProps.CARDINALS);
setBlockBounds(facing.getAxis());
}
@@ -71,7 +71,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
@Override
public int getMetaFromState(IBlockState state) {
return ((SpreaderVariant) state.getValue(BotaniaStateProps.SPREADER_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.SPREADER_VARIANT).ordinal();
}
@Override
@@ -252,7 +252,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
SpreaderVariant variant = ((SpreaderVariant) world.getBlockState(pos).getValue(BotaniaStateProps.SPREADER_VARIANT));
SpreaderVariant variant = world.getBlockState(pos).getValue(BotaniaStateProps.SPREADER_VARIANT);
return variant == SpreaderVariant.MANA ? LexiconData.spreader : variant == SpreaderVariant.REDSTONE ? LexiconData.redstoneSpreader : LexiconData.dreamwoodSpreader;
}
@@ -53,7 +53,7 @@ public abstract class BlockRedString extends BlockModContainer<TileRedString> im
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(BotaniaStateProps.FACING)).getIndex();
return state.getValue(BotaniaStateProps.FACING).getIndex();
}
@Override
@@ -35,7 +35,7 @@ public class BlockRedStringDispenser extends BlockRedString {
@Override
public int getMetaFromState(IBlockState state) {
int meta = ((EnumFacing) state.getValue(BotaniaStateProps.FACING)).getIndex();
int meta = state.getValue(BotaniaStateProps.FACING).getIndex();
if (state.getValue(BotaniaStateProps.POWERED)) {
meta |= 8;
} else {
@@ -42,7 +42,7 @@ public class BlockRedStringInterceptor extends BlockRedString {
@Override
public int getMetaFromState(IBlockState state) {
int meta = ((EnumFacing) state.getValue(BotaniaStateProps.FACING)).getIndex();
int meta = state.getValue(BotaniaStateProps.FACING).getIndex();
if (state.getValue(BotaniaStateProps.POWERED)) {
meta |= 8;
} else {
@@ -194,7 +194,7 @@ public class TileAlfPortal extends TileMod implements ITickable {
}
public boolean onWanded() {
AlfPortalState state = ((AlfPortalState) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.ALFPORTAL_STATE));
AlfPortalState state = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.ALFPORTAL_STATE);
if(state == AlfPortalState.OFF) {
AlfPortalState newState = getValidState();
if(newState != AlfPortalState.OFF) {
@@ -136,7 +136,9 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
@Override
public void update() {
IBlockState state = worldObj.getBlockState(getPos());
EnumFacing.Axis axis = ((EnumFacing.Axis) state.getValue(BotaniaStateProps.ENCHANTER_DIRECTION));
if (state.getBlock() != ModBlocks.enchanter)
return;
EnumFacing.Axis axis = state.getValue(BotaniaStateProps.ENCHANTER_DIRECTION);
if(getBlockMetadata() < PYLON_LOCATIONS.size())
for(BlockPos pylon : PYLON_LOCATIONS.get(axis)) {
@@ -29,7 +29,7 @@ public class TileManaBeacon extends TileMod implements ITickable {
}
if(!redstone) {
int hex = ((EnumDyeColor) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
int hex = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
@@ -11,17 +11,25 @@
package vazkii.botania.common.block.tile;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ITickable;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibObfuscation;
public class TileOpenCrate extends TileSimpleInventory implements ITickable {
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
return true;
}
@Override
public int getSizeInventory() {
return 1;
@@ -36,7 +36,7 @@ public class TilePylon extends TileEntity implements ITickable {
@Override
public void update() {
++ticks;
PylonVariant variant = ((PylonVariant) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.PYLON_VARIANT));
PylonVariant variant = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.PYLON_VARIANT);
if(activated && worldObj.isRemote) {
if(worldObj.getBlockState(centerPos).getBlock() != getBlockForMeta() || variant != PylonVariant.MANA && worldObj.getBlockState(centerPos).getBlock().getMetaFromState(worldObj.getBlockState(centerPos)) == 0) { // todo 1.8 clarify
@@ -70,7 +70,7 @@ public class TilePylon extends TileEntity implements ITickable {
Block block = worldObj.getBlockState(pos.down()).getBlock();
if(block == ModBlocks.flower || block == ModBlocks.shinyFlower) {
int hex = ((EnumDyeColor) worldObj.getBlockState(pos.down()).getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
int hex = worldObj.getBlockState(pos.down()).getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
@@ -15,6 +15,7 @@ import java.util.List;
import com.google.common.base.Predicates;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -27,12 +28,14 @@ import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ITickable;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import org.lwjgl.opengl.GL11;
@@ -102,6 +105,11 @@ public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLoc
int ticks = 0;
boolean sendPacket = false;
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
return true;
}
@Override
public boolean isFull() {
Block blockBelow = worldObj.getBlockState(pos.down()).getBlock();
@@ -14,6 +14,7 @@ import java.util.List;
import java.util.UUID;
import com.google.common.base.Predicates;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -141,6 +142,11 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
List<PositionProperties> lastTentativeBurst;
boolean invalidTentativeBurst = false;
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
return true;
}
@Override
public boolean isFull() {
return mana >= getMaxMana();
@@ -76,7 +76,7 @@ public abstract class TileRedString extends TileMod implements ITileBound, ITick
}
public EnumFacing getOrientation() {
return ((EnumFacing) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.FACING));
return worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.FACING);
}
public TileEntity getTileAtBinding() {
@@ -60,7 +60,7 @@ public class ModPotions {
}
} catch (Exception e) {
System.err.println("Severe error, please report this to the mod author:");
System.err.println(e);
e.printStackTrace();
}
}
}
@@ -90,7 +90,7 @@ public class EntityPoolMinecart extends EntityMinecart {
if(tile != null && tile instanceof IManaPool && !pump.hasRedstone) {
IManaPool pool = (IManaPool) tile;
EnumFacing pumpDir = ((EnumFacing) worldObj.getBlockState(posP).getValue(BotaniaStateProps.CARDINALS));
EnumFacing pumpDir = worldObj.getBlockState(posP).getValue(BotaniaStateProps.CARDINALS);
boolean did = false;
boolean can = false;
@@ -209,7 +209,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
for (int j = 0; j < list.size(); ++j)
{
Entity entity1 = (Entity)list.get(j);
Entity entity1 = list.get(j);
if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5))
{
@@ -318,7 +318,7 @@ public abstract class EntityThrowableCopy extends Entity implements IProjectile
tagCompound.setShort("xTile", (short)this.xTile);
tagCompound.setShort("yTile", (short)this.yTile);
tagCompound.setShort("zTile", (short)this.zTile);
ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
ResourceLocation resourcelocation = Block.blockRegistry.getNameForObject(this.inTile);
tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
tagCompound.setByte("shake", (byte)this.throwableShake);
tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));