Merge branch 'HbmMods:master' into master

This commit is contained in:
polyvus 2026-07-03 21:52:35 +02:00 committed by GitHub
commit 34db24d2c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 76 additions and 18 deletions

View File

@ -11,6 +11,7 @@
* Filters can be set using items or RoR commands
* Requests can be configured to take as much as possible, to only take full stacks, or to only take full requests
* In combination with assembler recipe switching, using RoR logic, this means that on-demand recipe automation is now possible
* The budget didn't cover actually testing this so uh, you go figure it out
## Changed
* Updated chinese localization
@ -81,3 +82,4 @@
* Fixed `anyBismoid` group not being a proper group, causing other mods' bismuth and arsenic to not be included
* Fixed RoR gauge not using SI suffixes on values below 0
* Fixed AUTOCAL units not closing their GUI when the unit is destroyed
* Fixed AUTOCAL's $buffer$ substitution not working

View File

@ -9,6 +9,7 @@ import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIPneumoStorageExporter extends GuiInfoContainer {
@ -27,6 +28,25 @@ public class GUIPneumoStorageExporter extends GuiInfoContainer {
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 16, 18, 18, x, y, "Request mode: " + EnumChatFormatting.YELLOW + (this.importer.continuousRequest ? "Continuous" : "By request"));
this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 34, 18, 18, x, y, "Request type: " + EnumChatFormatting.YELLOW + (
this.importer.requestMode == this.importer.MODE_AS_MUCH_AS_POSSIBLE ? "As much as possible" :
this.importer.requestMode == this.importer.MODE_FULL_STACK ? "Only full stacks" : "Only full requests"
));
if(this.importer.rorConfiguredMode) {
String[] label = new String[10];
label[0] = "Filter type: " + EnumChatFormatting.YELLOW + "RoR configured";
for(int i = 0; i < 9; i++) {
boolean hasFilter = this.importer.rorFilters[i][0] != 0 && this.importer.rorFilters[i][2] > 0;
label[i + 1] = "Slot " + (i + 1) + ": " + (!hasFilter ? "None" : ("Item #" + this.importer.rorFilters[i][0] + " with Meta " + this.importer.rorFilters[i][1] + " x" + this.importer.rorFilters[i][2]));
}
this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 52, 18, 18, x, y, label);
} else {
this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 52, 18, 18, x, y, "Filter type: " + EnumChatFormatting.YELLOW + "Manually configured");
}
}
@Override
@ -52,8 +72,11 @@ public class GUIPneumoStorageExporter extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(this.importer.rorConfiguredMode) {
drawTexturedModalRect(guiLeft + 142, guiTop + 52, xSize, 18, 18, 18);
drawTexturedModalRect(guiLeft + 14, guiTop + 14, 77, 14, 58, 58);
}
if(!this.importer.continuousRequest) drawTexturedModalRect(guiLeft + 142, guiTop + 16, xSize, 0, 18, 18);
if(!this.importer.rorConfiguredMode) drawTexturedModalRect(guiLeft + 142, guiTop + 52, xSize, 18, 18, 18);
if(this.importer.requestMode == importer.MODE_FULL_STACK) drawTexturedModalRect(guiLeft + 142, guiTop + 34, xSize + 18, 0, 18, 18);
if(this.importer.requestMode == importer.MODE_FULL_REQUEST) drawTexturedModalRect(guiLeft + 142, guiTop + 34, xSize + 18, 18, 18, 18);
}

View File

