Java Code Examples for net.minecraft.item.ItemDye#field_150922_c()
The following examples show how to use
net.minecraft.item.ItemDye#field_150922_c() .
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: FluidPlastic.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
public static int getPlasticMeta(FluidStack plastic){ int[] dyeColors = ItemDye.field_150922_c; int[] plasticColor = getColor3(plastic); int bestMatching = -1; double closestGap = Double.MAX_VALUE; List<ItemStack> plasticTypes = new ArrayList<ItemStack>(); ((ItemPlasticPlants)Itemss.plasticPlant).addSubItems(plasticTypes); for(ItemStack s : plasticTypes) { int i = s.getItemDamage(); double gap = Math.pow(plasticColor[0] - (dyeColors[i] >> 16), 2) + Math.pow(plasticColor[1] - (dyeColors[i] >> 8 & 255), 2) + Math.pow(plasticColor[2] - (dyeColors[i] & 255), 2); if(gap < closestGap) { closestGap = gap; bestMatching = i; } } return bestMatching; }
Example 2
Source File: FluidPlastic.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public static void addDye(FluidStack plastic, int dyeMetadata){ if(!Fluids.areFluidsEqual(plastic.getFluid(), Fluids.plastic)) throw new IllegalArgumentException("Given fluid stack isn't mixable! " + plastic); int dyeColor = ItemDye.field_150922_c[dyeMetadata]; int[] dyeColors = new int[]{dyeColor >> 16, dyeColor >> 8 & 255, dyeColor & 255}; int[] plasticColor = getColor3(plastic); double ratio = PneumaticValues.PLASTIC_MIX_RATIO / (PneumaticValues.PLASTIC_MIX_RATIO * (plastic.amount / 1000D)); for(int i = 0; i < 3; i++) { plasticColor[i] = (int)(ratio * dyeColors[i] + (1 - ratio) * plasticColor[i]); } if(plastic.tag == null) plastic.tag = new NBTTagCompound(); plastic.tag.setInteger("color", (plasticColor[0] << 16) + (plasticColor[1] << 8) + plasticColor[2]); }
Example 3
Source File: RenderCarvableBeacon.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) { float f1 = beacon.func_146002_i(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if(f1 > 0.1F){ Color color = new Color(ItemDye.field_150922_c[beacon.getWorldObj().getBlockMetadata(beacon.xCoord, beacon.yCoord, beacon.zCoord)]); Tessellator tessellator = Tessellator.instance; this.bindTexture(texture); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = (float) beacon.getWorldObj().getTotalWorldTime() + partialTicks; float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F); byte b0 = 1; double d3 = (double) f2 * 0.025D * (1.0D - (double) (b0 & 1) * 2.5D); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32); double d5 = (double) b0 * 0.2D; double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5; double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5; double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5; double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5; double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5; double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5; double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5; double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5; double d23 = (double) (256.0F * f1); double d25 = 0.0D; double d27 = 1.0D; double d28 = (double) (-1.0F + f3); double d29 = (double) (256.0F * f1) * (0.5D / d5) + d28; tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29); tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28); tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29); tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28); tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29); tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28); tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29); tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28); tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28); tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29); tessellator.draw(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32); double d30 = 0.2D; double d4 = 0.2D; double d6 = 0.8D; double d8 = 0.2D; double d10 = 0.2D; double d12 = 0.8D; double d14 = 0.8D; double d16 = 0.8D; double d18 = (double) (256.0F * f1); double d20 = 0.0D; double d22 = 1.0D; double d24 = (double) (-1.0F + f3); double d26 = (double) (256.0F * f1) + d24; tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26); tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24); tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26); tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24); tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26); tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24); tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26); tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24); tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24); tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); } }
Example 4
Source File: Configurations.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
public static boolean refreshConfig() { String category; /* general */ category = "general"; concreteVelocity = config.get(category, "concreteVelocity", 0.45, "Traversing concrete roads, players will acceleration to this velocity. For reference, normal running speed is about 0.28. Set to 0 to disable acceleration.").getDouble(0.45); fullBlockConcrete = config.get(category, "fullBlockConcrete", false, "Should concrete be a full block. This will also unavoidably disable speed increase if set to true.").getBoolean(false); ghostCloud = config.get(category, "doesCloudRenderLikeGhost", true).getBoolean(true); factoryBlockAmount = config.get(category, "amountYouGetFromFactoryBlockCrafting", 32).getInt(32); allowMossy = config.get(category, "allowBrickToMossyInChisel", true, "If true, you can chisel stone brick to mossy stone brick.").getBoolean(true); allowSmoothStone = config.get(category, "allowSmoothStoneToStoneBricksAndBack", true).getBoolean(true); chiselRecipe = config.get(category, "chiselAlternateRecipe", false, "Use alternative crafting recipe for the chisel").getBoolean(false); enableFMP = config.get(category, "enableFMP", true, "Do you want to enable FMP").getBoolean(true); chiselStoneToCobbleBricks = config.get(category, "chiselStoneToCobbleBricks", true, "Chisel stone to cobblestone and bricks by left clicking.").getBoolean(false); chiselBackToVanillaLeaves = config .get(category, "chiselBackToVanillaLeaves", false, "If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.").getBoolean(false); /* worldgen */ category = "worldgen"; marbleAmount = config.get(category, "marbleAmount", 7, "Amount of marble to generate in the world; use 0 for none").getInt(7); limestoneAmount = config.get(category, "limestoneAmount", 8, "Amount of limestone to generate in the world; use 0 for none").getInt(8); graniteAmount = config.get(category, "graniteAmount", 8, "Amount of granite to generate in the world; use 0 for none.").getInt(8); dioriteAmount = config.get(category, "dioriteAmount", 8, "Amount of diorite to generate in the world; use 0 for none.").getInt(8); andesiteAmount = config.get(category, "andesiteAmount", 8, "Amount of andesite to generate in the world; use 0 for none.").getInt(8); /* client */ category = "client"; particlesTickrate = config.get(category, "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1); oldPillars = config.get(category, "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false); disableCTM = !config.get(category, "connectedTextures", true, "Enable connected textures").getBoolean(true); CTM.disableObscuredFaceCheckConfig = connectInsideCTM = config.get(category, "connectInsideCTM", false, "Choose whether the inside corner is disconnected on a CTM block - http://imgur.com/eUywLZ4").getBoolean(false); blockDescriptions = config.get(category, "tooltipsUseBlockDescriptions", true, "Make variations of blocks have the same name, and use the description in tooltip to distinguish them.") .getBoolean(true); imTooGoodForDescriptions = config.get(category, "imTooGoodForBlockDescriptions", false, "For those people who just hate block descriptions on the world gen!").getBoolean(); /* chisel */ category = "chisel"; allowChiselDamage = config.get(category, "allowChiselDamage", true, "Should the chisel be damageable and take damage when it chisels something.").getBoolean(); ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel."); diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel."); obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel."); ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean(); ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean(); allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean(); ironChiselAttackDamage = config .get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.").getInt(); diamondChiselAttackDamage = config.get(category, "diamondChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt(); obsidianChiselAttackDamage = config.get(category, "obsidianChiselAttackDamage", 4, "The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt(); /* block */ category = "block"; useRoadLineTool = config.get(category, "useRoadLineTool", false, "Should the road line require a tool to break (If false, road lines can be broken in Adventure)").getBoolean(); getRoadLineTool = config.get(category, "getRoadLineTool", "pickaxe", "The tool that is able to break roadLines (requires useRoadLineTool to be true to take effect)").getString(); roadLineToolLevel = config.get(category, "roadLineToolLevel", 0, "The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0") .getInt(); /* hexColors */ category = "hexColors"; for (int i = 0; i < ItemDye.field_150923_a.length; i++) { // tterrag... don't kill me over this formatting. String temp = config.get(category, "hex" + ItemDye.field_150923_a[i], "#" + Integer.toHexString(ItemDye.field_150922_c[i]), Character.toUpperCase(ItemDye.field_150923_a[i].charAt(0)) + ItemDye.field_150923_a[i].substring(1) + " color for hex block overlay #RRGGBB").getString(); // Or this try { configColors[i] = Integer.decode(temp); } catch (NumberFormatException e) { Chisel.logger.warn("Configuration error, " + temp + " was not recognized as a color. Using default: #" + Integer.toHexString(ItemDye.field_150922_c[i])); configColors[i] = ItemDye.field_150922_c[i]; } } if (config.hasChanged()) { config.save(); } return true; }
Example 5
Source File: ItemPlasticElectronTube.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack itemStack, int renderPass){ return renderPass == 0 || itemStack.getItemDamage() >= 16 ? super.getColorFromItemStack(itemStack, renderPass) : ItemDye.field_150922_c[itemStack.getItemDamage()]; }