net.minecraft.init.Blocks Java Examples
The following examples show how to use
net.minecraft.init.Blocks.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockTorikkiGrass.java From Wizardry with GNU Lesser General Public License v3.0 | 7 votes |
@Override 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(worldIn, pos.up()) > 2) { worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, DirtType.DIRT)); } else { if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { for (int i = 0; i < 4; ++i) { BlockPos posAt = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); IBlockState stateAt = worldIn.getBlockState(posAt); IBlockState stateAbove = worldIn.getBlockState(posAt.up()); if (Blocks.DIRT.equals(stateAt.getBlock()) && DirtType.DIRT.equals(stateAt.getValue(BlockDirt.VARIANT)) && worldIn.getLightFromNeighbors(posAt.up()) >= 4 && stateAbove.getLightOpacity(worldIn, posAt.up()) <= 2) { worldIn.setBlockState(posAt, this.getDefaultState()); } } } } } }
Example #2
Source File: StructureApprenticeTowerAncient.java From Artifacts with MIT License | 6 votes |
private static void basement(World world, int i, int j, int k, Random rand) { boolean noair = false; int y = -1; do { noair = false; for(int x = 0; x <= 6; x++) { for(int z = 0; z <= 6; z++) { //5,y,4 int d = (x-3)*(x-3)+(z-3)*(z-3); if(d <= 10) { if(!world.getBlock(i+x, j+y, z+k).isOpaqueCube() || world.getBlock(i+x, j+y, z+k) == Blocks.leaves) { noair=true; world.setBlock(i+x, j+y, z+k, StructureGenHelper.cobbleMossyOrAir(rand), 0, 2); } } } } y--; } while(noair && (j+y) >= 0); }
Example #3
Source File: DamageableShapelessOreRecipeTest.java From customstuff4 with GNU General Public License v3.0 | 6 votes |
private void doTest(boolean inOrder, boolean enoughDamage) { DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"), new int[] {enoughDamage ? 5 : 5000, 0}, new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD), new ItemStack(Items.APPLE)); InventoryCrafting inv = new InventoryCrafting(new Container() { @Override public boolean canInteractWith(EntityPlayer playerIn) { return false; } }, 3, 3); inv.setInventorySlotContents(inOrder ? 3 : 4, new ItemStack(Items.WOODEN_SWORD)); inv.setInventorySlotContents(inOrder ? 4 : 3, new ItemStack(Items.APPLE)); assertSame(enoughDamage, recipe.matches(inv, null)); if (enoughDamage) { NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv); assertSame(Items.WOODEN_SWORD, remaining.get(inOrder ? 3 : 4).getItem()); assertEquals(5, remaining.get(inOrder ? 3 : 4).getItemDamage()); } }
Example #4
Source File: RadiationHelper.java From BigReactors with MIT License | 6 votes |
private void moderateByBlock(RadiationData data, RadiationPacket radiation, Block block, int metadata) { ReactorInteriorData moderatorData = null; if(block == Blocks.iron_block) { moderatorData = ReactorInterior.getBlockData("blockIron"); } else if(block == Blocks.gold_block) { moderatorData = ReactorInterior.getBlockData("blockGold"); } else if(block == Blocks.diamond_block) { moderatorData = ReactorInterior.getBlockData("blockDiamond"); } else if(block == Blocks.emerald_block) { moderatorData = ReactorInterior.getBlockData("blockEmerald"); } else { // Check the ore dictionary. moderatorData = ReactorInterior.getBlockData(ItemHelper.oreProxy.getOreName(new ItemStack(block, 1, metadata))); } if(moderatorData == null) { moderatorData = airData; } applyModerationFactors(data, radiation, moderatorData); }
Example #5
Source File: BlockMapleLeaveOrange.java From Sakura_mod with MIT License | 6 votes |
@SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { Blocks.LEAVES.randomDisplayTick(stateIn, worldIn, pos, rand); if (rand.nextInt(40) == 0) { int j = rand.nextInt(2) * 2 - 1; int k = rand.nextInt(2) * 2 - 1; double d0 = pos.getX() + 0.5D + 0.25D * j; double d1 = pos.getY() - 0.15D; double d2 = pos.getZ() + 0.5D + 0.25D * k; double d3 = rand.nextFloat() * j * 0.1D; double d4 = ((rand.nextFloat()) * 0.055D) + 0.015D; double d5 = rand.nextFloat() * k * 0.1D; SakuraMain.proxy.spawnParticle(SakuraParticleType.MAPLEORANGE, d0, d1, d2, d3, -d4, d5); } }
Example #6
Source File: BlockDecorativePot.java From GardenCollection with MIT License | 6 votes |
@Override protected boolean applyItemToGarden (World world, int x, int y, int z, EntityPlayer player, ItemStack itemStack, float hitX, float hitY, float hitZ, boolean hitValid) { ItemStack item = (itemStack == null) ? player.inventory.getCurrentItem() : itemStack; if (item != null && item.getItem() == Items.flint_and_steel) { ItemStack substrate = getGardenSubstrate(world, x, y, z, Slot2Profile.SLOT_CENTER); if (substrate != null && substrate.getItem() == Item.getItemFromBlock(Blocks.netherrack)) { if (world.isAirBlock(x, y + 1, z)) { world.playSoundEffect(x + .5, y + .5, z + .5, "fire.ignite", 1, world.rand.nextFloat() * .4f + .8f); world.setBlock(x, y + 1, z, ModBlocks.smallFire); world.notifyBlocksOfNeighborChange(x, y, z, this); world.notifyBlocksOfNeighborChange(x, y - 1, z, this); } item.damageItem(1, player); return true; } } return super.applyItemToGarden(world, x, y, z, player, itemStack, hitX, hitY, hitZ, hitValid); }
Example #7
Source File: BaseRecipeRegistry.java From Electro-Magic-Tools with GNU General Public License v3.0 | 6 votes |
public static void addDrillRecipe() { woodenDrill = toolRecipe(BaseItemStacks.woodenDrill, BaseItemStacks.woodenDrillTop, "plankWood", "stickWood"); stoneDrill = toolRecipe(BaseItemStacks.stoneDrill, BaseItemStacks.stoneDrillTop, "stone", "cobblestone"); ironDrill = toolRecipe(BaseItemStacks.ironDrill, BaseItemStacks.ironDrillTop, "ingotIron", new ItemStack(Items.leather)); goldenDrill = toolRecipe(BaseItemStacks.goldenDrill, BaseItemStacks.goldenDrillTop, "ingotGold", new ItemStack(Blocks.obsidian)); diamondDrill = toolRecipe(BaseItemStacks.diamondDrill, BaseItemStacks.diamondDrillTop, "gemDiamond", "ingotGold"); if (isOreRegistered("ingotCopper") && isOreRegistered("ingotTin")) copperDrill = toolRecipe(BaseItemStacks.copperDrill, BaseItemStacks.copperDrillTop, "ingotCopper", "ingotTin"); if (isOreRegistered("ingotTin")) tinDrill = toolRecipe(BaseItemStacks.tinDrill, BaseItemStacks.tinDrillTop, "ingotTin", "ingotGold"); if (isOreRegistered("ingotLead")) leadDrill = toolRecipe(BaseItemStacks.leadDrill, BaseItemStacks.leadDrillTop, "ingotLead", "ingotIron"); if (isOreRegistered("ingotBronze")) bronzeDrill = toolRecipe(BaseItemStacks.bronzeDrill, BaseItemStacks.bronzeDrillTop, "ingotBronze", new ItemStack(Blocks.obsidian)); }
Example #8
Source File: BlockUtils.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
/** * Tries breaking a block safely and fires an event for it. * * @return Whether the block was successfully broken */ public static boolean breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nullable IBlockState oldState, @Nonnull EntityPlayerMP player) { if (!world.isBlockLoaded(pos)) return false; if (!(player instanceof FakePlayer) && !hasEditPermission(pos, player)) return false; if (oldState == null) oldState = world.getBlockState(pos); BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, oldState, player); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) return false; TileEntity tile = world.getTileEntity(pos); Block block = oldState.getBlock(); if (block.removedByPlayer(oldState, world, pos, player, true)) { block.onPlayerDestroy(world, pos, oldState); block.harvestBlock(world, player, pos, oldState, tile, player.getHeldItemMainhand()); world.notifyBlockUpdate(pos, oldState, Blocks.AIR.getDefaultState(), 3); } else return false; return true; }
Example #9
Source File: BiomeGenMarsh.java From AdvancedRocketry with MIT License | 6 votes |
@Override public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) { super.genTerrainBlocks(worldIn, rand, chunkPrimerIn, x, z, noiseVal); double d1 = GRASS_COLOR_NOISE.getValue((double)x * 0.25D, (double)z * 0.25D); x = Math.abs(x % 16); z = Math.abs(z % 16); if (d1 > 0.2D) { chunkPrimerIn.setBlockState(x, 62, z, Blocks.GRASS.getDefaultState()); for(int y = (int)(61); y > 1; y--) { if(!chunkPrimerIn.getBlockState(x, y, z).isOpaqueCube()) chunkPrimerIn.setBlockState(x, y, z, Blocks.GRASS.getDefaultState()); else break; } } }
Example #10
Source File: WorldGeneratorSignals.java From Signals with GNU General Public License v3.0 | 6 votes |
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){ // TODO when adding worldgen, resolve the note at https://github.com/MineMaarten/Signals/pull/80 regarding the possibility of rails not being included in the network. if(chunkX == 0) { int x = chunkX * 16 + 8; int y = 4; int startZ = chunkZ * 16; for(int z = startZ; z < startZ + 16; z++) { world.setBlockState(new BlockPos(x, y, z), Blocks.STONE.getDefaultState(), 0); world.setBlockState(new BlockPos(x, y + 1, z), Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, EnumRailDirection.NORTH_SOUTH), 0); if(z % 256 == 0) { world.setBlockState(new BlockPos(x + 1, y + 1, z), ModBlocks.BLOCK_SIGNAL.getDefaultState().withProperty(BlockSignalBase.FACING, EnumFacing.NORTH), 0); } } } }
Example #11
Source File: TaskCountBlocksPlacement.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void countAtPosition(BlockPos pos) { IBlockState stateSchematic = this.worldSchematic.getBlockState(pos).getActualState(this.worldSchematic, pos); if (stateSchematic.getBlock() != Blocks.AIR) { IBlockState stateClient = this.worldClient.getBlockState(pos).getActualState(this.worldClient, pos); this.countsTotal.addTo(stateSchematic, 1); if (stateClient.getBlock() == Blocks.AIR) { this.countsMissing.addTo(stateSchematic, 1); } else if (stateClient != stateSchematic) { this.countsMissing.addTo(stateSchematic, 1); this.countsMismatch.addTo(stateSchematic, 1); } } }
Example #12
Source File: LitematicaBlockStateContainerFull.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void setBits(int bitsIn) { if (bitsIn != this.bits) { this.bits = bitsIn; if (this.bits <= MAX_BITS_LINEAR) { this.bits = Math.max(2, this.bits); this.palette = new LitematicaBlockStatePaletteLinear(this.bits, this); } else { this.palette = new LitematicaBlockStatePaletteHashMap(this.bits, this); } // Always reserve ID 0 for air, so that the container doesn't need to be filled with air separately this.palette.idFor(Blocks.AIR.getDefaultState()); } }
Example #13
Source File: WaterWalk.java From ehacks-pro with GNU General Public License v3.0 | 6 votes |
public static boolean isOnLiquid(AxisAlignedBB boundingBox) { boundingBox = boundingBox.contract(0.01, 0.0, 0.01).offset(0.0, -0.01, 0.0); boolean onLiquid = false; int y = (int) boundingBox.minY; for (int x = MathHelper.floor_double(boundingBox.minX); x < MathHelper.floor_double((boundingBox.maxX + 1.0)); ++x) { for (int z = MathHelper.floor_double(boundingBox.minZ); z < MathHelper.floor_double((boundingBox.maxZ + 1.0)); ++z) { Block block = Wrapper.INSTANCE.world().getBlock(x, y, z); if (block == Blocks.air) { continue; } if (!(block instanceof BlockLiquid)) { return false; } onLiquid = true; } } return onLiquid; }
Example #14
Source File: BlockGardenContainer.java From GardenCollection with MIT License | 6 votes |
protected boolean isValidSubstrate (World world, int x, int y, int z, int slot, ItemStack itemStack) { if (itemStack == null || itemStack.getItem() == null) return false; Block block = Block.getBlockFromItem(itemStack.getItem()); if (block == null) return false; return block == Blocks.dirt || block == Blocks.sand || block == Blocks.gravel || block == Blocks.soul_sand || block == Blocks.grass || block == Blocks.water || block == Blocks.farmland || block == Blocks.mycelium || block == ModBlocks.gardenSoil || block == ModBlocks.gardenFarmland; }
Example #15
Source File: SchematicEditUtils.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
private static boolean breakSchematicBlocks(Minecraft mc) { Entity entity = fi.dy.masa.malilib.util.EntityUtils.getCameraEntity(); RayTraceWrapper wrapper = RayTraceUtils.getSchematicWorldTraceWrapperIfClosest(mc.world, entity, 20); if (wrapper != null) { RayTraceResult trace = wrapper.getRayTraceResult(); BlockPos pos = trace.getBlockPos(); EnumFacing playerFacingH = mc.player.getHorizontalFacing(); EnumFacing direction = fi.dy.masa.malilib.util.PositionUtils.getTargetedDirection(trace.sideHit, playerFacingH, pos, trace.hitVec); // Center region if (direction == trace.sideHit) { direction = direction.getOpposite(); } BlockPos posEnd = getReplacementBoxEndPos(pos, direction); return setSchematicBlockStates(pos, posEnd, Blocks.AIR.getDefaultState()); } return false; }
Example #16
Source File: RenderCarvableBeacon.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { float f = 0.1875F; renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.glass)); renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1); renderer.renderAllFaces = true; renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.obsidian)); renderer.setRenderBounds(0.125D, 0.00625D, 0.125D, 0.875D, (double)f, 0.875D); renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1); renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.beacon)); renderer.setRenderBounds(0.1875D, (double)f, 0.1875D, 0.8125D, 0.875D, 0.8125D); renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1); renderer.renderAllFaces = false; renderer.clearOverrideBlockTexture(); return true; }
Example #17
Source File: Recipes.java From ExNihiloAdscensio with MIT License | 5 votes |
public static void init() { GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerWood, new Object[] { " x ", " yx", "y ", 'x', "plankWood", 'y', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerStone, new Object[] { " x ", " yx", "y ", 'x', "cobblestone", 'y', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerIron, new Object[] { " x ", " yx", "y ", 'x', "ingotIron", 'y', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerGold, new Object[] { " x ", " yx", "y ", 'x', "ingotGold", 'y', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerDiamond, new Object[] { " x ", " yx", "y ", 'x', "gemDiamond", 'y', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.crookWood, new Object[] { "xx"," x"," x", 'x', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.crookBone, new Object[] { "xx"," x"," x", 'x', Items.BONE})); if (Config.enableBarrels) { GameRegistry.addRecipe(new ShapedOreRecipe(ENBlocks.barrelWood, new Object[] {"x x","x x", "xyx", 'x', "plankWood", 'y', "slabWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(ENBlocks.barrelStone, new Object[] {"x x","x x", "xyx", 'x', new ItemStack(Blocks.STONE), 'y', new ItemStack(Blocks.STONE_SLAB)})); } if (Config.enableCrucible) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENBlocks.crucible, 1, 0), new Object[] {"x x","x x","xxx", 'x', "clayPorcelain"})); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ENBlocks.crucible, 1, 0), new ItemStack(ENBlocks.crucible, 1, 1), 0.7f); } GameRegistry.addRecipe(new ShapedOreRecipe(Blocks.COBBLESTONE, new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("stone")})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.STONE, 1, BlockStone.EnumType.GRANITE.ordinal()), new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("granite")})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.STONE, 1, BlockStone.EnumType.DIORITE.ordinal()), new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("diorite")})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.STONE, 1, BlockStone.EnumType.ANDESITE.ordinal()), new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("andesite")})); GameRegistry.addShapelessRecipe(ItemResource.getResourceStack("porcelain_clay"), new ItemStack(Items.CLAY_BALL), new ItemStack(Items.DYE, 1, 15)); GameRegistry.addRecipe(new ShapedOreRecipe(ENBlocks.sieve, new Object[] {"x x","xyx","z z", 'z', "plankWood", 'y', "slabWood", 'z', "stickWood"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 1), new Object[] {"xxx","xxx","xxx", 'x', Items.STRING})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 2), new Object[] {"x x","xyx","x x", 'x', Items.FLINT, 'y', new ItemStack(ENItems.mesh, 1, 1)})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 3), new Object[] {"x x","xyx","x x", 'x', Items.IRON_INGOT, 'y', new ItemStack(ENItems.mesh, 1, 2)})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 4), new Object[] {"x x","xyx","x x", 'x', Items.DIAMOND, 'y', new ItemStack(ENItems.mesh, 1, 3)})); FurnaceRecipes.instance().addSmeltingRecipe(ItemResource.getResourceStack("silkworm"), new ItemStack(ENItems.cookedSilkworm), 0.7f); GameRegistry.addRecipe(new ShapedOreRecipe(ItemResource.getResourceStack("doll", 4), new Object[] {"xyx"," x ", "x x", 'x', "clayPorcelain", 'y', "gemDiamond"})); GameRegistry.addRecipe(new ShapedOreRecipe(ItemResource.getResourceStack("doll", 6), new Object[] {"xyx"," x ", "x x", 'x', "clayPorcelain", 'y', "gemEmerald"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.dolls, 1, 0), new Object[] {"xyx", "zwz", "xvx", 'x', Items.BLAZE_POWDER, 'v', Items.NETHER_WART, 'w', ItemResource.getResourceStack("doll"), 'y', "dustRedstone", 'z', "dustGlowstone"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.dolls, 1, 1), new Object[] {"xyx", "zwz", "xvx", 'v', Items.NETHER_WART, 'x', "dyeBlack", 'w', ItemResource.getResourceStack("doll"), 'y', "dustRedstone", 'z', "dustGlowstone"})); }
Example #18
Source File: ChunkProviderRoss128b.java From bartworks with MIT License | 5 votes |
@Override public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas, BiomeGenBase[] p_147422_5_) { super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_); for (int i = 0; i < blocks.length; i++) { if (blocks[i] == Blocks.grass) { blocks[i] = Blocks.dirt; metas[i] = 2; } } }
Example #19
Source File: QuestGather.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private static QuestData quest2(Province province, EntityPlayer player) { Random rand = player.world.rand; QuestData data = baseQuest(province, player); List<ItemStack> required = new ArrayList<ItemStack>(); required.add(new ItemStack(Items.FLINT_AND_STEEL, 1)); required.add(new ItemStack(Blocks.OBSIDIAN, 10)); QuestGather.setRequiredItems(data, required); List<ItemStack> reward = new ArrayList<ItemStack>(); reward.add(new ItemStack(Items.EMERALD, 3 + rand.nextInt(2))); QuestGather.setRewardItems(data, reward); setRewardRep(data, 10); return data; }
Example #20
Source File: BlockVegDesert.java From TFC2 with GNU General Public License v3.0 | 5 votes |
protected void checkAndDropBlock(World worldIn, BlockPos pos, IBlockState state) { if (!canBlockStay(worldIn, pos, state)) { dropBlockAsItem(worldIn, pos, state, 0); worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); } }
Example #21
Source File: FarmLogicHelium.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private boolean tryPlaceSoil(int x, int y, int z){ if(housing.getWorld().getBlock(x, y, z).isReplaceable(housing.getWorld(), x, y, z)) { if(housing.hasResources(new ItemStack[]{new ItemStack(Blocks.netherrack)})) { housing.removeResources(new ItemStack[]{new ItemStack(Blocks.netherrack)}); housing.getWorld().setBlock(x, y, z, Blocks.netherrack); return true; } } return false; }
Example #22
Source File: SaplingRegistry.java From GardenCollection with MIT License | 5 votes |
private SaplingRegistry () { registry = new UniqueMetaRegistry<SaplingRecord>(); Item sapling = Item.getItemFromBlock(Blocks.sapling); registerSapling(sapling, 0, Blocks.log, 0, Blocks.leaves, 0); registerSapling(sapling, 1, Blocks.log, 1, Blocks.leaves, 1); registerSapling(sapling, 2, Blocks.log, 2, Blocks.leaves, 2); registerSapling(sapling, 3, Blocks.log, 3, Blocks.leaves, 3); registerSapling(sapling, 4, Blocks.log2, 0, Blocks.leaves2, 0); registerSapling(sapling, 5, Blocks.log2, 1, Blocks.leaves2, 1); }
Example #23
Source File: GTTileMagicEnergyAbsorber.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) @Override public void randomTickDisplay(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (this.isActive && this.portalMode && worldIn.getBlockState(this.pos.offset(EnumFacing.DOWN)).getBlock() == Blocks.END_PORTAL) { for (EnumFacing facing : EnumFacing.HORIZONTALS) { BlockPos sidePos = pos.offset(facing); if (world.getBlockState(sidePos).isFullBlock()) { continue; } for (int k = 3; k > 0; --k) { ParticleManager er = Minecraft.getMinecraft().effectRenderer; float multPos = (float) (.1 * 2) + 0.9F; double x = (double) ((float) sidePos.getX() + 0.05F + rand.nextFloat() * multPos); double y = (double) ((float) sidePos.getY() + 0.0F + rand.nextFloat() * 0.5F); double z = (double) ((float) sidePos.getZ() + 0.05F + rand.nextFloat() * multPos); double[] velocity = new double[] { 0.0D, 7.6D, 0.0D }; if (k < 4) { velocity[2] *= 0.55D; } float foo = rand.nextFloat() * .25F; float[] colour = new float[] { 0.0F, foo, foo }; er.addEffect(new EntityChargePadAuraFX(this.world, x, y, z, 8, velocity, colour, false)); } } } }
Example #24
Source File: BlockSakuraSapling.java From Sakura_mod with MIT License | 5 votes |
@Override public void grow(World world, Random rand, BlockPos pos, IBlockState state) { WorldGenerator treeGenerator = rand.nextInt(8) == 0 ? new WorldGenSakuraTree(true, 5) : new WorldGenBigSakura(true); world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4); if (!treeGenerator.generate(world, rand, pos)) world.setBlockState(pos, state, 4); }
Example #25
Source File: EntityBallOMoss.java From Chisel with GNU General Public License v2.0 | 5 votes |
public static void turnToMoss(World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); Block resBlock = block; int resMeta = meta; if(block.equals(Blocks.cobblestone)) { resBlock = Blocks.mossy_cobblestone; } else if(block.equals(Blocks.cobblestone_wall) && meta == 0) { resMeta = 1; } else if(block.equals(ChiselBlocks.blockCobblestone)) { resBlock = ChiselBlocks.blockCobblestoneMossy; } else if(block.equals(ChiselBlocks.blockTemple)) { resBlock = ChiselBlocks.blockTempleMossy; } else if(block.equals(Blocks.stonebrick)) { resMeta = 1; } if(resBlock.equals(block) && resMeta == meta) return; world.setBlock(x, y, z, resBlock, resMeta, 3); }
Example #26
Source File: Repeater.java From minecraft-roguelike with GNU General Public License v3.0 | 5 votes |
public static void generate(IWorldEditor editor, Random rand, Cardinal dir, int delay, boolean powered, Coord pos){ MetaBlock repeater = powered ? new MetaBlock(Blocks.POWERED_REPEATER) : new MetaBlock(Blocks.UNPOWERED_REPEATER); repeater.withProperty(BlockRedstoneRepeater.FACING, Cardinal.facing(dir)); if (delay > 0 && delay <= 4) repeater.withProperty(BlockRedstoneRepeater.DELAY, delay); repeater.set(editor, pos); }
Example #27
Source File: GuiContainerManager.java From NotEnoughItems with MIT License | 5 votes |
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) { enable3DRender(); float zLevel = drawItems.zLevel += 100F; try { drawItems.renderItemAndEffectIntoGUI(itemstack, i, j); drawItems.renderItemOverlays(fontRenderer, itemstack, i, j); if (!checkMatrixStack()) throw new IllegalStateException("Modelview matrix stack too deep"); if (Tessellator.getInstance().getWorldRenderer().isDrawing) throw new IllegalStateException("Still drawing"); } catch (Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String stackTrace = itemstack + sw.toString(); if (!stackTraces.contains(stackTrace)) { System.err.println("Error while rendering: " + itemstack); e.printStackTrace(); stackTraces.add(stackTrace); } restoreMatrixStack(); if (Tessellator.getInstance().getWorldRenderer().isDrawing) Tessellator.getInstance().draw(); drawItems.zLevel = zLevel; drawItems.renderItemIntoGUI(new ItemStack(Blocks.fire), i, j); } enable2DRender(); drawItems.zLevel = zLevel - 100; }
Example #28
Source File: ModRecipes.java From Et-Futurum with The Unlicense | 5 votes |
private static void registerOreDictionary() { OreDictionary.registerOre("chestWood", new ItemStack(Blocks.chest)); OreDictionary.registerOre("trapdoorWood", Blocks.trapdoor); if (EtFuturum.enablePrismarine) { OreDictionary.registerOre("shardPrismarine", new ItemStack(ModItems.prismarine_shard)); OreDictionary.registerOre("crystalPrismarine", new ItemStack(ModItems.prismarine_crystals)); OreDictionary.registerOre("blockPrismarine", new ItemStack(ModBlocks.prismarine, 1, OreDictionary.WILDCARD_VALUE)); } if (EtFuturum.enableStones) { OreDictionary.registerOre("stoneGranite", new ItemStack(ModBlocks.stone, 1, Stone.GRANITE)); OreDictionary.registerOre("stoneDiorite", new ItemStack(ModBlocks.stone, 1, Stone.DIORITE)); OreDictionary.registerOre("stoneAndesite", new ItemStack(ModBlocks.stone, 1, Stone.ANDESITE)); OreDictionary.registerOre("stoneGranitePolished", new ItemStack(ModBlocks.stone, 1, Stone.POLISHED_GRANITE)); OreDictionary.registerOre("stoneDioritePolished", new ItemStack(ModBlocks.stone, 1, Stone.POLISHED_DIORITE)); OreDictionary.registerOre("stoneAndesitePolished", new ItemStack(ModBlocks.stone, 1, Stone.POLISHED_ANDESITE)); } if (EtFuturum.enableSlimeBlock) OreDictionary.registerOre("blockSlime", new ItemStack(ModBlocks.slime)); if (EtFuturum.enableIronTrapdoor) OreDictionary.registerOre("trapdoorIron", ModBlocks.iron_trapdoor); if (EtFuturum.enableBeetroot) OreDictionary.registerOre("cropBeetroot", ModItems.beetroot); if (EtFuturum.enableChorusFruit) OreDictionary.registerOre("brickEndStone", ModBlocks.end_bricks); }
Example #29
Source File: MainRegistry.java From NewHorizonsCoreMod with GNU General Public License v3.0 | 5 votes |
private void InitAdditionalBlocks() { GameRegistry.registerBlock(_mBlockBabyChest, ItemBlockBabyChest.class, "BabyChest"); GameRegistry.addShapelessRecipe(new ItemStack(_mBlockBabyChest, 9), new ItemStack(Blocks.chest, 1, 0)); GameRegistry.registerTileEntity(TileEntityBabyChest.class, "teBabyChest"); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); proxy.registerRenderInfo(); }
Example #30
Source File: TileEntityDrawbridge.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Nullable private IBlockState getPlacementStateForPosition(int position, World world, BlockPos pos, FakePlayer player, ItemStack stack) { if (this.blockInfoTaken[position] != null) { return this.blockInfoTaken[position].getState(); } // The Normal variant shouldn't place blocks into positions it didn't take them from, // unless it hasn't taken any blocks but was instead extended with inserted-only items. if ((this.isAdvanced() || this.numTaken == 0) && stack.isEmpty() == false && stack.getItem() instanceof ItemBlock) { ItemBlock itemBlock = (ItemBlock) stack.getItem(); Block block = itemBlock.getBlock(); if (block != null && block != Blocks.AIR) { int meta = itemBlock.getMetadata(stack.getMetadata()); player.rotationYaw = this.getFacing().getHorizontalAngle(); return block.getStateForPlacement(world, pos, EnumFacing.UP, 0.5f, 1f, 0.5f, meta, player, EnumHand.MAIN_HAND); } } return null; }