@ -264,10 +264,11 @@ public class ParseMSES1 implements IParse {
if(!readingVar) {
readingVar = true;
} else {
if("buffer".equals(var)) {
String varName = var.toString();
if("buffer".equals(varName)) {
joined.append(ctx.readBuffer());
} else {
String variable = ctx.variables.getString(var.toString());
String variable = ctx.variables.getString(varName);
if(forceNumber && variable.isEmpty()) variable = "0";
joined.append(variable);
var.delete(0, var.length());

View File

@ -57,10 +57,7 @@ import com.hbm.tileentity.machine.pile.*;
import com.hbm.tileentity.machine.rbmk.*;
import com.hbm.tileentity.machine.storage.*;
import com.hbm.tileentity.network.*;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageClutter;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageMono;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube;
import com.hbm.tileentity.network.pneumatic.*;
import com.hbm.tileentity.turret.*;
import com.hbm.util.Compat;
@ -476,6 +473,8 @@ public class TileMappings {
put(TileEntityPneumoStorageAccess.class, "tileentity_pneumatic_storage_access");
put(TileEntityPneumoStorageClutter.class, "tileentity_pneumatic_storage_clutter");
put(TileEntityPneumoStorageMono.class, "tileentity_pneumatic_storage_mono");
put(TileEntityPneumoStorageImporter.class, "tileentity_pneumatic_storage_importer");
put(TileEntityPneumoStorageExporter.class, "tileentity_pneumatic_storage_exporter");
put(TileEntityRadioTorchSender.class, "tileentity_rtty_sender");
put(TileEntityRadioTorchReceiver.class, "tileentity_rtty_rec");

View File

@ -18,10 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive, IControlReceiver { // TODO: NBT serialization
// TODO: also maybe test all of this first
// TODO: more energy drincc
// TODO: the lion does not concern himself with chest pains, it's just the feeling of the heart screaming for more redbull
public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive, IControlReceiver {
/** If requests should be pulled repeatedly every tick */
public boolean continuousRequest = false;
@ -101,7 +98,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
int requestSize = filter[2];
int existingSize = 0;
ItemStack existingStack = slots[i];
ItemStack existingStack = slots[i + 9];
if(existingStack != null) {
if(existingStack.getItem() == item && existingStack.getItemDamage() == meta && !existingStack.hasTagCompound()) {
@ -132,7 +129,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
int requestSize = filter[2];
int existingSize = 0;
ItemStack existingStack = slots[i];
ItemStack existingStack = slots[i + 9];
if(existingStack != null) existingSize = existingStack.stackSize;
ItemStack newStack = new ItemStack(item, 1, meta);
@ -143,8 +140,8 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
CacheSlot cacheSlot = this.cache.cacheSlots.get(hash);
if(cacheSlot == null) continue; // safeguard
slots[i] = newStack;
slots[i].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, requestSize);
slots[i + 9] = newStack;
slots[i + 9].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, requestSize);
}
this.markChanged();
@ -166,7 +163,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
int requestSize = filter[2];
int existingSize = 0;
ItemStack existingStack = slots[slot];
ItemStack existingStack = slots[slot + 9];
if(existingStack != null) {
if(existingStack.getItem() == item && existingStack.getItemDamage() == meta && !existingStack.hasTagCompound()) {
@ -192,8 +189,9 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
if(cacheSlot.stacksize <= 0) return false;
int toPull = (int) BobMathUtil.min(requestSize, cacheSlot.stacksize, capacityLeft);
slots[slot] = newStack;
slots[slot].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, toPull);
slots[slot + 9] = newStack;
slots[slot + 9].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, toPull);
this.markChanged();
return true;
@ -248,6 +246,41 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.continuousRequest = nbt.getBoolean("continuousRequest");
this.rorConfiguredMode = nbt.getBoolean("rorConfiguredMode");
this.requestMode = nbt.getByte("requestMode");
for(int i = 0; i < 9; i++) {
rorFilters[i][0] = nbt.getShort("filter_" + i + "_0");
rorFilters[i][1] = nbt.getShort("filter_" + i + "_1");
rorFilters[i][2] = nbt.getShort("filter_" + i + "_2");
}
this.lastRedstone = nbt.getBoolean("lastRedstone");
this.slotDelay = nbt.getIntArray("slotDelay");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setBoolean("continuousRequest", continuousRequest);
nbt.setBoolean("rorConfiguredMode", rorConfiguredMode);
nbt.setByte("requestMode", (byte) requestMode);
for(int i = 0; i < 9; i++) {
nbt.setShort("filter_" + i + "_0", (short) rorFilters[i][0]);
nbt.setShort("filter_" + i + "_1", (short) rorFilters[i][1]);
nbt.setShort("filter_" + i + "_2", (short) rorFilters[i][2]);
}
nbt.setBoolean("lastRedstone", lastRedstone);
nbt.setIntArray("slotDelay", slotDelay);
}
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageExporter(player.inventory, this); }
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIPneumoStorageExporter(player.inventory, this); }