aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2024-08-28 06:55:12 +0800
committerGitHub <noreply@github.com>2024-08-27 22:55:12 +0000
commit432bb57cab4e575f63203536e105af81e28e41bf (patch)
treeb44b53b7c6a8d30ffd5c23c004ac8ca6c5c3c501 /src/main/java/com
parentefef6ba7b449de1af1e14f6cec141a101d7b1e8d (diff)
downloadGT5-Unofficial-432bb57cab4e575f63203536e105af81e28e41bf.tar.gz
GT5-Unofficial-432bb57cab4e575f63203536e105af81e28e41bf.tar.bz2
GT5-Unofficial-432bb57cab4e575f63203536e105af81e28e41bf.zip
implement whole multiblock hatch configuration copying (#2965)
enable whole multiblock hatch configuration copying does not include crafting bus for now Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java
index 5a8c1e054c..3a81a89386 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java
@@ -211,7 +211,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends
public String getTypeForDisplay() {
- if (this.type.equals(new NBTTagCompound())) return "";
+ if (!isImprinted()) return "";
return GT_LanguageManager.getTranslation(
GT_LanguageManager.getTranslateableItemStackName(CircuitImprintLoader.getStackFromTag(this.type)));
}
@@ -226,15 +226,20 @@ public class GT_TileEntity_CircuitAssemblyLine extends
super(aName);
}
+ public boolean isImprinted() {
+ return !this.type.hasNoTags();
+ }
+
private boolean imprintMachine(ItemStack itemStack) {
- if (!this.type.equals(new NBTTagCompound())) return true;
+ if (isImprinted()) return true;
if (!GT_Utility.isStackValid(itemStack)) return false;
if (itemStack.getItem() instanceof BW_Meta_Items.BW_GT_MetaGenCircuits && itemStack.getItemDamage() == 0
- && itemStack.getTagCompound() != null
- && this.type.equals(new NBTTagCompound())) {
+ && itemStack.getTagCompound() != null) {
this.type = itemStack.getTagCompound();
- this.mInventory[1].stackSize -= 1;
- if (this.mInventory[1].stackSize <= 0) this.mInventory[1] = null;
+ itemStack.stackSize -= 1;
+ if (itemStack == getControllerSlot() && itemStack.stackSize <= 0) {
+ mInventory[getControllerSlotIndex()] = null;
+ }
this.getBaseMetaTileEntity()
.issueBlockUpdate();
return true;
@@ -269,20 +274,34 @@ public class GT_TileEntity_CircuitAssemblyLine extends
@Override
public void setItemNBT(NBTTagCompound aNBT) {
- if (!this.type.equals(new NBTTagCompound())) aNBT.setTag(IMPRINT_KEY, this.type);
+ if (isImprinted()) aNBT.setTag(IMPRINT_KEY, this.type);
aNBT.setInteger(RUNNING_MODE_KEY, mode);
super.saveNBTData(aNBT);
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- if (!this.type.equals(new NBTTagCompound())) aNBT.setTag(IMPRINT_KEY, this.type);
+ if (isImprinted()) aNBT.setTag(IMPRINT_KEY, this.type);
aNBT.setInteger(RUNNING_MODE_KEY, mode);
aNBT.setInteger(LENGTH_KEY, length);
super.saveNBTData(aNBT);
}
@Override
+ public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (mode == 0 && !isImprinted() && getBaseMetaTileEntity().isServerSide()) {
+ ItemStack heldItem = aPlayer.getHeldItem();
+ if (imprintMachine(heldItem)) {
+ if (heldItem.stackSize <= 0) {
+ aPlayer.inventory.setInventorySlotContents(aPlayer.inventory.currentItem, null);
+ }
+ return;
+ }
+ }
+ super.onLeftclick(aBaseMetaTileEntity, aPlayer);
+ }
+
+ @Override
public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (getBaseMetaTileEntity().isServerSide()) {
this.mode = (this.mode + 1) % 2;
@@ -324,7 +343,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends
@Override
public CheckRecipeResult checkProcessing() {
if (mode == 0) {
- if (this.type.equals(new NBTTagCompound()) && !this.imprintMachine(this.getControllerSlot()))
+ if (!isImprinted() && !this.imprintMachine(this.getControllerSlot()))
return SimpleCheckRecipeResult.ofFailure("no_imprint");
if (this.imprintedItemName == null || this.imprintedStack == null) {
this.imprintedStack = new ItemStack(BW_Meta_Items.getCircuitParts(), 1, 0);