public void renderPistonRodUD(double p_147763_1_, double p_147763_3_, double p_147763_5_, double p_147763_7_, double p_147763_9_, double p_147763_11_, float p_147763_13_, double p_147763_14_) { IIcon var16 = BlockPistonBase.func_150074_e("piston_side"); if (this.hasOverrideBlockTexture()) { var16 = this.overrideBlockTexture; } Tessellator var17 = Tessellator.instance; double var18 = (double)var16.getMinU(); double var20 = (double)var16.getMinV(); double var22 = (double)var16.getInterpolatedU(p_147763_14_); double var24 = (double)var16.getInterpolatedV(4.0D); var17.setColorOpaque_F(p_147763_13_, p_147763_13_, p_147763_13_); var17.addVertexWithUV(p_147763_1_, p_147763_7_, p_147763_9_, var22, var20); var17.addVertexWithUV(p_147763_1_, p_147763_5_, p_147763_9_, var18, var20); var17.addVertexWithUV(p_147763_3_, p_147763_5_, p_147763_11_, var18, var24); var17.addVertexWithUV(p_147763_3_, p_147763_7_, p_147763_11_, var22, var24); }
public void renderPistonRodSN(double p_147789_1_, double p_147789_3_, double p_147789_5_, double p_147789_7_, double p_147789_9_, double p_147789_11_, float p_147789_13_, double p_147789_14_) { IIcon var16 = BlockPistonBase.func_150074_e("piston_side"); if (this.hasOverrideBlockTexture()) { var16 = this.overrideBlockTexture; } Tessellator var17 = Tessellator.instance; double var18 = (double)var16.getMinU(); double var20 = (double)var16.getMinV(); double var22 = (double)var16.getInterpolatedU(p_147789_14_); double var24 = (double)var16.getInterpolatedV(4.0D); var17.setColorOpaque_F(p_147789_13_, p_147789_13_, p_147789_13_); var17.addVertexWithUV(p_147789_1_, p_147789_5_, p_147789_11_, var22, var20); var17.addVertexWithUV(p_147789_1_, p_147789_5_, p_147789_9_, var18, var20); var17.addVertexWithUV(p_147789_3_, p_147789_7_, p_147789_9_, var18, var24); var17.addVertexWithUV(p_147789_3_, p_147789_7_, p_147789_11_, var22, var24); }
public void renderPistonRodEW(double p_147738_1_, double p_147738_3_, double p_147738_5_, double p_147738_7_, double p_147738_9_, double p_147738_11_, float p_147738_13_, double p_147738_14_) { IIcon var16 = BlockPistonBase.func_150074_e("piston_side"); if (this.hasOverrideBlockTexture()) { var16 = this.overrideBlockTexture; } Tessellator var17 = Tessellator.instance; double var18 = (double)var16.getMinU(); double var20 = (double)var16.getMinV(); double var22 = (double)var16.getInterpolatedU(p_147738_14_); double var24 = (double)var16.getInterpolatedV(4.0D); var17.setColorOpaque_F(p_147738_13_, p_147738_13_, p_147738_13_); var17.addVertexWithUV(p_147738_3_, p_147738_5_, p_147738_9_, var22, var20); var17.addVertexWithUV(p_147738_1_, p_147738_5_, p_147738_9_, var18, var20); var17.addVertexWithUV(p_147738_1_, p_147738_7_, p_147738_11_, var18, var24); var17.addVertexWithUV(p_147738_3_, p_147738_7_, p_147738_11_, var22, var24); }
public static void placeInAir(World world, ItemStack itemStack, EntityPlayer entityPlayer) { /* if (world.isRemote) return; */ BlockPos pos = getSelectedBlock(entityPlayer); EnumFacing facing = BlockPistonBase.getFacingFromEntity(pos, entityPlayer).getOpposite(); IBlockState blockState = world.getBlockState(pos); if (blockState != null && blockState.getBlock().isAir(blockState, world, pos)) { int dmg = itemStack.getItemDamage(); int count = itemStack.stackSize; itemStack.onItemUse(entityPlayer, world, pos, entityPlayer.getActiveHand(), facing, 0.5F, 0.5F, 0.5F); if (entityPlayer.isCreative()) { itemStack.setItemDamage(dmg); itemStack.stackSize = count; } } }
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving) { int orientation = BlockPistonBase.determineOrientation(world, x, y, z, entityliving); TileEntityElectricEngine eEngine = (TileEntityElectricEngine) world.getTileEntity(x, y, z); world.setBlockMetadataWithNotify(x, y, z, Minecraft.getMinecraft().thePlayer.inventory.getItemStack().getItemDamage(), 1 | 2); switch(orientation) { case 0: eEngine.rotationY = -90F; break; case 1: eEngine.rotationY = 90F; break; case 2: eEngine.rotationX = 270F; break; case 3: eEngine.rotationX = 90F; break; case 4: break; default: eEngine.rotationX = 180F; break; } }
public void renderPistonRodUD(double p_147763_1_, double p_147763_3_, double p_147763_5_, double p_147763_7_, double p_147763_9_, double p_147763_11_, float p_147763_13_, double p_147763_14_) { IIcon iicon = BlockPistonBase.getPistonBaseIcon("piston_side"); if (this.hasOverrideBlockTexture()) { iicon = this.overrideBlockTexture; } Tessellator tessellator = Tessellator.instance; double d7 = (double)iicon.getMinU(); double d8 = (double)iicon.getMinV(); double d9 = (double)iicon.getInterpolatedU(p_147763_14_); double d10 = (double)iicon.getInterpolatedV(4.0D); tessellator.setColorOpaque_F(p_147763_13_, p_147763_13_, p_147763_13_); tessellator.addVertexWithUV(p_147763_1_, p_147763_7_, p_147763_9_, d9, d8); tessellator.addVertexWithUV(p_147763_1_, p_147763_5_, p_147763_9_, d7, d8); tessellator.addVertexWithUV(p_147763_3_, p_147763_5_, p_147763_11_, d7, d10); tessellator.addVertexWithUV(p_147763_3_, p_147763_7_, p_147763_11_, d9, d10); }
public void renderPistonRodSN(double p_147789_1_, double p_147789_3_, double p_147789_5_, double p_147789_7_, double p_147789_9_, double p_147789_11_, float p_147789_13_, double p_147789_14_) { IIcon iicon = BlockPistonBase.getPistonBaseIcon("piston_side"); if (this.hasOverrideBlockTexture()) { iicon = this.overrideBlockTexture; } Tessellator tessellator = Tessellator.instance; double d7 = (double)iicon.getMinU(); double d8 = (double)iicon.getMinV(); double d9 = (double)iicon.getInterpolatedU(p_147789_14_); double d10 = (double)iicon.getInterpolatedV(4.0D); tessellator.setColorOpaque_F(p_147789_13_, p_147789_13_, p_147789_13_); tessellator.addVertexWithUV(p_147789_1_, p_147789_5_, p_147789_11_, d9, d8); tessellator.addVertexWithUV(p_147789_1_, p_147789_5_, p_147789_9_, d7, d8); tessellator.addVertexWithUV(p_147789_3_, p_147789_7_, p_147789_9_, d7, d10); tessellator.addVertexWithUV(p_147789_3_, p_147789_7_, p_147789_11_, d9, d10); }
public void renderPistonRodEW(double p_147738_1_, double p_147738_3_, double p_147738_5_, double p_147738_7_, double p_147738_9_, double p_147738_11_, float p_147738_13_, double p_147738_14_) { IIcon iicon = BlockPistonBase.getPistonBaseIcon("piston_side"); if (this.hasOverrideBlockTexture()) { iicon = this.overrideBlockTexture; } Tessellator tessellator = Tessellator.instance; double d7 = (double)iicon.getMinU(); double d8 = (double)iicon.getMinV(); double d9 = (double)iicon.getInterpolatedU(p_147738_14_); double d10 = (double)iicon.getInterpolatedV(4.0D); tessellator.setColorOpaque_F(p_147738_13_, p_147738_13_, p_147738_13_); tessellator.addVertexWithUV(p_147738_3_, p_147738_5_, p_147738_9_, d9, d8); tessellator.addVertexWithUV(p_147738_1_, p_147738_5_, p_147738_9_, d7, d8); tessellator.addVertexWithUV(p_147738_1_, p_147738_7_, p_147738_11_, d7, d10); tessellator.addVertexWithUV(p_147738_3_, p_147738_7_, p_147738_11_, d9, d10); }
public void func_71852_a(World p_71852_1_, int p_71852_2_, int p_71852_3_, int p_71852_4_, int p_71852_5_, int p_71852_6_) { super.func_71852_a(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_5_, p_71852_6_); int var7 = Facing.field_71588_a[func_72121_f(p_71852_6_)]; p_71852_2_ += Facing.field_71586_b[var7]; p_71852_3_ += Facing.field_71587_c[var7]; p_71852_4_ += Facing.field_71585_d[var7]; int var8 = p_71852_1_.func_72798_a(p_71852_2_, p_71852_3_, p_71852_4_); if(var8 == Block.field_71963_Z.field_71990_ca || var8 == Block.field_71956_V.field_71990_ca) { p_71852_6_ = p_71852_1_.func_72805_g(p_71852_2_, p_71852_3_, p_71852_4_); if(BlockPistonBase.func_72114_f(p_71852_6_)) { Block.field_71973_m[var8].func_71897_c(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_6_, 0); p_71852_1_.func_94571_i(p_71852_2_, p_71852_3_, p_71852_4_); } } }
public void func_78591_a(double p_78591_1_, double p_78591_3_, double p_78591_5_, double p_78591_7_, double p_78591_9_, double p_78591_11_, float p_78591_13_, double p_78591_14_) { Icon var16 = BlockPistonBase.func_94496_b("piston_side"); if(this.func_94167_b()) { var16 = this.field_78664_d; } Tessellator var17 = Tessellator.field_78398_a; double var18 = (double)var16.func_94209_e(); double var20 = (double)var16.func_94206_g(); double var22 = (double)var16.func_94214_a(p_78591_14_); double var24 = (double)var16.func_94207_b(4.0D); var17.func_78386_a(p_78591_13_, p_78591_13_, p_78591_13_); var17.func_78374_a(p_78591_1_, p_78591_7_, p_78591_9_, var22, var20); var17.func_78374_a(p_78591_1_, p_78591_5_, p_78591_9_, var18, var20); var17.func_78374_a(p_78591_3_, p_78591_5_, p_78591_11_, var18, var24); var17.func_78374_a(p_78591_3_, p_78591_7_, p_78591_11_, var22, var24); }
public void func_78607_b(double p_78607_1_, double p_78607_3_, double p_78607_5_, double p_78607_7_, double p_78607_9_, double p_78607_11_, float p_78607_13_, double p_78607_14_) { Icon var16 = BlockPistonBase.func_94496_b("piston_side"); if(this.func_94167_b()) { var16 = this.field_78664_d; } Tessellator var17 = Tessellator.field_78398_a; double var18 = (double)var16.func_94209_e(); double var20 = (double)var16.func_94206_g(); double var22 = (double)var16.func_94214_a(p_78607_14_); double var24 = (double)var16.func_94207_b(4.0D); var17.func_78386_a(p_78607_13_, p_78607_13_, p_78607_13_); var17.func_78374_a(p_78607_1_, p_78607_5_, p_78607_11_, var22, var20); var17.func_78374_a(p_78607_1_, p_78607_5_, p_78607_9_, var18, var20); var17.func_78374_a(p_78607_3_, p_78607_7_, p_78607_9_, var18, var24); var17.func_78374_a(p_78607_3_, p_78607_7_, p_78607_11_, var22, var24); }
public void func_78571_c(double p_78571_1_, double p_78571_3_, double p_78571_5_, double p_78571_7_, double p_78571_9_, double p_78571_11_, float p_78571_13_, double p_78571_14_) { Icon var16 = BlockPistonBase.func_94496_b("piston_side"); if(this.func_94167_b()) { var16 = this.field_78664_d; } Tessellator var17 = Tessellator.field_78398_a; double var18 = (double)var16.func_94209_e(); double var20 = (double)var16.func_94206_g(); double var22 = (double)var16.func_94214_a(p_78571_14_); double var24 = (double)var16.func_94207_b(4.0D); var17.func_78386_a(p_78571_13_, p_78571_13_, p_78571_13_); var17.func_78374_a(p_78571_3_, p_78571_5_, p_78571_9_, var22, var20); var17.func_78374_a(p_78571_1_, p_78571_5_, p_78571_9_, var18, var20); var17.func_78374_a(p_78571_1_, p_78571_7_, p_78571_11_, var18, var24); var17.func_78374_a(p_78571_3_, p_78571_7_, p_78571_11_, var22, var24); }
/** * Render piston rod up/down */ public void renderPistonRodUD(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14) { Icon icon = BlockPistonBase.getPistonBaseIcon("piston_side"); if (this.hasOverrideBlockTexture()) { icon = this.overrideBlockTexture; } Tessellator tessellator = Tessellator.instance; double d7 = (double)icon.getMinU(); double d8 = (double)icon.getMinV(); double d9 = (double)icon.getInterpolatedU(par14); double d10 = (double)icon.getInterpolatedV(4.0D); tessellator.setColorOpaque_F(par13, par13, par13); tessellator.addVertexWithUV(par1, par7, par9, d9, d8); tessellator.addVertexWithUV(par1, par5, par9, d7, d8); tessellator.addVertexWithUV(par3, par5, par11, d7, d10); tessellator.addVertexWithUV(par3, par7, par11, d9, d10); }
/** * Render piston rod south/north */ public void renderPistonRodSN(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14) { Icon icon = BlockPistonBase.getPistonBaseIcon("piston_side"); if (this.hasOverrideBlockTexture()) { icon = this.overrideBlockTexture; } Tessellator tessellator = Tessellator.instance; double d7 = (double)icon.getMinU(); double d8 = (double)icon.getMinV(); double d9 = (double)icon.getInterpolatedU(par14); double d10 = (double)icon.getInterpolatedV(4.0D); tessellator.setColorOpaque_F(par13, par13, par13); tessellator.addVertexWithUV(par1, par5, par11, d9, d8); tessellator.addVertexWithUV(par1, par5, par9, d7, d8); tessellator.addVertexWithUV(par3, par7, par9, d7, d10); tessellator.addVertexWithUV(par3, par7, par11, d9, d10); }
/** * Render piston rod east/west */ public void renderPistonRodEW(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14) { Icon icon = BlockPistonBase.getPistonBaseIcon("piston_side"); if (this.hasOverrideBlockTexture()) { icon = this.overrideBlockTexture; } Tessellator tessellator = Tessellator.instance; double d7 = (double)icon.getMinU(); double d8 = (double)icon.getMinV(); double d9 = (double)icon.getInterpolatedU(par14); double d10 = (double)icon.getInterpolatedV(4.0D); tessellator.setColorOpaque_F(par13, par13, par13); tessellator.addVertexWithUV(par3, par5, par9, d9, d8); tessellator.addVertexWithUV(par1, par5, par9, d7, d8); tessellator.addVertexWithUV(par1, par7, par11, d7, d10); tessellator.addVertexWithUV(par3, par7, par11, d9, d10); }
@Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving player) { int type = getTypeFromMeta(world.getBlockMetadata(x, y, z)); int orientation = BlockPistonBase.determineOrientation(world, x, y, z, (EntityPlayer) player); byte oriented = 0; switch (orientation) { case 0: case 1: oriented = 0; break; case 2: case 3: oriented = 8; break; case 4: case 5: oriented = 4; } world.setBlockMetadataWithNotify(x, y, z, type | oriented); }
public boolean canMove() { this.toMove.clear(); this.toDestroy.clear(); Block block = this.world.getBlockState(this.blockToMove).getBlock(); if (!BlockPistonBase.canPush(block, this.world, this.blockToMove, this.moveDirection, false)) { if (block.getMobilityFlag() != 1) { return false; } else { this.toDestroy.add(this.blockToMove); return true; } } else if (!this.func_177251_a(this.blockToMove)) { return false; } else { for (int i = 0; i < this.toMove.size(); ++i) { BlockPos blockpos = (BlockPos)this.toMove.get(i); if (this.world.getBlockState(blockpos).getBlock() == Blocks.slime_block && !this.func_177250_b(blockpos)) { return false; } } return true; } }
public boolean canMove() { this.toMove.clear(); this.toDestroy.clear(); IBlockState iblockstate = this.world.getBlockState(this.blockToMove); if (!BlockPistonBase.canPush(iblockstate, this.world, this.blockToMove, this.moveDirection, false)) { if (iblockstate.getMobilityFlag() == EnumPushReaction.DESTROY) { this.toDestroy.add(this.blockToMove); return true; } else { return false; } } else if (!this.addBlockLine(this.blockToMove)) { return false; } else { for (int i = 0; i < this.toMove.size(); ++i) { BlockPos blockpos = (BlockPos)this.toMove.get(i); if (this.world.getBlockState(blockpos).getBlock() == Blocks.SLIME_BLOCK && !this.addBranchingBlocks(blockpos)) { return false; } } return true; } }
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)); } } }
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, BlockPistonBase.getFacingFromEntity(worldIn, pos, placer)), 2); if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityDispenser) { ((TileEntityDispenser)tileentity).setCustomName(stack.getDisplayName()); } } }
protected void dispense(World worldIn, BlockPos pos) { BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos); TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity(); if (tileentitydispenser != null) { int i = tileentitydispenser.getDispenseSlot(); if (i < 0) { worldIn.playAuxSFX(1001, pos, 0); } else { ItemStack itemstack = tileentitydispenser.getStackInSlot(i); IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack); if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider) { try{ IPosition iposition = BlockDispenser.getDispensePosition(blocksourceimpl); BlockPos pos1 = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ()); Block block = Block.getBlockFromItem(itemstack.getItem()); if (worldIn.canBlockBePlaced(block,pos1,true,BlockPistonBase.getFacing(1),en,itemstack)){ ItemStack itemstack1 = this.dispenseStack(blocksourceimpl, itemstack, worldIn); worldIn.playSoundEffect(iposition.getX(), iposition.getY(), iposition.getZ(), block.stepSound.getPlaceSound(), 1.0f, 1.0f); if (block.getStateFromMeta(itemstack1.getMetadata())==worldIn.getBlockState(pos1))tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize == 0 ? null : itemstack1); }} catch (Exception e) {} } } } }
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack,World worldIn) { try{ IPosition iposition = BlockDispenser.getDispensePosition(source); ItemStack itemstack1 = stack.splitStack(1); BlockPos pos = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ()); Block block; block = Block.getBlockFromItem(itemstack1.getItem()); if( worldIn.canBlockBePlaced(block,pos,true,BlockPistonBase.getFacing(1),en,itemstack1)){ worldIn.setBlockState(pos, block.getStateFromMeta(itemstack1.getMetadata())); }} catch (Exception e) {return stack;} return stack; }
@Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing blockFaceClickedOn, float hitX, float hitY, float hitZ, int meta, EntityLivingBase player) { EnumFacing facing = BlockPistonBase.getFacingFromEntity(world, pos, player); return this.getDefaultState().withProperty(PROPERTYFACING, facing); }
@Override public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) { if (player.isSneaking()) { int l = BlockPistonBase.determineOrientation(world, x, y, z, player); world.setBlockMetadataWithNotify(x, y, z, l, 2); } else { this.setInvert(!reverted); world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); } return 0; }
@Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { TileEntity te = worldIn.getTileEntity(pos); if (te != null && te instanceof TileEntityMarker) { ((TileEntityMarker) te).setFacing(BlockPistonBase.getFacingFromEntity(pos, placer)); BlockUtils.markBlockForUpdate(worldIn, pos); } }
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int g = BlockPistonBase.determineOrientation(world, x, y, z, par5EntityLivingBase); if(world.getTileEntity(x,y,z) instanceof TileEntityDataConverter){ TileEntityDataConverter tile = (TileEntityDataConverter)world.getTileEntity(x,y,z); tile.dir = ForgeDirection.getOrientation(g); } }
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int g = BlockPistonBase.determineOrientation(world, x, y, z, par5EntityLivingBase); if(world.getTileEntity(x,y,z) instanceof TileEntityDataDetector){ TileEntityDataDetector tile = (TileEntityDataDetector)world.getTileEntity(x,y,z); tile.dir = ForgeDirection.getOrientation(g); } }
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int g = BlockPistonBase.determineOrientation(world, x, y, z, par5EntityLivingBase); if(world.getTileEntity(x,y,z) instanceof TileEntityDataSelector){ TileEntityDataSelector tile = (TileEntityDataSelector)world.getTileEntity(x,y,z); tile.dir = ForgeDirection.getOrientation(g); } }