From 80c83d3fcecd664adb8a0068658478716f9340a4 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:06:08 +1000 Subject: [PATCH 01/13] Create Packet for Relaying Control Mode --- .../obelisk/weather/BlockWeatherObelisk.java | 2 + .../weather/PacketControlModeWeather.java | 43 +++++++++++++++++++ .../obelisk/weather/TileWeatherObelisk.java | 10 +++++ 3 files changed, 55 insertions(+) create mode 100644 src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java index 7e63fb78..91bcd5bf 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java @@ -31,6 +31,8 @@ public class BlockWeatherObelisk extends BlockObeliskAbstract + implements IMessageHandler { + + private boolean pulse; + + public PacketControlModeWeather() {} + + public PacketControlModeWeather(TileWeatherObelisk te) { + super(te); + this.pulse = te.getPulseControl(); + } + + @Override + public void toBytes(ByteBuf buf) { + super.toBytes(buf); + buf.writeBoolean(pulse); + } + + @Override + public void fromBytes(ByteBuf buf) { + super.fromBytes(buf); + pulse = buf.readBoolean(); + } + + @Override + public IMessage onMessage(PacketControlModeWeather message, MessageContext ctx) { + TileWeatherObelisk te = message.getTileEntity(message.getWorld(ctx)); + if (te != null) { + if (PacketUtil.isInvalidPacketForGui(ctx, te, getClass())) return null; + te.setPulseControl(message.pulse); + } + return null; + } +} diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index 8d81ca8c..c2ff5431 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -100,6 +100,8 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity private boolean canBeActive = true; private boolean tanksDirty; + private boolean pulseControl = false; + private static final ICapacitor cap = Capacitors.BASIC_CAPACITOR.capacitor; private FluidTank inputTank = new FluidTank(8000); @@ -382,4 +384,12 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity public FluidTankInfo[] getTankInfo(ForgeDirection from) { return new FluidTankInfo[] { inputTank.getInfo() }; } + + public void setPulseControl(boolean pulseControl) { + this.pulseControl = pulseControl; + } + + public boolean getPulseControl() { + return this.pulseControl; + } } From 2fe6acc76211ebb710b2b52f89c5111c0f9e71b5 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:07:10 +1000 Subject: [PATCH 02/13] Make UI elements and lang entries --- .../obelisk/weather/GuiWeatherObelisk.java | 37 +++++++++++++++++-- .../resources/assets/enderio/lang/en_US.lang | 4 ++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java index 1b928b46..1840cc8f 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java @@ -3,6 +3,7 @@ package crazypants.enderio.machine.obelisk.weather; import java.awt.Color; import java.awt.Rectangle; +import com.enderio.core.client.gui.button.ToggleButton; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fluids.FluidStack; @@ -24,6 +25,7 @@ import crazypants.enderio.network.PacketHandler; public class GuiWeatherObelisk extends GuiPoweredMachineBase { private IconButton buttonStart; + private ToggleButton buttonMode; public GuiWeatherObelisk(InventoryPlayer inventory, TileWeatherObelisk tileEntity) { super(tileEntity, new ContainerWeatherObelisk(inventory, tileEntity), "weatherObelisk"); @@ -50,10 +52,23 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase public void initGui() { super.initGui(); - int x = (xSize / 2) - (BUTTON_SIZE / 2); + int x_mode = xSize - 5 - BUTTON_SIZE; + int x_start = (xSize / 2) - (BUTTON_SIZE / 2); int y = 58; - addButton(buttonStart = new IconButton(this, 0, x, y, IconEIO.TICK)); + buttonMode = new ToggleButton(this, 1, x_mode, y, IconEIO.ROUND_ROBIN_OFF, IconEIO.REDSTONE_MODE_WITH_SIGNAL); + + buttonMode.setToolTip(EnderIO.lang.localize("gui.machine.weather.control")); + buttonMode.setSelectedToolTip(EnderIO.lang.localize("gui.machine.weather.loop")); + buttonMode.setUnselectedToolTip(EnderIO.lang.localize("gui.machine.weather.manual")); + buttonMode.setSelected(getTileEntity().getPulseControl()); + addButton(buttonMode); + buttonMode.onGuiInit(); + + buttonStart = new IconButton(this, 0, x_start, y, IconEIO.TICK); + buttonStart.setToolTip(EnderIO.lang.localize("gui.machine.weather.run")); + + addButton(buttonStart); buttonStart.onGuiInit(); refreshButtons(); @@ -68,6 +83,9 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase } private void refreshButtons() { + boolean pulseControl = getTileEntity().getPulseControl(); + pulseControlAction(pulseControl); + FluidStack fs = getTileEntity().getInputTank().getFluid(); if (fs == null) { buttonStart.enabled = false; @@ -143,9 +161,22 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase @Override protected void actionPerformed(GuiButton b) { super.actionPerformed(b); - if (b.id >= 0 && b.id <= 2) { + if (b.id == 0) { + // Start Button getTileEntity().startTask(); PacketHandler.INSTANCE.sendToServer(new PacketActivateWeather(getTileEntity())); + } else if (b.id == 1) { + // Control Mode Button + boolean pulseControl = buttonMode.isSelected(); + getTileEntity().setPulseControl(pulseControl); + pulseControlAction(pulseControl); + PacketControlModeWeather packet = new PacketControlModeWeather(getTileEntity()); + PacketHandler.INSTANCE.sendToServer(packet); } } + + protected void pulseControlAction(boolean pulseControl) { + redstoneButton.setVisible(!pulseControl); + buttonStart.setVisible(!pulseControl); + } } diff --git a/src/main/resources/assets/enderio/lang/en_US.lang b/src/main/resources/assets/enderio/lang/en_US.lang index 861f0b05..8e50efd4 100644 --- a/src/main/resources/assets/enderio/lang/en_US.lang +++ b/src/main/resources/assets/enderio/lang/en_US.lang @@ -1101,6 +1101,10 @@ enderio.gui.machine.side.west=West enderio.gui.machine.side.east=East enderio.gui.machine.side.up=Up enderio.gui.machine.side.down=Down +enderio.gui.machine.weather.control=Control Mode +enderio.gui.machine.weather.loop=Launch on Redstone Pulse +enderio.gui.machine.weather.manual=Default Control Mode +enderio.gui.machine.weather.run=Launch #Power Monitor From 559c64e82c5cf75a1932d72b719882fb555c2efe Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:46:01 +1000 Subject: [PATCH 03/13] PacketActivateWeather now can start/stop on client or server --- .../obelisk/weather/GuiWeatherObelisk.java | 2 +- .../weather/PacketActivateWeather.java | 20 ++++++++++++++++++- .../obelisk/weather/TileWeatherObelisk.java | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java index 1840cc8f..3aea5b60 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java @@ -164,7 +164,7 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase if (b.id == 0) { // Start Button getTileEntity().startTask(); - PacketHandler.INSTANCE.sendToServer(new PacketActivateWeather(getTileEntity())); + PacketHandler.INSTANCE.sendToServer(new PacketActivateWeather(getTileEntity(), true)); } else if (b.id == 1) { // Control Mode Button boolean pulseControl = buttonMode.isSelected(); diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketActivateWeather.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketActivateWeather.java index 0599d0ce..179497b7 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketActivateWeather.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketActivateWeather.java @@ -7,14 +7,30 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import crazypants.enderio.EnderIO; import crazypants.enderio.network.PacketUtil; +import io.netty.buffer.ByteBuf; public class PacketActivateWeather extends MessageTileEntity implements IMessageHandler { + private boolean start; + public PacketActivateWeather() {} - public PacketActivateWeather(TileWeatherObelisk te) { + public PacketActivateWeather(TileWeatherObelisk te, boolean start) { super(te); + this.start = start; + } + + @Override + public void toBytes(ByteBuf buf) { + super.toBytes(buf); + buf.writeBoolean(start); + } + + @Override + public void fromBytes(ByteBuf buf) { + super.fromBytes(buf); + start = buf.readBoolean(); } @Override @@ -24,6 +40,8 @@ public class PacketActivateWeather extends MessageTileEntity if (te != null) { if (ctx.side.isServer()) { if (PacketUtil.isInvalidPacketForGui(ctx, te, getClass())) return null; + } + if (message.start) { te.startTask(); } else { te.stopTask(); diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index c2ff5431..109273a3 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -303,7 +303,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity activeTask = null; fluidUsed = 0; if (!worldObj.isRemote) { - PacketHandler.INSTANCE.sendToDimension(new PacketActivateWeather(this), worldObj.provider.dimensionId); + PacketHandler.INSTANCE.sendToDimension(new PacketActivateWeather(this, false), worldObj.provider.dimensionId); } else { playedFuse = false; } From b3acdd8f35f7f6d5ed16c33d819217a49d90b3dd Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:46:54 +1000 Subject: [PATCH 04/13] Server notify client of startTask() --- .../enderio/machine/obelisk/weather/TileWeatherObelisk.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index 109273a3..33dbd129 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -286,6 +286,9 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity * @return If the operation was successful. */ public boolean startTask() { + if (!worldObj.isRemote) { + PacketHandler.INSTANCE.sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); + } if (getActiveTask() == null && inputTank.getFluidAmount() > 0) { fluidUsed = 0; WeatherTask task = WeatherTask.fromFluid(inputTank.getFluid().getFluid()); From bc7975f26ce38ff8adfb629eeeb03ca2a244c219 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:47:27 +1000 Subject: [PATCH 05/13] Remove unused return type --- .../machine/obelisk/weather/TileWeatherObelisk.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index 33dbd129..fae4aedb 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -282,10 +282,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity && inputTank.getFluidAmount() >= 1000; } - /** - * @return If the operation was successful. - */ - public boolean startTask() { + public void startTask() { if (!worldObj.isRemote) { PacketHandler.INSTANCE.sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); } @@ -295,10 +292,8 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity if (canStartTask(task)) { decrStackSize(0, 1); activeTask = task; - return true; } } - return false; } public void stopTask() { From 0ef9ce80ead6b967486258fe0f1149bf9da97b73 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:48:35 +1000 Subject: [PATCH 06/13] Logic for serverside startTask() --- .../enderio/machine/obelisk/weather/TileWeatherObelisk.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index fae4aedb..2b0dea7a 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -2,6 +2,7 @@ package crazypants.enderio.machine.obelisk.weather; import java.awt.Color; +import crazypants.enderio.machine.RedstoneControlMode; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; @@ -232,7 +233,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity protected boolean processTasks(boolean redstoneCheckPassed) { boolean res = false; - if (!redstoneCheckPassed) { + if (!redstoneCheckPassed && !pulseControl) { if (canBeActive) { canBeActive = false; res = true; @@ -259,6 +260,9 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity stopTask(); res = true; } + } else if (pulseControl && RedstoneControlMode.isConditionMet(RedstoneControlMode.ON, this)) { + startTask(); + res = true; } } From efbe0ba25993cbb292ef902c2203a1871edcb05f Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:33:54 +1000 Subject: [PATCH 07/13] Save control mode state --- .../enderio/machine/obelisk/weather/TileWeatherObelisk.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index 2b0dea7a..feb2d852 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -316,12 +316,14 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity public void writeCommon(NBTTagCompound nbtRoot) { super.writeCommon(nbtRoot); nbtRoot.setTag("tank", inputTank.writeToNBT(new NBTTagCompound())); + nbtRoot.setBoolean("weatherobeliskcontrolmode", pulseControl); } @Override public void readCommon(NBTTagCompound nbtRoot) { super.readCommon(nbtRoot); inputTank.readFromNBT(nbtRoot.getCompoundTag("tank")); + pulseControl = nbtRoot.getBoolean("weatherobeliskcontrolmode"); } private boolean isValidFluid(Fluid f) { From 3e72fe00ac1b7b6dda71b421663eccd1d811ec29 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:38:52 +1000 Subject: [PATCH 08/13] Add serverside cooldown to prevent double launch --- .../machine/obelisk/weather/TileWeatherObelisk.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index feb2d852..ff7ac938 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -102,6 +102,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity private boolean tanksDirty; private boolean pulseControl = false; + private int cooldown = 0; private static final ICapacitor cap = Capacitors.BASIC_CAPACITOR.capacitor; @@ -233,6 +234,12 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity protected boolean processTasks(boolean redstoneCheckPassed) { boolean res = false; + if (cooldown > 0) { + cooldown --; + res = true; + return res; + } + if (!redstoneCheckPassed && !pulseControl) { if (canBeActive) { canBeActive = false; @@ -257,6 +264,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity EntityWeatherRocket e = new EntityWeatherRocket(worldObj, activeTask); e.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); worldObj.spawnEntityInWorld(e); + cooldown = 100; stopTask(); res = true; } From 68bc2116b4c44d5c8dbfcbbf438c2a7c39570983 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:42:36 +1000 Subject: [PATCH 09/13] Rename feature to launch on redstone --- .../obelisk/weather/GuiWeatherObelisk.java | 8 ++++---- .../weather/PacketControlModeWeather.java | 4 ++-- .../obelisk/weather/TileWeatherObelisk.java | 18 +++++++++--------- .../resources/assets/enderio/lang/en_US.lang | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java index 3aea5b60..ca68fbfa 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/GuiWeatherObelisk.java @@ -59,9 +59,9 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase buttonMode = new ToggleButton(this, 1, x_mode, y, IconEIO.ROUND_ROBIN_OFF, IconEIO.REDSTONE_MODE_WITH_SIGNAL); buttonMode.setToolTip(EnderIO.lang.localize("gui.machine.weather.control")); - buttonMode.setSelectedToolTip(EnderIO.lang.localize("gui.machine.weather.loop")); + buttonMode.setSelectedToolTip(EnderIO.lang.localize("gui.machine.weather.redstone")); buttonMode.setUnselectedToolTip(EnderIO.lang.localize("gui.machine.weather.manual")); - buttonMode.setSelected(getTileEntity().getPulseControl()); + buttonMode.setSelected(getTileEntity().getLaunchOnRedstone()); addButton(buttonMode); buttonMode.onGuiInit(); @@ -83,7 +83,7 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase } private void refreshButtons() { - boolean pulseControl = getTileEntity().getPulseControl(); + boolean pulseControl = getTileEntity().getLaunchOnRedstone(); pulseControlAction(pulseControl); FluidStack fs = getTileEntity().getInputTank().getFluid(); @@ -168,7 +168,7 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase } else if (b.id == 1) { // Control Mode Button boolean pulseControl = buttonMode.isSelected(); - getTileEntity().setPulseControl(pulseControl); + getTileEntity().setLaunchOnRedstone(pulseControl); pulseControlAction(pulseControl); PacketControlModeWeather packet = new PacketControlModeWeather(getTileEntity()); PacketHandler.INSTANCE.sendToServer(packet); diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java index 107e26b4..43b4c7a6 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java @@ -16,7 +16,7 @@ public class PacketControlModeWeather extends MessageTileEntity Date: Tue, 22 Apr 2025 19:55:04 +1000 Subject: [PATCH 10/13] sa --- .../machine/obelisk/weather/BlockWeatherObelisk.java | 7 +++++-- .../machine/obelisk/weather/GuiWeatherObelisk.java | 8 ++++---- .../obelisk/weather/PacketControlModeWeather.java | 1 + .../machine/obelisk/weather/TileWeatherObelisk.java | 10 ++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java index 91bcd5bf..4f835ce0 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/BlockWeatherObelisk.java @@ -31,8 +31,11 @@ public class BlockWeatherObelisk extends BlockObeliskAbstract @Override protected void actionPerformed(GuiButton b) { super.actionPerformed(b); - if (b.id == 0) { - // Start Button + if (b.id == 0) { + // Start Button getTileEntity().startTask(); PacketHandler.INSTANCE.sendToServer(new PacketActivateWeather(getTileEntity(), true)); } else if (b.id == 1) { - // Control Mode Button + // Control Mode Button boolean pulseControl = buttonMode.isSelected(); getTileEntity().setLaunchOnRedstone(pulseControl); pulseControlAction(pulseControl); diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java index 43b4c7a6..88f8b0dc 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/PacketControlModeWeather.java @@ -1,6 +1,7 @@ package crazypants.enderio.machine.obelisk.weather; import com.enderio.core.common.network.MessageTileEntity; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index 9aea917d..8143ebbc 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -2,7 +2,6 @@ package crazypants.enderio.machine.obelisk.weather; import java.awt.Color; -import crazypants.enderio.machine.RedstoneControlMode; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; @@ -25,6 +24,7 @@ import cpw.mods.fml.relauncher.SideOnly; import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.machine.AbstractPowerConsumerEntity; +import crazypants.enderio.machine.RedstoneControlMode; import crazypants.enderio.machine.SlotDefinition; import crazypants.enderio.network.PacketHandler; import crazypants.enderio.power.Capacitors; @@ -235,7 +235,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity boolean res = false; if (cooldown > 0) { - cooldown --; + cooldown--; res = true; return res; } @@ -296,7 +296,8 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity public void startTask() { if (!worldObj.isRemote) { - PacketHandler.INSTANCE.sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); + PacketHandler.INSTANCE + .sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); } if (getActiveTask() == null && inputTank.getFluidAmount() > 0) { fluidUsed = 0; @@ -313,7 +314,8 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity activeTask = null; fluidUsed = 0; if (!worldObj.isRemote) { - PacketHandler.INSTANCE.sendToDimension(new PacketActivateWeather(this, false), worldObj.provider.dimensionId); + PacketHandler.INSTANCE + .sendToDimension(new PacketActivateWeather(this, false), worldObj.provider.dimensionId); } else { playedFuse = false; } From d023c347cb07100054407bb33ed722ad2431eb0d Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:47:47 +1000 Subject: [PATCH 11/13] Remove unused weather obelisk config items --- .../crazypants/enderio/config/Config.java | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index 9f8213ec..2e0b0e24 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -74,7 +74,6 @@ public final class Config { public static final Section sectionMobConfig = new Section("Mob Config", "mobconfig"); public static final Section sectionRailConfig = new Section("Rail", "railconfig"); public static final Section sectionEnchantments = new Section("Enchantments", "enchantments"); - public static final Section sectionWeather = new Section("Weather", "weather"); public static final Section sectionTelepad = new Section("Telepad", "telepad"); public static final Section sectionInventoryPanel = new Section("InventoryPanel", "inventorypanel"); public static final Section sectionMisc = new Section("Misc", "misc"); @@ -544,10 +543,6 @@ public final class Config { public static boolean spawnGuardStopAllSlimesDebug = false; public static boolean spawnGuardStopAllSquidSpawning = false; - public static int weatherObeliskClearFluid = 2000; - public static int weatherObeliskRainFluid = 500; - public static int weatherObeliskThunderFluid = 1000; - // Loot Defaults public static boolean lootDarkSteel = true; public static boolean lootItemConduitProbe = true; @@ -2746,22 +2741,6 @@ public final class Config { spawnGuardStopAllSquidSpawning, "When true no squid will be spawned."); - weatherObeliskClearFluid = config.get( - sectionWeather.name, - "weatherObeliskClearFluid", - weatherObeliskClearFluid, - "The fluid required (in mB) to set the world to clear weather").getInt(); - weatherObeliskRainFluid = config.get( - sectionWeather.name, - "weatherObeliskRainFluid", - weatherObeliskRainFluid, - "The fluid required (in mB) to set the world to rainy weather").getInt(); - weatherObeliskThunderFluid = config.get( - sectionWeather.name, - "weatherObeliskThunderFluid", - weatherObeliskThunderFluid, - "The fluid required (in mB) to set the world to thundering weather").getInt(); - // Loot Config lootDarkSteel = config.getBoolean( "lootDarkSteel", From a12e5f37ba50fe1cc3c29d3f417d61e9a494424f Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:53:10 +1000 Subject: [PATCH 12/13] tweak cooldown logic and timing --- .../machine/obelisk/weather/TileWeatherObelisk.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index 8143ebbc..f7781391 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -264,7 +264,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity EntityWeatherRocket e = new EntityWeatherRocket(worldObj, activeTask); e.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); worldObj.spawnEntityInWorld(e); - cooldown = 100; + cooldown = 200; stopTask(); res = true; } @@ -295,14 +295,14 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity } public void startTask() { - if (!worldObj.isRemote) { - PacketHandler.INSTANCE - .sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); - } if (getActiveTask() == null && inputTank.getFluidAmount() > 0) { fluidUsed = 0; WeatherTask task = WeatherTask.fromFluid(inputTank.getFluid().getFluid()); if (canStartTask(task)) { + if (!worldObj.isRemote) { + PacketHandler.INSTANCE + .sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); + } decrStackSize(0, 1); activeTask = task; } From 6e5087dac1dc9a77094704e36768a91eb2fd5117 Mon Sep 17 00:00:00 2001 From: dibbydoda <93301589+dibbydoda@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:53:48 +1000 Subject: [PATCH 13/13] sa --- .../enderio/machine/obelisk/weather/TileWeatherObelisk.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java index f7781391..35be6538 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/weather/TileWeatherObelisk.java @@ -301,7 +301,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity if (canStartTask(task)) { if (!worldObj.isRemote) { PacketHandler.INSTANCE - .sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); + .sendToDimension(new PacketActivateWeather(this, true), worldObj.provider.dimensionId); } decrStackSize(0, 1); activeTask = task;