Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
read/write set for yothatch
Browse files Browse the repository at this point in the history
  • Loading branch information
GlodBlock committed Feb 1, 2022
1 parent 01835d7 commit fdcd3db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch implements IGridProxyabl
private YottaFluidTank host;
private AENetworkProxy gridProxy = null;
private int priority;
private AccessRestriction readMode = AccessRestriction.READ_WRITE;
private final AccessRestriction[] AEModes = new AccessRestriction[]{AccessRestriction.NO_ACCESS, AccessRestriction.READ, AccessRestriction.WRITE, AccessRestriction.READ_WRITE};

public YOTTAHatch(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 0,
new String[] {"Special I/O port for EC2.",
"Directly connected YOTTank with AE fluid storage system.",
"Use screwdriver/soldering iron to set storage priority"});
"Use screwdriver to set storage priority",
"Use soldering iron to set read/write mode"});
}

public YOTTAHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
Expand All @@ -76,12 +79,14 @@ public void setTank(YottaFluidTank te) {
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setInteger("mAEPriority", this.priority);
aNBT.setInteger("mAEMode", this.readMode.ordinal());
}

@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
this.priority = aNBT.getInteger("mAEPriority");
this.readMode = AEModes[aNBT.getInteger("mAEMode")];
}

@Override
Expand All @@ -105,11 +110,8 @@ public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, floa

@Override
public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aPlayer.isSneaking())
this.priority -= 100;
else
this.priority += 100;
GT_Utility.sendChatToPlayer(aPlayer, String.format(StatCollector.translateToLocal("yothatch.chat.0"), this.priority));
this.readMode = AEModes[(readMode.ordinal() + 1) % 4];
GT_Utility.sendChatToPlayer(aPlayer, String.format(StatCollector.translateToLocal("yothatch.chat.1"), this.readMode));
return true;
}

Expand Down Expand Up @@ -333,7 +335,7 @@ public IGridNode getActionableNode() {
@Override
@Optional.Method(modid = "appliedenergistics2")
public AccessRestriction getAccess() {
return AccessRestriction.READ_WRITE;
return this.readMode;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/goodgenerator/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ largeessentiagenerator.chat= Installed!
essentiahatch.chat.0=Successfully locked to %s.
essentiahatch.chat.1=Cleared.
yothatch.chat.0=Set storage priority to %s.
yothatch.chat.1=Set to %s mode
yottank.chat.0=Clear the lock filter
yottank.chat.1=Lock to %s

#Achievement
achievement.gt.blockmachines.nag=Large Naquadah Reactor
Expand Down

0 comments on commit fdcd3db

Please sign in to comment.