当前位置: 首页>>代码示例>>Java>>正文


Java BlockPistonExtension类代码示例

本文整理汇总了Java中net.minecraft.block.BlockPistonExtension的典型用法代码示例。如果您正苦于以下问题:Java BlockPistonExtension类的具体用法?Java BlockPistonExtension怎么用?Java BlockPistonExtension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BlockPistonExtension类属于net.minecraft.block包,在下文中一共展示了BlockPistonExtension类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_190609_a

import net.minecraft.block.BlockPistonExtension; //导入依赖的package包/类
public void func_190609_a(World p_190609_1_, BlockPos p_190609_2_, AxisAlignedBB p_190609_3_, List<AxisAlignedBB> p_190609_4_, @Nullable Entity p_190609_5_)
{
    if (!this.extending && this.shouldHeadBeRendered)
    {
        this.pistonState.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true)).addCollisionBoxToList(p_190609_1_, p_190609_2_, p_190609_3_, p_190609_4_, p_190609_5_, false);
    }

    EnumFacing enumfacing = (EnumFacing)field_190613_i.get();

    if ((double)this.progress >= 1.0D || enumfacing != (this.extending ? this.pistonFacing : this.pistonFacing.getOpposite()))
    {
        int i = p_190609_4_.size();
        IBlockState iblockstate;

        if (this.shouldPistonHeadBeRendered())
        {
            iblockstate = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.FACING, this.pistonFacing).withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(this.extending != 1.0F - this.progress < 0.25F));
        }
        else
        {
            iblockstate = this.pistonState;
        }

        float f = this.getExtendedProgress(this.progress);
        double d0 = (double)((float)this.pistonFacing.getFrontOffsetX() * f);
        double d1 = (double)((float)this.pistonFacing.getFrontOffsetY() * f);
        double d2 = (double)((float)this.pistonFacing.getFrontOffsetZ() * f);
        iblockstate.addCollisionBoxToList(p_190609_1_, p_190609_2_, p_190609_3_.offset(-d0, -d1, -d2), p_190609_4_, p_190609_5_, true);

        for (int j = i; j < p_190609_4_.size(); ++j)
        {
            p_190609_4_.set(j, ((AxisAlignedBB)p_190609_4_.get(j)).offset(d0, d1, d2));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:TileEntityPiston.java

示例2: addCollisionBoxToList

import net.minecraft.block.BlockPistonExtension; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_)
   {
	//super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn, p_185477_7_);
       TileEntity tile = worldIn.getTileEntity(pos);

       if (tile != null && tile instanceof TileEntityCasePiston)
       {
       	TileEntityCasePiston piston = (TileEntityCasePiston)tile;
       	
       	for(EnumFacing enumfacing : piston.validFaces){
       		BlockPos pos2 = pos.offset(enumfacing);
       		float progress = piston.progress[enumfacing.getIndex()];
       		if (progress >= 1.0D)
       		{
       			IBlockState iblockstate;
       			iblockstate = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockDirectional.FACING, enumfacing).withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(piston.isExtending[enumfacing.getIndex()] != 1.0F - progress < 0.25F));
       			float f = piston.getExtendedProgress(progress, enumfacing);
       			double d0 = enumfacing.getFrontOffsetX() * f;
       			double d1 = enumfacing.getFrontOffsetY() * f;
       			double d2 = enumfacing.getFrontOffsetZ() * f;
       			iblockstate.addCollisionBoxToList(worldIn, pos2, entityBox.offset(-d0, -d1, -d2), collidingBoxes, entityIn, true);
       		}
       	}
       } 
       super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn, p_185477_7_);
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:29,代码来源:BlockCase.java

示例3: registerVanillaVariantProps

