Compare commits

..

7 Commits

Author SHA1 Message Date
NotMyWing 1d1205412c impl 2025-03-28 14:29:08 +11:00
NotMyWing ad8b7aa7bd Fix stored energy tooltip typo 2025-03-27 16:45:44 +11:00
NotMyWing 26bb5986c6 Temporary OreDict bus serialization fix
Fixes #542
2025-03-25 16:57:55 +11:00
NotMyWing e175bccace Fix Color Applicator model
Closes #518
2025-03-18 20:02:51 +11:00
NotMyWing 127872b310 Fix Wireless Interface Terminal hotkey
Closes #537
2025-03-18 18:37:00 +11:00
NotMyWing b030cb9f00 Fix slot OOB indexing 2025-03-18 18:30:44 +11:00
NotMyWing f1e5a33a6e Fix ME Portable Cell voiding/dupes & disabled slot idiocy
Fixes #383, fixes #299
2025-03-18 18:22:03 +11:00
16 changed files with 162 additions and 33 deletions
@@ -44,5 +44,6 @@ public enum ActionItems
TOGGLE_SHOW_FULL_INTERFACES_OFF,
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON,
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF,
HIGHLIGHT_INTERFACE
HIGHLIGHT_INTERFACE,
CONFIGURE_INTERFACE
}
@@ -38,6 +38,8 @@ import appeng.core.AppEng;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigureInterface;
import appeng.helpers.DualityInterface;
import appeng.helpers.PatternHelper;
import appeng.helpers.WirelessTerminalGuiObject;
@@ -285,10 +287,14 @@ public class GuiInterfaceTerminal extends AEBaseGui {
for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(currentScroll + x);
if (lineObj instanceof ClientDCInternalInv inv) {
GuiButton highlightBtn = new GuiImgButton(guiLeft + 4, guiTop + offset + 1, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
guiButtonHashMap.put(highlightBtn, inv);
this.buttonList.add(highlightBtn);
GuiButton guiButton = new GuiImgButton(guiLeft + 4, guiTop + offset + 1, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
guiButtonHashMap.put(guiButton, inv);
this.buttonList.add(guiButton);
GuiButton configBtn = new GuiImgButton(guiLeft + 4, guiTop + offset + 1 - 16, Settings.ACTIONS, ActionItems.CONFIGURE_INTERFACE);
guiButtonHashMap.put(configBtn, inv);
this.buttonList.add(configBtn);
final int extraLines = numUpgradesMap.get(inv);
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
@@ -323,11 +329,12 @@ public class GuiInterfaceTerminal extends AEBaseGui {
@Override
protected void actionPerformed(final GuiButton btn) throws IOException {
if (guiButtonHashMap.containsKey(btn)) {
BlockPos blockPos = blockPosHashMap.get(guiButtonHashMap.get(this.selectedButton));
if (guiButtonHashMap.containsKey(btn) && btn instanceof GuiImgButton guiImgButton) {
ClientDCInternalInv inv = guiButtonHashMap.get(this.selectedButton);
BlockPos blockPos = blockPosHashMap.get(inv);
BlockPos blockPos2 = mc.player.getPosition();
int playerDim = mc.world.provider.getDimension();
int interfaceDim = dimHashMap.get(guiButtonHashMap.get(this.selectedButton));
int interfaceDim = dimHashMap.get(inv);
if (playerDim != interfaceDim) {
try {
mc.player.sendStatusMessage(PlayerMessages.InterfaceInOtherDimParam.get(interfaceDim, DimensionManager.getWorld(interfaceDim).provider.getDimensionType().getName()), false);
@@ -335,10 +342,14 @@ public class GuiInterfaceTerminal extends AEBaseGui {
mc.player.sendStatusMessage(PlayerMessages.InterfaceInOtherDim.get(), false);
}
} else {
hilightBlock(blockPos, System.currentTimeMillis() + 500 * BlockPosUtils.getDistance(blockPos, blockPos2), playerDim);
mc.player.sendStatusMessage(PlayerMessages.InterfaceHighlighted.get(blockPos.getX(), blockPos.getY(), blockPos.getZ()), false);
if (guiImgButton.getCurrentValue() == ActionItems.HIGHLIGHT_INTERFACE) {
hilightBlock(blockPos, System.currentTimeMillis() + 500 * BlockPosUtils.getDistance(blockPos, blockPos2), playerDim);
mc.player.sendStatusMessage(PlayerMessages.InterfaceHighlighted.get(blockPos.getX(), blockPos.getY(), blockPos.getZ()), false);
mc.player.closeScreen();
} else if (guiImgButton.getCurrentValue() == ActionItems.CONFIGURE_INTERFACE) {
NetworkHandler.instance.sendToServer(new PacketConfigureInterface(inv.getId()));
}
}
mc.player.closeScreen();
} else if (btn == guiButtonHideFull) {
onlyShowWithSpace = !onlyShowWithSpace;
this.refreshList();
@@ -465,8 +476,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
this.refreshList = true;
}
for (final Object oKey : in.getKeySet()) {
final String key = (String) oKey;
for (final String key : in.getKeySet()) {
if (key.startsWith("=")) {
try {
final long id = Long.parseLong(key.substring(1), Character.MAX_RADIX);
@@ -20,13 +20,14 @@ package appeng.client.gui.implementations;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.implementations.ContainerMEPortableCell;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiMEPortableCell extends GuiMEMonitorable {
public GuiMEPortableCell(final InventoryPlayer inventoryPlayer, final IPortableCell te) {
super(inventoryPlayer, te);
super(inventoryPlayer, te, new ContainerMEPortableCell(inventoryPlayer, te));
}
@Override
@@ -121,6 +121,7 @@ public class GuiImgButton extends GuiButton implements ITooltip {
this.registerApp(8 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOffDesc);
this.registerApp(9 + 5 * 16, Settings.ACTIONS, ActionItems.MOLECULAR_ASSEMBLERS_OFF, ButtonToolTips.ToggleMolecularAssemblers, ButtonToolTips.ToggleMolecularAssemblersOffDesc);
this.registerApp(6 + 6 * 16, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE, ButtonToolTips.HighlightInterface, "");
this.registerApp(66, Settings.ACTIONS, ActionItems.CONFIGURE_INTERFACE, ButtonToolTips.ConfigureInterface, "");
this.registerApp(4 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF, ButtonToolTips.ToggleShowOnlyInvalidInterface, ButtonToolTips.ToggleShowOnlyInvalidInterfaceOffDesc);
this.registerApp(5 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON, ButtonToolTips.ToggleShowOnlyInvalidInterface, ButtonToolTips.ToggleShowOnlyInvalidInterfaceOnDesc);
@@ -1,7 +1,6 @@
package appeng.client.render.model;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
@@ -9,9 +8,8 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.PerspectiveMapWrapper;
import net.minecraftforge.common.model.TRSRTransformation;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -24,15 +22,12 @@ class ColorApplicatorBakedModel implements IBakedModel {
private final IBakedModel baseModel;
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
private final EnumMap<EnumFacing, List<BakedQuad>> quadsBySide;
private final List<BakedQuad> generalQuads;
ColorApplicatorBakedModel(IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright) {
ColorApplicatorBakedModel(IBakedModel baseModel, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright) {
this.baseModel = baseModel;
this.transforms = map;
// Put the tint indices in... Since this is an item model, we are ignoring rand
this.generalQuads = this.fixQuadTint(null, texDark, texMedium, texBright);
@@ -68,7 +63,7 @@ class ColorApplicatorBakedModel implements IBakedModel {
}
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
public @NotNull List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
if (side == null) {
return this.generalQuads;
}
@@ -91,22 +86,22 @@ class ColorApplicatorBakedModel implements IBakedModel {
}
@Override
public TextureAtlasSprite getParticleTexture() {
public @NotNull TextureAtlasSprite getParticleTexture() {
return this.baseModel.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
public @NotNull ItemCameraTransforms getItemCameraTransforms() {
return this.baseModel.getItemCameraTransforms();
}
@Override
public ItemOverrideList getOverrides() {
public @NotNull ItemOverrideList getOverrides() {
return this.baseModel.getOverrides();
}
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType type) {
return PerspectiveMapWrapper.handlePerspective(this, this.transforms, type);
public @NotNull Pair<? extends IBakedModel, Matrix4f> handlePerspective(@NotNull ItemCameraTransforms.TransformType type) {
return this.baseModel.handlePerspective(type);
}
}
@@ -55,7 +55,7 @@ public class ColorApplicatorModel implements IModel {
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map = PerspectiveMapWrapper.getTransforms(state);
return new ColorApplicatorBakedModel(baseModel, map, texDark, texMedium, texBright);
return new ColorApplicatorBakedModel(baseModel, texDark, texMedium, texBright);
}
private IBakedModel getBaseModel(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
@@ -961,9 +961,13 @@ public abstract class AEBaseContainer extends Container {
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, @NotNull EntityPlayer player) {
if (slotId >= 0 && clickTypeIn == ClickType.PICKUP) {
if (slotId >= 0) {
final var slot = this.getSlot(slotId);
if (slot instanceof AppEngSlot appEngSlot) {
if (slot instanceof SlotDisabled) {
return ItemStack.EMPTY;
}
if (slot instanceof AppEngSlot appEngSlot && clickTypeIn == ClickType.PICKUP) {
var slotStack = slot.getStack();
var draggedStack = this.invPlayer.getItemStack();
@@ -192,6 +192,15 @@ public class ContainerInterfaceTerminal extends AEBaseContainer {
}
}
public DualityInterface getById(long id) {
var tracker = this.byId.get(id);
if (tracker == null) {
return null;
}
return tracker.getDualityInterface();
}
@Override
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) {
final InvTracker inv = this.byId.get(id);
@@ -428,8 +437,10 @@ public class ContainerInterfaceTerminal extends AEBaseContainer {
private final BlockPos pos;
private final int dim;
private final int numUpgrades;
private final DualityInterface dualityInterface;
public InvTracker(final DualityInterface dual, final IItemHandler patterns, final String unlocalizedName) {
this.dualityInterface = dual;
this.server = patterns;
this.client = new AppEngInternalInventory(null, this.server.getSlots());
this.unlocalizedName = unlocalizedName;
@@ -438,6 +449,10 @@ public class ContainerInterfaceTerminal extends AEBaseContainer {
this.dim = dual.getLocation().getWorld().provider.getDimension();
this.numUpgrades = dual.getInstalledUpgrades(Upgrades.PATTERN_EXPANSION);
}
public DualityInterface getDualityInterface() {
return dualityInterface;
}
}
private static class PatternSlotFilter implements IAEItemFilter {
@@ -168,6 +168,8 @@ public enum ButtonToolTips {
ToggleShowOnlyInvalidInterfaceOffDesc,
HighlightInterface,
HighlightInterfaceDesc,
ConfigureInterface,
ConfigureInterfaceDesc,
SearchFieldInputs,
SearchFieldOutputs,
SearchFieldNames,
@@ -92,6 +92,8 @@ public class AppEngPacketHandlerBase {
PACKET_CABLE_BUS_LANDING_PARTICLE(PacketCableBusLandingParticle.class),
PACKET_CONFIGURE_INTERFACE(PacketConfigureInterface.class),
;
@@ -0,0 +1,52 @@
package appeng.core.sync.packets;
import appeng.api.util.AEPartLocation;
import appeng.container.implementations.ContainerInterfaceTerminal;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.helpers.IPriorityHost;
import appeng.parts.AEBasePart;
import appeng.util.Platform;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
public class PacketConfigureInterface extends AppEngPacket {
private final long id;
// automatic.
public PacketConfigureInterface(final ByteBuf stream) {
this.id = stream.readLong();
}
// api
public PacketConfigureInterface(final long id) {
this.id = id;
final ByteBuf data = Unpooled.buffer();
data.writeInt(this.getPacketID());
data.writeLong(id);
this.configureWrite(data);
}
@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
var container = player.openContainer;
if (container instanceof ContainerInterfaceTerminal terminal) {
var byId = terminal.getById(this.id);
if (byId != null) {
var host = byId.getHost();
// I don't know why this is in IPriorityHost.
if (host instanceof IPriorityHost guiHandler) {
var bridge = guiHandler.getGuiBridge();
var side = host instanceof AEBasePart part ? part.getSide() : AEPartLocation.INTERNAL;
Platform.openGUI(player, host.getTile(), side, bridge);
}
}
}
}
}
@@ -9,7 +9,7 @@ public enum Terminal {
WIRELESS_CRAFTING_TERMINAL(AEApi.instance().definitions().items().wirelessCraftingTerminal(), GuiBridge.GUI_WIRELESS_CRAFTING_TERMINAL),
WIRELESS_PATTERN_TERMINAL(AEApi.instance().definitions().items().wirelessPatternTerminal(), GuiBridge.GUI_WIRELESS_PATTERN_TERMINAL),
WIRELESS_FLUID_TERMINAL(AEApi.instance().definitions().items().wirelessFluidTerminal(), GuiBridge.GUI_WIRELESS_FLUID_TERMINAL),
WIRELESS_INTERFACE_TERMINAL(AEApi.instance().definitions().items().wirelessInterfaceTerminal(),GuiBridge.GUI_INTERFACE_TERMINAL);
WIRELESS_INTERFACE_TERMINAL(AEApi.instance().definitions().items().wirelessInterfaceTerminal(),GuiBridge.GUI_WIRELESS_INTERFACE_TERMINAL);
final GuiBridge bridge;
final IItemDefinition itemDefinition;
@@ -41,6 +41,7 @@ import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.parts.automation.PartLevelEmitter;
import appeng.parts.misc.PartOreDicStorageBus;
import appeng.parts.networking.PartCable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
@@ -315,6 +316,10 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
if (cm != null) {
cm.readFromNBT(compound);
}
if (this instanceof PartOreDicStorageBus oreDicStorageBus) {
oreDicStorageBus.saveOreMatch(compound.getString("oreMatch"));
}
}
if (this instanceof IPriorityHost) {
@@ -378,6 +383,10 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
cm.writeToNBT(output);
}
if (this instanceof PartOreDicStorageBus oreDicStorageBus) {
output.setString("oreMatch", oreDicStorageBus.getOreExp());
}
if (this instanceof IPriorityHost) {
final IPriorityHost pHost = (IPriorityHost) this;
output.setInteger("priority", pHost.getPriority());
@@ -402,6 +402,7 @@ gui.tooltips.appliedenergistics2.ToggleShowOnlyInvalidInterface=Toggles showing
gui.tooltips.appliedenergistics2.ToggleShowOnlyInvalidInterfaceOffDesc=Showing all interfaces
gui.tooltips.appliedenergistics2.ToggleShowOnlyInvalidInterfaceOnDesc=Showing only interfaces with invalid patterns
gui.tooltips.appliedenergistics2.HighlightInterface=Highlight Interface
gui.tooltips.appliedenergistics2.ConfigureInterface=Configure Interface
gui.tooltips.appliedenergistics2.SearchFieldInputs=Recipe Inputs
gui.tooltips.appliedenergistics2.SearchFieldOutputs=Recipe Outputs
gui.tooltips.appliedenergistics2.SearchFieldNames=Interface Names
@@ -470,7 +471,7 @@ theoneprobe.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 In
theoneprobe.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - §2%d§r Inputs
theoneprobe.appliedenergistics2.p2p_output=Linked (Output Side)
theoneprobe.appliedenergistics2.p2p_frequency=Frequency: §5%1$s§r
theoneprobe.appliedenergistics2.stored_energy=§2%1$d§к / §4%2$d§r
theoneprobe.appliedenergistics2.stored_energy=§2%1$d§r / §4%2$d§r
// Items
item.appliedenergistics2.storage_cell_1k.name=§61k§r ME Storage Cell
@@ -1,5 +1,5 @@
{
"parent": "item/generated",
"parent": "appliedenergistics2:item/color_applicator_uncolored",
"textures": {
"layer0": "appliedenergistics2:items/color_applicator",
"layer1": "appliedenergistics2:items/color_applicator_tip_dark",
@@ -1,6 +1,42 @@
{
"parent": "item/generated",
"parent": "item/handheld",
"textures": {
"layer0": "appliedenergistics2:items/color_applicator"
},
"display": {
"thirdperson_righthand": {
"rotation": [
0,
90,
-55
],
"translation": [
0,
4,
0.5
],
"scale": [
0.85,
0.85,
0.85
]
},
"thirdperson_lefthand": {
"rotation": [
0,
-90,
55
],
"translation": [
0,
4,
0.5
],
"scale": [
0.85,
0.85,
0.85
]
}
}
}