aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java62
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java363
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java10
-rw-r--r--src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java84
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java52
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java247
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java10
10 files changed, 478 insertions, 360 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 0d8f64030e..524e377010 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -1,19 +1,9 @@
package gregtech.api.metatileentity;
-import static gregtech.GT_Mod.GT_FML_LOGGER;
-import static gregtech.api.enums.GT_Values.NW;
-import static gregtech.api.metatileentity.BaseMetaTileEntity.COVER_DATA_NBT_KEYS;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.SoundResource;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.graphs.Lock;
import gregtech.api.graphs.Node;
import gregtech.api.graphs.paths.NodePath;
@@ -25,31 +15,30 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity;
import gregtech.api.net.GT_Packet_TileEntity;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.*;
-import gregtech.common.GT_Client;
-import gregtech.common.covers.GT_Cover_Fluidfilter;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.*;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.enums.GT_Values.NW;
-import static gregtech.api.metatileentity.BaseMetaTileEntity.COVER_DATA_NBT_KEYS;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -59,9 +48,8 @@ import static gregtech.api.metatileentity.BaseMetaTileEntity.COVER_DATA_NBT_KEYS
public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IPipeRenderedTileEntity, IDebugableTileEntity {
public byte mConnections = IConnectable.NO_CONNECTION;
protected MetaPipeEntity mMetaTileEntity;
- private int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
+ private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
private boolean mWorkUpdate = false, mWorks = true;
- private final boolean mCheckConnections = false;
private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, mLagWarningCount = 0;
private int oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0;
protected Node node;
@@ -376,12 +364,16 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
if (mLagWarningCount > 0) {
tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
}
- tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED+" not "+EnumChatFormatting.RESET) + "accessible for you");
+ if (mMetaTileEntity != null) {
+ tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED+" not "+EnumChatFormatting.RESET) + "accessible for you");
+ }
}
if(joinedIc2Enet)
tList.add("Joined IC2 ENet");
- return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
+ return mMetaTileEntity != null ?
+ mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList) :
+ new ArrayList<>();
}
@Override
@@ -713,7 +705,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
tNBT.setIntArray("mCoverSides", mCoverSides);
if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT);
if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT);
- return new ArrayList<ItemStack>(Arrays.asList(rStack));
+ return new ArrayList<>(Collections.singletonList(rStack));
}
@Override
@@ -741,7 +733,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
if (mMetaTileEntity.onWrenchRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
mMetaTileEntity.markDirty();
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
@@ -751,14 +743,14 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
setCoverDataAtSide(tSide, getCoverBehaviorAtSideNew(tSide).onCoverScrewdriverClick(tSide, getCoverIDAtSide(tSide), getComplexCoverDataAtSide(tSide), this, aPlayer, 0.5F, 0.5F, 0.5F));
mMetaTileEntity.onScrewdriverRightClick(tSide, aPlayer, aX, aY, aZ);
mMetaTileEntity.markDirty();
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
} else {
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
setCoverDataAtSide(aSide, getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ));
mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
mMetaTileEntity.markDirty();
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
}
return true;
@@ -777,7 +769,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
else enableWorking();
mMetaTileEntity.markDirty();
GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("090","Machine Processing: ") + (isAllowedToWork() ? GT_Utility.trans("088","Enabled") : GT_Utility.trans("087","Disabled")));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
@@ -786,7 +778,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
mMetaTileEntity.markDirty();
//logic handled internally
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
doEnetUpdate();
return true;
@@ -796,12 +788,12 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
mMetaTileEntity.markDirty();
//logic handled internally
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord);
} else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mMetaTileEntity.markDirty();
mStrongRedstone ^= (1 << tSide);
GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091","Redstone Output at Side ") + tSide + GT_Utility.trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093","Strong") : GT_Utility.trans("094","Weak")));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord);
issueBlockUpdate();
}
doEnetUpdate();
@@ -819,14 +811,14 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec
setCoverItemAtSide(coverSide, tCurrentItem);
mMetaTileEntity.markDirty();
if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
} else {
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) {
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord);
dropCover(coverSide, aSide, false);
mMetaTileEntity.markDirty();
}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 5fc2e1cc9f..0af728ef27 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -20,6 +20,7 @@ import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
+import gregtech.api.enums.SoundResource;
import gregtech.api.enums.Textures;
import gregtech.api.graphs.GenerateNodeMap;
import gregtech.api.graphs.GenerateNodeMapPower;
@@ -62,11 +63,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.enums.GT_Values.NW;
@@ -82,32 +79,30 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
@Optional.Interface(iface = "appeng.api.networking.security.IActionHost", modid = "appliedenergistics2", striprefs = true),
@Optional.Interface(iface = "appeng.me.helpers.IGridProxyable", modid = "appliedenergistics2", striprefs = true)})
public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable, IAlignmentProvider, IConstructableProvider, IDebugableTileEntity, IGregtechWailaProvider {
+ private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper.findField(EntityItem.class, "health", "field_70291_e");
+ private final boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false};
+ private final boolean[] mActiveEUOutputs = new boolean[]{false, false, false, false, false, false};
+ private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
+ public long mLastSoundTick = 0;
+ public boolean mWasShutdown = false;
protected MetaTileEntity mMetaTileEntity;
protected long mStoredEnergy = 0, mStoredSteam = 0;
protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0;
protected boolean mReleaseEnergy = false;
protected long[] mAverageEUInput = new long[]{0, 0, 0, 0, 0}, mAverageEUOutput = new long[]{0, 0, 0, 0, 0};
- private final boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false};
- private final boolean[] mActiveEUOutputs = new boolean[]{false, false, false, false, false, false};
- private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false;
private boolean mActive = false, mWorkUpdate = false, mSteamConverter = false, mWorks = true;
private boolean oRedstone = false;
- private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage=0;
+ private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage = 0;
private byte oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0;
private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0;
private long oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE;
- public long mLastSoundTick = 0;
private long mLastCheckTick = 0;
private String mOwnerName = "";
private UUID mOwnerUuid = GT_Utility.defaultUuid;
private NBTTagCompound mRecipeStuff = new NBTTagCompound();
private int cableUpdateDelay = 30;
- public boolean mWasShutdown = false;
-
- private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper.findField(EntityItem.class, "health", "field_70291_e");
-
public BaseMetaTileEntity() {
}
@@ -170,7 +165,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
mOwnerName = aNBT.getString("mOwnerName");
try {
mOwnerUuid = UUID.fromString(aNBT.getString("mOwnerUuid"));
- } catch (IllegalArgumentException e){
+ } catch (IllegalArgumentException e) {
mOwnerUuid = null;
}
mLockUpgrade = aNBT.getBoolean("mLockUpgrade");
@@ -284,7 +279,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
}
}
if (aSideServer && mTickTimer > 10) {
- if(!doCoverThings()) {
+ if (!doCoverThings()) {
mRunningThroughTick = false;
return;
}
@@ -381,7 +376,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
if (getRandomNumber(10) == 0) {
try {
GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
- } catch (Exception ignored) {}
+ } catch (Exception ignored) {
+ }
GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + this.worldObj.provider.dimensionId + " explosion due to rain!");
doEnergyExplosion();
} else {
@@ -396,7 +392,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getRandomNumber(3) == 0) {
try {
GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
- } catch (Exception ignored) {}
+ } catch (Exception ignored) {
+ }
GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + this.worldObj.provider.dimensionId + " explosion due to Thunderstorm!");
doEnergyExplosion();
}
@@ -509,7 +506,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
tTime = System.nanoTime() - tTime;
if (mTimeStatistics.length > 0)
mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime;
- if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING* 1000000L) && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10)
+ if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L) && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10)
GT_FML_LOGGER.warn("WARNING: Possible Lag Source at [" + xCoord + ", " + yCoord + ", " + zCoord + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime + "ns caused by an instance of " + getMetaTileEntity().getClass());
}
@@ -518,7 +515,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
@Override
public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
- if(hasValidMetaTileEntity() && getMetaTileEntity() != null) {
+ if (hasValidMetaTileEntity() && getMetaTileEntity() != null) {
getMetaTileEntity().getWailaBody(itemStack, currenttip, accessor, config);
}
super.getWailaBody(itemStack, currenttip, accessor, config);
@@ -527,7 +524,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
@Override
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) {
super.getWailaNBTData(player, tile, tag, world, x, y, z);
- if(hasValidMetaTileEntity() && getMetaTileEntity() != null) {
+ if (hasValidMetaTileEntity() && getMetaTileEntity() != null) {
getMetaTileEntity().getWailaNBTData(player, tile, tag, world, x, y, z);
}
}
@@ -573,7 +570,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
@Deprecated
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
- receiveMetaTileEntityData(aID, aCover0, aCover1, aCover2, aCover3, aCover4, aCover5, aTextureData, (byte)0, aUpdateData, aRedstoneData, aColorData);
+ receiveMetaTileEntityData(aID, aCover0, aCover1, aCover2, aCover3, aCover4, aCover5, aTextureData, (byte) 0, aUpdateData, aRedstoneData, aColorData);
}
@@ -597,15 +594,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
mFacing = (byte) (aValue & 7);
mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0);
- //mLockUpgrade = ((aValue&32) != 0);
- mWorks = ((aValue & 64) != 0);
+ //mLockUpgrade = ((aValue&32) != 0);
+ mWorks = ((aValue & 64) != 0);
break;
case GregTechTileClientEvents.CHANGE_CUSTOM_DATA:
if (hasValidMetaTileEntity()) {
if ((aValue & 0x80) == 0) //Is texture index
mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F));
else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)//is texture page and hatch
- ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F));
+ ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F));
}
break;
case GregTechTileClientEvents.CHANGE_COLOR:
@@ -644,7 +641,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
final ArrayList<String> tList = new ArrayList<>();
if (aLogLevel > 2) {
- tList.add("Meta-ID: " +EnumChatFormatting.BLUE+ mID +EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " "));
+ tList.add("Meta-ID: " + EnumChatFormatting.BLUE + mID + EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET : " "));
}
if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
@@ -659,23 +656,23 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
//tList.add("tTime " + tTime);
}
tList.add("Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length) + "ns over " + GT_Utility.formatNumbers(mTimeStatistics.length) + " ticks with worst time of " + GT_Utility.formatNumbers(tWorstTime) + "ns.");
- tList.add("Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + " sound requests in " + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + " ticks." );
+ tList.add("Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + " sound requests in " + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + " ticks.");
mLastCheckTick = mTickTimer;
mMetaTileEntity.mSoundRequests = 0;
}
if (mLagWarningCount > 0) {
tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
}
- tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED+" not "+EnumChatFormatting.RESET) + "accessible for you");
+ tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you");
}
if (aLogLevel > 0) {
if (getSteamCapacity() > 0 && hasSteamEngineUpgrade())
tList.add(GT_Utility.formatNumbers(getStoredSteam()) + " of " + GT_Utility.formatNumbers(getSteamCapacity()) + " Steam");
- tList.add("Machine is " + (mActive ? EnumChatFormatting.GREEN+"active"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"inactive"+EnumChatFormatting.RESET));
+ tList.add("Machine is " + (mActive ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET : EnumChatFormatting.RED + "inactive" + EnumChatFormatting.RESET));
if (!mHasEnoughEnergy)
- tList.add(EnumChatFormatting.RED+"ATTENTION: This Device needs more power."+EnumChatFormatting.RESET);
+ tList.add(EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET);
}
- if(joinedIc2Enet)
+ if (joinedIc2Enet)
tList.add("Joined IC2 ENet");
return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
}
@@ -922,7 +919,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
@Override
public boolean inputEnergyFrom(byte aSide, boolean waitForActive) {
if (aSide == 6) return true;
- if (isServerSide() && waitForActive) return ((aSide >= 0 && aSide < 6) && mActiveEUInputs[aSide]) && !mReleaseEnergy;
+ if (isServerSide() && waitForActive)
+ return ((aSide >= 0 && aSide < 6) && mActiveEUInputs[aSide]) && !mReleaseEnergy;
return isEnergyInputSide(aSide);
}
@@ -934,7 +932,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
@Override
public boolean outputsEnergyTo(byte aSide, boolean waitForActive) {
if (aSide == 6) return true;
- if (isServerSide() && waitForActive) return ((aSide >= 0 && aSide < 6) && mActiveEUOutputs[aSide]) || mReleaseEnergy;
+ if (isServerSide() && waitForActive)
+ return ((aSide >= 0 && aSide < 6) && mActiveEUOutputs[aSide]) || mReleaseEnergy;
return isEnergyOutputSide(aSide);
}
@@ -951,15 +950,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
public void generatePowerNodes() {
if (isServerSide() && (isEnetInput() || isEnetOutput())) {
final int time = MinecraftServer.getServer().getTickCounter();
- for (byte i = 0;i<6;i++) {
- if (outputsEnergyTo(i,false) || inputEnergyFrom(i,false)) {
+ for (byte i = 0; i < 6; i++) {
+ if (outputsEnergyTo(i, false) || inputEnergyFrom(i, false)) {
final IGregTechTileEntity TE = getIGregTechTileEntityAtSide(i);
if (TE instanceof BaseMetaPipeEntity) {
final Node node = ((BaseMetaPipeEntity) TE).getNode();
if (node == null) {
new GenerateNodeMapPower((BaseMetaPipeEntity) TE);
} else if (node.mCreationTime != time) {
- GenerateNodeMap.clearNodeMap(node,-1);
+ GenerateNodeMap.clearNodeMap(node, -1);
new GenerateNodeMapPower((BaseMetaPipeEntity) TE);
}
}
@@ -1041,8 +1040,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
public ITexture[] getTexture(Block aBlock, byte aSide) {
final ITexture coverTexture = getCoverTexture(aSide);
final ITexture[] textureUncovered = hasValidMetaTileEntity() ?
- mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) :
- Textures.BlockIcons.ERROR_RENDERING;
+ mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) :
+ Textures.BlockIcons.ERROR_RENDERING;
final ITexture[] textureCovered;
if (coverTexture != null) {
textureCovered = Arrays.copyOf(textureUncovered, textureUncovered.length + 1);
@@ -1160,17 +1159,19 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
try {
mReleaseEnergy = true;
IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);
- } catch (Exception ignored) {}
+ } catch (Exception ignored) {
+ }
}
mReleaseEnergy = false;
// Normal Explosion Code
mMetaTileEntity.onExplosion();
- if(GT_Mod.gregtechproxy.mExplosionItemDrop){
+ if (GT_Mod.gregtechproxy.mExplosionItemDrop) {
for (int i = 0; i < this.getSizeInventory(); i++) {
final ItemStack tItem = this.getStackInSlot(i);
if ((tItem != null) && (tItem.stackSize > 0) && (this.isValidSlot(i))) {
- dropItems(tItem);
- this.setInventorySlotContents(i, null); }
+ dropItems(tItem);
+ this.setInventorySlotContents(i, null);
+ }
}
}
if (mRecipeStuff != null) {
@@ -1186,8 +1187,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
}
}
- public void dropItems(ItemStack tItem){
- if(tItem==null)return;
+ public void dropItems(ItemStack tItem) {
+ if (tItem == null) return;
final EntityItem tItemEntity = new EntityItem(this.worldObj, this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
if (tItem.hasTagCompound()) {
tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
@@ -1198,9 +1199,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
tItemEntity.hurtResistantTime = 999999;
tItemEntity.lifespan = 60000;
try {
- if(ENTITY_ITEM_HEALTH_FIELD != null)
+ if (ENTITY_ITEM_HEALTH_FIELD != null)
ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999);
- } catch (Exception ignored) {}
+ } catch (Exception ignored) {
+ }
this.worldObj.spawnEntityInWorld(tItemEntity);
tItem.stackSize = 0;
}
@@ -1251,13 +1253,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
return true;
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) {
- if(aPlayer.isSneaking() && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine && ((GT_MetaTileEntity_BasicMachine)mMetaTileEntity).setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))){
+ if (aPlayer.isSneaking() && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine && ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity).setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
cableUpdateDelay = 10;
- }else if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) {
+ } else if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
cableUpdateDelay = 10;
}
return true;
@@ -1267,7 +1269,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) {
setCoverDataAtSide(aSide, getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ));
mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
@@ -1276,8 +1278,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
mInputDisabled = !mInputDisabled;
if (mInputDisabled) mOutputDisabled = !mOutputDisabled;
- GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("086","Auto-Input: ") + (mInputDisabled ? GT_Utility.trans("087","Disabled") : GT_Utility.trans("088","Enabled") + GT_Utility.trans("089"," Auto-Output: ") + (mOutputDisabled ? GT_Utility.trans("087","Disabled") : GT_Utility.trans("088","Enabled"))));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("086", "Auto-Input: ") + (mInputDisabled ? GT_Utility.trans("087", "Disabled") : GT_Utility.trans("088", "Enabled") + GT_Utility.trans("089", " Auto-Output: ") + (mOutputDisabled ? GT_Utility.trans("087", "Disabled") : GT_Utility.trans("088", "Enabled"))));
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_ANVIL_USE, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
@@ -1292,7 +1294,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
tChat = getMetaTileEntity().getAlternativeModeText();
GT_Utility.sendChatToPlayer(aPlayer, tChat);
}
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
@@ -1301,11 +1303,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
//logic handled internally
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord);
} else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mStrongRedstone ^= (1 << tSide);
- GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091","Redstone Output at Side ") + tSide + GT_Utility.trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093","Strong") : GT_Utility.trans("094","Weak")));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091", "Redstone Output at Side ") + tSide + GT_Utility.trans("092", " set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong") : GT_Utility.trans("094", "Weak")));
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord);
issueBlockUpdate();
}
doEnetUpdate();
@@ -1314,10 +1316,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) {
- final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
+ final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
//logic handled internally
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
doEnetUpdate();
cableUpdateDelay = 10;
@@ -1330,25 +1332,23 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
if (getCoverIDAtSide(coverSide) == 0) {
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) {
if (GregTech_API.getCoverBehaviorNew(tCurrentItem).isCoverPlaceable(coverSide, tCurrentItem, this) &&
- mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem)))
- {
+ mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) {
setCoverItemAtSide(coverSide, tCurrentItem);
if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
}
} else {
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) {
if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, xCoord, yCoord, zCoord);
+ GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDO