net.minecraft.item.ItemDye Java Examples

The following examples show how to use net.minecraft.item.ItemDye. 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 vote down vote up
@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: ModuleLogistics.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void addInfo(List<String> curInfo){
    super.addInfo(curInfo);
    String status;
    if(ticksSinceAction >= 0) {
        status = "waila.logisticsModule.transporting";
    } else if(ticksSinceNotEnoughAir >= 0) {
        status = "waila.logisticsModule.notEnoughAir";
    } else if(hasPower()) {
        status = "waila.logisticsModule.powered";
    } else {
        status = "waila.logisticsModule.noPower";
    }
    curInfo.add(StatCollector.translateToLocal("hud.msg.state") + ": " + StatCollector.translateToLocal(status));
    curInfo.add(StatCollector.translateToLocal("waila.logisticsModule.channel") + " " + EnumChatFormatting.YELLOW + StatCollector.translateToLocal("item.fireworksCharge." + ItemDye.field_150923_a[colorChannel]));
}
 
Example #3
Source File: FluidPlastic.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
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 #4
Source File: EntityDrone.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean interact(EntityPlayer player){
    ItemStack equippedItem = player.getCurrentEquippedItem();
    if(!worldObj.isRemote && equippedItem != null) {
        if(equippedItem.getItem() == Itemss.GPSTool) {
            ChunkPosition gpsLoc = ItemGPSTool.getGPSLocation(equippedItem);
            if(gpsLoc != null) {
                getNavigator().tryMoveToXYZ(gpsLoc.chunkPosX, gpsLoc.chunkPosY, gpsLoc.chunkPosZ, 0.1D);
            }
        } else {
            int dyeIndex = TileEntityPlasticMixer.getDyeIndex(equippedItem);
            if(dyeIndex >= 0) {
                setDroneColor(ItemDye.field_150922_c[dyeIndex]);
                equippedItem.stackSize--;
                if(equippedItem.stackSize <= 0) {
                    player.setCurrentItemOrArmor(0, null);
                }
            }
        }
    }
    return false;
}
 
Example #5
Source File: DyeModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Listener
public void onUpdate(EventPlayerUpdate event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        final Minecraft mc = Minecraft.getMinecraft();
        if(mc.player.inventory.getCurrentItem().getItem() instanceof ItemDye) {
            final EnumDyeColor color = EnumDyeColor.byDyeDamage(mc.player.inventory.getCurrentItem().getMetadata());

            for(Entity e : mc.world.loadedEntityList) {
                if(e != null && e instanceof EntitySheep) {
                    final EntitySheep sheep = (EntitySheep) e;
                    if(sheep.getHealth() > 0) {
                        if (sheep.getFleeceColor() != color && !sheep.getSheared() && mc.player.getDistance(sheep) <= 4.5f) {
                            mc.playerController.interactWithEntity(mc.player, sheep, EnumHand.MAIN_HAND);
                        }
                    }
                }
            }
        }
    }
}
 
Example #6
Source File: ItemCompost.java    From GardenCollection with MIT License 6 votes vote down vote up
public boolean applyEnrichment (ItemStack itemStack, World world, int x, int y, int z, EntityPlayer player) {
    ConfigManager config = GardenCore.config;
    Block block = world.getBlock(x, y, z);

    EnrichedSoilEvent event = new EnrichedSoilEvent(player, world, block, x, y, z);
    if (MinecraftForge.EVENT_BUS.post(event))
        return false;

    if (!config.enableCompostBonemeal)
        return false;

    if (event.getResult() == Event.Result.ALLOW) {
        if (!world.isRemote)
            itemStack.stackSize--;
        return true;
    }

    int prob = (config.compostBonemealStrength == 0) ? 0 : (int)(1 / config.compostBonemealStrength);
    if (world.rand.nextInt(prob) == 0)
        return ItemDye.applyBonemeal(itemStack, world, x, y, z, player);
    else
        --itemStack.stackSize;

    return true;
}
 
Example #7
Source File: ModuleEffectThrive.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderSpell(World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
	Vec3d position = spell.getTarget(world);

	ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, new BlockPos(position));
	ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, new BlockPos(position.add(0,1,0)));

	if (position == null) return;
	LibParticles.EFFECT_REGENERATE(world, position, instance.getPrimaryColor());
}
 
Example #8
Source File: PacketThriveBlock.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void handle(@NotNull MessageContext ctx) {
	World world = LibrarianLib.PROXY.getClientPlayer().world;

	ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, pos);
	ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, pos.add(0,1,0));
}
 
