本文整理匯總了Java中net.minecraft.block.BlockTorch類的典型用法代碼示例。如果您正苦於以下問題:Java BlockTorch類的具體用法?Java BlockTorch怎麽用?Java BlockTorch使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlockTorch類屬於net.minecraft.block包,在下文中一共展示了BlockTorch類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addComponentParts
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (this.field_143015_k < 0)
{
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
if (this.field_143015_k < 0)
{
return true;
}
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
}
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
return true;
}
示例2: func_189921_a
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
private void func_189921_a(World p_189921_1_, StructureBoundingBox p_189921_2_, int p_189921_3_, int p_189921_4_, int p_189921_5_, int p_189921_6_, int p_189921_7_, Random p_189921_8_)
{
if (this.func_189918_a(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_7_, p_189921_6_, p_189921_5_))
{
IBlockState iblockstate = this.func_189917_F_();
IBlockState iblockstate1 = this.func_189919_b();
IBlockState iblockstate2 = Blocks.AIR.getDefaultState();
this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_4_, p_189921_5_, p_189921_3_, p_189921_6_ - 1, p_189921_5_, iblockstate1, iblockstate2, false);
this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_7_, p_189921_4_, p_189921_5_, p_189921_7_, p_189921_6_ - 1, p_189921_5_, iblockstate1, iblockstate2, false);
if (p_189921_8_.nextInt(4) == 0)
{
this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_6_, p_189921_5_, p_189921_3_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_7_, p_189921_6_, p_189921_5_, p_189921_7_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
}
else
{
this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_6_, p_189921_5_, p_189921_7_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
this.randomlyPlaceBlock(p_189921_1_, p_189921_2_, p_189921_8_, 0.05F, p_189921_3_ + 1, p_189921_6_, p_189921_5_ - 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
this.randomlyPlaceBlock(p_189921_1_, p_189921_2_, p_189921_8_, 0.05F, p_189921_3_ + 1, p_189921_6_, p_189921_5_ + 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
}
}
}
示例3: addComponentParts
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn))
{
return false;
}
else
{
this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 6, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 1, 1, 0);
this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 6);
IBlockState iblockstate = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST);
IBlockState iblockstate1 = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 1, iblockstate);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 1, iblockstate1);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 5, iblockstate);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 5, iblockstate1);
if (this.expandsX)
{
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 2, 0, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
}
if (this.expandsZ)
{
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 4, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
}
return true;
}
}
示例4: func_189926_a
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
protected void func_189926_a(World p_189926_1_, EnumFacing p_189926_2_, int p_189926_3_, int p_189926_4_, int p_189926_5_, StructureBoundingBox p_189926_6_)
{
if (!this.isZombieInfested)
{
this.setBlockState(p_189926_1_, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, p_189926_2_), p_189926_3_, p_189926_4_, p_189926_5_, p_189926_6_);
}
}
示例5: addComponentParts
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
/**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
* Mineshafts at the end, it adds Fences...
*/
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn))
{
return false;
}
else
{
this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 6, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 1, 1, 0);
this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 6);
IBlockState iblockstate = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST);
IBlockState iblockstate1 = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 1, iblockstate);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 1, iblockstate1);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 5, iblockstate);
this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 5, iblockstate1);
if (this.expandsX)
{
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 2, 0, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
}
if (this.expandsZ)
{
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 4, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
}
return true;
}
}
示例6: isDefered
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
private boolean isDefered(StructureBlock sb) {
Block block = GameRegistry.findBlock(sb.getModId(), sb.getBlockName());
if(block == null) {
return false;
}
return block instanceof BlockTorch || block instanceof BlockSand || block instanceof BlockGravel || block instanceof BlockAnvil
|| block instanceof BlockTripWireHook || block instanceof BlockTripWire|| block instanceof BlockRedstoneWire;
}
示例7: processImpact
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
@Override
protected void processImpact(RayTraceResult mop) {
if (mop.entityHit != null) {
//zero damage means just knockback
mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
}
EnumFacing sideHit = mop.sideHit;
BlockPos pos = mop.getBlockPos();
BlockPos offset = mop.getBlockPos();
if (sideHit != null) {
offset = pos.offset(sideHit);
}
if (offset == null) {
return;
}
World world = this.getEntityWorld();
boolean isSideSolid = world.isSideSolid(mop.getBlockPos(), sideHit);
boolean isValidBlockstate = BlockTorch.FACING.getAllowedValues().contains(sideHit);
boolean isValidLocation = world.isAirBlock(offset) ||
world.getBlockState(offset) == null ||
world.getBlockState(offset).getBlock() == null ||
world.getBlockState(offset).getBlock().isReplaceable(world, offset);
if (isValidLocation && isValidBlockstate && isSideSolid && world.isRemote == false) {
world.setBlockState(offset, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, sideHit));
}
// else {
// UtilItemStack.dropItemStackInWorld(world, this.getPosition(), renderSnowball);
// }
this.setDead();
}
示例8: handleInTileState
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
@Override
protected void handleInTileState(Block block, EnumFacing facing) {
BlockPos blockpos = new BlockPos(this.xTile, this.yTile, this.zTile);
BlockPos facingBlockPos = facingBlock(blockpos, facing);
if (facing != EnumFacing.DOWN && Blocks.TORCH.canPlaceBlockAt(world, facingBlockPos)) {
world.setBlockState(facingBlockPos, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, swapZFacing(facing)));
} else {
Block.spawnAsEntity(world, facingBlockPos, new ItemStack(ModFFQuiver.torchArrow));
}
this.setDead();
}
示例9: isValidPeripheral
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
@Override
public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List<BlockPos> availableBlocks)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(BlockTorch.FACING);
return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
}
示例10: calcConnectYFlags
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
private int calcConnectYFlags (IBlockAccess world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block != this)
return 0;
Block blockYNeg = world.getBlock(x, y - 1, z);
boolean hardYNeg = isNeighborHardConnectionY(world, x, y - 1, z, blockYNeg, ForgeDirection.DOWN);
boolean connectYNeg = hardYNeg || blockYNeg == this;
Block blockYPos = world.getBlock(x, y + 1, z);
boolean hardYPos = isNeighborHardConnectionY(world, x, y + 1, z, blockYPos, ForgeDirection.UP);
boolean connectYPos = hardYPos || blockYPos == this|| blockYPos instanceof BlockTorch;
return (connectYNeg ? 1 : 0) | (connectYPos ? 2 : 0) | (hardYNeg ? 4 : 0) | (hardYPos ? 8 : 0);
}
示例11: canBreakBlock
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
/**
* Returns true if the whip can destroy the material type
*/
protected boolean canBreakBlock(Block block, Material m, BlockPos pos, EnumFacing side) {
EntityLivingBase thrower = getThrower();
if (block instanceof IWhipBlock) {
return ((IWhipBlock) block).canBreakBlock(getType(), thrower, worldObj, pos, side);
}
boolean isBreakable = block.getBlockHardness(worldObj, pos) >= 0.0F;
boolean canPlayerEdit = false;
if (thrower instanceof EntityPlayer) {
canPlayerEdit = ((EntityPlayer) thrower).capabilities.allowEdit && Config.canHookshotBreakBlocks();
}
// can dislodge blocks such as torches, leaves, flowers, etc.
return (isBreakable && canPlayerEdit && (block instanceof BlockTorch || m == Material.leaves || m == Material.plants));
}
示例12: calcConnectYFlags
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
private int calcConnectYFlags (IBlockAccess world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block != this)
return 0;
Block blockYNeg = world.getBlock(x, y - 1, z);
boolean hardYNeg = isNeighborHardConnectionY(blockYNeg);
boolean connectYNeg = hardYNeg || blockYNeg == this;
Block blockYPos = world.getBlock(x, y + 1, z);
boolean hardYPos = isNeighborHardConnectionY(blockYPos);
boolean connectYPos = hardYPos || blockYPos == this|| blockYPos instanceof BlockTorch;
return (connectYNeg ? 1 : 0) | (connectYPos ? 2 : 0) | (hardYNeg ? 4 : 0) | (hardYPos ? 8 : 0);
}
示例13: generatePortal
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
/**
* Generate the portal when the dragon dies
*/
private void generatePortal(BlockPos pos)
{
int i = 4;
double d0 = 12.25D;
double d1 = 6.25D;
for (int j = -1; j <= 32; ++j)
{
for (int k = -4; k <= 4; ++k)
{
for (int l = -4; l <= 4; ++l)
{
double d2 = (double)(k * k + l * l);
if (d2 <= 12.25D)
{
BlockPos blockpos = pos.add(k, j, l);
if (j < 0)
{
if (d2 <= 6.25D)
{
this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
}
}
else if (j > 0)
{
this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState());
}
else if (d2 > 6.25D)
{
this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
}
else
{
this.worldObj.setBlockState(blockpos, Blocks.end_portal.getDefaultState());
}
}
}
}
}
this.worldObj.setBlockState(pos, Blocks.bedrock.getDefaultState());
this.worldObj.setBlockState(pos.up(), Blocks.bedrock.getDefaultState());
BlockPos blockpos1 = pos.up(2);
this.worldObj.setBlockState(blockpos1, Blocks.bedrock.getDefaultState());
this.worldObj.setBlockState(blockpos1.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
this.worldObj.setBlockState(blockpos1.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
this.worldObj.setBlockState(blockpos1.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
this.worldObj.setBlockState(blockpos1.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
this.worldObj.setBlockState(pos.up(3), Blocks.bedrock.getDefaultState());
this.worldObj.setBlockState(pos.up(4), Blocks.dragon_egg.getDefaultState());
}
示例14: checkBlock
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
if (p_checkBlock_0_.isFullCube())
{
return false;
}
else if (p_checkBlock_0_.isOpaqueCube())
{
return false;
}
else if (p_checkBlock_0_ instanceof BlockSnow)
{
return false;
}
else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
{
if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
{
if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
{
return true;
}
else
{
if (p_checkBlock_0_ instanceof BlockLever)
{
Object object = p_checkBlock_1_.getValue(BlockLever.FACING);
if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
{
return true;
}
}
return false;
}
}
else
{
return true;
}
}
else
{
return true;
}
}
示例15: generate
import net.minecraft.block.BlockTorch; //導入依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(new BlockPos(position.getX() - 4, position.getY() - 1, position.getZ() - 4), new BlockPos(position.getX() + 4, position.getY() + 32, position.getZ() + 4)))
{
double d0 = blockpos$mutableblockpos.getDistance(position.getX(), blockpos$mutableblockpos.getY(), position.getZ());
if (d0 <= 3.5D)
{
if (blockpos$mutableblockpos.getY() < position.getY())
{
if (d0 <= 2.5D)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
}
else if (blockpos$mutableblockpos.getY() < position.getY())
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.END_STONE.getDefaultState());
}
}
else if (blockpos$mutableblockpos.getY() > position.getY())
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
}
else if (d0 > 2.5D)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
}
else if (this.activePortal)
{
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.END_PORTAL.getDefaultState());
}
else
{
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.AIR.getDefaultState());
}
}
}
for (int i = 0; i < 4; ++i)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(i), Blocks.BEDROCK.getDefaultState());
}
BlockPos blockpos = position.up(2);
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos.offset(enumfacing), Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, enumfacing));
}
return true;
}