本文整理汇总了Java中net.minecraft.init.Blocks.sticky_piston方法的典型用法代码示例。如果您正苦于以下问题:Java Blocks.sticky_piston方法的具体用法?Java Blocks.sticky_piston怎么用?Java Blocks.sticky_piston使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.init.Blocks
的用法示例。
在下文中一共展示了Blocks.sticky_piston方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockHarvested
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (player.capabilities.isCreativeMode)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
if (enumfacing != null)
{
BlockPos blockpos = pos.offset(enumfacing.getOpposite());
Block block = worldIn.getBlockState(blockpos).getBlock();
if (block == Blocks.piston || block == Blocks.sticky_piston)
{
worldIn.setBlockToAir(blockpos);
}
}
}
super.onBlockHarvested(worldIn, pos, state, player);
}
示例2: onNeighborBlockChange
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
* Called when a neighboring block changes.
*/
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
BlockPos blockpos = pos.offset(enumfacing.getOpposite());
IBlockState iblockstate = worldIn.getBlockState(blockpos);
if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston)
{
worldIn.setBlockToAir(pos);
}
else
{
iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
}
}
示例3: setBlockBoundsBasedOnState
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
if (tileentitypiston != null)
{
IBlockState iblockstate = tileentitypiston.getPistonState();
Block block = iblockstate.getBlock();
if (block == this || block.getMaterial() == Material.air)
{
return;
}
float f = tileentitypiston.getProgress(0.0F);
if (tileentitypiston.isExtending())
{
f = 1.0F - f;
}
block.setBlockBoundsBasedOnState(worldIn, pos);
if (block == Blocks.piston || block == Blocks.sticky_piston)
{
f = 0.0F;
}
EnumFacing enumfacing = tileentitypiston.getFacing();
this.minX = block.getBlockBoundsMinX() - (double)((float)enumfacing.getFrontOffsetX() * f);
this.minY = block.getBlockBoundsMinY() - (double)((float)enumfacing.getFrontOffsetY() * f);
this.minZ = block.getBlockBoundsMinZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
this.maxX = block.getBlockBoundsMaxX() - (double)((float)enumfacing.getFrontOffsetX() * f);
this.maxY = block.getBlockBoundsMaxY() - (double)((float)enumfacing.getFrontOffsetY() * f);
this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
}
}
示例4: breakBlock
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
super.breakBlock(worldIn, pos, state);
EnumFacing enumfacing = ((EnumFacing)state.getValue(FACING)).getOpposite();
pos = pos.offset(enumfacing);
IBlockState iblockstate = worldIn.getBlockState(pos);
if ((iblockstate.getBlock() == Blocks.piston || iblockstate.getBlock() == Blocks.sticky_piston) && ((Boolean)iblockstate.getValue(BlockPistonBase.EXTENDED)).booleanValue())
{
iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
worldIn.setBlockToAir(pos);
}
}
示例5: canPush
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, EnumFacing direction, boolean allowDestroy)
{
if (blockIn == Blocks.obsidian)
{
return false;
}
else if (!worldIn.getWorldBorder().contains(pos))
{
return false;
}
else if (pos.getY() >= 0 && (direction != EnumFacing.DOWN || pos.getY() != 0))
{
if (pos.getY() <= worldIn.getHeight() - 1 && (direction != EnumFacing.UP || pos.getY() != worldIn.getHeight() - 1))
{
if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
{
if (blockIn.getBlockHardness(worldIn, pos) == -1.0F)
{
return false;
}
if (blockIn.getMobilityFlag() == 2)
{
return false;
}
if (blockIn.getMobilityFlag() == 1)
{
if (!allowDestroy)
{
return false;
}
return true;
}
}
else if (((Boolean)worldIn.getBlockState(pos).getValue(EXTENDED)).booleanValue())
{
return false;
}
return !(blockIn instanceof ITileEntityProvider);
}
else
{
return false;
}
}
else
{
return false;
}
}
示例6: renderTileEntityAt
import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
BlockPos blockpos = te.getPos();
IBlockState iblockstate = te.getPistonState();
Block block = iblockstate.getBlock();
if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
this.bindTexture(TextureMap.locationBlocksTexture);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(770, 771);
GlStateManager.enableBlend();
GlStateManager.disableCull();
if (Minecraft.isAmbientOcclusionEnabled())
{
GlStateManager.shadeModel(7425);
}
else
{
GlStateManager.shadeModel(7424);
}
worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
World world = this.getWorld();
if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F)
{
iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
}
else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
{
BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true);
worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
}
else
{
this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false);
}
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
}
}