propane and propane accessories

This commit is contained in:
Boblet 2026-06-29 13:03:34 +02:00
parent 24ed4224a8
commit a93144f4c0
9 changed files with 164 additions and 7 deletions

View File

@ -9,7 +9,7 @@ public interface IRORInteractive extends IRORInfo {
public static String EX_NAME = "Exception: Multiple Name Separators"; public static String EX_NAME = "Exception: Multiple Name Separators";
public static String EX_FORMAT = "Exception: Parameter in Invalid Format"; public static String EX_FORMAT = "Exception: Parameter in Invalid Format";
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are optional. */ /** Runs a function on the ROR component, usually causing the component to change or do something. Returns are unused for now. */
public String runRORFunction(String name, String[] params); public String runRORFunction(String name, String[] params);
/** Extracts the command name from a full command string */ /** Extracts the command name from a full command string */

View File

@ -29,7 +29,7 @@ public class SlotPattern extends Slot {
@Override @Override
public int getSlotStackLimit() { public int getSlotStackLimit() {
return 1; return allowStackSize ? 64 : 1;
} }
@Override @Override

View File

@ -0,0 +1,44 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotPattern;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerPneumoStorageExporter extends ContainerBase {
public ContainerPneumoStorageExporter(InventoryPlayer invPlayer, TileEntityPneumoStorageExporter exporter) {
super(invPlayer, exporter);
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new SlotPattern(exporter, i, 17 + (i % 3) * 18, 17 + (i / 3) * 18, true));
}
addSlots(exporter, 9, 80, 17, 3, 3);
playerInv(invPlayer, 103);
}
@Override
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
//L/R: 0
//M3: 3
//SHIFT: 1
//DRAG: 5
if(index < 0 || index >= 9) {
return super.slotClick(index, button, mode, player);
}
Slot slot = this.getSlot(index);
ItemStack ret = null;
ItemStack held = player.inventory.getItemStack();
if(slot.getHasStack()) ret = slot.getStack().copy();
slot.putStack(held);
return ret;
}
}

View File

@ -0,0 +1,60 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerPneumoStorageExporter;
import com.hbm.lib.RefStrings;
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.ResourceLocation;
public class GUIPneumoStorageExporter extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_pneumatic_exporter.png");
private TileEntityPneumoStorageExporter importer;
public GUIPneumoStorageExporter(InventoryPlayer invPlayer, TileEntityPneumoStorageExporter importer) {
super(new ContainerPneumoStorageExporter(invPlayer, importer));
this.importer = importer;
this.xSize = 176;
this.ySize = 185;
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
clickSendFlag(importer, x, y, 142, 16, 18, 18, "continuous");
clickSendFlag(importer, x, y, 142, 34, 18, 18, "request");
clickSendFlag(importer, x, y, 142, 52, 18, 18, "ror");
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.importer.hasCustomInventoryName() ? this.importer.getInventoryName() : I18n.format(this.importer.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
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

@ -22,7 +22,7 @@ public class GUIPneumoStorageImporter extends GuiContainer {
this.importer = importer; this.importer = importer;
this.xSize = 176; this.xSize = 176;
this.ySize = 186; this.ySize = 185;
} }
@Override @Override

View File

@ -1,12 +1,18 @@
package com.hbm.tileentity.network.pneumatic; package com.hbm.tileentity.network.pneumatic;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerPneumoStorageExporter;
import com.hbm.inventory.gui.GUIPneumoStorageExporter;
import api.hbm.redstoneoverradio.IRORInteractive; import api.hbm.redstoneoverradio.IRORInteractive;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive { public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive, IControlReceiver {
/** If requests should be pulled repeatedly every tick */ /** If requests should be pulled repeatedly every tick */
public boolean continuousRequest = false; public boolean continuousRequest = false;
@ -14,6 +20,8 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
public boolean rorConfiguredMode = false; public boolean rorConfiguredMode = false;
/** What strategy to use for handling request filters */ /** What strategy to use for handling request filters */
public int requestMode = 0; public int requestMode = 0;
/** Item ID and meta pairs for RoR controlled filters */
public short[][] rorFilters = new short[9][2];
/** Each slot individually tries to pull as much as it can of the configured item */ /** Each slot individually tries to pull as much as it can of the configured item */
public static final int MODE_AS_MUCH_AS_POSSIBLE = 0; public static final int MODE_AS_MUCH_AS_POSSIBLE = 0;
@ -34,10 +42,55 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
@Override @Override
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
if(!worldObj.isRemote) {
this.networkPackNT(15);
}
} }
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } @Override
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeBoolean(continuousRequest);
buf.writeBoolean(rorConfiguredMode);
buf.writeByte((byte) requestMode);
for(int i = 0; i < 9; i++) {
buf.writeShort(rorFilters[i][0]);
buf.writeShort(rorFilters[i][1]);
}
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
this.continuousRequest = buf.readBoolean();
this.rorConfiguredMode = buf.readBoolean();
this.requestMode = buf.readByte();
for(int i = 0; i < 9; i++) {
rorFilters[i][0] = buf.readShort();
rorFilters[i][1] = buf.readShort();
}
}
@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); }
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("continuous")) {
this.continuousRequest = !this.continuousRequest;
}
if(data.hasKey("request")) {
this.requestMode++;
if(this.requestMode >= 3) this.requestMode = 0;
}
if(data.hasKey("ror")) {
this.rorConfiguredMode = !this.rorConfiguredMode;
}
this.markChanged();
}
@Override @Override
public String[] getFunctionInfo() { public String[] getFunctionInfo() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

After

Width:  |  Height:  |  Size: 500 B