feat: add pattern encoder
This commit is contained in:
parent
1c81059335
commit
54a0ed7d09
|
@ -0,0 +1,130 @@
|
|||
---
|
||||
AccessModifierOffset: 0
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros: []
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BitFieldColonSpacing: After
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
#BreakArrays: false
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 90
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false # wtf
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros: ["BOOST_FOREACH"]
|
||||
IfMacros: []
|
||||
IncludeBlocks: Regroup
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: Indent
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: BeforeHash
|
||||
#IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
#InsertBraces: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaImportGroups: ["java"]
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: OuterScope
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
PackConstructorInitializers: NextLine
|
||||
PointerAlignment: Left
|
||||
QualifierAlignment: Left
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: true
|
||||
#RemoveSemicolon: true
|
||||
#RequiresClausePosition: OwnLine
|
||||
#RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Always
|
||||
SortIncludes: CaseInsensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceAroundPointerQualifiers: After
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: false
|
||||
SpaceBeforeInheritanceColon: false
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInAngles: Never
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros: []
|
||||
StatementMacros: []
|
||||
TabWidth: 4
|
||||
TypenameMacros: []
|
||||
UseCRLF: false # wtf
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros: ["BOOST_PP_STRINGSIZE"]
|
|
@ -26,6 +26,7 @@
|
|||
# include git important files
|
||||
!.gitmodules
|
||||
!.gitignore
|
||||
!.clang-format
|
||||
|
||||
# code format to reduce noise in git commits
|
||||
!codeformat/
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
- transition plane doesn't collect items
|
||||
- legacy blocks aren't colorable
|
||||
- BlockLegacyDisplays don't rotate their faces correctly on the top and bottom
|
||||
- pattern encoder can create pattern with no inputs
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.legacy.TilePatternEncoder;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockPatternEncoder extends AEBaseTileBlock {
|
||||
public BlockPatternEncoder() {
|
||||
super(Material.iron);
|
||||
this.setTileEntity(TilePatternEncoder.class);
|
||||
this.setFeature(EnumSet.of(AEFeature.Legacy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World w,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer p,
|
||||
int side,
|
||||
// useless parameters
|
||||
float alec1,
|
||||
float alec2,
|
||||
float alec3
|
||||
) {
|
||||
TileEntity tileEntity = w.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
Platform.openGUI(
|
||||
p,
|
||||
tileEntity,
|
||||
ForgeDirection.getOrientation(side),
|
||||
GuiBridge.GUI_PATTERN_ENCODER
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -185,10 +185,6 @@ public class BlockStorageMonitor extends BlockLegacyDisplay {
|
|||
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) {
|
||||
TileStorageMonitor te = (TileStorageMonitor) w.getTileEntity(x, y, z);
|
||||
|
||||
System.out.println(
|
||||
"AAALEC: " + te.upgraded + " " + s + " " + te.getForward().ordinal()
|
||||
);
|
||||
|
||||
if (te != null && te.upgraded && s == te.getForward().ordinal()) {
|
||||
return ExtraBlockTextures.BlockStorageMonitorFrontMatrix.getIcon();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerPatternEncoder;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.tile.legacy.TilePatternEncoder;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiPatternEncoder extends AEBaseGui {
|
||||
GuiButton encodeBtn;
|
||||
GuiButton clearBtn;
|
||||
|
||||
public GuiPatternEncoder(
|
||||
InventoryPlayer inventoryPlayer, TilePatternEncoder tileEntity
|
||||
) {
|
||||
super(new ContainerPatternEncoder(inventoryPlayer, tileEntity));
|
||||
this.ySize = 172;
|
||||
this.xSize = 176;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
try {
|
||||
if (guibutton == this.clearBtn) {
|
||||
NetworkHandler.instance.sendToServer(
|
||||
(new PacketValueConfig("PatternEncoder.Clear", "1"))
|
||||
);
|
||||
} else {
|
||||
NetworkHandler.instance.sendToServer(
|
||||
(new PacketValueConfig("PatternEncoder.Encode", "1"))
|
||||
);
|
||||
}
|
||||
} catch (IOException var4) {
|
||||
var4.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.add(
|
||||
this.clearBtn = new GuiButton(
|
||||
1, 238, 94, 42, 20, StatCollector.translateToLocal("gui.appliedenergistics2.PatternEncoder.clear")
|
||||
)
|
||||
);
|
||||
this.buttonList.add(
|
||||
this.encodeBtn = new GuiButton(
|
||||
1, 238, 94, 42, 20, StatCollector.translateToLocal("gui.appliedenergistics2.PatternEncoder.encode")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("gui.appliedenergistics2.PatternEncoder"), 8, 6, 4210752
|
||||
);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
8,
|
||||
this.ySize - 96 + 3,
|
||||
4210752
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.bindTexture("guis/me_pattern_encoder.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.encodeBtn.xPosition = x + 105;
|
||||
this.encodeBtn.yPosition = y + 57 + 6;
|
||||
this.clearBtn.xPosition = x + 105;
|
||||
this.clearBtn.yPosition = y + 9 + 6;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlacableItemType;
|
||||
import appeng.tile.legacy.TilePatternEncoder;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerPatternEncoder extends AEBaseContainer {
|
||||
public TilePatternEncoder patEnc;
|
||||
|
||||
// TODO: WTF
|
||||
//public InventoryPaternEnc PatternEnc;
|
||||
|
||||
// TODO: WTF
|
||||
//@Override
|
||||
public void updateClient() {
|
||||
this.patEnc.lockChanges = true;
|
||||
this.patEnc.lockChanges = false;
|
||||
//super.updateClient();
|
||||
}
|
||||
|
||||
public ContainerPatternEncoder(
|
||||
InventoryPlayer inventoryPlayer, TilePatternEncoder te
|
||||
) {
|
||||
super(inventoryPlayer, te, null);
|
||||
this.patEnc = te;
|
||||
//this.PatternEnc = new InventoryPaternEnc(this, te.field_70331_k);
|
||||
this.patEnc.lockChanges = true;
|
||||
|
||||
this.patEnc.lockChanges = false;
|
||||
this.addSlotToContainer(new SlotRestrictedInput(
|
||||
PlacableItemType.BLANK_PATTERN,
|
||||
this.patEnc.storage,
|
||||
10,
|
||||
151,
|
||||
19,
|
||||
inventoryPlayer
|
||||
));
|
||||
this.addSlotToContainer(new SlotRestrictedInput(
|
||||
PlacableItemType.ENCODED_PATTERN,
|
||||
this.patEnc.storage,
|
||||
11,
|
||||
151,
|
||||
63,
|
||||
inventoryPlayer
|
||||
));
|
||||
this.addSlotToContainer(
|
||||
new SlotFake(((TilePatternEncoder) this.getTileEntity()).storage, 9, 119, 41)
|
||||
);
|
||||
|
||||
int var6;
|
||||
int var7;
|
||||
for (var6 = 0; var6 < 3; ++var6) {
|
||||
for (var7 = 0; var7 < 3; ++var7) {
|
||||
this.addSlotToContainer(new SlotFake(
|
||||
((TilePatternEncoder) this.getTileEntity()).storage,
|
||||
var7 + var6 * 3,
|
||||
30 + var7 * 18,
|
||||
17 + var6 * 18 + 6
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (var6 = 0; var6 < 3; ++var6) {
|
||||
for (var7 = 0; var7 < 9; ++var7) {
|
||||
this.addSlotToContainer(new SlotPlayerInv(
|
||||
inventoryPlayer,
|
||||
var7 + var6 * 9 + 9,
|
||||
8 + var7 * 18,
|
||||
84 + var6 * 18 + 6
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (var6 = 0; var6 < 9; ++var6) {
|
||||
this.addSlotToContainer(
|
||||
new SlotPlayerHotBar(inventoryPlayer, var6, 8 + var6 * 18, 148)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
((TilePatternEncoder) this.getTileEntity()).clearConfig();
|
||||
}
|
||||
|
||||
public void encode() {
|
||||
((TilePatternEncoder) this.getTileEntity()).encodePattern();
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ import appeng.block.grindstone.BlockGrinder;
|
|||
import appeng.block.legacy.BlockCraftMonitor;
|
||||
import appeng.block.legacy.BlockCraftTerminal;
|
||||
import appeng.block.legacy.BlockLegacyController;
|
||||
import appeng.block.legacy.BlockPatternEncoder;
|
||||
import appeng.block.legacy.BlockStorageMonitor;
|
||||
import appeng.block.legacy.BlockTerminal;
|
||||
import appeng.block.legacy.BlockTransitionPlane;
|
||||
|
@ -141,6 +142,7 @@ public final class ApiBlocks implements IBlocks {
|
|||
private final ITileDefinition legacyWirelessAccessPoint;
|
||||
private final ITileDefinition transitionPlane;
|
||||
private final ITileDefinition storageMonitor;
|
||||
private final ITileDefinition patternEncoder;
|
||||
|
||||
public ApiBlocks(final DefinitionConstructor constructor) {
|
||||
final BlockLightDetector lightDetector = new BlockLightDetector();
|
||||
|
@ -320,6 +322,8 @@ public final class ApiBlocks implements IBlocks {
|
|||
= constructor.registerTileDefinition(new BlockTransitionPlane());
|
||||
this.storageMonitor
|
||||
= constructor.registerTileDefinition(new BlockStorageMonitor());
|
||||
this.patternEncoder
|
||||
= constructor.registerTileDefinition(new BlockPatternEncoder());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,6 +60,7 @@ import appeng.tile.crafting.TileCraftingTile;
|
|||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.legacy.TileLegacyController;
|
||||
import appeng.tile.legacy.TilePatternEncoder;
|
||||
import appeng.tile.misc.*;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
@ -272,6 +273,13 @@ public enum GuiBridge implements IGuiHandler {
|
|||
ITerminalHost.class,
|
||||
GuiHostType.ITEM_OR_WORLD,
|
||||
SecurityPermissions.CRAFT
|
||||
),
|
||||
|
||||
GUI_PATTERN_ENCODER(
|
||||
ContainerPatternEncoder.class,
|
||||
TilePatternEncoder.class,
|
||||
GuiHostType.WORLD,
|
||||
SecurityPermissions.CRAFT
|
||||
);
|
||||
|
||||
private final Class tileClass;
|
||||
|
|
|
@ -140,6 +140,13 @@ public class PacketValueConfig extends AppEngPacket {
|
|||
} else if (this.Name.equals("CellWorkbench.Fuzzy")) {
|
||||
ccw.setFuzzy(FuzzyMode.valueOf(this.Value));
|
||||
}
|
||||
} else if (this.Name.startsWith("PatternEncoder.") && c instanceof ContainerPatternEncoder) {
|
||||
ContainerPatternEncoder cpe = (ContainerPatternEncoder) c;
|
||||
if (this.Name.equals("PatternEncoder.Clear")) {
|
||||
cpe.clear();
|
||||
} else if (this.Name.equals("PatternEncoder.Encode")) {
|
||||
cpe.encode();
|
||||
}
|
||||
} else if (c instanceof ContainerNetworkTool) {
|
||||
if (this.Name.equals("NetworkTool") && this.Value.equals("Toggle")) {
|
||||
((ContainerNetworkTool) c).toggleFacadeMode();
|
||||
|
|
|
@ -15,22 +15,23 @@ public class TileLegacyDisplay extends AENetworkTile {
|
|||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStreamTileLegacyDisplay(ByteBuf data) {
|
||||
public boolean writeToStreamTileLegacyDisplay(ByteBuf data) {
|
||||
data.writeBoolean(this.displayPowered);
|
||||
return true;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public void readFromStreamTileLegacyDisplay(ByteBuf data) {
|
||||
public boolean readFromStreamTileLegacyDisplay(ByteBuf data) {
|
||||
this.displayPowered = data.readBoolean();
|
||||
this.worldObj.func_147451_t(this.xCoord, this.yCoord, this.zCoord);
|
||||
this.worldObj.markBlockRangeForRenderUpdate(
|
||||
this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void powerUpdate(final MENetworkPowerStatusChange changed) {
|
||||
System.out.println("ALEC");
|
||||
this.displayPowered = this.getProxy().isPowered();
|
||||
this.worldObj.func_147451_t(this.xCoord, this.yCoord, this.zCoord);
|
||||
this.markForUpdate();
|
||||
|
|
|
@ -0,0 +1,296 @@
|
|||
package appeng.tile.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.implementations.ContainerPatternEncoder;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TilePatternEncoder extends AEBaseInvTile {
|
||||
public AppEngInternalInventory storage = new AppEngInternalInventory(this, 12);
|
||||
public boolean lockChanges = false;
|
||||
|
||||
public void invChanged(int slot, InvOperation op) {
|
||||
if (slot == 11) {
|
||||
this.lockChanges = true;
|
||||
ItemStack pi = this.storage.getStackInSlot(11);
|
||||
if (pi != null && pi.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails ap = ((ICraftingPatternItem) pi.getItem())
|
||||
.getPatternForItem(pi, this.worldObj);
|
||||
if (ap == null)
|
||||
return;
|
||||
|
||||
IAEItemStack[] s = ap.getInputs();
|
||||
|
||||
for (int x = 0; x < 9; ++x) {
|
||||
this.storage.setInventorySlotContents(
|
||||
x, s[x] == null ? null : s[x].getItemStack()
|
||||
);
|
||||
}
|
||||
|
||||
this.storage.setInventorySlotContents(
|
||||
9, ap.getCondensedOutputs()[0].getItemStack()
|
||||
);
|
||||
}
|
||||
|
||||
this.lockChanges = false;
|
||||
this.triggerContainerUpdate();
|
||||
} else {
|
||||
if (slot >= 0 && slot <= 8 && !this.lockChanges) {
|
||||
InventoryCrafting ci = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||
|
||||
for (int x = 0; x < 9; ++x) {
|
||||
ci.setInventorySlotContents(x, this.storage.getStackInSlot(x));
|
||||
}
|
||||
|
||||
ItemStack is = Platform.findMatchingRecipeOutput(ci, this.worldObj);
|
||||
if (is != null) {
|
||||
this.storage.setInventorySlotContents(9, is);
|
||||
}
|
||||
}
|
||||
|
||||
this.triggerContainerUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public void encodePattern() {
|
||||
ItemStack fish = this.storage.getStackInSlot(11);
|
||||
if (this.storage.getStackInSlot(9) != null) {
|
||||
if (fish == null) {
|
||||
fish = this.storage.decrStackSize(10, 1);
|
||||
}
|
||||
|
||||
if (fish != null) {
|
||||
if (fish.getItem()
|
||||
== AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.blankPattern()
|
||||
.maybeItem()
|
||||
.get()) {
|
||||
fish = AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.encodedPattern()
|
||||
.maybeStack(1)
|
||||
.get();
|
||||
this.storage.setInventorySlotContents(11, fish);
|
||||
}
|
||||
|
||||
ItemStack[] cm = new ItemStack[] {
|
||||
this.storage.getStackInSlot(0), this.storage.getStackInSlot(1),
|
||||
this.storage.getStackInSlot(2), this.storage.getStackInSlot(3),
|
||||
this.storage.getStackInSlot(4), this.storage.getStackInSlot(5),
|
||||
this.storage.getStackInSlot(6), this.storage.getStackInSlot(7),
|
||||
this.storage.getStackInSlot(8)
|
||||
};
|
||||
|
||||
NBTTagCompound fishTag = new NBTTagCompound();
|
||||
|
||||
NBTTagList inputList = new NBTTagList();
|
||||
for (ItemStack inStack : cm) {
|
||||
NBTTagCompound inputTag = new NBTTagCompound();
|
||||
|
||||
if (inStack != null) {
|
||||
inStack.writeToNBT(inputTag);
|
||||
}
|
||||
|
||||
inputList.appendTag(inputTag);
|
||||
}
|
||||
|
||||
NBTTagCompound outputTag = new NBTTagCompound();
|
||||
if (this.storage.getStackInSlot(9) != null)
|
||||
this.storage.getStackInSlot(9).writeToNBT(outputTag);
|
||||
|
||||
NBTTagList outputList = new NBTTagList();
|
||||
outputList.appendTag(outputTag);
|
||||
|
||||
fishTag.setTag("in", inputList);
|
||||
fishTag.setTag("out", outputList);
|
||||
|
||||
InventoryCrafting ci = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||
|
||||
for (int x = 0; x < 9; ++x) {
|
||||
ci.setInventorySlotContents(x, this.storage.getStackInSlot(x));
|
||||
}
|
||||
|
||||
fishTag.setBoolean(
|
||||
"crafting",
|
||||
ItemStack.areItemStacksEqual(
|
||||
Platform.findMatchingRecipeOutput(ci, this.worldObj),
|
||||
this.storage.getStackInSlot(9)
|
||||
)
|
||||
);
|
||||
fishTag.setBoolean("substitute", false);
|
||||
|
||||
fish.setTagCompound(fishTag);
|
||||
|
||||
this.storage.setInventorySlotContents(11, fish);
|
||||
this.triggerContainerUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNbtTilePatternEncoder(NBTTagCompound tagCompound) {
|
||||
this.storage.readFromNBT(tagCompound, "storage");
|
||||
this.invChanged(-1, InvOperation.setInventorySlotContents);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNbtTilePatternEncoder(NBTTagCompound tagCompound) {
|
||||
this.storage.writeToNBT(tagCompound, "storage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.storage.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int var1) {
|
||||
return this.storage.getStackInSlot(var1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int var1, int var2) {
|
||||
return this.storage.decrStackSize(var1, var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int var1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int var1, ItemStack var2) {
|
||||
this.storage.setInventorySlotContents(var1, var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Pattern Encoder";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return this.storage.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return i == 1 ? itemstack.getItem()
|
||||
== AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.encodedPattern()
|
||||
.maybeItem()
|
||||
.get()
|
||||
: itemstack.getItem()
|
||||
== AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.blankPattern()
|
||||
.maybeItem()
|
||||
.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return this.isItemValidForSlot(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearConfig() {
|
||||
for (int x = 0; x < 10; ++x) {
|
||||
this.storage.setInventorySlotContents(x, null);
|
||||
}
|
||||
|
||||
this.triggerContainerUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer p) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: p.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 32.0;
|
||||
}
|
||||
|
||||
private void triggerContainerUpdate() {
|
||||
if (this.worldObj == null)
|
||||
return;
|
||||
|
||||
List<EntityPlayerMP> players = this.worldObj.getEntitiesWithinAABB(
|
||||
EntityPlayerMP.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
this.xCoord - 8.0,
|
||||
this.yCoord - 8.0,
|
||||
this.zCoord - 8.0,
|
||||
this.xCoord + 8.0,
|
||||
this.yCoord + 8.0,
|
||||
this.zCoord + 8.0
|
||||
)
|
||||
);
|
||||
|
||||
for (EntityPlayerMP pl : players) {
|
||||
if (!(pl.openContainer instanceof ContainerPatternEncoder))
|
||||
continue;
|
||||
|
||||
pl.sendContainerToPlayer(pl.openContainer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory() {
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added
|
||||
) {
|
||||
this.invChanged(slot, mc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection side) {
|
||||
return new int[] { side == ForgeDirection.DOWN ? 11 : 10 };
|
||||
}
|
||||
}
|
|
@ -56,25 +56,24 @@ public class TileStorageMonitor extends TileLegacyDisplay implements IStackWatch
|
|||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStreamTileStorageMonitor(ByteBuf data) {
|
||||
public boolean writeToStreamTileStorageMonitor(ByteBuf data) {
|
||||
try {
|
||||
// TODO: this is a hack because the stupid AE2 reflection BS doesn't work
|
||||
super.writeToStreamTileLegacyDisplay(data);
|
||||
int flags = (this.isLocked ? 1 : 0) | (this.upgraded ? 0b10 : 0)
|
||||
| (this.myItem != null ? 0b100 : 0);
|
||||
|
||||
data.writeByte(flags);
|
||||
if (this.myItem != null)
|
||||
this.myItem.writeToPacket(data);
|
||||
|
||||
return true;
|
||||
} catch (IOException kek) {
|
||||
throw new RuntimeException(kek);
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public void readFromStreamTileStorageMonitor(ByteBuf data) {
|
||||
public boolean readFromStreamTileStorageMonitor(ByteBuf data) {
|
||||
try {
|
||||
// TODO: this is a hack because the stupid AE2 reflection BS doesn't work
|
||||
super.readFromStreamTileLegacyDisplay(data);
|
||||
byte flags = data.readByte();
|
||||
this.isLocked = (flags & 0b1) > 0;
|
||||
|
@ -84,11 +83,13 @@ public class TileStorageMonitor extends TileLegacyDisplay implements IStackWatch
|
|||
if ((flags & 0b100) > 0) {
|
||||
this.myItem = AEItemStack.loadItemStackFromPacket(data);
|
||||
}
|
||||
|
||||
this.updateDisplayList = true;
|
||||
|
||||
return true;
|
||||
} catch (IOException kek) {
|
||||
throw new RuntimeException(kek);
|
||||
}
|
||||
|
||||
this.updateDisplayList = true;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
|
@ -131,7 +132,6 @@ public class TileStorageMonitor extends TileLegacyDisplay implements IStackWatch
|
|||
|
||||
this.myItem.setStackSize(meitem == null ? 0 : meitem.getStackSize());
|
||||
} catch (GridAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ tile.appliedenergistics2.BlockCellWorkbench.name=Cell Workbench
|
|||
tile.appliedenergistics2.BlockCharger.name=Charger
|
||||
tile.appliedenergistics2.BlockChest.name=ME Chest
|
||||
tile.appliedenergistics2.BlockCondenser.name=Matter Condenser
|
||||
tile.appliedenergistics2.BlockController.name=ME Controller
|
||||
tile.appliedenergistics2.BlockController.name=ME Core
|
||||
tile.appliedenergistics2.BlockCrank.name=Wooden Crank
|
||||
tile.appliedenergistics2.BlockCreativeEnergyCell.name=Creative Energy Cell
|
||||
tile.appliedenergistics2.BlockDenseEnergyCell.name=Dense Energy Cell
|
||||
|
@ -52,15 +52,21 @@ tile.appliedenergistics2.BlockCraftingUnit.name=Crafting Unit
|
|||
tile.appliedenergistics2.BlockMolecularAssembler.name=Molecular Assembler
|
||||
|
||||
# Legacy
|
||||
tile.appliedenergistics2.BlockTerminal.name=ME Access Terminal
|
||||
tile.appliedenergistics2.BlockCraftTerminal.name=ME Crafting Terminal
|
||||
tile.appliedenergistics2.BlockCraftMonitor.name=ME Crafting Monitor
|
||||
tile.appliedenergistics2.BlockLegacyController.name=ME Controller (W.I.P)
|
||||
tile.appliedenergistics2.BlockWirelessAccessPoint.name=Wireless Access Point
|
||||
tile.appliedenergistics2.BlockCraftTerminal.name=ME Crafting Terminal
|
||||
tile.appliedenergistics2.BlockLegacyController.name=ME Controller
|
||||
tile.appliedenergistics2.BlockPatternEncoder.name=Pattern Encoder
|
||||
tile.appliedenergistics2.BlockStorageMonitor.name=Storage Monitor
|
||||
tile.appliedenergistics2.BlockTerminal.name=ME Access Terminal
|
||||
tile.appliedenergistics2.BlockWirelessAccessPoint.name=Wireless Access Point
|
||||
|
||||
item.appliedenergistics2.ItemMaterial.ConversionMatrix.name=Conversion Matrix
|
||||
|
||||
# Legacy GUI
|
||||
gui.appliedenergistics2.PatternEncoder.clear=Clear
|
||||
gui.appliedenergistics2.PatternEncoder.encode=Encode
|
||||
gui.appliedenergistics2.PatternEncoder=Pattern Encoder
|
||||
|
||||
# Stairs
|
||||
tile.appliedenergistics2.ChiseledQuartzStairBlock.name=Chiseled Certus Quartz Stairs
|
||||
tile.appliedenergistics2.FluixStairBlock.name=Fluix Stairs
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 371 B |
Binary file not shown.
After Width: | Height: | Size: 398 B |
Binary file not shown.
After Width: | Height: | Size: 367 B |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Loading…
Reference in New Issue