@Nonnull @Override public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { if(par2ItemStack.getItemDamage() == EnumDyeColor.BROWN.getDyeDamage()) { Block block = Blocks.COCOA; EnumFacing facing = par1IBlockSource.getBlockState().getValue(BlockDispenser.FACING); BlockPos pos = par1IBlockSource.getBlockPos().offset(facing); World world = par1IBlockSource.getWorld(); BlockPos logPos = pos.offset(facing); IBlockState logState = world.getBlockState(logPos); if(logState.getBlock() == Blocks.LOG && logState.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE && world.isAirBlock(pos) && block.canPlaceBlockAt(world, pos)) { world.setBlockState(pos, block.getDefaultState().withProperty(BlockHorizontal.FACING, facing)); par2ItemStack.shrink(1); return par2ItemStack; } } return vanillaBehaviour.dispense(par1IBlockSource, par2ItemStack); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); tagCompound.setByte("Color", (byte) color.getDyeDamage()); return tagCompound; }
protected boolean isBonemeal(ItemStack stack) { return stack.getItem() == Items.DYE && stack.getItemDamage() == EnumDyeColor.WHITE.getDyeDamage(); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); waterTank.writeToNBT(tagCompound); tagCompound.setByte("Color", (byte) color.getDyeDamage()); return tagCompound; }
@Override public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> items) { if (!isInCreativeTab(tab)) return; if (!glazed) items.add(new ItemStack(this)); else for (EnumDyeColor color : EnumDyeColor.values()) items.add(new ItemStack(this, 1, color.getDyeDamage())); } }
@Override public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> items) { if (!isInCreativeTab(tab)) return; if (!glazed) items.add(new ItemStack(this)); else for (EnumDyeColor color : EnumDyeColor.values()) items.add(new ItemStack(this, 1, color.getDyeDamage())); }
private ColorMeta(String name, String textureName, int rgb, EnumDyeColor vanilla) { this.oreName = "dye" + WordUtils.capitalize(name); this.oreId = OreDictionary.getOreID(oreName); this.textureName = textureName; this.name = name.toLowerCase(Locale.ENGLISH); this.unlocalizedName = "openmodslib.color." + name; this.rgb = rgb; this.vanillaEnum = vanilla; this.vanillaDyeId = vanilla.getDyeDamage(); this.vanillaBlockId = vanilla.getMetadata(); this.bitmask = 1 << vanillaBlockId; this.rgbWrap = new RGB(rgb); this.cymkWrap = rgbWrap.toCYMK(); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); tagCompound.setTag("ItemHandler", itemHandler.serializeNBT()); tagCompound.setByte("Color", (byte) color.getDyeDamage()); return tagCompound; }
public LaptopRecipeWrapper(EnumDyeColor color) { ItemStack motherboard = new ItemStack(DeviceItems.COMPONENT_MOTHERBOARD); NBTTagCompound tag = motherboard.getOrCreateSubCompound("components"); tag.setBoolean("cpu", true); tag.setBoolean("ram", true); tag.setBoolean("gpu", true); tag.setBoolean("wifi", true); ImmutableList.Builder<ItemStack> input = ImmutableList.builder(); input.add(new ItemStack(DeviceItems.PLASTIC_FRAME)); input.add(new ItemStack(DeviceItems.COMPONENT_SCREEN)); input.add(new ItemStack(DeviceItems.PLASTIC_FRAME)); input.add(new ItemStack(DeviceItems.COMPONENT_BATTERY)); input.add(motherboard); input.add(new ItemStack(DeviceItems.COMPONENT_HARD_DRIVE)); input.add(new ItemStack(DeviceItems.PLASTIC_FRAME)); input.add(new ItemStack(Items.DYE, 1, color.getDyeDamage())); input.add(new ItemStack(DeviceItems.PLASTIC_FRAME)); this.inputs = input.build(); ImmutableList.Builder<ItemStack> output = ImmutableList.builder(); output.add(new ItemStack(DeviceBlocks.LAPTOP, 1, color.getMetadata())); this.outputs = output.build(); }
public FruitCocoa() { this.stateMatcher = new BlockStateMatcher(Blocks.COCOA); this.stackMatcher = new ItemStackMatcher.Builder(Items.DYE).setMeta(EnumDyeColor.BROWN.getDyeDamage()).build(); }
@Override protected void drawChest() { Minecraft mc = Minecraft.getMinecraft(); BlockPos pos = mc.objectMouseOver.getBlockPos(); if(pos != null) { TileEntity tile = mc.world.getTileEntity(pos); if(tile instanceof TileEntityShulkerBox) { TileEntityShulkerBox shulker = (TileEntityShulkerBox) tile; EnumDyeColor dye = ((BlockShulkerBox) shulker.getBlockType()).getColor(); int color = ItemDye.DYE_COLORS[dye.getDyeDamage()]; Color colorObj = new Color(color).brighter(); GlStateManager.color((float) colorObj.getRed() / 255F, (float) colorObj.getGreen() / 255F, (float) colorObj.getBlue() / 255F); super.drawIcon(16, 128); GlStateManager.color(1F, 1F, 1F); return; } } super.drawChest(); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); tagCompound.setTag("ItemHandler", itemHandler.serializeNBT()); tagCompound.setByte("FridgeColor", (byte) fridgeColor.getDyeDamage()); tagCompound.setBoolean("HasIceUpgrade", hasIceUpgrade); tagCompound.setBoolean("HasPreservationUpgrade", hasPreservationUpgrade); return tagCompound; }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); NBTTagCompound itemCompound = new NBTTagCompound(); if (!noFilterBook.isEmpty()) { noFilterBook.writeToNBT(itemCompound); } tagCompound.setTag("NoFilterBook", itemCompound); tagCompound.setByte("Color", (byte) color.getDyeDamage()); return tagCompound; }
/** * Creates an NBTTagList which contains the data for the banner layers passed. Each layer * is stored as a String for the ID and an int that represents an EnumDyeColor. The created * NBTTagList can be directly used by the Banner TileEntity. Layers are written in the * order they are passed. * * @param layers The layers to write to NBT. * @return An NBTTagList that contains all of the banner layers written as tag compound. */ public static NBTTagList createPatternList (BannerLayer... layers) { final NBTTagList patterns = new NBTTagList(); for (final BannerLayer layer : layers) { final NBTTagCompound tag = new NBTTagCompound(); tag.setString("Pattern", layer.pattern.getHashname()); tag.setInteger("Color", layer.color.getDyeDamage()); patterns.appendTag(tag); } return patterns; }
@Override public boolean initialize() { addShapelessRecipe(ItemHelper.cloneStack(fertilizerBasic, 4), "dustWood", "dustWood", "dustSaltpeter", "crystalSlag"); addShapelessRecipe(ItemHelper.cloneStack(fertilizerBasic, 16), "dustCharcoal", "dustSaltpeter", "crystalSlag"); addShapelessRecipe(ItemHelper.cloneStack(fertilizerRich, 4), "dustWood", "dustWood", "dustSaltpeter", "crystalSlagRich"); addShapelessRecipe(ItemHelper.cloneStack(fertilizerRich, 16), "dustCharcoal", "dustSaltpeter", "crystalSlagRich"); if (!Loader.isModLoaded("thermalexpansion")) { addShapelessRecipe(fertilizerRich, fertilizerBasic, new ItemStack(Items.DYE, 1, EnumDyeColor.WHITE.getDyeDamage())); addShapelessRecipe(fertilizerFlux, fertilizerRich, "dustRedstone"); } return true; }
@SuppressWarnings("deprecation") public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { if (this.averageGroundLvl < 0) { this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); if (this.averageGroundLvl < 0) { return true; } this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 5, 0); } IBlockState iblockstate = this.getBiomeSpecificBlockState(Blocks.SPRUCE_FENCE.getDefaultState()); this.setBlockState(worldIn, iblockstate, 1, 0, 0, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 1, 1, 0, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 1, 2, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.WOOL.getStateFromMeta(EnumDyeColor.BLACK.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.EAST, 2, 3, 0, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.NORTH, 1, 3, 1, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.WEST, 0, 3, 0, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.SOUTH, 1, 3, -1, structureBoundingBoxIn); return true; }
@Override public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { if(par2ItemStack.getItemDamage() == EnumDyeColor.BROWN.getDyeDamage()) { Block block = Blocks.COCOA; EnumFacing facing = par1IBlockSource.getBlockState().getValue(BlockDispenser.FACING); BlockPos pos = par1IBlockSource.getBlockPos().offset(facing); World world = par1IBlockSource.getWorld(); BlockPos logPos = pos.offset(facing); IBlockState logState = world.getBlockState(logPos); if(logState.getBlock() == Blocks.LOG && logState.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE && world.isAirBlock(pos) && block.canPlaceBlockAt(world, pos)) { world.setBlockState(pos, block.getDefaultState().withProperty(BlockHorizontal.FACING, facing)); par2ItemStack.shrink(1); return par2ItemStack; } } return vanillaBehaviour.dispense(par1IBlockSource, par2ItemStack); }
/** * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes * Mineshafts at the end, it adds Fences... */ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { if (this.averageGroundLvl < 0) { this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); if (this.averageGroundLvl < 0) { return true; } this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 4 - 1, 0); } IBlockState iblockstate = this.getBiomeSpecificBlockState(Blocks.OAK_FENCE.getDefaultState()); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.setBlockState(worldIn, iblockstate, 1, 0, 0, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 1, 1, 0, structureBoundingBoxIn); this.setBlockState(worldIn, iblockstate, 1, 2, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.WOOL.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.EAST, 2, 3, 0, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.NORTH, 1, 3, 1, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.WEST, 0, 3, 0, structureBoundingBoxIn); this.func_189926_a(worldIn, EnumFacing.SOUTH, 1, 3, -1, structureBoundingBoxIn); return true; }
for (FusedQuartzType type : FusedQuartzType.values()) { registry.register(new ShapedOreRecipe(null, new ItemStack(type.getBlock(), 8, color.getMetadata()), "GGG", "CGG", "GGG", 'G', type.getOreDictName(), 'C', "dye" + MaterialOredicts.dyes[color.getDyeDamage()]) .setRegistryName(Crafting.mkRL("Auto: Coloring " + type.getName() + " with " + color.getUnlocalizedName()))); if (color != EnumDyeColor.WHITE) { registry.register(new ShapedOreRecipe(null, new ItemStack(type.getBlock(), 8, color.getMetadata()), "GGG", "CGG", "GGG", 'G', new ItemStack(type.getBlock(), 1, EnumDyeColor.WHITE.getMetadata()), 'C', "dye" + MaterialOredicts.dyes[color.getDyeDamage()]) .setRegistryName(Crafting.mkRL("Auto: Easy Lookup for coloring " + type.getName() + " with " + color.getUnlocalizedName())));
addRecipe(new RecipePackager(new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(Items.DYE, 9, EnumDyeColor.BLUE.getDyeDamage()))); addRecipe(new RecipePackager(new ItemStack(Blocks.BONE_BLOCK), new ItemStack(Items.DYE, 9, EnumDyeColor.WHITE.getDyeDamage())));