diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang index 10ac6012..ebfdd750 100644 --- a/resources/assets/enderio/lang/en_US.lang +++ b/resources/assets/enderio/lang/en_US.lang @@ -845,6 +845,12 @@ enderio.gui.conduit.fluid.blacklist=Blacklist enderio.gui.conduit.gas.autoExtract=Auto Extract +//Weather +enderio.gui.weather.task.clear=Clear Weather +enderio.gui.weather.task.rain=Rainy Weather +enderio.gui.weather.task.storm=Thunderstorm +enderio.gui.weather.requireditem=Required Item: %s + //Enchants enchantment.enderio.soulBound=Soulbound description.enchantment.enderio.soulBound=This enchantment prevents the item from being lost on death diff --git a/resources/assets/enderio/textures/gui/widgets.png b/resources/assets/enderio/textures/gui/widgets.png index 62f5e115..c364a301 100644 Binary files a/resources/assets/enderio/textures/gui/widgets.png and b/resources/assets/enderio/textures/gui/widgets.png differ diff --git a/src/main/java/crazypants/enderio/gui/IconEIO.java b/src/main/java/crazypants/enderio/gui/IconEIO.java index 027f0bc6..c9bad739 100644 --- a/src/main/java/crazypants/enderio/gui/IconEIO.java +++ b/src/main/java/crazypants/enderio/gui/IconEIO.java @@ -124,7 +124,11 @@ public final class IconEIO { public static final IconEIO UNLOCKED = new IconEIO(150, 245, 10, 10); public static final IconEIO LOCKED = new IconEIO(162, 245, 10, 10); - + + public static final IconEIO SUN = new IconEIO(32, 132); + public static final IconEIO RAIN = new IconEIO(48, 132); + public static final IconEIO THUNDER = new IconEIO(64, 132); + public final double minU; public final double maxU; public final double minV; diff --git a/src/main/java/crazypants/enderio/machine/weather/GuiWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/weather/GuiWeatherObelisk.java index ab03b72f..6a6739dd 100644 --- a/src/main/java/crazypants/enderio/machine/weather/GuiWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/weather/GuiWeatherObelisk.java @@ -1,13 +1,22 @@ package crazypants.enderio.machine.weather; +import java.awt.Color; +import java.util.Locale; + import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + import crazypants.enderio.gui.IconButtonEIO; import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.gui.GuiPoweredMachineBase; import crazypants.enderio.machine.weather.TileWeatherObelisk.Task; import crazypants.enderio.network.PacketHandler; +import crazypants.util.Lang; public class GuiWeatherObelisk extends GuiPoweredMachineBase { @@ -18,17 +27,24 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase } @Override - public void initGui() { + public void initGui() { super.initGui(); - - int x = guiLeft + (xSize / 2) - (BUTTON_SIZE / 2); - int y = guiTop + 8; - - addButton(new IconButtonEIO(this, 0, x - 30, y, IconEIO.SINGLE_PLUS)); - addButton(new IconButtonEIO(this, 1, x, y, IconEIO.DOUBLE_PLUS)); - addButton(new IconButtonEIO(this, 2, x + 30, y, IconEIO.TRIPLE_PLUS)); + + int x = (xSize / 2) - (BUTTON_SIZE / 2); + int y = 8; + + addButton(new IconButtonEIO(this, 0, x - 30, y, IconEIO.SUN), Task.CLEAR); + addButton(new IconButtonEIO(this, 1, x, y, IconEIO.RAIN), Task.RAIN); + addButton(new IconButtonEIO(this, 2, x + 30, y, IconEIO.THUNDER), Task.STORM); } - + + private void addButton(IconButtonEIO button, Task task) { + String tt1 = EnumChatFormatting.WHITE + Lang.localize("gui.weather.task." + task.name().toLowerCase(Locale.ENGLISH)); + String tt2 = EnumChatFormatting.GRAY + String.format(Lang.localize("gui.weather.requireditem"), task.requiredItem.getDisplayName()); + button.setToolTip(tt1, tt2); + button.onGuiInit(); + } + @Override protected boolean showRecipeButton() { return false; @@ -40,9 +56,12 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase this.drawTexturedModalRect(getGuiLeft(), getGuiTop(), 0, 0, getXSize(), getYSize()); - int barHeight = getTileEntity().getProgressScaled(31); - this.drawTexturedModalRect(getGuiLeft() + 81, getGuiTop() + 58 - barHeight, getXSize(), 32 - barHeight, 12, barHeight); - + if(getTileEntity().activeTask != null) { + int barHeight = getTileEntity().getProgressScaled(31); + Color color = getTileEntity().activeTask.color; + GL11.glColor3f((float) color.getRed() / 255f, (float) color.getGreen() / 255f, (float) color.getBlue() / 255f); + this.drawTexturedModalRect(getGuiLeft() + 81, getGuiTop() + 58 - barHeight, getXSize(), 32 - barHeight, 12, barHeight); + } super.drawGuiContainerBackgroundLayer(par1, par2, par3); } diff --git a/src/main/java/crazypants/enderio/machine/weather/PacketFinishWeather.java b/src/main/java/crazypants/enderio/machine/weather/PacketFinishWeather.java index 8ffeec87..fd894e9e 100644 --- a/src/main/java/crazypants/enderio/machine/weather/PacketFinishWeather.java +++ b/src/main/java/crazypants/enderio/machine/weather/PacketFinishWeather.java @@ -19,8 +19,8 @@ public class PacketFinishWeather extends PacketActivateWeather { @Override public IMessage onMessage(PacketFinishWeather message, MessageContext ctx) { TileWeatherObelisk te = message.getTileEntity(EnderIO.proxy.getClientWorld()); - if (te != null) { - te.activateClientParticles(); + if(te != null) { + te.activateClientParticles(Task.values()[message.taskid]); } return null; } diff --git a/src/main/java/crazypants/enderio/machine/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/weather/TileWeatherObelisk.java index 860afa23..616b62fa 100644 --- a/src/main/java/crazypants/enderio/machine/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/weather/TileWeatherObelisk.java @@ -1,5 +1,7 @@ package crazypants.enderio.machine.weather; +import java.awt.Color; + import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntitySmokeFX; import net.minecraft.init.Items; @@ -16,21 +18,21 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity { enum Task { // TODO placeholder power vals - CLEAR(1000, new ItemStack(Items.cake)) { + CLEAR(1000, new ItemStack(Items.cake), Color.YELLOW) { @Override void complete(TileEntity te) { rain(te, false); thunder(te, false); } }, - RAIN(1000, new ItemStack(Items.water_bucket)) { + RAIN(1000, new ItemStack(Items.water_bucket), new Color(120, 120, 255)) { @Override void complete(TileEntity te) { rain(te, true); thunder(te, false); } }, - STORM(1000, new ItemStack(Items.lava_bucket)) { + STORM(1000, new ItemStack(Items.lava_bucket), Color.DARK_GRAY) { @Override void complete(TileEntity te) { rain(te, true); @@ -40,10 +42,12 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity { final int power; final ItemStack requiredItem; + final Color color; - Task(int power, ItemStack requiredItem) { + Task(int power, ItemStack requiredItem, Color color) { this.power = power; this.requiredItem = requiredItem; + this.color = color; } abstract void complete(TileEntity te); @@ -64,6 +68,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity { int powerUsed = 0; Task activeTask = null; + private Color particleColor; private boolean canBeActive = true; public TileWeatherObelisk() { @@ -81,8 +86,9 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity { @SideOnly(Side.CLIENT) private void spawnParticle() { - EntitySmokeFX fx = new EntitySmokeFX(getWorldObj(), xCoord + 0.5, yCoord + 0.3, zCoord + 0.5, 0, 0.2, 0); - fx.setRBGColorF(0.95f, 0.50f, 1f); + EntitySmokeFX fx = new EntitySmokeFX(getWorldObj(), xCoord + 0.5, yCoord + 0.3, zCoord + 0.5, 0, 0, 0); + fx.setRBGColorF((float) particleColor.getRed() / 255f, (float) particleColor.getGreen() / 255f, (float) particleColor.getBlue() / 255f); + fx.setVelocity(worldObj.rand.nextDouble() * 0.1 - 0.05, 0.35, worldObj.rand.nextDouble() * 0.1 - 0.05); Minecraft.getMinecraft().effectRenderer.addEffect(fx); activeParticleTicks--; } @@ -163,7 +169,8 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity { private int activeParticleTicks = 0; - public void activateClientParticles() { - activeParticleTicks = 10; + public void activateClientParticles(Task task) { + activeParticleTicks = 20; + particleColor = task.color; } }