aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAntifluxfield <lyj_299792458@163.com>2017-06-29 17:50:51 +0800
committerGitHub <noreply@github.com>2017-06-29 17:50:51 +0800
commit3e566dc404f658846b93aaeeacbd175d45bdaa1f (patch)
tree8c5b1819985d56699bf157c97db80618f7578fef /src/main/java
parent6cc01b71e9632b1ffbb9cdf4751286dfb19d80d7 (diff)
downloadGT5-Unofficial-3e566dc404f658846b93aaeeacbd175d45bdaa1f.tar.gz
GT5-Unofficial-3e566dc404f658846b93aaeeacbd175d45bdaa1f.tar.bz2
GT5-Unofficial-3e566dc404f658846b93aaeeacbd175d45bdaa1f.zip
Trying to fix #1112
A simple duct-tape of this issue.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 336c9234fc..54a9ff8198 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -48,6 +48,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
private int oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0;
private short mID = 0;
private long mTickTimer = 0;
+ private String mOwnerName = ""; //Currently only used by PlayerDetector
public BaseMetaPipeEntity() {
}
@@ -69,6 +70,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
aNBT.setByte("mColor", mColor);
aNBT.setByte("mStrongRedstone", mStrongRedstone);
aNBT.setBoolean("mWorks", !mWorks);
+ aNBT.setString("mOwnerName", mOwnerName);
} catch (Throwable e) {
GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
@@ -122,6 +124,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mColor = aNBT.getByte("mColor");
mStrongRedstone = aNBT.getByte("mStrongRedstone");
mWorks = !aNBT.getBoolean("mWorks");
+ mOwnerName = aNBT.getString("mOwnerName");
if (mCoverData.length != 6) mCoverData = new int[]{0, 0, 0, 0, 0, 0};
if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0};
@@ -829,6 +832,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
if (GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) {
if (GregTech_API.getCoverBehavior(tCurrentItem).isCoverPlaceable(cSide, new GT_ItemStack(tCurrentItem), this) && mMetaTileEntity.allowCoverOnSide(cSide, new GT_ItemStack(tCurrentItem))) {
setCoverItemAtSide(cSide, tCurrentItem);
+ if (GregTech_API.getCoverBehavior(tCurrentItem) instanceof GT_Cover_PlayerDetector) setOwnerName(aPlayer.getDisplayName());
if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
}
@@ -1101,12 +1105,14 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
@Override
public String getOwnerName() {
- return "Player";
+ if (GT_Utility.isStringInvalid(mOwnerName)) return "Player";
+ return mOwnerName;
}
@Override
public String setOwnerName(String aName) {
- return "Player";
+ if (GT_Utility.isStringInvalid(aName)) return mOwnerName = "Player";
+ return mOwnerName = aName;
}
@Override
@@ -1312,4 +1318,4 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
}
-} \ No newline at end of file
+}