Example #9
Source File: ModuleLogistics.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void renderModule(){
    super.renderModule();
    RenderUtils.glColorHex(0xFF000000 | ItemDye.field_150922_c[getColorChannel()]);
    model.renderChannelColorFrame(1 / 16F);
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example #10
Source File: DateEventHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private static ItemStack getFireworkCharge(){
    ItemStack charge = new ItemStack(Items.firework_charge);
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    byte b0 = 0;
    ArrayList arraylist = new ArrayList();

    arraylist.add(Integer.valueOf(ItemDye.field_150922_c[rand.nextInt(16)]));

    if(rand.nextBoolean()) nbttagcompound1.setBoolean("Flicker", true);

    if(rand.nextBoolean()) nbttagcompound1.setBoolean("Trail", true);

    b0 = (byte)rand.nextInt(5);

    int[] aint = new int[arraylist.size()];

    for(int j2 = 0; j2 < aint.length; ++j2) {
        aint[j2] = ((Integer)arraylist.get(j2)).intValue();
    }

    nbttagcompound1.setIntArray("Colors", aint);
    nbttagcompound1.setByte("Type", b0);
    nbttagcompound.setTag("Explosion", nbttagcompound1);
    charge.setTagCompound(nbttagcompound);
    return charge;
}
 
Example #11
Source File: FluidPlastic.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
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 #12
Source File: ClientProxy.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(){
    for(int i = 0; i < 16; i++) { //Only register these recipes client side, so NEI compatibility works, but drones don't lose their program when dyed.
        ItemStack drone = new ItemStack(Itemss.drone);
        NBTTagCompound tag = new NBTTagCompound();
        tag.setInteger("color", ItemDye.field_150922_c[i]);
        drone.setTagCompound(tag);
        GameRegistry.addRecipe(new ShapelessOreRecipe(drone, Itemss.drone, TileEntityPlasticMixer.DYES[i]));
    }
    CraftingRegistrator.addShapelessRecipe(new ItemStack(Itemss.drone), new ItemStack(Itemss.logisticsDrone), Itemss.printedCircuitBoard);

    ThirdPartyManager.instance().clientInit();
}
 
Example #13
Source File: ArchimedesShipMod.java    From archimedes-ships with MIT License 5 votes vote down vote up
private void registerBlocksAndItems()
{
	GameRegistry.addRecipe(new ItemStack(blockMarkShip, 1), "X#X", "#O#", "X#X", Character.valueOf('X'), Blocks.planks, Character.valueOf('#'), Items.stick, Character.valueOf('O'), Items.iron_ingot);
	GameRegistry.registerTileEntity(TileEntityHelm.class, "archiHelm");
	Blocks.fire.setFireInfo(blockMarkShip, 5, 5);
	
	GameRegistry.addShapelessRecipe(new ItemStack(blockFloater, 1), Blocks.log, Blocks.wool);
	GameRegistry.addShapelessRecipe(new ItemStack(blockFloater, 1), Blocks.log2, Blocks.wool);
	
	//GameRegistry.addRecipe(new ItemStack(blockBalloon, 1), "X", "#", Character.valueOf('X'), Block.cloth, Character.valueOf('#'), Item.silk);
	for (int i = 0; i < ItemDye.field_150923_a.length; i++)
	{
		GameRegistry.addRecipe(new ItemStack(blockBalloon, 1, i), "X", "#", Character.valueOf('X'), new ItemStack(Blocks.wool, 1, i), Character.valueOf('#'), Items.string);
	}
	Blocks.fire.setFireInfo(blockBalloon, 30, 60);
	
	GameRegistry.addRecipe(new ItemStack(blockGauge, 1, 0), "VXV", "XO#", " # ", Character.valueOf('X'), Items.iron_ingot, Character.valueOf('#'), Items.gold_ingot, Character.valueOf('O'), Items.redstone, Character.valueOf('V'), Blocks.glass_pane);
	GameRegistry.addRecipe(new ItemStack(blockGauge, 1, 0), "VXV", "XO#", " # ", Character.valueOf('X'), Items.gold_ingot, Character.valueOf('#'), Items.iron_ingot, Character.valueOf('O'), Items.redstone, Character.valueOf('V'), Blocks.glass_pane);
	GameRegistry.addRecipe(new ItemStack(blockGauge, 1, 1), "VXV", "XO#", "V#V", Character.valueOf('X'), Items.iron_ingot, Character.valueOf('#'), Items.gold_ingot, Character.valueOf('O'), Items.redstone, Character.valueOf('V'), Blocks.glass_pane);
	GameRegistry.addRecipe(new ItemStack(blockGauge, 1, 1), "VXV", "XO#", "V#V", Character.valueOf('X'), Items.gold_ingot, Character.valueOf('#'), Items.iron_ingot, Character.valueOf('O'), Items.redstone, Character.valueOf('V'), Blocks.glass_pane);
	GameRegistry.registerTileEntity(TileEntityGauge.class, "archiGauge");
	
	GameRegistry.addRecipe(new ItemStack(blockSeat), "X ", "XX", Character.valueOf('X'), Blocks.wool);
	Blocks.fire.setFireInfo(blockSeat, 30, 30);
	
	GameRegistry.addShapelessRecipe(new ItemStack(blockBuffer), blockFloater, new ItemStack(Items.dye, 1, 0));
	
	GameRegistry.addRecipe(new ItemStack(blockCrateWood, 3), " # ", "# #", "XXX", Character.valueOf('#'), Items.leather, Character.valueOf('X'), Blocks.planks);
	GameRegistry.registerTileEntity(TileEntityCrate.class, "archiCrate");
	
	GameRegistry.addRecipe(new ItemStack(blockEngine, 1), "#O#", "#X#", "###", Character.valueOf('#'), Items.iron_ingot, Character.valueOf('O'), Items.water_bucket, Character.valueOf('X'), Blocks.furnace);
	GameRegistry.registerTileEntity(TileEntityEngine.class, "archiEngine");
}
 
Example #14
Source File: BlockElevator.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player,
        EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
    ItemStack stack = EntityUtils.getHeldItemOfType(player, ItemDye.class);

    if (stack.isEmpty() == false)
    {
        EnumDyeColor stackColor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (state.getValue(COLOR) != stackColor)
        {
            if (world.isRemote == false)
            {
                world.setBlockState(pos, state.withProperty(COLOR, stackColor), 3);
                world.playSound(null, pos, SoundEvents.ENTITY_ITEMFRAME_ADD_ITEM, SoundCategory.BLOCKS, 1f, 1f);

                if (player.capabilities.isCreativeMode == false)
                {
                    stack.shrink(1);
                }
            }

            return true;
        }

        return false;
    }
    else
    {
        return super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ);
    }
}
 
