本文整理匯總了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();
}
}