meta is bad pls

This commit is contained in:
Shadows_of_Fire 2018-03-19 11:46:43 -04:00
parent 3fcebcdd05
commit 8bb71ad796
8 changed files with 10 additions and 10 deletions

View file

@ -62,7 +62,7 @@ public class BlockLampPowerer extends BlockBase{
private void updateLamp(World world, BlockPos pos){ private void updateLamp(World world, BlockPos pos){
if(!world.isRemote){ if(!world.isRemote){
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state))); BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
this.updateLampsAtPos(world, coords, world.isBlockIndirectlyGettingPowered(pos) > 0, new ArrayList<BlockPos>()); this.updateLampsAtPos(world, coords, world.isBlockIndirectlyGettingPowered(pos) > 0, new ArrayList<BlockPos>());
} }
} }

View file

@ -112,7 +112,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
@Override @Override
public EnumFacing getOrientation(){ public EnumFacing getOrientation(){
IBlockState state = this.world.getBlockState(this.pos); IBlockState state = this.world.getBlockState(this.pos);
return WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)); return WorldUtil.getDirectionByPistonRotation(state);
} }
@Override @Override

View file

@ -78,7 +78,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
private void doWork(){ private void doWork(){
IBlockState state = this.world.getBlockState(this.pos); IBlockState state = this.world.getBlockState(this.pos);
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state);
BlockPos coordsBlock = this.pos.offset(sideToManipulate); BlockPos coordsBlock = this.pos.offset(sideToManipulate);
IBlockState stateToBreak = this.world.getBlockState(coordsBlock); IBlockState stateToBreak = this.world.getBlockState(coordsBlock);

View file

@ -77,7 +77,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{
private void doWork(){ private void doWork(){
if(this.storage.getEnergyStored() >= ENERGY_USE*RANGE){ if(this.storage.getEnergyStored() >= ENERGY_USE*RANGE){
IBlockState state = this.world.getBlockState(this.pos); IBlockState state = this.world.getBlockState(this.pos);
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state);
for(int i = 0; i < RANGE; i++){ for(int i = 0; i < RANGE; i++){
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1); BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);

View file

@ -67,7 +67,7 @@ public class TileEntityDropper extends TileEntityInventoryBase{
ItemStack theoreticalRemove = this.removeFromInventory(false); ItemStack theoreticalRemove = this.removeFromInventory(false);
if(StackUtil.isValid(theoreticalRemove)){ if(StackUtil.isValid(theoreticalRemove)){
IBlockState state = this.world.getBlockState(this.pos); IBlockState state = this.world.getBlockState(this.pos);
WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)), this.world, this.pos, StackUtil.setStackSize(theoreticalRemove.copy(), 1)); WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state), this.world, this.pos, StackUtil.setStackSize(theoreticalRemove.copy(), 1));
this.removeFromInventory(true); this.removeFromInventory(true);
} }
} }

View file

@ -163,7 +163,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
@Override @Override
public EnumFacing getOrientation(){ public EnumFacing getOrientation(){
IBlockState state = this.world.getBlockState(this.pos); IBlockState state = this.world.getBlockState(this.pos);
return WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)); return WorldUtil.getDirectionByPistonRotation(state);
} }
@Override @Override

View file

@ -68,8 +68,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing
private void doWork(){ private void doWork(){
IBlockState state = this.world.getBlockState(this.pos); IBlockState state = this.world.getBlockState(this.pos);
Block block = state.getBlock(); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state);
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(block.getMetaFromState(state));
BlockPos coordsBlock = this.pos.offset(sideToManipulate); BlockPos coordsBlock = this.pos.offset(sideToManipulate);
IBlockState stateToBreak = this.world.getBlockState(coordsBlock); IBlockState stateToBreak = this.world.getBlockState(coordsBlock);

View file

@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -260,8 +261,8 @@ public final class WorldUtil {
} }
} }
public static EnumFacing getDirectionByPistonRotation(int meta) { public static EnumFacing getDirectionByPistonRotation(IBlockState state) {
return EnumFacing.values()[meta]; return state.getValue(BlockDirectional.FACING);
} }
public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) { public static ArrayList<Material> getMaterialsAround(World world, BlockPos pos) {