private void setIgloo() { this.floor = Blocks.snow.getDefaultState(); this.exterior = Blocks.snow.getDefaultState(); this.wall = Blocks.packed_ice.getDefaultState(); this.light = Blocks.torch.getDefaultState(); this.goal = Blocks.redstone_block.getDefaultState(); this.moat = Blocks.water.getDefaultState(); this.moatContainer = Blocks.glowstone.getDefaultState(); this.doorUpper = Blocks.spruce_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.doorLower = Blocks.spruce_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.stairs = Blocks.spruce_stairs.getDefaultState(); this.stairsPlatform = Blocks.packed_ice.getDefaultState(); this.ladder = Blocks.ladder.getDefaultState(); this.puzzleDoorUpper = Blocks.iron_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER); this.puzzleDoorLower = Blocks.iron_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER); this.trigger = Blocks.lever.getDefaultState(); this.platform = Blocks.snow.getDefaultState(); this.hint = Blocks.redstone_ore.getDefaultState(); }
private void drawStandardRoads(World world, int chunkX, int groundY, int chunkZ, int chunkSize) { // Draw roads for (int x = 0, maxX = chunkSize; x < maxX; ++x) { for (int z = 0, maxZ = chunkSize; z < maxZ; ++z) { int edgeX = (x > chunkSize / 2) ? chunkSize - 1 - x : x; int edgeZ = (z > chunkSize / 2) ? chunkSize - 1 - z : z; if (edgeX < 2 || edgeZ < 2) { world.setBlockState(new BlockPos(chunkX * 16 + x, groundY, chunkZ * 16 + z), Blocks.STONE.getStateFromMeta(4), 2); } } } }
/** * 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) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue()) { if (worldIn.isRemote) { return true; } else { ((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack); worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this)); --stack.stackSize; playerIn.triggerAchievement(StatList.field_181740_X); return true; } } else { return false; } }
public static void initRecipes(){ recipes.add(new PotteryKilnRecipe(new ItemStack(Items.CLAY_BALL), new ItemStack(Items.BRICK))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.CLAY), new ItemStack(Blocks.HARDENED_CLAY))); recipes.add(new PotteryKilnRecipe(new ItemStack(ItemsRegistry.clay_Pot), new ItemStack(Items.FLOWER_POT))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 0), new ItemStack(Blocks.WHITE_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 1), new ItemStack(Blocks.ORANGE_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 2), new ItemStack(Blocks.MAGENTA_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 3), new ItemStack(Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 4), new ItemStack(Blocks.YELLOW_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 5), new ItemStack(Blocks.LIME_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 6), new ItemStack(Blocks.PINK_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 7), new ItemStack(Blocks.GRAY_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 8), new ItemStack(Blocks.SILVER_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 9), new ItemStack(Blocks.CYAN_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 10), new ItemStack(Blocks.PURPLE_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 11), new ItemStack(Blocks.BLUE_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 12), new ItemStack(Blocks.BROWN_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 13), new ItemStack(Blocks.GREEN_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 14), new ItemStack(Blocks.RED_GLAZED_TERRACOTTA))); recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 15), new ItemStack(Blocks.BLACK_GLAZED_TERRACOTTA))); }
/** * Return true to set given position as destination */ protected boolean shouldMoveTo(World worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos).getBlock(); if (block == Blocks.FARMLAND) { pos = pos.up(); IBlockState iblockstate = worldIn.getBlockState(pos); block = iblockstate.getBlock(); if (block instanceof BlockCrops && ((BlockCrops)block).isMaxAge(iblockstate) && this.wantsToReapStuff && (this.currentTask == 0 || this.currentTask < 0)) { this.currentTask = 0; return true; } if (iblockstate.getMaterial() == Material.AIR && this.hasFarmItem && (this.currentTask == 1 || this.currentTask < 0)) { this.currentTask = 1; return true; } } return false; }
@SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { IForgeRegistry<Item> registry = event.getRegistry(); registry.registerAll( new Mooncake().setRegistryName("mooncakecraft:mooncake"), new MooncakeMold().setRegistryName("mooncakecraft:mooncakemold"), new MooncakeFilling().setRegistryName("mooncakecraft:mooncake_filling"), new Item().setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setHasSubtypes(false).setUnlocalizedName("mooncakecraft.wheat_flour").setRegistryName("mooncakecraft:wheat_flour"), new MoonCakeRaw().setRegistryName("mooncakecraft:mooncakeraw"), new MoonCakeUnshaped().setRegistryName("mooncakecraft:mooncakeunshaped"), new Item().setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setHasSubtypes(false).setUnlocalizedName("mooncakecraft.lotus_seeds").setRegistryName("mooncakecraft:lotus_seeds"), new Item().setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setHasSubtypes(false).setUnlocalizedName("mooncakecraft.jujube").setRegistryName("mooncakecraft:jujube"), new ItemSeeds(MooncakeConstants.PEANUT_PLANT, Blocks.FARMLAND).setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setUnlocalizedName("mooncakecraft.peanut_seeds").setRegistryName("mooncakecraft:peanut_seeds"), new ItemSeeds(MooncakeConstants.SESAME_PLANT, Blocks.FARMLAND).setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setUnlocalizedName("mooncakecraft.sesame_seeds").setRegistryName("mooncakecraft:sesame_seeds"), new Item().setRegistryName("mooncakecraft:icon") ); }
/** * Attempts to extinguish a fire */ public boolean extinguishFire(EntityPlayer player, BlockPos pos, EnumFacing side) { pos = pos.offset(side); if (this.getBlockState(pos).getBlock() == Blocks.fire) { this.playAuxSFXAtEntity(player, 1004, pos, 0); this.setBlockToAir(pos); return true; } else { return false; } }
@Override public boolean generate(World worldIn, Random rand, BlockPos position) { for (int i = 0; i < 16; ++i) { BlockPos offset = position.add(rand.nextInt(6) - rand.nextInt(6), 6, rand.nextInt(6) - rand.nextInt(6)); while (!worldIn.isSideSolid(offset.down(), EnumFacing.UP, false) && offset.getY() > 0) { offset = offset.down(); } if (worldIn.isAirBlock(offset) && !worldIn.getBlockState(offset.down()).getBlock().isAssociatedBlock(Blocks.SAND)) { EnumRockClass erc = GenerationHelper.getStoneTypeAt(worldIn, offset); worldIn.setBlockState(offset, ExPBlocks.pebble.getDefaultState().withProperty(ExPBlockProperties.ROCK_CLASS, erc), 2); } } return true; }
protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) { Block block = blockState.getBlock(); if (block == Blocks.redstone_wire) { return true; } else if (Blocks.unpowered_repeater.isAssociated(block)) { EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); return enumfacing == side || enumfacing.getOpposite() == side; } else { return block.canProvidePower() && side != null; } }
public static int getItemBurnTimeBurning(ItemStack itemStack) { if(itemStack == null) return 0; else { Item item = itemStack.getItem(); if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); if(block == Blocks.coal_block) return 3200; } if(item == Items.coal) return 320; return 0; } }
public EntityDiggingFX func_174845_l() { this.field_181019_az = new BlockPos(this.posX, this.posY, this.posZ); Block block = this.field_174847_a.getBlock(); if (block == Blocks.grass) { return this; } else { int i = block.getRenderColor(this.field_174847_a); this.particleRed *= (float)(i >> 16 & 255) / 255.0F; this.particleGreen *= (float)(i >> 8 & 255) / 255.0F; this.particleBlue *= (float)(i & 255) / 255.0F; return this; } }
/** * Sets a block to air, but also plays the sound and particles and can spawn drops */ public boolean destroyBlock(BlockPos pos, boolean dropBlock) { IBlockState iblockstate = this.getBlockState(pos); Block block = iblockstate.getBlock(); if (block.getMaterial() == Material.air) { return false; } else { this.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); if (dropBlock) { block.dropBlockAsItem(this, pos, iblockstate, 0); } return this.setBlockState(pos, Blocks.air.getDefaultState(), 3); } }
@Override public void update() { /* * Most of the Electrostatic Compressor's logic can be found in TickHandlerPneumaticCraft#handleElectrostaticGeneration(). */ if (getWorld().getTotalWorldTime() % 40 == 0) { for (ironBarsBeneath = 0; ironBarsBeneath < 128; ironBarsBeneath++) { if (getWorld().getBlockState(getPos().offset(EnumFacing.DOWN, ironBarsBeneath + 1)).getBlock() != Blocks.IRON_BARS) { break; } } } super.update(); if (!getWorld().isRemote) { if (lastRedstoneState != shouldEmitRedstone()) { lastRedstoneState = !lastRedstoneState; updateNeighbours(); } struckByLightningCooldown--; } }
/** * Returns the block corresponding to the given coordinates inside a chunk. */ private Block getBlock0(int x, int y, int z) { Block block = Blocks.air; if (y >= 0 && y >> 4 < this.storageArrays.length) { ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4]; if (extendedblockstorage != null) { try { block = extendedblockstorage.getBlockByExtId(x, y & 15, z); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block"); throw new ReportedException(crashreport); } } } return block; }
/** * Called when a neighboring block changes. */ public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS); if (enumfacing$axis == EnumFacing.Axis.X) { BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.X); if (!blockportal$size.func_150860_b() || blockportal$size.field_150864_e < blockportal$size.field_150868_h * blockportal$size.field_150862_g) { worldIn.setBlockState(pos, Blocks.air.getDefaultState()); } } else if (enumfacing$axis == EnumFacing.Axis.Z) { BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.Z); if (!blockportal$size1.func_150860_b() || blockportal$size1.field_150864_e < blockportal$size1.field_150868_h * blockportal$size1.field_150862_g) { worldIn.setBlockState(pos, Blocks.air.getDefaultState()); } } }
public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); if (itemstack.getItem() == Items.SHEARS && !this.getSheared() && !this.isChild()) { if (!this.world.isRemote) { this.setSheared(true); int i = 1 + this.rand.nextInt(3); for (int j = 0; j < i; ++j) { EntityItem entityitem = this.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.WOOL), 1, this.getFleeceColor().getMetadata()), 1.0F); entityitem.motionY += (double)(this.rand.nextFloat() * 0.05F); entityitem.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); entityitem.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); } } itemstack.damageItem(1, player); this.playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1.0F, 1.0F); } return super.processInteract(player, hand); }
private void fillEight(ItemStack stack, World world, EntityPlayer player) { boolean doSFX = false; int counter = 0; while (counter < 8) { if (player.inventory.hasItem(Item.getItemFromBlock(Blocks.cactus))) { int dmg = stack.getItemDamage() - 1; stack.setItemDamage(dmg); player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.cactus)); // We're just grabbing what we need from the inventory doSFX = true; } // else, doesn't have what it takes counter += 1; } if (doSFX) { world.playSoundAtEntity(player, "random.wood_click", 1.0F, 0.2F); } }
/** * removes a piston's tile entity (and if the piston is moving, stops it) */ public void clearPistonTileEntity() { if (this.lastProgress < 1.0F && this.worldObj != null) { this.lastProgress = this.progress = 1.0F; this.worldObj.removeTileEntity(this.pos); this.invalidate(); if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) { this.worldObj.setBlockState(this.pos, this.pistonState, 3); this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); } } }
@Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (side != 1) return false; Block block = world.getBlock(x, y, z); if (block == Blocks.obsidian || block == Blocks.bedrock) if (world.isAirBlock(x, y + 1, z)) { if (!world.isRemote) { EntityPlacedEndCrystal endCrystal = new EntityPlacedEndCrystal(world); endCrystal.setPosition(x + 0.5, y, z + 0.5); endCrystal.setBlockPos(x, y, z); world.spawnEntityInWorld(endCrystal); if (!player.capabilities.isCreativeMode) stack.stackSize--; } return true; } return false; }
@Override public void addRecipes() { if (this.Enabled) { // One obsidigun (empty) GameRegistry.addRecipe(new ItemStack(this, 1 , this.getMaxDamage()), "x x", "zbz", "xyx", 'x', Blocks.obsidian, 'y', Blocks.lever, 'z', Items.iron_ingot, 'a', Items.repeater, 'b', Blocks.piston ); } else if (Main.noCreative) { this.setCreativeTab(null); } // Not enabled and not allowed to be in the creative menu // Reloading with obsidian magazine, setting its ammo metadata as ours (Need to be empty for that) Helper.registerAmmoRecipe(ObsidianMagazine.class, this); }
protected ItemStack createStackedBlock(IBlockState state) { switch ((BlockSilverfish.EnumType)state.getValue(VARIANT)) { case COBBLESTONE: return new ItemStack(Blocks.cobblestone); case STONEBRICK: return new ItemStack(Blocks.stonebrick); case MOSSY_STONEBRICK: return new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.EnumType.MOSSY.getMetadata()); case CRACKED_STONEBRICK: return new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.EnumType.CRACKED.getMetadata()); case CHISELED_STONEBRICK: return new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.EnumType.CHISELED.getMetadata()); default: return new ItemStack(Blocks.stone); } }
/** * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height * limit, is valid. */ private boolean validTreeLocation() { Block block = this.world.getBlockState(this.basePos.down()).getBlock(); if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) { return false; } else { int i = this.checkBlockLine(this.basePos, this.basePos.up(this.heightLimit - 1)); if (i == -1) { return true; } else if (i < 6) { return false; } else { this.heightLimit = i; return true; } } }
/** * Generates the leaves surrounding an individual entry in the leafNodes list. */ void generateLeafNode(BlockPos pos) { for (int i = 0; i < this.leafDistanceLimit; ++i) { this.func_181631_a(pos.up(i), this.leafSize(i), Blocks.leaves.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false))); } }
public boolean isFlammableWithin(AxisAlignedBB bb) { int i = MathHelper.floor_double(bb.minX); int j = MathHelper.ceiling_double_int(bb.maxX); int k = MathHelper.floor_double(bb.minY); int l = MathHelper.ceiling_double_int(bb.maxY); int i1 = MathHelper.floor_double(bb.minZ); int j1 = MathHelper.ceiling_double_int(bb.maxZ); if (this.isAreaLoaded(i, k, i1, j, l, j1, true)) { BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { Block block = this.getBlockState(blockpos$pooledmutableblockpos.setPos(k1, l1, i2)).getBlock(); if (block == Blocks.FIRE || block == Blocks.FLOWING_LAVA || block == Blocks.LAVA) { blockpos$pooledmutableblockpos.release(); return true; } else if (block.isBurning(this, new BlockPos(k1, l1, i2))) { return true; } } } } blockpos$pooledmutableblockpos.release(); } return false; }
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) { Block block = worldIn.getBlockState(pos).getBlock(); if (block == Blocks.snow_layer) { side = EnumFacing.UP; } else if (!block.isReplaceable(worldIn, pos)) { pos = pos.offset(side); } return worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack); }
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { if (this.isOn && !worldIn.isBlockPowered(pos)) { worldIn.setBlockState(pos, Blocks.redstone_lamp.getDefaultState(), 2); } else if (!this.isOn && worldIn.isBlockPowered(pos)) { worldIn.setBlockState(pos, Blocks.lit_redstone_lamp.getDefaultState(), 2); } } }
@Override public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { if(world.getTileEntity(pos) instanceof TileEntitySmelter){ if(fromPos.up().equals(pos)){ //if the block is beneath us Block down = world.getBlockState(fromPos).getBlock(); if(down == Blocks.AIR) { dropBlockAsItem(world, pos, getDefaultState(), 0); world.setBlockToAir(pos); } else if(down == Blocks.LIT_FURNACE) { ((TileEntitySmelter)world.getTileEntity(pos)).setCooking(); world.notifyBlockUpdate(pos, state, getDefaultState(), 3); } else if(down == Blocks.FURNACE) { ((TileEntitySmelter)world.getTileEntity(pos)).stopCooking(); world.notifyBlockUpdate(pos, state, getDefaultState(), 3); } else if (down == ExSartagineBlock.range_extension_lit) { ((TileEntitySmelter)world.getTileEntity(pos)).setCooking(); world.notifyBlockUpdate(pos, state, getDefaultState(), 3); } else if (down == ExSartagineBlock.range_extension) { ((TileEntitySmelter)world.getTileEntity(pos)).stopCooking(); world.notifyBlockUpdate(pos, state, getDefaultState(), 3); } } } }
public BiomeGenMushroomIsland(int p_i1984_1_) { super(p_i1984_1_); this.theBiomeDecorator.treesPerChunk = -100; this.theBiomeDecorator.flowersPerChunk = -100; this.theBiomeDecorator.grassPerChunk = -100; this.theBiomeDecorator.mushroomsPerChunk = 1; this.theBiomeDecorator.bigMushroomsPerChunk = 1; this.topBlock = Blocks.mycelium.getDefaultState(); this.spawnableMonsterList.clear(); this.spawnableCreatureList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityMooshroom.class, 8, 4, 8)); }
@Override public void registerRecipes() { if (Item.REGISTRY.getObject(new ResourceLocation("enderio:itemAlloy")) != null) { RezolveMod.addRecipe(new ItemStack(this.itemBlock), "RCR", "FMF", "RcR", 'R', "item|enderio:itemAlloy|3", 'C', Items.COMPARATOR, 'F', "item|enderio:itemBasicFilterUpgrade", 'M', "item|enderio:itemMachinePart|0", 'c', "item|enderio:itemBasicCapacitor|2" ); } else { RezolveMod.addRecipe(new ItemStack(this.itemBlock), "QEQ", "CRC", "QNQ", 'Q', Blocks.QUARTZ_BLOCK, 'E', Blocks.ENCHANTING_TABLE, 'C', Blocks.CRAFTING_TABLE, 'R', Items.COMPARATOR, 'N', Items.NETHER_STAR ); } }
private void playParticles() { if (this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY + (double)this.height / 1.5D, this.posZ, 10, (double)(this.width / 4.0F), (double)(this.height / 4.0F), (double)(this.width / 4.0F), 0.05D, new int[] {Block.getStateId(Blocks.planks.getDefaultState())}); } }
public void killMinecart(DamageSource p_94095_1_) { super.killMinecart(p_94095_1_); double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ; if (!p_94095_1_.isExplosion() && this.worldObj.getGameRules().getBoolean("doEntityDrops")) { this.entityDropItem(new ItemStack(Blocks.tnt, 1), 0.0F); } if (p_94095_1_.isFireDamage() || p_94095_1_.isExplosion() || d0 >= 0.009999999776482582D) { this.explodeCart(d0); } }
@Override public float getDestroySpeed(ItemStack stack, IBlockState state) { Block block = state.getBlock(); if (block == Blocks.WEB) { return 15.0F; } else { Material material = state.getMaterial(); return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL && material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F; } }
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { Random random = new Random((long)this.fillSeed); for (int i = 0; i <= 4; ++i) { for (int j = 3; j <= 4; ++j) { int k = random.nextInt(8); this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, j, 0, i, j, k, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); } } int l = random.nextInt(8); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 0, 5, l, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); l = random.nextInt(8); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 0, 4, 5, l, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); for (l = 0; l <= 4; ++l) { int i1 = random.nextInt(5); this.fillWithBlocks(worldIn, structureBoundingBoxIn, l, 2, 0, l, 2, i1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); } for (l = 0; l <= 4; ++l) { for (int j1 = 0; j1 <= 1; ++j1) { int k1 = random.nextInt(3); this.fillWithBlocks(worldIn, structureBoundingBoxIn, l, j1, 0, l, j1, k1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); } } return true; }
private static void addBrickOvenRecipes() { BrickOvenConfig.addShapedRecipe(new ItemStack(Items.GOLDEN_APPLE), "GGG", "GAG", "GGG", 'G', Items.GOLD_INGOT, 'A', Items.APPLE); BrickOvenConfig.addShapedRecipe(new ItemStack(Items.GOLDEN_APPLE, 1, 1), "###", "#A#", "###", '#', Blocks.GOLD_BLOCK, 'A', Items.APPLE); BrickOvenConfig.addShapedRecipe(new ItemStack(Items.CAKE), "MMM", "SES", "WWW", 'M', Items.MILK_BUCKET, 'S', Items.SUGAR, 'E', Items.EGG, 'W', "cropWheat"); BrickOvenConfig.addShapedRecipe(new ItemStack(Items.BREAD, 2), "WWW", 'W', "cropWheat"); BrickOvenConfig.addShapedRecipe(new ItemStack(Items.COOKIE, 8), "WCW", 'W', "cropWheat", 'C', new ItemStack(Items.DYE, 1, 3)); // Cocoa bean BrickOvenConfig.addShapedRecipe(new ItemStack(Items.RABBIT_STEW), " R ", "CPM", " B ", 'R', Items.COOKED_RABBIT, 'C', "cropCarrot", 'P', "cropPotato", 'M', Blocks.BROWN_MUSHROOM, 'B', Items.BOWL); BrickOvenConfig.addShapedRecipe(new ItemStack(Items.RABBIT_STEW), " R ", "CPM", " B ", 'R', Items.COOKED_RABBIT, 'C', "cropCarrot", 'P', "cropPotato", 'M', Blocks.RED_MUSHROOM, 'B', Items.BOWL); BrickOvenConfig.addShapedRecipe(new ItemStack(RegisterItems.marshmallow, 3), " S ", "SSS", " S ", 'S', Items.SUGAR); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.MUSHROOM_STEW), Blocks.BROWN_MUSHROOM, Blocks.RED_MUSHROOM, Items.BOWL); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_BEEF), Items.BEEF); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_PORKCHOP), Items.PORKCHOP); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_CHICKEN), Items.CHICKEN); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_FISH), Items.FISH); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_FISH, 1, 1), new ItemStack(Items.FISH, 1, 1)); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_RABBIT), Items.RABBIT); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.COOKED_MUTTON), Items.MUTTON); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.BAKED_POTATO), "cropPotato"); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.PUMPKIN_PIE), Items.EGG, Items.SUGAR, Blocks.PUMPKIN); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.FERMENTED_SPIDER_EYE), Items.SPIDER_EYE, Items.SUGAR, Blocks.BROWN_MUSHROOM); BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.MAGMA_CREAM), Items.SLIME_BALL, Items.BLAZE_POWDER); }
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) { player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); } else { super.harvestBlock(worldIn, player, pos, state, te); } }
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity() > 2) { worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState()); } else { if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { for (int i = 0; i < 4; ++i) { BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos)) { return; } IBlockState iblockstate = worldIn.getBlockState(blockpos.up()); IBlockState iblockstate1 = worldIn.getBlockState(blockpos); if (iblockstate1.getBlock() == Blocks.DIRT && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity() <= 2) { worldIn.setBlockState(blockpos, Blocks.GRASS.getDefaultState()); } } } } } }
@SuppressWarnings("incomplete-switch") /** * 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) { if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) { return false; } else { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) { if (block == Blocks.grass) { return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getDefaultState()); } if (block == Blocks.dirt) { switch ((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT)) { case DIRT: return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getDefaultState()); case COARSE_DIRT: return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); } } } return false; } }
/** * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] = itemstack.copy(); } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { ++this.furnaceItemStacks[2].stackSize; } if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) { this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket); } --this.furnaceItemStacks[0].stackSize; if (this.furnaceItemStacks[0].stackSize <= 0) { this.furnaceItemStacks[0] = null; } } }
public void placeInPortal(Entity entityIn, float rotationYaw) { if (this.worldServerInstance.provider.getDimensionId() != 1) { if (!this.placeInExistingPortal(entityIn, rotationYaw)) { this.makePortal(entityIn); this.placeInExistingPortal(entityIn, rotationYaw); } } else { int i = MathHelper.floor_double(entityIn.posX); int j = MathHelper.floor_double(entityIn.posY) - 1; int k = MathHelper.floor_double(entityIn.posZ); int l = 1; int i1 = 0; for (int j1 = -2; j1 <= 2; ++j1) { for (int k1 = -2; k1 <= 2; ++k1) { for (int l1 = -1; l1 < 3; ++l1) { int i2 = i + k1 * l + j1 * i1; int j2 = j + l1; int k2 = k + k1 * i1 - j1 * l; boolean flag = l1 < 0; this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.obsidian.getDefaultState() : Blocks.air.getDefaultState()); } } } entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F); entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; } }
private void func_181647_a(World p_181647_1_, BlockPos p_181647_2_, PropertyBool p_181647_3_) { IBlockState iblockstate = Blocks.vine.getDefaultState().withProperty(p_181647_3_, Boolean.valueOf(true)); this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); int i = 4; for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) { this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); p_181647_2_ = p_181647_2_.down(); } }