private int getEMCValue(Block block, int meta, World world, int blockX, int blockY, int blockZ) { int emc; ItemStack stack = new ItemStack(block, 1, meta); emc = ProjectEAPI.getEMCProxy().getValue(stack); if (emc <= 0) { Item item; if (block == Blocks.redstone_wire) item = Items.redstone; else if (block instanceof BlockBush) item = block.getItem(world, blockX, blockY, blockZ); else if (block == Blocks.wooden_door) item = Items.wooden_door; else if (block == Blocks.iron_door) item = Items.iron_door; else item = Item.getItemFromBlock(block); if (item != null) emc = ProjectEAPI.getEMCProxy().getValue(item); } return emc; }
/** * Gives a bonemeal growth effect to the plant in question. Does not work on BlockBush because they appear to pop off on tall pushes. * @param world * @param pos * @return */ public static boolean growPlantAtBlock(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(block instanceof IGrowable && !(block instanceof BlockBush)) { ((IGrowable)block).grow(world, rand, pos, state); // block.updateTick(world, pos, state, world.rand); return true; } return false; }
@Override public boolean onBlockDestroyed(ItemStack itemstack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { boolean done = false; int size = 2; for(int newX = -size; newX <= size; newX++) { for(int newZ = -size; newZ <= size; newZ++) { BlockPos pos2 = pos.add(newX, 0, newZ); IBlockState sta = world.getBlockState(pos2); Block block = sta.getBlock(); if((block instanceof BlockBush) || (block instanceof BlockFlower) || (block instanceof BlockDoublePlant)) { block.dropBlockAsItem(world, pos2, sta, 0); world.setBlockToAir(pos2); itemstack.damageItem(1, entityLiving); done = true; } } } return done; }
@Override public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) { whiteListedBlocks.clear(); whiteListedBlocks.add(HarshenBlocks.CROP_OF_GLEAM); if(worldIn.getBlockState(pos.add(0, 1, 0)).getBlock() instanceof BlockBush && !whiteListedBlocks.contains(worldIn.getBlockState(pos.add(0, 1, 0)).getBlock())) { worldIn.setBlockState(pos.add(0, 1, 0), HarshenBlocks.HARSHEN_DESTROYED_PLANT.getDefaultState(), 2); if(worldIn.getBlockState(pos.add(0, 2, 0)).getBlock() instanceof BlockBush) worldIn.setBlockState(pos.add(0, 2, 0),Blocks.AIR.getDefaultState(), 2); } }
@Override public void notifyBlockUpdate(World worldIn, BlockPos pos, IBlockState oldState, IBlockState currentState, int flags) { if (currentState.getBlock() == Blocks.FIRE && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockObsidian) && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockBush) && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockTallGrass)) { IBlockState newStateBlock = BlockRegistry.specialfire.getDefaultState().withProperty(BlockSpecialFire.AGE, currentState.getValue(BlockFire.AGE)).withProperty(BlockSpecialFire.NORTH, currentState.getValue(BlockFire.NORTH)).withProperty(BlockSpecialFire.EAST, currentState.getValue(BlockFire.EAST)).withProperty(BlockSpecialFire.SOUTH, currentState.getValue(BlockFire.SOUTH)).withProperty(BlockSpecialFire.WEST, currentState.getValue(BlockFire.WEST)).withProperty(BlockSpecialFire.UPPER, currentState.getValue(BlockFire.UPPER)); worldIn.setBlockState(pos, newStateBlock, flags); } }
private static void initSaplingList() { ContainerTerraformer.saplingList = new LinkedList(); Iterator iterator = Block.blockRegistry.getKeys().iterator(); while (iterator.hasNext()) { Block b = (Block) Block.blockRegistry.getObject((String)iterator.next()); if (b instanceof BlockBush) { try { Item item = Item.getItemFromBlock(b); if (item != null) { //item.getSubItems(item, null, subItemsList); - can't use because clientside only ContainerTerraformer.saplingList.add(new ItemStack(item, 1, 0)); String basicName = item.getUnlocalizedName(new ItemStack(item, 1, 0)); for (int i = 1; i < 16; i++) { ItemStack testStack = new ItemStack(item, 1, i); String testName = item.getUnlocalizedName(testStack); if (testName == null || testName.equals("") || testName.equals(basicName)) break; ContainerTerraformer.saplingList.add(testStack); } } } catch (Exception e) { } } } }
private boolean isGroundBlock(IBlockState blockState) { if (blockState == null || blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() == Blocks.LOG2 || blockState.getBlock() instanceof BlockBush) { return false; } return blockState.isOpaqueCube(); }
private boolean isGroundBlock(IBlockState blockState) { if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) { return false; } return blockState.isOpaqueCube(); }
public static void addBush() { ShiftedSnowApi.addSimpleClassMapping(BlockBush.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockSign.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockAnvil.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockBush.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockPressurePlate.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockLever.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockRailBase.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockTripWire.class, EnumSnowType.MINUS_FULL); ShiftedSnowApi.addSimpleClassMapping(BlockTripWireHook.class, EnumSnowType.MINUS_FULL); }
@Override public void debugActionBlockClicked(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { pos = pos.toImmutable(); for (int x = -radius; x < radius; x++) { for (int z = -radius; z < radius; z++) { BlockPos loc = pos.add(x, 0, z); Block block = world.getBlockState(loc).getBlock(); if (block instanceof BlockBush) { world.destroyBlock(loc, false); } } } }
public BlockCandelilla (String blockName) { setBlockTextureName(GardenTrees.MOD_ID + ":candelilla"); setBlockName(blockName); setHardness(0); setStepSound(BlockBush.soundTypeGrass); setCreativeTab(ModCreativeTabs.tabGardenTrees); }
public GeneratorBushFeature(BlockBush p_i45633_1_) { this.field_175908_a = p_i45633_1_; }
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_) { if (p_checkBlock_0_.isFullCube()) { return false; } else if (p_checkBlock_0_.isOpaqueCube()) { return false; } else if (p_checkBlock_0_ instanceof BlockSnow) { return false; } else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass)) { if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall)) { if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP) { return true; } else { if (p_checkBlock_0_ instanceof BlockLever) { Object object = p_checkBlock_1_.getValue(BlockLever.FACING); if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z) { return true; } } return false; } } else { return true; } } else { return true; } }
public WorldGenBush(BlockBush blockIn) { this.block = blockIn; }
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_) { if (p_checkBlock_1_.isFullCube()) { return false; } else if (p_checkBlock_1_.isOpaqueCube()) { return false; } else if (p_checkBlock_0_ instanceof BlockSnow) { return false; } else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass)) { if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall)) { if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP) { return true; } else { if (p_checkBlock_0_ instanceof BlockLever) { Object object = p_checkBlock_1_.getValue(BlockLever.FACING); if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z) { return true; } } return false; } } else { return true; } } else { return true; } }
protected static boolean isGroundBlock(IBlockState blockState) { if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) { return false; } return blockState.isOpaqueCube(); }
protected static boolean cantBuildOver(IBlockState blockState) { if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() instanceof BlockBush) { return false; } return blockState.isOpaqueCube(); }
private boolean isGroundBlock(IBlockState blockState) { if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() instanceof BlockBush) { return false; } return blockState.isOpaqueCube(); }
public MHPlantGen(BlockBush blockToSpawn) { this(blockToSpawn, 4); }
public MHPlantGen(BlockBush blockToSpawn, int groupSize) { block = blockToSpawn; size = groupSize; }
@Override public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { if (!ModConfig.ee3Block) return tooltip; Block block = accessor.getBlock(); int meta = accessor.getMetadata(); MovingObjectPosition pos = accessor.getPosition(); if (block != null) { ItemStack stack = new ItemStack(block, 1, meta); boolean isKnown = WIIEMC.proxy.doesPlayerKnow(stack); boolean canBeLearned = WIIEMC.proxy.canPlayerLearn(stack); EnergyValue value = EnergyValueRegistryProxy.getEnergyValue(stack); if (value == null) { Item item; if (block == Blocks.redstone_wire) item = Items.redstone; else if (block instanceof BlockBush) item = block.getItem(accessor.getWorld(), pos.blockX, pos.blockY, pos.blockZ); else if (block == Blocks.wooden_door) item = Items.wooden_door; else if (block == Blocks.iron_door) item = Items.iron_door; else item = Item.getItemFromBlock(block); if (item != null) { stack = new ItemStack(item); value = EnergyValueRegistryProxy.getEnergyValue(stack); isKnown = WIIEMC.proxy.doesPlayerKnow(stack); canBeLearned = WIIEMC.proxy.canPlayerLearn(stack); } } if (value != null && value.getValue() > 0f) { if (ModConfig.showEMC) { String tip = StatCollector.translateToLocal(ModLang.ENERGY_VALUE_EE3); String energy = energyValueDecimalFormat.format(value.getValue()); tooltip.add(String.format(tip, energy)); } } else { if (ModConfig.showNoEMC) tooltip.add(StatCollector.translateToLocal(ModLang.NO_ENERGY_EE3)); } if (canBeLearned && value != null) { if (ModConfig.showCanLearn) tooltip.add(StatCollector.translateToLocal(ModLang.UNKNOWN)); } else { if (isKnown && ModConfig.showIsLearned) tooltip.add(StatCollector.translateToLocal(ModLang.IS_KNOWN)); else if (ModConfig.showCantLearn) tooltip.add(StatCollector.translateToLocal(ModLang.NOT_LEARNABLE)); } } return tooltip; }
@Override protected void placeFootprintBlock(EntityTameableDragon dragon, BlockPos blockPos) { World world = dragon.worldObj; // grow mushrooms and plants BlockPos blockPosGround = blockPos.down(); BlockPos blockPosSurface = blockPos; IBlockState blockStateUnderFoot = world.getBlockState(blockPosGround); Block blockUnderFoot = blockStateUnderFoot.getBlock(); boolean plantFlower = false; boolean plantMushroom = false; if (blockUnderFoot == Blocks.GRASS) { // plant flowers on grass plantFlower = true; } else if (blockUnderFoot == Blocks.DIRT) { DirtType dirtType = blockStateUnderFoot.getValue(BlockDirt.VARIANT); if (dirtType != DirtType.DIRT) { // plant mushrooms on special dirt types plantMushroom = true; } else if (world.getLightFromNeighbors(blockPosSurface) >= GRASS_LIGHT_THRESHOLD) { // turn normal dirt green if there's enough light world.setBlockState(blockPosGround, Blocks.GRASS.getDefaultState()); // also add flowers randomly plantFlower = world.rand.nextBoolean(); } } else if (blockUnderFoot == Blocks.MYCELIUM) { // always plant mushrooms on mycelium plantMushroom = true; } // pick plant BlockBush blockPlant = null; IBlockState statePlant = null; if (plantFlower) { EnumFlowerType flower = world.getBiome(blockPosSurface) .pickRandomFlower(world.rand, blockPosSurface); BlockFlower blockFlower = flower.getBlockType().getBlock(); blockPlant = blockFlower; statePlant = blockFlower.getDefaultState() .withProperty(blockFlower.getTypeProperty(), flower); } if (plantMushroom) { blockPlant = (world.rand.nextBoolean() ? Blocks.RED_MUSHROOM : Blocks.BROWN_MUSHROOM); statePlant = blockPlant.getDefaultState(); } // place plant if defined if (blockPlant != null && blockPlant.canBlockStay(world, blockPosSurface, statePlant)) { world.setBlockState(blockPosSurface, statePlant); } }
public void genSide(World world,int x, int y, int z,int meta) { Block block = world.getBlock(x, y, z); if (block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z) || block instanceof BlockBush) { this.setBlockAndNotifyAdequately(world, x, y, z, GameRegistry.findBlock("derpyshiz", "log"), meta); } }
public boolean canHarvestBlock(IBlockState block) { return block instanceof BlockBush; }