use of net.minecraft.block.state.IBlockState in project Railcraft by Railcraft.
the class TileRockCrusher method isMapPositionValid.
@Override
protected boolean isMapPositionValid(BlockPos pos, char mapPos) {
IBlockState state = WorldPlugin.getBlockState(worldObj, pos);
Block block = state.getBlock();
int meta = block.getMetaFromState(state);
switch(mapPos) {
case // Other
'O':
if (block == getBlockType() && meta == getBlockMetadata())
return false;
break;
// Window
case 'D':
// Block
case 'B':
// Block
case 'a':
// Block
case 'b':
// Block
case 'c':
// Block
case 'd':
// Block
case 'e':
// Block
case 'f':
// Block
case 'g':
case // Block
'h':
if (block != getBlockType() || meta != getBlockMetadata())
return false;
break;
case // Air
'A':
if (!worldObj.isAirBlock(pos))
return false;
break;
}
return true;
}
use of net.minecraft.block.state.IBlockState in project Railcraft by Railcraft.
the class TileSteamOven method placeSteamOven.
public static void placeSteamOven(World world, BlockPos pos, @Nullable List<ItemStack> input, @Nullable List<ItemStack> output) {
MultiBlockPattern pattern = TileSteamOven.patterns.get(0);
Map<Character, IBlockState> blockMapping = new HashMap<Character, IBlockState>();
blockMapping.put('B', EnumMachineAlpha.STEAM_OVEN.getDefaultState());
TileEntity tile = pattern.placeStructure(world, pos, blockMapping);
if (tile instanceof TileSteamOven) {
TileSteamOven master = (TileSteamOven) tile;
for (int slot = 0; slot < 9; slot++) {
if (input != null && slot < input.size())
master.inv.setInventorySlotContents(TileSteamOven.SLOT_INPUT + slot, input.get(slot));
if (output != null && slot < output.size())
master.inv.setInventorySlotContents(TileSteamOven.SLOT_OUTPUT + slot, output.get(slot));
}
}
}
use of net.minecraft.block.state.IBlockState in project Railcraft by Railcraft.
the class TileBoilerFireboxFluid method placeFluidBoiler.
public static void placeFluidBoiler(World world, BlockPos pos, int width, int height, boolean highPressure, int water, FluidStack fuel) {
for (MultiBlockPattern pattern : TileBoiler.patterns) {
if (pattern.getPatternHeight() - 3 == height && pattern.getPatternWidthX() - 2 == width) {
Map<Character, IBlockState> blockMapping = new HashMap<Character, IBlockState>();
blockMapping.put('F', EnumMachineBeta.BOILER_FIREBOX_FLUID.getDefaultState());
blockMapping.put('H', highPressure ? EnumMachineBeta.BOILER_TANK_HIGH_PRESSURE.getDefaultState() : EnumMachineBeta.BOILER_TANK_LOW_PRESSURE.getDefaultState());
TileEntity tile = pattern.placeStructure(world, pos, blockMapping);
if (tile instanceof TileBoilerFireboxFluid) {
TileBoilerFireboxFluid master = (TileBoilerFireboxFluid) tile;
master.tankWater.setFluid(Fluids.WATER.get(water));
master.tankFuel.setFluid(fuel);
}
return;
}
}
}
use of net.minecraft.block.state.IBlockState in project Railcraft by Railcraft.
the class TileBoilerFireboxSolid method placeSolidBoiler.
public static void placeSolidBoiler(World world, BlockPos pos, int width, int height, boolean highPressure, int water, List<ItemStack> fuel) {
for (MultiBlockPattern pattern : TileBoiler.patterns) {
if (pattern.getPatternHeight() - 3 == height && pattern.getPatternWidthX() - 2 == width) {
Map<Character, IBlockState> blockMapping = new HashMap<Character, IBlockState>();
blockMapping.put('F', EnumMachineBeta.BOILER_FIREBOX_SOLID.getDefaultState());
blockMapping.put('H', highPressure ? EnumMachineBeta.BOILER_TANK_HIGH_PRESSURE.getDefaultState() : EnumMachineBeta.BOILER_TANK_LOW_PRESSURE.getDefaultState());
TileEntity tile = pattern.placeStructure(world, pos, blockMapping);
if (tile instanceof TileBoilerFireboxSolid) {
TileBoilerFireboxSolid master = (TileBoilerFireboxSolid) tile;
master.tankWater.setFluid(Fluids.WATER.get(water));
InventoryMapper masterFuel = InventoryMapper.make(master.inventory, SLOT_BURN, 4);
for (ItemStack stack : fuel) {
InvTools.moveItemStack(stack, masterFuel);
}
}
return;
}
}
}
use of net.minecraft.block.state.IBlockState in project Railcraft by Railcraft.
the class TileBlastFurnace method isMapPositionValid.
@Override
protected boolean isMapPositionValid(BlockPos pos, char mapPos) {
IBlockState state = worldObj.getBlockState(pos);
Block block = state.getBlock();
int meta = block.getMetaFromState(state);
switch(mapPos) {
case 'O':
if (block != RailcraftBlocks.MACHINE_ALPHA.block() || meta != getBlockMetadata())
return true;
break;
case 'B':
case 'W':
if (block == RailcraftBlocks.MACHINE_ALPHA.block() && meta == getBlockMetadata())
return true;
break;
case 'A':
if (block.isAir(state, worldObj, pos) || state.getMaterial() == Material.LAVA)
return true;
break;
}
return false;
}
Aggregations