net.minecraft.block.BlockColored Java Examples
The following examples show how to use
net.minecraft.block.BlockColored.
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: ItemLantern.java From GardenCollection with MIT License | 6 votes |
@SideOnly(Side.CLIENT) @Override public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) { if (ModBlocks.lantern.isGlass(itemStack)) { String glassName = Blocks.stained_glass.getUnlocalizedName() + "." + ItemDye.field_150923_a[BlockColored.func_150032_b(itemStack.getItemDamage())]; list.add(StatCollector.translateToLocal(glassName + ".name")); } String contents = StatCollector.translateToLocal(ModBlocks.makeName("lanternSource")) + ": " + EnumChatFormatting.YELLOW; String source = ModBlocks.lantern.getLightSource(itemStack); ILanternSource lanternSource = (source != null) ? Api.instance.registries().lanternSources().getLanternSource(source) : null; if (lanternSource != null) contents += StatCollector.translateToLocal(lanternSource.getLanguageKey(itemStack.getItemDamage())); else contents += StatCollector.translateToLocal(ModBlocks.makeName("lanternSource.none")); list.add(contents); }
Example #2
Source File: CraftingRecipeLoader.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
private static void registerColoringRecipes(BlockColored block) { for (EnumDyeColor dyeColor : EnumDyeColor.values()) { String recipeName = String.format("%s_color_%s", block.getRegistryName().getResourcePath(), getColorName(dyeColor)); ModHandler.addShapedRecipe(recipeName, new ItemStack(block, 8, dyeColor.getMetadata()), "XXX", "XDX", "XXX", 'X', new ItemStack(block, 1, GTValues.W), 'D', getOrdictColorName(dyeColor)); } }
Example #3
Source File: QuestEnemyEncampment.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private void buildHut(QuestData data, BlockPos pos) { World world = data.getPlayer().getEntityWorld(); if (pos == null) { return; } int w = hutHalfWidth; BlockPos pointer; IBlockState block; for (int x = -w; x <= w; x++) { for (int y = 0; y <= w; y++) { for (int z = -w; z <= w; z++) { pointer = pos.add(x, y, z); block = world.getBlockState(pointer); if (cantBuildOver(block)) { continue; } if (y + Math.abs(z) == w) { if (x % 2 == 0) { world.setBlockState(pointer, Blocks.WOOL.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.RED)); } else { world.setBlockState(pointer, Blocks.WOOL.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.BLACK)); } } else if (z == 0 && (x == w || x == -w)) { world.setBlockState(pointer, Blocks.DARK_OAK_FENCE.getDefaultState()); } } } } }
Example #4
Source File: DebugModeTestBlockRange.java From AgriCraft with MIT License | 5 votes |
/** * This method allows the user to test what Block Positions are covered by the BlockRange * iterator. The expected result will be the full cuboid between opposing corner positions. Also * remember that the BlockRange min and max positions aren't necessarily the input positions. * * Usage: Right-click on two blocks to specify the opposite corners. Some blocks should get * replaced with free wool. Be careful. In case of terrible bugs, might destroy or overwrite * unexpected locations! */ @Override public void debugActionBlockClicked(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return; } Optional<BlockPos> startPos = getStartPos(stack); if (!startPos.isPresent()) { // This is the first click. Save 'pos' as the starting coordinate. setStartPos(stack, pos); player.sendMessage(new TextComponentString("Starting corner set: (" + pos.getX() + "," + pos.getY() + "," + pos.getZ() + ")")); player.sendMessage(new TextComponentString("Next right click will set the opposite/ending corner.")); player.sendMessage(new TextComponentString("WARNING: this mode will destroy blocks, be careful.")); } else { // This is the second click. Load the starting coordinate. Use 'pos' as the ending coordinate. Then fill the cuboid with wool. int count = 0; IBlockState wool = Blocks.WOOL.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.BLACK); // // IMPORTANT PART OF THE TEST IS BELOW // BlockRange range = new BlockRange(startPos.get(), pos); for (BlockPos target : range) { // <-- Is the iterator giving a complete set? IBlockState old = world.getBlockState(target); world.destroyBlock(target, true); world.setBlockState(target, wool); world.notifyBlockUpdate(target, old, wool, 2); count += 1; } // // IMPORTANT PART OF THE TEST IS ABOVE // player.sendMessage(new TextComponentString("Volume: " + range.getVolume())); player.sendMessage(new TextComponentString("Replaced: " + count)); player.sendMessage(new TextComponentString("Coverage: " + (range.getVolume() == count ? "Complete" : "INCOMPLETE"))); setStartPos(stack, null); } }
Example #5
Source File: ArchimedesShipMod.java From archimedes-ships with MIT License | 5 votes |
private void createBlocksAndItems() { materialFloater = new Material(MapColor.clothColor); blockMarkShip = (BlockHelm) new BlockHelm().setCreativeTab(CreativeTabs.tabTransport); blockMarkShip.setStepSound(Block.soundTypeWood).setHardness(1F).setResistance(1F); registerBlock("marker", blockMarkShip); blockFloater = new BlockAS(materialFloater).setCreativeTab(CreativeTabs.tabTransport); blockFloater.setStepSound(Block.soundTypeWood).setHardness(1F).setResistance(1F); registerBlock("floater", blockFloater); blockBalloon = new BlockColored(Material.cloth).setCreativeTab(CreativeTabs.tabTransport); blockBalloon.setStepSound(Block.soundTypeCloth).setHardness(0.35F).setResistance(1F); registerBlock("balloon", blockBalloon, ItemCloth.class); blockGauge = (BlockGauge) new BlockGauge().setCreativeTab(CreativeTabs.tabTransport); blockGauge.setStepSound(Block.soundTypeMetal).setHardness(1F).setResistance(1F); registerBlock("gauge", blockGauge, ItemGaugeBlock.class); blockSeat = (BlockSeat) new BlockSeat().setHardness(1F).setResistance(1F).setCreativeTab(CreativeTabs.tabTransport); blockSeat.setStepSound(Block.soundTypeCloth); registerBlock("seat", blockSeat); blockBuffer = new BlockAS(Material.cloth).setHardness(1F).setResistance(1F).setCreativeTab(CreativeTabs.tabTransport); blockBuffer.setStepSound(Block.soundTypeWood); registerBlock("buffer", blockBuffer); blockEngine = new BlockEngine(Material.iron, 1f, 10).setHardness(2F).setResistance(3F).setCreativeTab(CreativeTabs.tabTransport); blockEngine.setStepSound(Block.soundTypeMetal); registerBlock("engine", blockEngine); blockCrateWood = new BlockCrate(Material.wood).setHardness(1f).setResistance(1f).setCreativeTab(CreativeTabs.tabTransport); blockCrateWood.setStepSound(Block.soundTypeWood); registerBlock("crate_wood", blockCrateWood); }