本文整理汇总了Java中net.minecraft.block.BlockRail类的典型用法代码示例。如果您正苦于以下问题:Java BlockRail类的具体用法?Java BlockRail怎么用?Java BlockRail使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockRail类属于net.minecraft.block包,在下文中一共展示了BlockRail类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateChest
import net.minecraft.block.BlockRail; //导入依赖的package包/类
protected boolean generateChest(World worldIn, StructureBoundingBox structurebb, Random randomIn, int x, int y, int z, ResourceLocation loot)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (structurebb.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR)
{
IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
this.setBlockState(worldIn, iblockstate, x, y, z, structurebb);
EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
entityminecartchest.setLootTable(loot, randomIn.nextLong());
worldIn.spawnEntityInWorld(entityminecartchest);
return true;
}
else
{
return false;
}
}
示例2: generateChest
import net.minecraft.block.BlockRail; //导入依赖的package包/类
/**
* Adds chest to the structure and sets its contents
*/
protected boolean generateChest(World worldIn, StructureBoundingBox structurebb, Random randomIn, int x, int y, int z, ResourceLocation loot)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (structurebb.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR)
{
IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
this.setBlockState(worldIn, iblockstate, x, y, z, structurebb);
EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
entityminecartchest.setLootTable(loot, randomIn.nextLong());
worldIn.spawnEntityInWorld(entityminecartchest);
return true;
}
else
{
return false;
}
}
示例3: generateChest
import net.minecraft.block.BlockRail; //导入依赖的package包/类
/**
* Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests.
*/
@Override
protected boolean generateChest(World world, StructureBoundingBox structureboundingbox, Random rand, int x, int y, int z, ResourceLocation loot)
{
BlockPos blockpos = new BlockPos(getXWithOffset(x, z), getYWithOffset(y), getZWithOffset(x, z));
if (structureboundingbox.isVecInside(blockpos) && world.getBlockState(blockpos).getMaterial() == Material.AIR)
{
IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, rand.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
setBlockState(world, iblockstate, x, y, z, structureboundingbox);
EntityMinecartChest entityminecartchest = new EntityMinecartChest(world, blockpos.getX() + 0.5F, blockpos.getY() + 0.5F, blockpos.getZ() + 0.5F);
entityminecartchest.setLootTable(loot, rand.nextLong());
world.spawnEntity(entityminecartchest);
return true;
} else
return false;
}
示例4: getValidVanillaBlockRotations
import net.minecraft.block.BlockRail; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
return (block instanceof BlockBed ||
block instanceof BlockPumpkin ||
block instanceof BlockFenceGate ||
block instanceof BlockEndPortalFrame ||
block instanceof BlockTripWireHook ||
block instanceof BlockCocoa ||
block instanceof BlockRailPowered ||
block instanceof BlockRailDetector ||
block instanceof BlockStairs ||
block instanceof BlockChest ||
block instanceof BlockEnderChest ||
block instanceof BlockFurnace ||
block instanceof BlockLadder ||
block == Blocks.field_150444_as ||
block == Blocks.field_150472_an ||
block instanceof BlockDoor ||
block instanceof BlockRail ||
block instanceof BlockButton ||
block instanceof BlockRedstoneRepeater ||
block instanceof BlockRedstoneComparator ||
block instanceof BlockTrapDoor ||
block instanceof BlockHugeMushroom ||
block instanceof BlockVine ||
block instanceof BlockSkull ||
block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
示例5: getValidVanillaBlockRotations
import net.minecraft.block.BlockRail; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
return (block instanceof BlockBed ||
block instanceof BlockPumpkin ||
block instanceof BlockFenceGate ||
block instanceof BlockEndPortalFrame ||
block instanceof BlockTripWireHook ||
block instanceof BlockCocoa ||
block instanceof BlockRailPowered ||
block instanceof BlockRailDetector ||
block instanceof BlockStairs ||
block instanceof BlockChest ||
block instanceof BlockEnderChest ||
block instanceof BlockFurnace ||
block instanceof BlockLadder ||
block == Blocks.wall_sign ||
block == Blocks.standing_sign ||
block instanceof BlockDoor ||
block instanceof BlockRail ||
block instanceof BlockButton ||
block instanceof BlockRedstoneRepeater ||
block instanceof BlockRedstoneComparator ||
block instanceof BlockTrapDoor ||
block instanceof BlockHugeMushroom ||
block instanceof BlockVine ||
block instanceof BlockSkull ||
block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
示例6: getBlockType
import net.minecraft.block.BlockRail; //导入依赖的package包/类
private static BlockType getBlockType(Block block) {
if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame
|| block instanceof BlockCocoa) {
return BlockType.BED;
}
if(block instanceof BlockRail) {
return BlockType.RAIL;
}
if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) {
return BlockType.RAIL_POWERED;
}
if(block instanceof BlockStairs) {
return BlockType.STAIR;
}
if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder
|| block == Blocks.wall_sign) {
return BlockType.CHEST;
}
if(block == Blocks.standing_sign) {
return BlockType.SIGNPOST;
}
if(block instanceof BlockDoor) {
return BlockType.DOOR;
}
if(block instanceof BlockButton) {
return BlockType.BUTTON;
}
if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) {
return BlockType.REDSTONE_REPEATER;
}
if(block instanceof BlockTrapDoor) {
return BlockType.TRAPDOOR;
}
if(block instanceof BlockHugeMushroom) {
return BlockType.MUSHROOM_CAP;
}
if(block instanceof BlockVine) {
return BlockType.VINE;
}
if(block instanceof BlockSkull) {
return BlockType.SKULL;
}
if(block instanceof BlockAnvil) {
return BlockType.ANVIL;
}
if(block instanceof BlockLog) {
return BlockType.LOG;
}
if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) {
return BlockType.DISPENSER;
}
if(block instanceof BlockTorch) {
return BlockType.TORCH;
}
if(block instanceof BlockLever) {
return BlockType.LEVER;
}
if(block instanceof BlockTripWireHook) {
return BlockType.TRIP_WIRE_HOOK;
}
return null;
}
示例7: addComponentParts
import net.minecraft.block.BlockRail; //导入依赖的package包/类
/**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
* Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
return false;
else
{
int i = sectionCount * 5 - 1;
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, i, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
generateMaybeBox(par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, i, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false, 0);
int j;
int k;
for (j = 0; j < sectionCount; ++j)
{
k = 2 + j * 5;
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, k, 0, 1, k, ACBlocks.dreadlands_wood_fence.getDefaultState(), Blocks.AIR.getDefaultState(), false);
fillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, k, 2, 1, k, ACBlocks.dreadlands_wood_fence.getDefaultState(), Blocks.AIR.getDefaultState(), false);
if (par2Random.nextInt(4) == 0)
{
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, k, 0, 2, k, ACBlocks.dreadlands_planks.getDefaultState(), Blocks.AIR.getDefaultState(), false);
fillWithBlocks(par1World, par3StructureBoundingBox, 2, 2, k, 2, 2, k, ACBlocks.dreadlands_planks.getDefaultState(), Blocks.AIR.getDefaultState(), false);
} else
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, k, 2, 2, k, ACBlocks.dreadlands_planks.getDefaultState(), Blocks.AIR.getDefaultState(), false);
randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
if (par2Random.nextInt(100) == 0)
generateChest(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, ACLoot.CHEST_DREADLANDS_MINESHAFT);
if (par2Random.nextInt(100) == 0)
generateChest(par1World, par3StructureBoundingBox, par2Random, 2, 0, k + 1, ACLoot.CHEST_DREADLANDS_MINESHAFT);
}
for (j = 0; j <= 2; ++j)
for (k = 0; k <= i; ++k)
{
byte b0 = -1;
IBlockState block1 = getBlockStateFromPos(par1World, j, b0, k, par3StructureBoundingBox);
if (block1.getMaterial() == Material.AIR)
{
byte b1 = -1;
setBlockState(par1World, ACBlocks.dreadlands_planks.getDefaultState(), j, b1, k, par3StructureBoundingBox);
}
}
if (hasRails){
IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
for (j = 0; j <= i; ++j)
{
IBlockState block = getBlockStateFromPos(par1World, 1, -1, j, par3StructureBoundingBox);
if (block.getMaterial() != Material.AIR && block.isFullBlock())
randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.7F, 1, 0, j, iblockstate);
}
}
return true;
}
}
示例8: getValidVanillaBlockRotations
import net.minecraft.block.BlockRail; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockDetectorRail || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID || block.blockID == Block.signPost.blockID || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockComparator || block instanceof BlockTrapDoor || block instanceof BlockMushroomCap || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}