Compare commits

..
Author SHA1 Message Date
Martin Robertzanddanyadev e90fa9478e Certus quartz tank drain from above (#364)
Co-authored-by: danyadev <[email protected]>
2025-11-14 18:26:43 +01:00
Martin Robertzanddanyadev 3a7fa881bc Large cells interaction with tanks (#363)
Co-authored-by: danyadev <[email protected]>
2025-11-14 18:25:19 +01:00
Martin Robertz 4ac3c06812 update deps 2025-11-14 18:04:50 +01:00
Martin Robertz 29cfee9ab6 Merge remote-tracking branch 'danyadev/certus-quartz-tank-comparator-support' into dev 2025-11-14 18:01:53 +01:00
Martin Robertz 1057a97d93 Merge remote-tracking branch 'danyadev/fix-certus-quartz-tank-sync' into dev 2025-11-14 18:01:33 +01:00
Kogepan229 e00aea2d07 Merge branch 'master' into gui-reaper 2025-11-15 00:38:21 +09:00
Martin Robertz c47e49a5aa Merge branch 'master' into certus-quartz-tank-comparator-support 2025-11-14 16:36:56 +01:00
Martin Robertz 0a21bcf98b Merge branch 'master' into fix-certus-quartz-tank-sync 2025-11-14 16:35:21 +01:00
Kogepan229 20a10250df Fix fluid export bus not working 2025-11-10 22:33:42 +09:00
Kogepan229 c358e041cd fix 2025-11-10 22:16:16 +09:00
Kogepan229 81c637c37a Merge branch 'master' into gui-reaper 2025-11-10 22:10:06 +09:00
Kogepan229 56cdadce75 Revert "Merge branch 'master' into gui-reaper"
This reverts commit f29844f2f8, reversing
changes made to f35d6856d5.
2025-11-10 21:58:28 +09:00
Martin Robertz 555b5d3071 Merge branch 'master' into certus-quartz-tank-comparator-support 2025-11-07 21:50:48 +01:00
Martin Robertz 4be7d52d5d Merge branch 'master' into fix-certus-quartz-tank-sync 2025-11-07 21:50:37 +01:00
Martin Robertz f29844f2f8 Merge branch 'master' into gui-reaper 2025-11-07 21:50:16 +01:00
lc-1337 f35d6856d5 refactor fix for terminal keybind 2025-11-07 21:10:46 +02:00
lc-1337 44c33b998c Merge branch 'master' into gui-reaper 2025-11-07 19:56:43 +02:00
lc_1337 9456dd5ecd fix terminal open keybind (sketch) 2025-11-07 15:56:19 +02:00
lc_1337 c1ccceb123 fix fluid bus legacy config 2025-11-07 11:23:40 +02:00
lc-1337 a900afc9fe fix extreme cell was stackable 2025-11-06 22:09:04 +02:00
Kogepan229 f876fe9ede Fix dual interface crash 2025-11-06 15:43:02 +09:00
Kogepan229 f942e3a9ab Move level things to AE2 2025-11-04 20:37:54 +09:00
Martin Robertz 15ed08077a Merge branch 'master' into gui-reaper 2025-11-04 12:08:07 +01:00
danyadev d4a5bbc9ec support comparators for Certus Quartz Tank 2025-11-02 21:16:38 +03:00
danyadev c8aa902d23 reimplement fluid flowing down without using updateEntity
This makes flowing logic instant (and called only once when placing a tank) instead of calling updateEntity every tick, thus making the tank way more performant

Also got rid of onComparatorUpdate because comparator logic doesn't work anyway
2025-11-02 15:13:42 +03:00
danyadev a54ee0f6fb always sync TE with server and optimize packet sending
use markBlockForUpdate to send the packet only to players who can see the tank

also grouped packet-related methods in one place
2025-11-02 14:46:46 +03:00
lc-1337 13e57daf1a update interfaces path 2025-11-01 09:42:19 +02:00
Kogepan229 a90e7c6e09 Fix Level Maintainer Gui 2025-10-31 23:52:24 +09:00
Kogepan229 f6242f8862 fix 2025-10-31 23:52:07 +09:00
Kogepan229 4f61e09ffd Cleanup 2025-10-31 19:03:31 +09:00
Kogepan229 9176dec955 Use AE2 sub gui system for Level Maintainer 2025-10-31 18:54:26 +09:00
Kogepan229 7a00f6e44a Remove unused 2025-10-31 18:36:41 +09:00
Kogepan229 5adddd2df5 Display stack size on level maintainer gui 2025-10-31 17:57:51 +09:00
lc-1337 b4265992c3 io bus fixes 2025-10-30 20:41:53 +02:00
Kogepan229 e1afdf1c53 Universal Level Maintainer Gui 2025-10-31 00:31:24 +09:00
Kogepan229 3107ecf1c0 Remove terminal type filter 2025-10-30 22:09:12 +09:00
Kogepan229 cdc86aaca9 Fix import 2025-10-30 22:08:33 +09:00
lc_1337 53d22de11a interface 2025-10-30 13:41:43 +02:00
lc-1337 20e69fa2c3 io bus fixes 2025-10-29 20:40:33 +02:00
lc_1337 e2947e41c9 io bus 2025-10-29 16:17:35 +02:00
Kogepan229 7a841a1eca Fix ultra terminal 2025-10-28 13:52:32 +09:00
Kogepan229 0039183e37 remove useless parametrization 2025-10-28 13:19:47 +09:00
Kogepan229 5b2429236c Fix Level Terminal 2025-10-27 21:12:40 +09:00
Kogepan229 024222d305 Fix funny 2025-10-27 20:38:04 +09:00
Kogepan229 dc50383f00 Fix infinite cells 2025-10-27 17:28:19 +09:00
Kogepan229 9bc66bbad6 Don't use AEBaseMEGui 2025-10-27 00:15:37 +09:00
Kogepan229 9f54e93ade Restore public api compatibility around cell 2025-10-26 23:07:56 +09:00
lc-1337 4afacb98f0 cells, remove ExtraCells integration 2025-10-26 12:07:36 +02:00
lc-1337 ebd42852ff cells 2025-10-25 23:31:24 +03:00
lc_1337 24d30ef078 storage bus 2025-10-24 12:47:09 +03:00
lc-1337 edb027424d Merge branch 'master' into gui-reaper 2025-10-23 20:51:16 +03:00
lc_1337 b9860934ee level terminal 2025-10-23 15:08:43 +03:00
lc-1337 461d574a54 Merge remote-tracking branch 'origin/gui-reaper' into gui-reaper
# Conflicts:
#	src/main/java/com/glodblock/github/client/gui/GuiFluidLevelEmitter.java
#	src/main/java/com/glodblock/github/inventory/gui/GuiType.java
2025-10-22 21:09:00 +03:00
lc-1337 644a8a4b42 level emitter 2025-10-22 21:07:28 +03:00
lc-1337 c0b8e58aae Merge branch 'master' into gui-reaper 2025-10-19 13:56:27 +03:00
lc-1337 3567b68acb ultra terminal 2025-10-19 13:53:41 +03:00
lc_1337 30624682e4 save 2025-10-17 15:20:14 +03:00
lc-1337 7a8ed661cd save 2025-10-16 22:16:02 +03:00
lc-1337 6680f3e91a save 2025-10-16 20:31:06 +03:00
lc_1337 7c567e0c38 save 2025-10-14 15:37:37 +03:00
lc_1337 be7b8d684e save 2025-10-13 16:28:19 +03:00
lc-1337 fce98077ff save 2025-10-12 19:37:16 +03:00
lc_1337 078073e5ce save 2025-10-09 16:12:43 +03:00
lc_1337 34dc6c423b save 2025-10-08 16:45:27 +03:00
11 changed files with 84 additions and 77 deletions

No files matched your search

+10 -10
View File
@@ -34,29 +34,29 @@
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.8.40-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-754-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.8.37-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-743-GTNH-pre:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.9.15:dev')
api("com.github.GTNewHorizons:GTNHLib:0.8.29:dev")
api('com.github.GTNewHorizons:waila:1.9.9:dev')
api("com.github.GTNewHorizons:GTNHLib:0.8.6:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.10:dev") {
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.8-pre:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.4-GTNH:dev')
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.2:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.8:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.138:dev') {
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.3:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.106:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.6-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.16-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.4-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.14-GTNH:dev') { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
}
@@ -16,8 +16,8 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.FluidTankInfo;
import com.glodblock.github.common.item.ItemCertusQuartzTank;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
@@ -253,10 +253,10 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
public int getComparatorInputOverride(World worldIn, int x, int y, int z, int side) {
TileEntity tileEntity = worldIn.getTileEntity(x, y, z);
if (tileEntity instanceof TileCertusQuartzTank tileCertusQuartzTank) {
FluidTankInfo info = tileCertusQuartzTank.getTankInfo(false)[0];
if (info.fluid != null) {
int nonEmptyBump = info.fluid.amount > 0 ? 1 : 0;
return (int) (14.0 * info.fluid.amount / info.capacity) + nonEmptyBump;
FluidTankInfo[] info = tileCertusQuartzTank.getTankInfo(false);
if (info[0].fluid != null) {
int nonEmptyBump = info[0].fluid.amount > 0 ? 1 : 0;
return (int) (14.0 * info[0].fluid.amount / info[0].capacity) + nonEmptyBump;
}
}
return 0;
@@ -12,7 +12,6 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -101,7 +100,6 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
public static UltraTerminalModes getMode(ItemStack is) {
Item item = is.getItem();
if (item instanceof ItemWirelessUltraTerminal) {
if (!is.hasTagCompound()) is.setTagCompound(new NBTTagCompound());
return UltraTerminalModes.values()[is.getTagCompound().getInteger(MODE)];
} else if (item instanceof ItemWirelessPatternTerminal) {
return UltraTerminalModes.PATTERN;
@@ -146,16 +144,4 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
if (wh == null) return null;
return new WirelessTerminalGuiObject(wh, is, p, world, x, y, z);
}
@Override
public boolean hasInfinityPower(ItemStack is) {
NBTTagCompound data = is.getTagCompound();
return data != null && data.hasKey(infinityEnergyCard) && data.getBoolean(infinityEnergyCard);
}
@Override
public boolean hasInfinityRange(ItemStack is) {
NBTTagCompound data = is.getTagCompound();
return data != null && data.hasKey(infinityBoosterCard) && data.getBoolean(infinityBoosterCard);
}
}
@@ -41,6 +41,6 @@ public class ItemWirelessInterfaceTerminal extends ItemBaseWirelessTerminal
public IGuiItemObject getGuiObject(ItemStack is, World world, EntityPlayer p, int x, int y, int z) {
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler(is);
if (wh == null) return null;
return new WirelessInterfaceTerminalGuiObject(wh, is, x);
return new WirelessInterfaceTerminalGuiObject(wh, is);
}
}
@@ -129,9 +129,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
if (terminal == null) return;
if (mode != null) setMode(terminal, mode);
else mode = getMode(terminal);
if (AEApi.instance().registries().wireless().performCheck(terminal, player))
openGui(terminal, player.worldObj, player, mode, term.getLeft());
openGui(terminal, player.worldObj, player, mode, term.getLeft());
}
}
@@ -219,7 +217,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.values()[y] : getMode(is)) {
case CRAFTING -> new WirelessCraftingTerminalGuiObject(wh, is, p, world, x, y, z);
case PATTERN, PATTERN_EX -> new WirelessPatternTerminalGuiObject(wh, is, p, world, x, y, z);
case INTERFACE -> new WirelessInterfaceTerminalGuiObject(wh, is, x);
case INTERFACE -> new WirelessInterfaceTerminalGuiObject(wh, is);
default -> super.getGuiObject(is, world, p, x, y, z);
};
}
@@ -95,10 +95,10 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
final IMEMonitor<IAEFluidStack> inv, final IEnergySource energy, final FuzzyMode fzMode) {
if (myTarget instanceof IFluidHandler fh) {
FluidTankInfo[] tanksInfo = fh.getTankInfo(this.getSide().getOpposite());
if (tanksInfo == null) return true;
if (tanksInfo == null) return false;
int maxDrain = this.calculateAmountToSend();
boolean doBreak = true;
boolean drained = false;
for (FluidTankInfo tankInfo : tanksInfo) {
if (tankInfo.fluid == null) continue;
@@ -117,14 +117,14 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
fh.drain(this.getSide().getOpposite(), aeFluidStack.getFluidStack(), true);
maxDrain -= aeFluidStack.getFluidStack().amount;
doBreak = false;
drained = true;
}
}
return doBreak;
return drained;
}
return true;
return false;
}
@Override
@@ -33,42 +33,57 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
return tankFluid == null || tankFluid.amount == 0 ? 0 : tankFluid.getFluid().getLuminosity(tankFluid);
}
public FluidStack drain(FluidStack fluid, boolean doDrain, boolean findMainTank) {
if (fluid == null || this.getFluid() == null || this.getFluid() != fluid.getFluid()) {
public FluidStack drain(Fluid fluid, int amount, boolean doDrain, boolean findMainTank) {
if (fluid != null && this.getFluid() != fluid) {
return null;
}
if (findMainTank) {
// Main tank is the highest tank in the column with desired fluid
TileCertusQuartzTank mainTank = this;
TileCertusQuartzTank tankAbove;
while ((tankAbove = mainTank.getTankAbove()) != null) {
// We can't drain tank with different or null fluid
if (fluid.getFluid() != tankAbove.getFluid()) {
break;
if (this.tank.getFluid() != null) {
// Current tank has a fluid, searching for the highest tank with this fluid
TileCertusQuartzTank tankAbove;
while ((tankAbove = mainTank.getTankAbove()) != null) {
// We can't drain tank with different or null fluid
if (tankAbove.getFluid() == null || mainTank.getFluid() != tankAbove.getFluid()) {
break;
}
mainTank = tankAbove;
}
} else {
// Current tank doesn't have a fluid, searching for the first non-empty tank below
TileCertusQuartzTank tankBelow;
while ((tankBelow = mainTank.getTankBelow()) != null) {
// We can't drain tank with different fluid
if (fluid != null && tankBelow.getFluid() != fluid) {
break;
}
mainTank = tankBelow;
if (tankBelow.getFluid() != null) {
break;
}
}
mainTank = tankAbove;
}
return mainTank.drain(fluid, doDrain, false);
return mainTank.drain(fluid, amount, doDrain, false);
}
FluidStack drainedFluid = this.tank.drain(fluid.amount, doDrain);
FluidStack drainedFluid = this.tank.drain(amount, doDrain);
int drained = drainedFluid != null ? drainedFluid.amount : 0;
if (drained > 0) {
update();
}
if (drained < fluid.amount) {
if (drained < amount) {
TileCertusQuartzTank tankBelow = this.getTankBelow();
if (tankBelow != null) {
FluidStack fluidToDrain = new FluidStack(fluid.getFluid(), fluid.amount - drained);
FluidStack externallyDrained = tankBelow.drain(fluidToDrain, doDrain, false);
FluidStack externallyDrained = tankBelow.drain(fluid, amount - drained, doDrain, false);
if (externallyDrained != null) {
return new FluidStack(fluid.getFluid(), drained + externallyDrained.amount);
return new FluidStack(fluid, drained + externallyDrained.amount);
}
}
}
@@ -78,14 +93,14 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return drain(resource, doDrain, true);
if (resource == null) return null;
return drain(resource.getFluid(), resource.amount, doDrain, true);
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
if (this.tank.getFluid() == null) return null;
return drain(from, new FluidStack(this.tank.getFluid(), maxDrain), doDrain);
return drain(null, maxDrain, true, true);
}
public int fill(FluidStack fluid, boolean doFill, boolean findMainTank) {
@@ -174,14 +189,14 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
}
final FluidStack tankFluidStack = this.tank.getFluid();
final Fluid mainFluid = tankFluidStack != null ? tankFluidStack.getFluid() : null;
Fluid mainFluid = tankFluidStack != null ? tankFluidStack.getFluid() : null;
int amount = tankFluidStack == null ? 0 : tankFluidStack.amount;
int capacity = this.tank.getCapacity();
TileCertusQuartzTank tankAbove = this;
while ((tankAbove = tankAbove.getTankAbove()) != null) {
if (tankAbove.getFluid() == null || mainFluid != tankAbove.getFluid()) {
if (tankAbove.getFluid() != null && mainFluid != tankAbove.getFluid()) {
break;
}
@@ -192,7 +207,10 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
TileCertusQuartzTank tankBelow = this;
while ((tankBelow = tankBelow.getTankBelow()) != null) {
if (mainFluid == null || mainFluid != tankBelow.getFluid()) {
if (mainFluid == null && tankBelow.getFluid() != null) {
mainFluid = tankBelow.getFluid();
}
if (mainFluid != tankBelow.getFluid()) {
break;
}
@@ -255,24 +255,24 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) {
switch (mc) {
case setInventorySlotContents -> {
if (inv == cell) {
if (added != null) {
if (added != null) {
if (inv == cell) {
if (added.getItem() instanceof ItemBasicStorageCell ibsc) {
totalBytes = ibsc.getBytesLong(added);
} else if (added.getItem() instanceof FCBaseItemCell fcbic) {
totalBytes = fcbic.getBytes(added);
}
getProxy().setIdlePowerUsage(Math.sqrt(Math.pow(totalBytes, 0.576D)));
} else if (removed != null) {
totalBytes = 0;
getProxy().setIdlePowerUsage(4d);
}
} else if (inv == invItems) {
if (added != null) {
} else if (inv == invItems) {
storedItemCount += added.stackSize;
}
}
if (removed != null) {
if (removed != null) {
if (inv == cell) {
totalBytes = 0;
getProxy().setIdlePowerUsage(4d);
} else if (inv == invItems) {
storedItemCount -= removed.stackSize;
}
}
@@ -282,12 +282,11 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
totalBytes = 0;
getProxy().setIdlePowerUsage(4d);
}
if (inv == invItems) {
storedItemCount -= removed.stackSize;
}
}
case markDirty -> markDirty();
case markDirty -> {}
}
try {
@@ -20,9 +20,11 @@ public class CertusQuartzTankWailaDataProvider extends BaseWailaDataProvider {
TileEntity tileEntity = accessor.getTileEntity();
if (tileEntity instanceof TileCertusQuartzTank quartzTank) {
FluidTankInfo info = quartzTank.getTankInfo(true)[0];
if (info.fluid != null) {
currentToolTip
.add(Tooltip.fluidFormat(info.fluid.getLocalizedName(), info.fluid.amount, info.capacity));
if (info.fluid == null) {
currentToolTip.add(Tooltip.tankEmptyFormat(info.capacity));
} else {
currentToolTip.add(
Tooltip.tankWithFluidFormat(info.fluid.getLocalizedName(), info.fluid.amount, info.capacity));
}
}
return currentToolTip;
@@ -15,14 +15,18 @@ public class Tooltip {
return String.format("%s: %s mB", name, NumberFormat.getInstance().format(amount));
}
public static String fluidFormat(String name, long amount, long capacity) {
public static String tankWithFluidFormat(String fluidName, long amount, long capacity) {
return String.format(
"%s: %s mB / %s mB",
name,
fluidName,
NumberFormat.getInstance().format(amount),
NumberFormat.getInstance().format(capacity));
}
public static String tankEmptyFormat(long capacity) {
return String.format("0 mB / %s mB", NumberFormat.getInstance().format(capacity));
}
public static String partFluidBusFormat(int amount) {
return String
.format("%s: %s mB/t", I18n.format(NameConst.WAILA_SPEED), NumberFormat.getInstance().format(amount));
@@ -28,7 +28,7 @@ public class FluidPrimaryGui extends PrimaryGui {
p,
p.worldObj,
new BlockPos(
this.slotIndex == Integer.MIN_VALUE ? p.inventory.currentItem : this.slotIndex,
p.inventory.currentItem,
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
0),
Objects.requireNonNull(side),