本文整理匯總了Java中net.minecraft.block.BlockFence類的典型用法代碼示例。如果您正苦於以下問題:Java BlockFence類的具體用法?Java BlockFence怎麽用?Java BlockFence使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlockFence類屬於net.minecraft.block包,在下文中一共展示了BlockFence類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleFalling
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* process player falling based on movement packet
*/
public void handleFalling(double p_71122_1_, boolean p_71122_3_)
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY - 0.20000000298023224D);
int k = MathHelper.floor_double(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
Block block = this.worldObj.getBlockState(blockpos).getBlock();
if (block.getMaterial() == Material.air)
{
Block block1 = this.worldObj.getBlockState(blockpos.down()).getBlock();
if (block1 instanceof BlockFence || block1 instanceof BlockWall || block1 instanceof BlockFenceGate)
{
blockpos = blockpos.down();
block = this.worldObj.getBlockState(blockpos).getBlock();
}
}
super.updateFallState(p_71122_1_, p_71122_3_, block, blockpos);
}
示例2: onItemUse
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
Block block = worldIn.getBlockState(pos).getBlock();
if (block instanceof BlockFence)
{
if (worldIn.isRemote)
{
return true;
}
else
{
attachToFence(playerIn, worldIn, pos);
return true;
}
}
else
{
return false;
}
}
示例3: handleFalling
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* process player falling based on movement packet
*/
public void handleFalling(double y, boolean onGroundIn)
{
int i = MathHelper.floor(this.posX);
int j = MathHelper.floor(this.posY - 0.20000000298023224D);
int k = MathHelper.floor(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.world.getBlockState(blockpos);
if (iblockstate.getMaterial() == Material.AIR)
{
BlockPos blockpos1 = blockpos.down();
IBlockState iblockstate1 = this.world.getBlockState(blockpos1);
Block block = iblockstate1.getBlock();
if (block instanceof BlockFence || block instanceof BlockWall || block instanceof BlockFenceGate)
{
blockpos = blockpos1;
iblockstate = iblockstate1;
}
}
super.updateFallState(y, onGroundIn, iblockstate, blockpos);
}
示例4: onItemUse
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
Block block = playerIn.getBlockState(worldIn).getBlock();
if (!(block instanceof BlockFence))
{
return EnumActionResult.PASS;
}
else
{
if (!playerIn.isRemote)
{
attachToFence(stack, playerIn, worldIn);
}
return EnumActionResult.SUCCESS;
}
}
示例5: handleFalling
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* process player falling based on movement packet
*/
public void handleFalling(double y, boolean onGroundIn)
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY - 0.20000000298023224D);
int k = MathHelper.floor_double(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
if (iblockstate.getBlock().isAir(iblockstate, this.worldObj, blockpos))
{
BlockPos blockpos1 = blockpos.down();
IBlockState iblockstate1 = this.worldObj.getBlockState(blockpos1);
Block block = iblockstate1.getBlock();
if (block instanceof BlockFence || block instanceof BlockWall || block instanceof BlockFenceGate)
{
blockpos = blockpos1;
iblockstate = iblockstate1;
}
}
super.updateFallState(y, onGroundIn, iblockstate, blockpos);
}
示例6: onItemUse
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
Block block = worldIn.getBlockState(pos).getBlock();
if (!(block instanceof BlockFence))
{
return EnumActionResult.PASS;
}
else
{
if (!worldIn.isRemote)
{
attachToFence(playerIn, worldIn, pos);
}
return EnumActionResult.SUCCESS;
}
}
示例7: canConnectTo
import net.minecraft.block.BlockFence; //導入依賴的package包/類
protected boolean canConnectTo(IBlockAccess blockAccess, int x, int y, int z) {
Block block = blockAccess.getBlock(x, y, z);
if (block == null) {
return false;
} else if (block.getMaterial().isOpaque()
&& block.renderAsNormalBlock()) {
// We'll connect against full 1x1x1 blocks.
return true;
} else if (block instanceof FenceBlock || block instanceof BlockFence
|| block instanceof BlockPane || block instanceof BlockWall) {
// Of course we connect to our own.
// And to vanilla fences, iron bars, glass panes and walls.
return true;
}
return false;
}
示例8: onNeighborBlockChange
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World world, int x, int y, int z, int neighbor)
{
boolean flag = false;
if (!world.doesBlockHaveSolidTopSurface(x, y - 1, z) && !BlockFence.isIdAFence(world.getBlockId(x, y - 1, z)))
{
flag = true;
}
if (flag)
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
}
示例9: onNeighborBlockChange
import net.minecraft.block.BlockFence; //導入依賴的package包/類
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor Block
*/
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_)
{
boolean flag = false;
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) && !BlockFence.func_149825_a(world.getBlock(x, y - 1, z)))
{
flag = true;
}
if (flag)
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
}
示例10: onItemUse
import net.minecraft.block.BlockFence; //導入依賴的package包/類
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return true;
} else {
IBlockState state = world.getBlockState(pos);
pos = pos.offset(side);
double dy = 0.0D;
if (side == EnumFacing.UP && state.getBlock() instanceof BlockFence) {
dy = 0.5D;
}
Entity entity = spawnCreature(world, stack.getItemDamage(), pos.getX() + 0.5D, pos.getY() + dy, pos.getZ() + 0.5D);
if (entity != null) {
if (entity instanceof EntityLivingBase && stack.hasDisplayName()) {
entity.setCustomNameTag(stack.getDisplayName());
}
if (!player.capabilities.isCreativeMode) {
--stack.stackSize;
}
}
return true;
}
}
示例11: canConnectTo
import net.minecraft.block.BlockFence; //導入依賴的package包/類
@Override
public boolean canConnectTo(@Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) {
if (super.canConnectTo(worldIn, pos)) {
return true;
}
final IBlockState blockState2 = worldIn.getBlockState(pos);
final Block block = blockState2.getBlock();
if (block instanceof BlockPaintedFence) {
return true;
}
if (block instanceof IPaintable.IBlockPaintableBlock) {
final IBlockState paintSource = ((IPaintable.IBlockPaintableBlock) block).getPaintSource(blockState2, worldIn, pos);
return paintSource != null && paintSource.getBlock() instanceof BlockFence && paintSource.getMaterial() == blockMaterial;
}
return false;
}
示例12: mapRender
import net.minecraft.block.BlockFence; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
private List<IBakedModel> mapRender(IBlockState state, @Nullable IBlockState paint) {
List<IBakedModel> result = new ArrayList<IBakedModel>();
result.add(PaintRegistry.getModel(IBakedModel.class, "fence_post", paint, null));
if (state.getValue(BlockFence.NORTH)) {
result.add(PaintRegistry.getModel(IBakedModel.class, "fence_side", paint, new UVLock(null)));
}
if (state.getValue(BlockFence.EAST)) {
result.add(PaintRegistry.getModel(IBakedModel.class, "fence_side", paint, new UVLock(ModelRotation.X0_Y90)));
}
if (state.getValue(BlockFence.SOUTH)) {
result.add(PaintRegistry.getModel(IBakedModel.class, "fence_side", paint, new UVLock(ModelRotation.X0_Y180)));
}
if (state.getValue(BlockFence.WEST)) {
result.add(PaintRegistry.getModel(IBakedModel.class, "fence_side", paint, new UVLock(ModelRotation.X0_Y270)));
}
return result;
}
示例13: canBeConnectedTo
import net.minecraft.block.BlockFence; //導入依賴的package包/類
@Override
public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
Block connector = world.getBlockState(pos.offset(facing)).getBlock();
if (connector instanceof BlockFence) {
if (this != Blocks.NETHER_BRICK_FENCE && connector == Blocks.NETHER_BRICK_FENCE) {
return false;
} else if (this == Blocks.NETHER_BRICK_FENCE && connector != Blocks.NETHER_BRICK_FENCE) {
return false;
}
return true;
}
return false;
}
示例14: getPathNodeTypeRaw
import net.minecraft.block.BlockFence; //導入依賴的package包/類
private PathNodeType getPathNodeTypeRaw(IBlockAccess p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_)
{
BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_);
IBlockState iblockstate = p_189553_1_.getBlockState(blockpos);
Block block = iblockstate.getBlock();
Material material = iblockstate.getMaterial();
return material == Material.AIR ? PathNodeType.OPEN : (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY ? (block == Blocks.FIRE ? PathNodeType.DAMAGE_FIRE : (block == Blocks.CACTUS ? PathNodeType.DAMAGE_CACTUS : (block instanceof BlockDoor && material == Material.WOOD && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.IRON && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && ((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_OPEN : (block instanceof BlockRailBase ? PathNodeType.RAIL : (!(block instanceof BlockFence) && !(block instanceof BlockWall) && (!(block instanceof BlockFenceGate) || ((Boolean)iblockstate.getValue(BlockFenceGate.OPEN)).booleanValue()) ? (material == Material.WATER ? PathNodeType.WATER : (material == Material.LAVA ? PathNodeType.LAVA : (block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED))) : PathNodeType.FENCE))))))) : PathNodeType.TRAPDOOR);
}
示例15: onUpdate
import net.minecraft.block.BlockFence; //導入依賴的package包/類
@Override
public void onUpdate()
{
super.onUpdate();
if ((this.ticksExisted - 1) % 20 == 0 && this.worldObj.isRemote)
{
this.flagData = ClientUtil.updateFlagData(this.getOwner(), Minecraft.getMinecraft().thePlayer.getDistanceToEntity(this) < 50.0D);
}
Vector3 vec = new Vector3(this.posX, this.posY, this.posZ);
vec = vec.translate(new Vector3(0, -1, 0));
final Block blockAt = vec.getBlock(this.worldObj);
if (blockAt != null)
{
if (blockAt instanceof BlockFence)
{
}
else if (blockAt.isAir(this.worldObj, vec.intX(), vec.intY(), vec.intZ()))
{
this.motionY -= 0.02F;
}
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
}