Example #15
Source File: BlockLargePotColored.java    From GardenCollection with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons (IIconRegister iconRegister) {
    iconArray = new IIcon[16];
    for (int i = 0; i < 16; i++) {
        String colorName = ItemDye.field_150921_b[getBlockFromDye(i)];
        iconArray[i] = iconRegister.registerIcon(GardenContainers.MOD_ID + ":large_pot_" + colorName);
    }

    super.registerBlockIcons(iconRegister);
}
 
Example #16
Source File: AbstractRailRenderer.java    From Signals with GNU General Public License v3.0 4 votes vote down vote up
public void compileRender(){
    int color = ItemDye.DYE_COLORS[colorIndex];
    float r = (color >> 16) / 256F;
    float g = (color >> 8 & 255) / 256F;
    float b = (color & 255) / 256F;

    NetworkRail<MCPos> rootNode = getRootNode(section);
    Set<NetworkRail<MCPos>> traversed = new HashSet<>();
    traversed.add(rootNode);

    Stack<NetworkRail<MCPos>> toTraverse = new Stack<>();

    toTraverse.push(rootNode);

    RailObjectHolder<MCPos> neighborProvider = getNeighborProvider(section);

    while(!toTraverse.isEmpty()) {
        NetworkRail<MCPos> node = toTraverse.pop();
        EnumRailDirection railDir = ((MCNetworkRail)node).getCurDir();

        List<NetworkRail<MCPos>> neighbors = node.getSectionNeighborRails(neighborProvider).collect(Collectors.toList());
        for(NetworkRail<MCPos> neighbor : neighbors) {
            if(shouldTraverse(section, neighbor) && traversed.add(neighbor)) {
                toTraverse.push(neighbor);
            }

            if(neighbor.getPos().getDimID() != node.getPos().getDimID()) continue;

            RectRenderer rectRenderer = rectRenderers.get(neighbor.getPos().getDimID());
            if(rectRenderer == null) {
                rectRenderer = new RectRenderer();
                rectRenderer.width = getLineWidth();
                rectRenderer.setColor(r, g, b);
                rectRenderers.put(neighbor.getPos().getDimID(), rectRenderer);
            }

            rectRenderer.pos(node.getPos().getX() + 0.5, node.getPos().getY() + (railDir.isAscending() ? 0.6 : 0.1) + getHeightOffset(), node.getPos().getZ() + 0.5);

            EnumFacing dir = HeadingUtils.toFacing(neighbor.getPos().getRelativeHeading(node.getPos()));
            int offset = getRailHeightOffset(node, dir);
            Vec3d interpolated = Vec3iUtils.interpolate(node.getPos().getPos(), neighbor.getPos().getPos());
            rectRenderer.pos(interpolated.x + 0.5, node.getPos().getY() + (offset == 1 ? 1.1 : 0.1) + getHeightOffset(), interpolated.z + 0.5);
        }
    }
}
 
