mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 13:30:04 +00:00
Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a6ad01b1d | ||
|
|
d2fb9186ea | ||
|
|
8f9e0e6835 | ||
|
|
4ffd6e2609 | ||
|
|
384c0f4922 | ||
|
|
c18de0ae2b | ||
|
|
8d9a9c7e8c | ||
|
|
0f9796b73c | ||
|
|
be3bfd32dd | ||
|
|
effe45544d | ||
|
|
bd128f59db | ||
|
|
e187ef370e | ||
|
|
36644fa59a | ||
|
|
43b3b619e8 | ||
|
|
29b000ff59 | ||
|
|
6cdc253867 | ||
|
|
3f3be51fc4 | ||
|
|
c74d7cabd3 | ||
|
|
504dfb51af | ||
|
|
94be0bc52c | ||
|
|
24b2e0a20b | ||
|
|
9d8447c002 | ||
|
|
486bd52417 | ||
|
|
ff70fc4264 | ||
|
|
2876db6772 | ||
|
|
51d6de3242 | ||
|
|
d7e034dcf7 | ||
|
|
30c3ab100d | ||
|
|
d0005adcf8 | ||
|
|
0e9652af56 | ||
|
|
0cd4f49d50 | ||
|
|
b6b03cfbd8 |
No files matched your search
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:NotEnoughItems:2.7.11-GTNH:dev')
|
api('com.github.GTNewHorizons:NotEnoughItems:2.7.11-GTNH:dev')
|
||||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-518-GTNH:dev')
|
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-519-GTNH-pre:dev')
|
||||||
api('curse.maven:cofh-core-69162:2388751')
|
api('curse.maven:cofh-core-69162:2388751')
|
||||||
api('com.github.GTNewHorizons:waila:1.8.2:dev')
|
api('com.github.GTNewHorizons:waila:1.8.2:dev')
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import net.minecraft.inventory.Slot;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
||||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
|
||||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.network.CPacketInventoryAction;
|
||||||
import com.glodblock.github.util.ModAndClassUtil;
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
import com.glodblock.github.util.NameConst;
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ import appeng.container.slot.OptionalSlotFake;
|
|||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
import appeng.container.slot.SlotPatternTerm;
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
|
||||||
public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
|
public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
|
||||||
|
|
||||||
@@ -143,6 +146,18 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
|
|||||||
4210752);
|
4210752);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
|
|
||||||
|
if (btn == 2 && doubleBtn.mousePressed(this.mc, xCoord, yCoord)) { //
|
||||||
|
InventoryAction action = InventoryAction.SET_PATTERN_MULTI;
|
||||||
|
|
||||||
|
final CPacketInventoryAction p = new CPacketInventoryAction(action, 0, 0);
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(p);
|
||||||
|
} else super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||||
if (mouseButton == 3) {
|
if (mouseButton == 3) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.glodblock.github.client.gui.container.ContainerFluidPatternExWireless
|
|||||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
||||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||||
|
import com.glodblock.github.network.CPacketInventoryAction;
|
||||||
import com.glodblock.github.util.ModAndClassUtil;
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
import com.glodblock.github.util.NameConst;
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ import appeng.api.config.PatternSlotConfig;
|
|||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
|
||||||
public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
|
public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
|
||||||
|
|
||||||
@@ -178,7 +180,12 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
|
|||||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||||
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
|
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
if (btn == 2 && doubleBtn.mousePressed(this.mc, xCoord, yCoord)) { //
|
||||||
|
InventoryAction action = InventoryAction.SET_PATTERN_MULTI;
|
||||||
|
|
||||||
|
final CPacketInventoryAction p = new CPacketInventoryAction(action, 0, 0);
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(p);
|
||||||
|
} else super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
|
||||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||||
changeActivePage();
|
changeActivePage();
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.network.CPacketPatternMultiSet;
|
||||||
|
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.implementations.GuiAmount;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.container.implementations.ContainerPatternMulti;
|
||||||
|
import appeng.core.localization.GuiColors;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.helpers.Reflected;
|
||||||
|
import appeng.util.calculators.ArithHelper;
|
||||||
|
import appeng.util.calculators.Calculator;
|
||||||
|
|
||||||
|
public class GuiPatternMulti extends GuiAmount {
|
||||||
|
|
||||||
|
private static final int DEFAULT_VALUE = 0;
|
||||||
|
private GuiImgButton symbolSwitch;
|
||||||
|
protected GuiType originalGui;
|
||||||
|
|
||||||
|
@Reflected
|
||||||
|
public GuiPatternMulti(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(new ContainerPatternMulti(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.symbolSwitch = new GuiImgButton(
|
||||||
|
this.guiLeft + 22,
|
||||||
|
this.guiTop + 53,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.MULTIPLY));
|
||||||
|
|
||||||
|
this.amountTextField.xPosition = this.guiLeft + 50;
|
||||||
|
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||||
|
this.amountTextField.setSelectionPos(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj
|
||||||
|
.drawString(GuiText.SelectAmount.getLocal(), 8, 6, GuiColors.CraftAmountSelectAmount.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.nextBtn.displayString = GuiText.Set.getLocal();
|
||||||
|
|
||||||
|
try {
|
||||||
|
int resultI = getAmount();
|
||||||
|
|
||||||
|
this.symbolSwitch.set(resultI >= 0 ? ActionItems.MULTIPLY : ActionItems.DIVIDE);
|
||||||
|
this.nextBtn.enabled = resultI < -1 || resultI > 1;
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
this.nextBtn.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.amountTextField.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (btn == this.nextBtn && btn.enabled) {
|
||||||
|
int resultI = getAmount();
|
||||||
|
if (resultI > 1 || resultI < -1)
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternMultiSet(this.originalGui, resultI));
|
||||||
|
}
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
// nope..
|
||||||
|
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btn == this.symbolSwitch) {
|
||||||
|
int resultI = -getAmount();
|
||||||
|
this.amountTextField.setText(Integer.toString(resultI));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getAmount() {
|
||||||
|
String out = this.amountTextField.getText();
|
||||||
|
|
||||||
|
double resultD = Calculator.conversion(out);
|
||||||
|
|
||||||
|
if (Double.isNaN(resultD)) {
|
||||||
|
return DEFAULT_VALUE;
|
||||||
|
} else {
|
||||||
|
return (int) ArithHelper.round(resultD, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int addOrderAmount(final int i) {
|
||||||
|
return i + getAmount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/patternMulti.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setOriginGUI(Object target) {
|
||||||
|
if (target instanceof PartFluidPatternTerminal) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
} else if (target instanceof PartFluidTerminal) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||||
|
} else if (target instanceof PartLevelTerminal) {
|
||||||
|
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||||
|
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||||
|
} else if (target instanceof WirelessLevelTerminalInventory) {
|
||||||
|
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -117,11 +117,10 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
|||||||
"PatternTerminal.Combine",
|
"PatternTerminal.Combine",
|
||||||
this.combineDisableBtn == btn ? "1" : "0"));
|
this.combineDisableBtn == btn ? "1" : "0"));
|
||||||
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||||
final int eventButton = Mouse.getEventButton();
|
int val = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
|
||||||
FluidCraft.proxy.netHandler.sendToServer(
|
if (Mouse.isButtonDown(1)) val |= 0b10;
|
||||||
new CPacketFluidPatternTermBtns(
|
FluidCraft.proxy.netHandler
|
||||||
"PatternTerminal.Double",
|
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Double", String.valueOf(val)));
|
||||||
(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0") + (eventButton == 1 ? "1" : "0")));
|
|
||||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||||
FluidCraft.proxy.netHandler
|
FluidCraft.proxy.netHandler
|
||||||
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||||
|
|||||||
+2
-2
@@ -153,9 +153,9 @@ public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doubleStacks(boolean isShift, boolean divide) {
|
public void doubleStacks(int val) {
|
||||||
if (!isCraftingMode()) {
|
if (!isCraftingMode()) {
|
||||||
super.doubleStacks(isShift, divide);
|
super.doubleStacks(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.networking.security.PlayerSource;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
|
||||||
|
public class ContainerPatternMulti extends AEBaseContainer {
|
||||||
|
|
||||||
|
public ContainerPatternMulti(final InventoryPlayer ip, final ITerminalHost te) {
|
||||||
|
super(ip, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IGrid getGrid() {
|
||||||
|
final IActionHost h = ((IActionHost) this.getTarget());
|
||||||
|
return h.getActionableNode().getGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public World getWorld() {
|
||||||
|
return this.getPlayerInv().player.worldObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseActionSource getActionSrc() {
|
||||||
|
return new PlayerSource(this.getPlayerInv().player, (IActionHost) this.getTarget());
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
-9
@@ -53,6 +53,8 @@ import appeng.util.item.AEItemStack;
|
|||||||
public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||||
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket, IPatternConsumer {
|
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket, IPatternConsumer {
|
||||||
|
|
||||||
|
public static final int MULTIPLE_OF_BUTTON_CLICK = 2;
|
||||||
|
public static final int MULTIPLE_OF_BUTTON_CLICK_ON_SHIFT = 8;
|
||||||
protected final IItemPatternTerminal patternTerminal;
|
protected final IItemPatternTerminal patternTerminal;
|
||||||
protected final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
protected final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
||||||
protected final IInventory crafting;
|
protected final IInventory crafting;
|
||||||
@@ -538,15 +540,10 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doubleStacks(boolean isShift, boolean divide) {
|
public void doubleStacks(int val) {
|
||||||
if (!isCraftingMode()) {
|
multiplyOrDivideStacks(
|
||||||
final int mult = (isShift ? 8 : 2) * (divide ? -1 : 1);
|
((val & 1) != 0 ? MULTIPLE_OF_BUTTON_CLICK_ON_SHIFT : MULTIPLE_OF_BUTTON_CLICK)
|
||||||
if (canMultiplyOrDivide(this.craftingSlots, mult) && canMultiplyOrDivide(this.outputSlots, mult)) {
|
* ((val & 2) != 0 ? -1 : 1));
|
||||||
multiplyOrDivideStacksInternal(this.craftingSlots, mult);
|
|
||||||
multiplyOrDivideStacksInternal(this.outputSlots, mult);
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean canMultiplyOrDivide(SlotFake[] slots, int mult) {
|
static boolean canMultiplyOrDivide(SlotFake[] slots, int mult) {
|
||||||
@@ -596,6 +593,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
|||||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
|
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
|
||||||
} else {
|
} else {
|
||||||
st.stackSize *= mult;
|
st.stackSize *= mult;
|
||||||
|
s.putStack(st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -608,12 +606,28 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
|||||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) / mult);
|
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) / mult);
|
||||||
} else {
|
} else {
|
||||||
st.stackSize /= mult;
|
st.stackSize /= mult;
|
||||||
|
s.putStack(st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiply or divide a number
|
||||||
|
*
|
||||||
|
* @param multi Positive numbers are multiplied and negative numbers are divided
|
||||||
|
*/
|
||||||
|
public void multiplyOrDivideStacks(int multi) {
|
||||||
|
if (!isCraftingMode()) {
|
||||||
|
if (canMultiplyOrDivide(this.craftingSlots, multi) && canMultiplyOrDivide(this.outputSlots, multi)) {
|
||||||
|
multiplyOrDivideStacksInternal(this.craftingSlots, multi);
|
||||||
|
multiplyOrDivideStacksInternal(this.outputSlots, multi);
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
||||||
if (this.patternTerminal != null) {
|
if (this.patternTerminal != null) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.minecraftforge.client.model.IModelCustom;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.glodblock.github.FluidCraft;
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.common.tile.TileWalrus;
|
||||||
|
|
||||||
public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||||
|
|
||||||
@@ -19,16 +20,28 @@ public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
|||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
|
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||||
|
if (!(tileentity instanceof TileWalrus Tile)) return;
|
||||||
|
float scale = Tile.getWalrusScale();
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
int orientation = Tile.getBlockMetadata();
|
||||||
int orientation = tileentity.getBlockMetadata();
|
switch (orientation) {
|
||||||
if (orientation == 4) {
|
case 2:
|
||||||
GL11.glRotatef(90, 0, 1, 0);
|
GL11.glTranslated(x + 0.5, y, z + 1 - scale * .655); // centering walrus model
|
||||||
} else if (orientation == 5) {
|
break;
|
||||||
GL11.glRotatef(-90, 0, 1, 0);
|
case 3:
|
||||||
} else if (orientation == 3) {
|
GL11.glTranslated(x + 0.5, y, z + scale * .655);
|
||||||
GL11.glRotatef(180, 0, 1, 0);
|
GL11.glRotatef(180, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
GL11.glTranslated(x + 1 - scale * .655, y, z + 0.5);
|
||||||
|
GL11.glRotatef(90, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
GL11.glTranslated(x + scale * .655, y, z + 0.5);
|
||||||
|
GL11.glRotatef(-90, 0, 1, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
GL11.glScalef(scale, scale, scale);
|
||||||
this.modelWalrus.renderAll();
|
this.modelWalrus.renderAll();
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,20 +52,20 @@ public class BlockWalrus extends BaseBlockContainer {
|
|||||||
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if (l == 0) {
|
if (l == 0) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 1) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 2) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l == 3) {
|
if (l == 1) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (l == 2) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l == 3) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -75,12 +75,28 @@ public class BlockWalrus extends BaseBlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
|
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
|
||||||
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
|
TileEntity tileentity = blockAccess.getTileEntity(x, y, z);
|
||||||
case NORTH -> setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
|
if (tileentity instanceof TileWalrus Tile) {
|
||||||
case EAST -> setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
|
float scale = Tile.getWalrusScale();
|
||||||
case SOUTH -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
|
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
|
||||||
case WEST -> setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
case NORTH -> setBlockBounds(
|
||||||
default -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
-(scale / 2 - 0.5F),
|
||||||
|
0.0F,
|
||||||
|
-scale * 2F + 1.0F,
|
||||||
|
(scale / 2 + 0.5f),
|
||||||
|
scale,
|
||||||
|
1.0F);
|
||||||
|
case EAST -> setBlockBounds(0.0F, 0.0F, -(scale / 2 - 0.5F), 2.0F * scale, scale, (scale / 2 + 0.5f));
|
||||||
|
case SOUTH -> setBlockBounds(-(scale / 2 - 0.5F), 0.F, 0.F, (scale / 2 + 0.5f), scale, 2.0F * scale);
|
||||||
|
case WEST -> setBlockBounds(
|
||||||
|
-scale * 2F + 1.0F,
|
||||||
|
0.0F,
|
||||||
|
-(scale / 2 - 0.5F),
|
||||||
|
1.0F,
|
||||||
|
scale,
|
||||||
|
(scale / 2 + 0.5f));
|
||||||
|
default -> setBlockBounds(0.0F, 0.0F, 0.0F, scale, scale, scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,4 +118,17 @@ public class BlockWalrus extends BaseBlockContainer {
|
|||||||
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World worldObj, int x, int y, int z, EntityPlayer entityplayer, int blockID,
|
||||||
|
float offsetX, float offsetY, float offsetZ) {
|
||||||
|
TileEntity tileentity = worldObj.getTileEntity(x, y, z);
|
||||||
|
if (!(tileentity instanceof TileWalrus Tile)) return false;
|
||||||
|
if (entityplayer.isSneaking()) {
|
||||||
|
Tile.setWalrusScale(Tile.getWalrusScale() / 2);
|
||||||
|
} else {
|
||||||
|
Tile.setWalrusScale(Tile.getWalrusScale() * 2);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -64,6 +64,7 @@ import appeng.helpers.IPriorityHost;
|
|||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.cache.GridStorageCache;
|
import appeng.me.cache.GridStorageCache;
|
||||||
import appeng.me.storage.MEInventoryHandler;
|
import appeng.me.storage.MEInventoryHandler;
|
||||||
|
import appeng.me.storage.StorageBusInventoryHandler;
|
||||||
import appeng.parts.automation.PartUpgradeable;
|
import appeng.parts.automation.PartUpgradeable;
|
||||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
import appeng.tile.inventory.InvOperation;
|
import appeng.tile.inventory.InvOperation;
|
||||||
@@ -374,7 +375,7 @@ public class PartFluidStorageBus extends PartUpgradeable
|
|||||||
this.monitor = h;
|
this.monitor = h;
|
||||||
}
|
}
|
||||||
if (inv != null) {
|
if (inv != null) {
|
||||||
this.handler = new MEInventoryHandler(inv, StorageChannel.FLUIDS);
|
this.handler = new StorageBusInventoryHandler(inv, StorageChannel.FLUIDS);
|
||||||
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
|
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
|
||||||
this.handler.setBaseAccess(currentAccess);
|
this.handler.setBaseAccess(currentAccess);
|
||||||
this.handler.setWhitelist(
|
this.handler.setWhitelist(
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import com.glodblock.github.api.registries.ILevelViewable;
|
import com.glodblock.github.api.registries.ILevelViewable;
|
||||||
import com.glodblock.github.common.Config;
|
import com.glodblock.github.common.Config;
|
||||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||||
|
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
|
||||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||||
import com.glodblock.github.inventory.AeStackInventory;
|
import com.glodblock.github.inventory.AeStackInventory;
|
||||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||||
@@ -169,19 +170,41 @@ public class TileLevelMaintainer extends AENetworkTile
|
|||||||
if (!isEnable || batchSize == 0) requests.updateState(i, State.None);
|
if (!isEnable || batchSize == 0) requests.updateState(i, State.None);
|
||||||
if (batchSize > 0) {
|
if (batchSize > 0) {
|
||||||
IAEItemStack craftItem = requests.getCraftItem(i);
|
IAEItemStack craftItem = requests.getCraftItem(i);
|
||||||
|
|
||||||
|
if (ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) {
|
||||||
|
craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem);
|
||||||
|
}
|
||||||
|
|
||||||
IAEItemStack aeItem = inv.findPrecise(craftItem);
|
IAEItemStack aeItem = inv.findPrecise(craftItem);
|
||||||
|
|
||||||
|
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||||
|
|
||||||
|
if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) {
|
||||||
|
stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(aeItem, grid);
|
||||||
|
}
|
||||||
|
|
||||||
boolean isDone = requests.isDone(i);
|
boolean isDone = requests.isDone(i);
|
||||||
boolean isCraftable = aeItem != null && aeItem.isCraftable();
|
boolean isCraftable = aeItem != null && aeItem.isCraftable();
|
||||||
boolean shouldCraft = isCraftable && aeItem.getStackSize() < quantity;
|
boolean shouldCraft = isCraftable && stackSize < quantity;
|
||||||
|
|
||||||
if (isDone) requests.updateState(i, State.Idle);
|
if (isDone) requests.updateState(i, State.Idle);
|
||||||
if (!isCraftable) requests.updateState(i, State.Error);
|
if (!isCraftable) requests.updateState(i, State.Error);
|
||||||
if (allBusy || !isDone
|
|
||||||
|| !shouldCraft
|
if (allBusy || !isDone || !shouldCraft) {
|
||||||
|| craftingGrid.canEmitFor(craftItem)
|
|
||||||
|| craftingGrid.isRequesting(craftItem))
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (craftingGrid.canEmitFor(craftItem)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (craftingGrid.isRequesting(craftItem)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// do crafting
|
// do crafting
|
||||||
Future<ICraftingJob> jobTask = requests.getJob(i);
|
Future<ICraftingJob> jobTask = requests.getJob(i);
|
||||||
|
|
||||||
if (jobTask == null) {
|
if (jobTask == null) {
|
||||||
if (itemToBegin == null) {
|
if (itemToBegin == null) {
|
||||||
itemToBegin = craftItem;
|
itemToBegin = craftItem;
|
||||||
|
|||||||
@@ -1,11 +1,55 @@
|
|||||||
package com.glodblock.github.common.tile;
|
package com.glodblock.github.common.tile;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public class TileWalrus extends TileEntity {
|
public class TileWalrus extends TileEntity {
|
||||||
|
|
||||||
|
private float scale = 1f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUpdate() {
|
public void readFromNBT(NBTTagCompound data) {
|
||||||
return false;
|
super.readFromNBT(data);
|
||||||
|
if (data.hasKey("scale")) {
|
||||||
|
scale = data.getFloat("scale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound data) {
|
||||||
|
super.writeToNBT(data);
|
||||||
|
data.setFloat("scale", scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet getDescriptionPacket() {
|
||||||
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
|
writeToNBT(nbttagcompound);
|
||||||
|
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
|
readFromNBT(pkt.func_148857_g());
|
||||||
|
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxRenderDistanceSquared() {
|
||||||
|
return 102400;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getWalrusScale() {
|
||||||
|
return scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWalrusScale(float f) {
|
||||||
|
if (f > 256f) f = 256f;
|
||||||
|
if (f < 0.03f) f = 0.03f;
|
||||||
|
scale = f;
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
package com.glodblock.github.crossmod.thaumcraft;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import thaumcraft.api.aspects.Aspect;
|
||||||
|
import thaumicenergistics.api.grid.IEssentiaGrid;
|
||||||
|
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||||
|
|
||||||
|
public class ThaumicEnergisticsCrafting {
|
||||||
|
|
||||||
|
public static Item neiAddonAspect, thaumicEnergisticsAspect;
|
||||||
|
|
||||||
|
public static void postInit() {
|
||||||
|
neiAddonAspect = GameRegistry.findItem("thaumcraftneiplugin", "Aspect");
|
||||||
|
thaumicEnergisticsAspect = GameRegistry.findItem("thaumicenergistics", "crafting.aspect");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a stack is an aspect preview (nei addon or thaumic energistics). Does not mean that the stack contains
|
||||||
|
* an aspect.
|
||||||
|
*/
|
||||||
|
public static boolean isAspectStack(ItemStack stack) {
|
||||||
|
if (stack == null) return false;
|
||||||
|
|
||||||
|
return stack.getItem() == neiAddonAspect || stack.getItem() == thaumicEnergisticsAspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Method(modid = "thaumicenergistics")
|
||||||
|
public static String getAspectName(ItemStack stack) {
|
||||||
|
if (stack == null) return null;
|
||||||
|
|
||||||
|
if (stack.getItem() == neiAddonAspect) {
|
||||||
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
if (tag == null || !(tag.getTag("Aspects") instanceof NBTTagList aspects)) return null;
|
||||||
|
if (aspects.tagCount() != 1) return null;
|
||||||
|
String aspect = aspects.getCompoundTagAt(0).getString("key");
|
||||||
|
if (aspect.isEmpty()) return null;
|
||||||
|
|
||||||
|
return aspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == thaumicEnergisticsAspect) {
|
||||||
|
return ItemCraftingAspect.getAspect(stack).getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Method(modid = "thaumicenergistics")
|
||||||
|
public static ItemStack getAspectStack(String aspectName, int stackSize) {
|
||||||
|
return ItemCraftingAspect.createStackForAspect(Aspect.getAspect(aspectName), stackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an aspect stack into a thaumic energistics stack.
|
||||||
|
*/
|
||||||
|
public static IAEItemStack convertAspectStack(IAEItemStack stack) {
|
||||||
|
if (stack == null) return null;
|
||||||
|
|
||||||
|
String aspect = getAspectName(stack.getItemStack());
|
||||||
|
|
||||||
|
if (aspect == null) return stack;
|
||||||
|
|
||||||
|
return Objects.requireNonNull(AEItemStack.create(getAspectStack(aspect, 1))).setStackSize(stack.getStackSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of essentia stored in a grid for a given aspect preview.
|
||||||
|
*/
|
||||||
|
@Method(modid = "thaumicenergistics")
|
||||||
|
public static long getEssentiaAmount(IAEItemStack stack, IGrid grid) {
|
||||||
|
String aspectName = getAspectName(stack.getItemStack());
|
||||||
|
|
||||||
|
if (aspectName == null) return 0;
|
||||||
|
|
||||||
|
Aspect aspect = Aspect.getAspect(aspectName);
|
||||||
|
|
||||||
|
if (aspect == null) return 0;
|
||||||
|
|
||||||
|
IEssentiaGrid essentiaGrid = grid.getCache(IEssentiaGrid.class);
|
||||||
|
|
||||||
|
return essentiaGrid.getEssentiaAmount(aspect);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,9 @@ public class ItemBiggerAppEngInventory extends BiggerAppEngInventory {
|
|||||||
boolean isCraft = Platform.openNbtData(is).getBoolean("craftingMode");
|
boolean isCraft = Platform.openNbtData(is).getBoolean("craftingMode");
|
||||||
boolean isCraftingTerm = Platform.openNbtData(is).getString("mode_main")
|
boolean isCraftingTerm = Platform.openNbtData(is).getString("mode_main")
|
||||||
.equals(GuiType.WIRELESS_CRAFTING_TERMINAL.toString());
|
.equals(GuiType.WIRELESS_CRAFTING_TERMINAL.toString());
|
||||||
if (!isCraftingTerm && isCraft) {
|
boolean isExPattern = Platform.openNbtData(is).getString("mode_main")
|
||||||
|
.equals(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX.toString());
|
||||||
|
if (!isCraftingTerm && !isExPattern && isCraft) {
|
||||||
for (int x = 0; x < this.getSizeInventory(); x++) {
|
for (int x = 0; x < this.getSizeInventory(); x++) {
|
||||||
final ItemStack is = this.getStackInSlot(x);
|
final ItemStack is = this.getStackInSlot(x);
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.glodblock.github.client.gui.GuiLevelMaintainer;
|
|||||||
import com.glodblock.github.client.gui.GuiLevelTerminal;
|
import com.glodblock.github.client.gui.GuiLevelTerminal;
|
||||||
import com.glodblock.github.client.gui.GuiLevelWireless;
|
import com.glodblock.github.client.gui.GuiLevelWireless;
|
||||||
import com.glodblock.github.client.gui.GuiOCPatternEditor;
|
import com.glodblock.github.client.gui.GuiOCPatternEditor;
|
||||||
|
import com.glodblock.github.client.gui.GuiPatternMulti;
|
||||||
import com.glodblock.github.client.gui.GuiPatternValueAmount;
|
import com.glodblock.github.client.gui.GuiPatternValueAmount;
|
||||||
import com.glodblock.github.client.gui.GuiRenamer;
|
import com.glodblock.github.client.gui.GuiRenamer;
|
||||||
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
|
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
|
||||||
@@ -61,6 +62,7 @@ import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
|
|||||||
import com.glodblock.github.client.gui.container.ContainerLevelTerminal;
|
import com.glodblock.github.client.gui.container.ContainerLevelTerminal;
|
||||||
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
|
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
|
||||||
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
|
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerPatternMulti;
|
||||||
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
||||||
import com.glodblock.github.client.gui.container.ContainerRenamer;
|
import com.glodblock.github.client.gui.container.ContainerRenamer;
|
||||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||||
@@ -512,6 +514,19 @@ public enum GuiType {
|
|||||||
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
||||||
return new GuiPatternValueAmount(player.inventory, inv);
|
return new GuiPatternValueAmount(player.inventory, inv);
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
GUI_PATTERN_MULTI(new PartOrItemGuiFactory<>(ITerminalHost.class) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||||
|
return new ContainerPatternMulti(player.inventory, inv);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
||||||
|
return new GuiPatternMulti(player.inventory, inv);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public static final List<GuiType> VALUES = ImmutableList.copyOf(values());
|
public static final List<GuiType> VALUES = ImmutableList.copyOf(values());
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.glodblock.github.network.CPacketFluidUpdate;
|
|||||||
import com.glodblock.github.network.CPacketInventoryAction;
|
import com.glodblock.github.network.CPacketInventoryAction;
|
||||||
import com.glodblock.github.network.CPacketLevelMaintainer;
|
import com.glodblock.github.network.CPacketLevelMaintainer;
|
||||||
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
||||||
|
import com.glodblock.github.network.CPacketPatternMultiSet;
|
||||||
import com.glodblock.github.network.CPacketPatternValueSet;
|
import com.glodblock.github.network.CPacketPatternValueSet;
|
||||||
import com.glodblock.github.network.CPacketRenamer;
|
import com.glodblock.github.network.CPacketRenamer;
|
||||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||||
@@ -78,6 +79,8 @@ public class ChannelLoader implements Runnable {
|
|||||||
CPacketLevelTerminalCommands.class,
|
CPacketLevelTerminalCommands.class,
|
||||||
id++,
|
id++,
|
||||||
Side.SERVER);
|
Side.SERVER);
|
||||||
|
netHandler
|
||||||
|
.registerMessage(new CPacketPatternMultiSet.Handler(), CPacketPatternMultiSet.class, id++, Side.SERVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacketToAllPlayers(Packet packet, World world) {
|
public static void sendPacketToAllPlayers(Packet packet, World world) {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
|||||||
case "PatternTerminal.Clear" -> cpt.clear();
|
case "PatternTerminal.Clear" -> cpt.clear();
|
||||||
case "PatternTerminal.Substitute" -> cpt.getPatternTerminal().setSubstitution(Value.equals("1"));
|
case "PatternTerminal.Substitute" -> cpt.getPatternTerminal().setSubstitution(Value.equals("1"));
|
||||||
case "PatternTerminal.Invert" -> cpt.getPatternTerminal().setInverted(Value.equals("1"));
|
case "PatternTerminal.Invert" -> cpt.getPatternTerminal().setInverted(Value.equals("1"));
|
||||||
case "PatternTerminal.Double" -> cpt.doubleStacks(Value.charAt(0) == '1', Value.charAt(1) == '1');
|
case "PatternTerminal.Double" -> cpt.doubleStacks(Integer.parseInt(message.Value));
|
||||||
case "PatternTerminal.Combine" -> cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
|
case "PatternTerminal.Combine" -> cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
|
||||||
case "PatternTerminal.beSubstitute" -> cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
|
case "PatternTerminal.beSubstitute" -> cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
|
||||||
case "PatternTerminal.ActivePage" ->
|
case "PatternTerminal.ActivePage" ->
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import com.glodblock.github.FluidCraft;
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerPatternMulti;
|
||||||
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
@@ -105,12 +106,12 @@ public class CPacketInventoryAction implements IMessage {
|
|||||||
new BlockPos(te),
|
new BlockPos(te),
|
||||||
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||||
GuiType.FLUID_CRAFTING_AMOUNT);
|
GuiType.FLUID_CRAFTING_AMOUNT);
|
||||||
} else if (target instanceof IWirelessTerminal) {
|
} else if (target instanceof IWirelessTerminal wt) {
|
||||||
InventoryHandler.openGui(
|
InventoryHandler.openGui(
|
||||||
sender,
|
sender,
|
||||||
sender.worldObj,
|
sender.worldObj,
|
||||||
new BlockPos(
|
new BlockPos(
|
||||||
((IWirelessTerminal) target).getInventorySlot(),
|
wt.getInventorySlot(),
|
||||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||||
0),
|
0),
|
||||||
ForgeDirection.UNKNOWN,
|
ForgeDirection.UNKNOWN,
|
||||||
@@ -135,12 +136,12 @@ public class CPacketInventoryAction implements IMessage {
|
|||||||
new BlockPos(te),
|
new BlockPos(te),
|
||||||
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||||
GuiType.PATTERN_VALUE_SET);
|
GuiType.PATTERN_VALUE_SET);
|
||||||
} else if (target instanceof IWirelessTerminal) {
|
} else if (target instanceof IWirelessTerminal wt) {
|
||||||
InventoryHandler.openGui(
|
InventoryHandler.openGui(
|
||||||
sender,
|
sender,
|
||||||
sender.worldObj,
|
sender.worldObj,
|
||||||
new BlockPos(
|
new BlockPos(
|
||||||
((IWirelessTerminal) target).getInventorySlot(),
|
wt.getInventorySlot(),
|
||||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||||
0),
|
0),
|
||||||
ForgeDirection.UNKNOWN,
|
ForgeDirection.UNKNOWN,
|
||||||
@@ -160,6 +161,32 @@ public class CPacketInventoryAction implements IMessage {
|
|||||||
cpv.detectAndSendChanges();
|
cpv.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (message.action == InventoryAction.SET_PATTERN_MULTI) {
|
||||||
|
final ContainerOpenContext context = baseContainer.getOpenContext();
|
||||||
|
if (context != null) {
|
||||||
|
final TileEntity te = context.getTile();
|
||||||
|
if (te != null) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
sender,
|
||||||
|
te.getWorldObj(),
|
||||||
|
new BlockPos(te),
|
||||||
|
Objects.requireNonNull(baseContainer.getOpenContext().getSide()),
|
||||||
|
GuiType.GUI_PATTERN_MULTI);
|
||||||
|
} else if (target instanceof IWirelessTerminal wt) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
sender,
|
||||||
|
sender.worldObj,
|
||||||
|
new BlockPos(
|
||||||
|
wt.getInventorySlot(),
|
||||||
|
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||||
|
0),
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
GuiType.GUI_PATTERN_MULTI);
|
||||||
|
}
|
||||||
|
if (sender.openContainer instanceof ContainerPatternMulti cpm) {
|
||||||
|
cpm.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
baseContainer.doAction(sender, message.action, message.slot, message.id);
|
baseContainer.doAction(sender, message.action, message.slot, message.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.glodblock.github.network;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerPatternMulti;
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.util.BlockPos;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
import appeng.container.ContainerOpenContext;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
public class CPacketPatternMultiSet implements IMessage {
|
||||||
|
|
||||||
|
private static GuiType guiType;
|
||||||
|
private static int multi;
|
||||||
|
|
||||||
|
public CPacketPatternMultiSet(GuiType guiType, int multi) {
|
||||||
|
CPacketPatternMultiSet.guiType = guiType;
|
||||||
|
CPacketPatternMultiSet.multi = multi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPacketPatternMultiSet() {
|
||||||
|
// NO-OP
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf byteBuf) {
|
||||||
|
guiType = GuiType.getByOrdinal(byteBuf.readByte());
|
||||||
|
multi = byteBuf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf byteBuf) {
|
||||||
|
byteBuf.writeByte(guiType != null ? guiType.ordinal() : 0);
|
||||||
|
byteBuf.writeInt(multi);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Handler implements IMessageHandler<CPacketPatternMultiSet, IMessage> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(CPacketPatternMultiSet message, MessageContext ctx) {
|
||||||
|
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||||
|
if (player.openContainer instanceof ContainerPatternMulti cpv) {
|
||||||
|
final Object target = cpv.getTarget();
|
||||||
|
if (target instanceof IGridHost) {
|
||||||
|
final ContainerOpenContext context = cpv.getOpenContext();
|
||||||
|
if (context != null) {
|
||||||
|
final TileEntity te = context.getTile();
|
||||||
|
if (te != null) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
player,
|
||||||
|
te.getWorldObj(),
|
||||||
|
new BlockPos(te),
|
||||||
|
Objects.requireNonNull(cpv.getOpenContext().getSide()),
|
||||||
|
guiType);
|
||||||
|
} else if (target instanceof IWirelessTerminal wt) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
player,
|
||||||
|
player.worldObj,
|
||||||
|
new BlockPos(
|
||||||
|
wt.getInventorySlot(),
|
||||||
|
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||||
|
0),
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
guiType);
|
||||||
|
}
|
||||||
|
if (player.openContainer instanceof FCContainerEncodeTerminal cpt) {
|
||||||
|
cpt.multiplyOrDivideStacks(multi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,7 +32,8 @@ public class CPacketTransferRecipe implements IMessage {
|
|||||||
private List<OrderStack<?>> inputs;
|
private List<OrderStack<?>> inputs;
|
||||||
private List<OrderStack<?>> outputs;
|
private List<OrderStack<?>> outputs;
|
||||||
private boolean isCraft;
|
private boolean isCraft;
|
||||||
private static final int MAX_INDEX = 32;
|
private static final int MAX_INDEX = 81;
|
||||||
|
private static final int MAX_SLOTS_INDEX = 32;
|
||||||
private boolean shift;
|
private boolean shift;
|
||||||
|
|
||||||
public CPacketTransferRecipe() {}
|
public CPacketTransferRecipe() {}
|
||||||
@@ -79,11 +80,11 @@ public class CPacketTransferRecipe implements IMessage {
|
|||||||
NBTTagCompound nbt_o = nbt_m.getCompoundTag("o");
|
NBTTagCompound nbt_o = nbt_m.getCompoundTag("o");
|
||||||
for (int i = 0; i < MAX_INDEX; i++) {
|
for (int i = 0; i < MAX_INDEX; i++) {
|
||||||
OrderStack<?> tmp = OrderStack.readFromNBT(nbt_i, null, i);
|
OrderStack<?> tmp = OrderStack.readFromNBT(nbt_i, null, i);
|
||||||
if (tmp != null) inputs.add(tmp);
|
if (tmp != null && inputs.size() < MAX_SLOTS_INDEX) inputs.add(tmp);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < MAX_INDEX; i++) {
|
for (int i = 0; i < MAX_INDEX; i++) {
|
||||||
OrderStack<?> tmp = OrderStack.readFromNBT(nbt_o, null, i);
|
OrderStack<?> tmp = OrderStack.readFromNBT(nbt_o, null, i);
|
||||||
if (tmp != null) outputs.add(tmp);
|
if (tmp != null && inputs.size() < MAX_SLOTS_INDEX) outputs.add(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.glodblock.github.common.tile.TileFluidInterface;
|
|||||||
import com.glodblock.github.common.tile.TileWalrus;
|
import com.glodblock.github.common.tile.TileWalrus;
|
||||||
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||||
|
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
|
||||||
import com.glodblock.github.inventory.external.AEFluidInterfaceHandler;
|
import com.glodblock.github.inventory.external.AEFluidInterfaceHandler;
|
||||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||||
@@ -46,6 +47,9 @@ public class CommonProxy {
|
|||||||
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
||||||
EC2Replacer.initReplacer();
|
EC2Replacer.initReplacer();
|
||||||
}
|
}
|
||||||
|
if (ModAndClassUtil.ThE) {
|
||||||
|
ThaumicEnergisticsCrafting.postInit();
|
||||||
|
}
|
||||||
if (ModAndClassUtil.isBigInterface) {
|
if (ModAndClassUtil.isBigInterface) {
|
||||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
||||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 811 B |
Reference in new issue
Block a user