use of net.minecraft.item.ItemBlock in project Railcraft by Railcraft.
the class SchematicMask method placeInWorld.
@Override
public void placeInWorld(IBuilderContext context, BlockPos pos, List<ItemStack> stacks) {
if (isConcrete) {
if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), pos)) {
return;
} else {
ItemStack stack = stacks.get(0);
EntityPlayer player = BuildCraftAPI.fakePlayerProvider.getBuildCraftPlayer((WorldServer) context.world()).get();
// force the block to be air block, in case it's just a soft
// block which replacement is not straightforward
context.world().setBlockToAir(pos);
// Find nearest solid surface to place on
EnumFacing solidFace = null;
for (EnumFacing face : EnumFacing.values()) {
BlockPos offset = pos.offset(face);
if (!BuildCraftAPI.isSoftBlock(context.world(), offset)) {
solidFace = face;
break;
}
}
ItemBlock itemBlock = (ItemBlock) stack.getItem();
IBlockState state = itemBlock.block.onBlockPlaced(context.world(), pos, solidFace, 0, 0, 0, stack.getMetadata(), player);
itemBlock.placeBlockAt(stack, player, context.world(), pos, solidFace, 0, 0, 0, state);
}
} else {
context.world().setBlockToAir(pos);
}
}
use of net.minecraft.item.ItemBlock in project Traverse by ProfessorProspector.
the class TraverseBlocks method registerBlock.
static void registerBlock(Block block) {
GameRegistry.register(block);
GameRegistry.register(new ItemBlock(block), block.getRegistryName());
}
use of net.minecraft.item.ItemBlock in project Railcraft by Railcraft.
the class BoreOreHandler method onOreEvent.
@SubscribeEvent
public void onOreEvent(OreRegisterEvent event) {
String oreClass = event.getName();
ItemStack ore = event.getOre();
if (InvTools.isEmpty(ore))
return;
if (ore.getItem() instanceof ItemBlock && oreClass.startsWith("ore")) {
if (EntityTunnelBore.mineableOreTags.add(oreClass))
Game.log(Level.DEBUG, "Automation Module: Ore Tag Detected, adding to blocks Tunnel Bore can mine: {0}", oreClass);
}
}
use of net.minecraft.item.ItemBlock in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ModBlocks method registerBlock.
public static void registerBlock(Block block) {
GameRegistry.register(block);
ItemBlock Item = new ItemBlock(block);
Item.setRegistryName(block.getRegistryName());
GameRegistry.register(Item);
}
Aggregations