Example #17
Source File: RenderCarvableBeacon.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
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 #18
Source File: ModuleEffectThrive.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
	BlockPos targetPos = spell.getTargetPos();
	Entity targetEntity = spell.getVictim(world);
	Entity caster = spell.getCaster(world);
	Vec3d pos = spell.getTarget(world);

	if (pos == null) return true;

	if (targetEntity instanceof EntityLivingBase) {
		double potency = spellRing.getAttributeValue(world, AttributeRegistry.POTENCY, spell) / 2;

		if (!spellRing.taxCaster(world, spell, true)) return false;

		((EntityLivingBase) targetEntity).heal((float) potency);
		world.playSound(null, new BlockPos(pos), ModSounds.HEAL, SoundCategory.NEUTRAL, 1, 1);
	}

	if (targetPos != null) {
		BlockPos otherTargetPos = spell.getTargetPos().add(0, 1, 0); // beam missed crops and targets farmland

		if (world.getBlockState(targetPos).getBlock() instanceof IGrowable || world.getBlockState(otherTargetPos).getBlock() instanceof IGrowable) {
			if (!spellRing.taxCaster(world, spell, true)) return false;
			if (!(caster instanceof EntityPlayerMP) || BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster)) {
				ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, targetPos);
				ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, otherTargetPos);

				PacketThriveBlock ptb = new PacketThriveBlock(targetPos);
				PacketHandler.NETWORK.sendToAllAround(ptb, new NetworkRegistry.TargetPoint(world.provider.getDimension(), targetPos.getX(), targetPos.getY(), targetPos.getZ(), 100));

				if (!world.isRemote) {
					world.playEvent(2005, targetPos, 0);
					world.playEvent(2005, otherTargetPos, 0);
				}
			}
		} else if (world.getBlockState(targetPos).getBlock() instanceof IPlantable || world.getBlockState(otherTargetPos).getBlock() instanceof IPlantable) {
			IBlockState state = world.getBlockState(targetPos);
			Block block = state.getBlock();
			if (!spellRing.taxCaster(world, spell, true)) return false;
			if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster))) {
				while (world.getBlockState(targetPos.up()).getBlock() == block) {
					targetPos = targetPos.up();
					state = world.getBlockState(targetPos);
					block = state.getBlock();
				}
				world.immediateBlockTick(targetPos, state, RandUtil.random);
				world.playSound(null, new BlockPos(pos), ModSounds.HEAL, SoundCategory.NEUTRAL, 1, 1);
			}

			state = world.getBlockState(otherTargetPos);
			block = state.getBlock();

			if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(otherTargetPos, (EntityPlayerMP) caster))) {
				while (world.getBlockState(otherTargetPos.up()).getBlock() == block) {
					otherTargetPos = otherTargetPos.up();
					state = world.getBlockState(otherTargetPos);
					block = state.getBlock();
				}
				world.immediateBlockTick(otherTargetPos, state, RandUtil.random);
				world.playSound(null, new BlockPos(pos), ModSounds.HEAL, SoundCategory.NEUTRAL, 1, 1);
			}
		}
	}

	return true;
}
 
Example #19
Source File: TileEntityDroneInterface.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private void messageToDrone(Class<? extends IProgWidget> widget){
    messageToDrone(ItemDye.field_150922_c[ItemProgrammingPuzzle.getWidgetForClass(widget).getCraftingColorIndex()]);
}
 
Example #20
Source File: ItemPlasticElectronTube.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@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()];
}
 
Example #21
Source File: ItemProgrammingPuzzle.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getUnlocalizedName(ItemStack stack){
    return super.getUnlocalizedName(stack) + "." + ItemDye.field_150923_a[MathHelper.clamp_int(stack.getItemDamage(), 0, 15)];
}
 
Example #22
Source File: ItemPlastic.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getUnlocalizedName(ItemStack stack){
    return super.getUnlocalizedName(stack) + "." + ItemDye.field_150923_a[MathHelper.clamp_int(stack.getItemDamage(), 0, 15)];
}
 
Example #23
Source File: BlockLargePotColored.java    From GardenCollection with MIT License 4 votes vote down vote up
@Override
public String[] getSubTypes () {
    return ItemDye.field_150921_b;
}
 
Example #24
Source File: BlockMediumPotColored.java    From GardenCollection with MIT License 4 votes vote down vote up
@Override
public String[] getSubTypes () {
    return ItemDye.field_150921_b;
}
 
Example #25
Source File: Configurations.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
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;
	}