mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 06:53:24 +00:00
Add button art, particles/progress bar are now colored per task.
This commit is contained in:
1 parent
938f5db503
commit
cb364ed831
6 files changed
+59
-23
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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<TileWeatherObelisk> {
|
||||
|
||||
@@ -18,17 +27,24 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase<TileWeatherObelisk>
|
||||
}
|
||||
|
||||
@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<TileWeatherObelisk>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user