import net.minecraft.block.BlockPistonExtension; //导入依赖的package包/类
private static void registerVanillaVariantProps() {
	// TODO: omit similar blocks
	registerVariantProperty(BlockStone.VARIANT);
	registerVariantProperty(BlockPlanks.VARIANT);
	registerVariantProperty(BlockSapling.TYPE);
	registerVariantProperty(BlockDirt.VARIANT);
	registerVariantProperty(BlockSand.VARIANT);
	registerVariantProperty(BlockOldLog.VARIANT);
	registerVariantProperty(BlockNewLog.VARIANT);
	registerVariantProperty(BlockOldLeaf.VARIANT);
	registerVariantProperty(BlockNewLeaf.VARIANT);
	registerVariantProperty(BlockSandStone.TYPE);
	registerVariantProperty(BlockTallGrass.TYPE);
	registerVariantProperty(BlockPistonExtension.TYPE);
	registerVariantProperty(BlockColored.COLOR);
	registerVariantProperty(BlockPistonMoving.TYPE);
	registerVariantProperty(Blocks.YELLOW_FLOWER.getTypeProperty());
	registerVariantProperty(Blocks.RED_FLOWER.getTypeProperty());
	registerVariantProperty(BlockStoneSlab.VARIANT);
	registerVariantProperty(BlockWoodSlab.VARIANT);
	registerVariantProperty(BlockAnvil.DAMAGE);
	registerVariantProperty(BlockQuartz.VARIANT);
	registerVariantProperty(BlockCarpet.COLOR);
	registerVariantProperty(BlockDoublePlant.VARIANT);
	registerVariantProperty(BlockStainedGlass.COLOR);
	registerVariantProperty(BlockStainedGlassPane.COLOR);
	registerVariantProperty(BlockPrismarine.VARIANT);
	registerVariantProperty(BlockRedSandstone.TYPE);
	registerVariantProperty(BlockStoneSlabNew.VARIANT);
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:31,代码来源:BlockPropertyRegistry.java

示例4: renderTileEntityAt

import net.minecraft.block.BlockPistonExtension; //导入依赖的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();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:55,代码来源:TileEntityPistonRenderer.java

示例5: renderTileEntityAt

import net.minecraft.block.BlockPistonExtension; //导入依赖的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 (iblockstate.getMaterial() != Material.AIR && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
        vertexbuffer.setTranslation(x - (double)blockpos.getX() + (double)te.getOffsetX(partialTicks), y - (double)blockpos.getY() + (double)te.getOffsetY(partialTicks), z - (double)blockpos.getZ() + (double)te.getOffsetZ(partialTicks));
        World world = this.getWorld();

        if (block == Blocks.PISTON_HEAD && te.getProgress(partialTicks) <= 0.25F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, 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.renderStateModel(blockpos, iblockstate1, vertexbuffer, world, true);
            vertexbuffer.setTranslation(x - (double)blockpos.getX(), y - (double)blockpos.getY(), z - (double)blockpos.getZ());
            iblockstate = iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else
        {
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, false);
        }

        vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:TileEntityPistonRenderer.java

示例6: func_190606_j

import net.minecraft.block.BlockPistonExtension; //导入依赖的package包/类
private IBlockState func_190606_j()
{
    return !this.isExtending() && this.shouldPistonHeadBeRendered() ? Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, this.pistonState.getBlock() == Blocks.STICKY_PISTON ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT).withProperty(BlockPistonExtension.FACING, this.pistonState.getValue(BlockPistonBase.FACING)) : this.pistonState;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:TileEntityPiston.java

示例7: renderTileEntityAt

import net.minecraft.block.BlockPistonExtension; //导入依赖的package包/类
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (iblockstate.getMaterial() != Material.AIR && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
        vertexbuffer.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.renderStateModel(blockpos, iblockstate, vertexbuffer, world, 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.renderStateModel(blockpos, iblockstate1, vertexbuffer, world, true);
            vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate = iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else
        {
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, false);
        }

        vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:56,代码来源:TileEntityPistonRenderer.java

示例8: getCollisionRelatedBlockState

import net.minecraft.block.BlockPistonExtension; //导入依赖的package包/类
private IBlockState getCollisionRelatedBlockState(EnumFacing side)
{
    return !isExtending[side.getIndex()] ? Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, BlockPistonExtension.EnumPistonType.DEFAULT).withProperty(BlockDirectional.FACING, side) : getWorld().getBlockState(getPos());
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:5,代码来源:TileEntityCasePiston.java

示例9: getBlockType

import net.minecraft.block.BlockPistonExtension; //导入依赖的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;
  }
 
开发者ID:SleepyTrousers,项目名称:Structures,代码行数:65,代码来源:RotationHelper.java


注:本文中的net.minecraft.block.BlockPistonExtension类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。