aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GT_Client.java86
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java1
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Machines.java159
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java127
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_FacadeAE.java6
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java8
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java2
-rw-r--r--src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java14
-rw-r--r--src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java16
-rw-r--r--src/main/java/gregtech/common/render/GT_RenderedTexture.java44
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java14
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java9
12 files changed, 212 insertions, 274 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index 9a9fb9c17e..92f4f2de59 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -1,6 +1,6 @@
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
-// Decompiler options: packimports(3)
+// Decompiler options: packimports(3)
// Source File Name: GT_Client.java
package gregtech.common;
@@ -181,21 +181,14 @@ public class GT_Client extends GT_Proxy
private static void drawGrid(DrawBlockHighlightEvent aEvent, boolean showCoverConnections, boolean aIsWrench, boolean aIsSneaking) {
if (!checkedForChicken) {
- try {
- Class.forName("codechicken.lib.vec.Rotation");
- } catch (Throwable e) {
- if (GT_Values.D1) {
- e.printStackTrace(GT_Log.err);
- }
- return;
- }
+ try {Class.forName("codechicken.lib.vec.Rotation");} catch (ClassNotFoundException e) {return;}
checkedForChicken = true;
}
GL11.glPushMatrix();
GL11.glTranslated(-(aEvent.player.lastTickPosX + (aEvent.player.posX - aEvent.player.lastTickPosX) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosY + (aEvent.player.posY - aEvent.player.lastTickPosY) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosZ + (aEvent.player.posZ - aEvent.player.lastTickPosZ) * (double) aEvent.partialTicks));
GL11.glTranslated((float) aEvent.target.blockX + 0.5F, (float) aEvent.target.blockY + 0.5F, (float) aEvent.target.blockZ + 0.5F);
- int tSideHit = aEvent.target.sideHit;
+ final int tSideHit = aEvent.target.sideHit;
Rotation.sideRotations[tSideHit].glApply();
// draw grid
GL11.glTranslated(0.0D, -0.501D, 0.0D);
@@ -210,7 +203,7 @@ public class GT_Client extends GT_Proxy
GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, +.50D);
- TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
+ final TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
// draw connection indicators
byte tConnections = 0;
@@ -282,11 +275,10 @@ public class GT_Client extends GT_Proxy
}
GL11.glEnd();
// draw turning indicator
- if (aIsWrench && tTile instanceof IGregTechTileEntity &&
- ((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof IAlignmentProvider) {
- IAlignment tAlignment = ((IAlignmentProvider) ((IGregTechTileEntity) tTile).getMetaTileEntity()).getAlignment();
+ if (aIsWrench && tTile instanceof IAlignmentProvider) {
+ final IAlignment tAlignment = ((IAlignmentProvider)(tTile)).getAlignment();
if (tAlignment != null) {
- ForgeDirection direction = tAlignment.getDirection();
+ final ForgeDirection direction = tAlignment.getDirection();
if (direction.ordinal() == tSideHit)
drawExtendedRotationMarker(ROTATION_MARKER_TRANSFORM_CENTER, aIsSneaking, false);
else if (direction.getOpposite().ordinal() == tSideHit) {
@@ -339,7 +331,7 @@ public class GT_Client extends GT_Proxy
private static void drawFlipMarker(Transformation transform) {
GL11.glPushMatrix();
transform.glApply();
- Tessellator t = Tessellator.instance;
+ final Tessellator t = Tessellator.instance;
// right shape
GL11.glLineStipple(4, (short) 0xAAAA);
GL11.glEnable(GL11.GL_LINE_STIPPLE);
@@ -405,7 +397,7 @@ public class GT_Client extends GT_Proxy
@Override
public void onPreLoad() {
super.onPreLoad();
- String[] arr = {
+ final String[] arr = {
"renadi", "hanakocz", "MysteryDump", "Flaver4", "x_Fame", "Peluche321", "Goshen_Ithilien", "manf", "Bimgo", "leagris",
"IAmMinecrafter02", "Cerous", "Devilin_Pixy", "Bkarlsson87", "BadAlchemy", "CaballoCraft", "melanclock", "Resursator", "demanzke", "AndrewAmmerlaan",
"Deathlycraft", "Jirajha", "Axlegear", "kei_kouma", "Dracion", "dungi", "Dorfschwein", "Zero Tw0", "mattiagraz85", "sebastiank30",
@@ -445,7 +437,7 @@ public class GT_Client extends GT_Proxy
@Override
public void onPostLoad() {
super.onPostLoad();
-
+
try {
for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) {
try {
@@ -472,7 +464,7 @@ public class GT_Client extends GT_Proxy
@Override
public void run() {
GT_Log.out.println("GT_Mod: Downloading Cape List.");
- try (Scanner tScanner = new Scanner(new URL(GT_CAPE_LIST_URL).openStream())) {
+ try (final Scanner tScanner = new Scanner(new URL(GT_CAPE_LIST_URL).openStream())) {
while (tScanner.hasNextLine()) {
this.mCapeList.add(tScanner.nextLine().toLowerCase());
}
@@ -480,9 +472,9 @@ public class GT_Client extends GT_Proxy
e.printStackTrace(GT_Log.err);
}
GT_Log.out.println("GT New Horizons: Downloading Cape List.");
- try (Scanner tScanner = new Scanner(new URL(GTNH_CAPE_LIST_URL).openStream())) {
+ try (final Scanner tScanner = new Scanner(new URL(GTNH_CAPE_LIST_URL).openStream())) {
while (tScanner.hasNextLine()) {
- String tName = tScanner.nextLine().toLowerCase();
+ final String tName = tScanner.nextLine().toLowerCase();
if (tName.contains(":")) {
if (!this.mCapeList.contains(tName.substring(0, tName.indexOf(":")))) {
this.mCapeList.add(tName);
@@ -541,7 +533,7 @@ public class GT_Client extends GT_Proxy
}
if (!GregTech_API.mServerStarted) GregTech_API.mServerStarted = true;
if (GT_Values.updateFluidDisplayItems) {
- MovingObjectPosition trace = Minecraft.getMinecraft().objectMouseOver;
+ final MovingObjectPosition trace = Minecraft.getMinecraft().objectMouseOver;
if (trace != null && trace.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK &&
(mLastUpdatedBlockX != trace.blockX &&
mLastUpdatedBlockY != trace.blockY &&
@@ -549,9 +541,9 @@ public class GT_Client extends GT_Proxy
mLastUpdatedBlockX = trace.blockX;
mLastUpdatedBlockY = trace.blockY;
mLastUpdatedBlockZ = trace.blockZ;
- TileEntity tileEntity = aEvent.player.worldObj.getTileEntity(trace.blockX, trace.blockY, trace.blockZ);
+ final TileEntity tileEntity = aEvent.player.worldObj.getTileEntity(trace.blockX, trace.blockY, trace.blockZ);
if (tileEntity instanceof IGregTechTileEntity) {
- IGregTechTileEntity gtTile = (IGregTechTileEntity) tileEntity;
+ final IGregTechTileEntity gtTile = (IGregTechTileEntity) tileEntity;
if (gtTile.getMetaTileEntity() instanceof IHasFluidDisplayItem) {
GT_Values.NW.sendToServer(new MessageUpdateFluidDisplayItem(trace.blockX, trace.blockY, trace.blockZ, gtTile.getWorld().provider.dimensionId));
}
@@ -575,11 +567,10 @@ public class GT_Client extends GT_Proxy
@SubscribeEvent
public void onDrawBlockHighlight(DrawBlockHighlightEvent aEvent) {
- Block aBlock = aEvent.player.worldObj.getBlock(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
- TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
+ final Block aBlock = aEvent.player.worldObj.getBlock(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
+ final TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
- if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList))
- {
+ if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList)) {
if (aTileEntity instanceof ITurnable || ROTATABLE_VANILLA_BLOCKS.contains(aBlock) || aTileEntity instanceof IWrenchable)
drawGrid(aEvent, false, true, aEvent.player.isSneaking());
return;
@@ -629,7 +620,7 @@ public class GT_Client extends GT_Proxy
public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) {
if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) {
if (changeDetected > 0) changeDetected--;
- int newHideValue = shouldHeldItemHideThings();
+ final int newHideValue = shouldHeldItemHideThings();
if (newHideValue != hideValue) {
hideValue = newHideValue;
changeDetected = 5;
@@ -638,9 +629,8 @@ public class GT_Client extends GT_Proxy
if (mAnimationTick % 50L == 0L) {
mAnimationDirection = !mAnimationDirection;
}
- int tDirection = mAnimationDirection ? 1 : -1;
- for (Object o : mPosR) {
- Materials tMaterial = (Materials) o;
+ final int tDirection = mAnimationDirection ? 1 : -1;
+ for (Materials tMaterial : mPosR) {
tMaterial.mRGBa[0] = getSafeRGBValue(tMaterial.mRGBa[0], tDirection);
}
@@ -738,55 +728,55 @@ public class GT_Client extends GT_Proxy
if (tString.startsWith("streaming."))
switch (aStack.stackSize) {
case 1: // '\001'
- tString = (new StringBuilder()).append(tString).append("13").toString();
+ tString = tString + "13";
break;
case 2: // '\002'
- tString = (new StringBuilder()).append(tString).append("cat").toString();
+ tString = tString + "cat";
break;
case 3: // '\003'
- tString = (new StringBuilder()).append(tString).append("blocks").toString();
+ tString = tString + "blocks";
break;
case 4: // '\004'
- tString = (new StringBuilder()).append(tString).append("chirp").toString();
+ tString = tString + "chirp";
break;
case 5: // '\005'
- tString = (new StringBuilder()).append(tString).append("far").toString();
+ tString = tString + "far";
break;
case 6: // '\006'
- tString = (new StringBuilder()).append(tString).append("mall").toString();
+ tString = tString + "mall";
break;
case 7: // '\007'
- tString = (new StringBuilder()).append(tString).append("mellohi").toString();
+ tString = tString + "mellohi";
break;
case 8: // '\b'
- tString = (new StringBuilder()).append(tString).append("stal").toString();
+ tString = tString + "stal";
break;
case 9: // '\t'
- tString = (new StringBuilder()).append(tString).append("strad").toString();
+ tString = tString + "strad";
break;
case 10: // '\n'
- tString = (new StringBuilder()).append(tString).append("ward").toString();
+ tString = tString + "ward";
break;
case 11: // '\013'
- tString = (new StringBuilder()).append(tString).append("11").toString();
+ tString = tString + "11";
break;
case 12: // '\f'
- tString = (new StringBuilder()).append(tString).append("wait").toString();
+ tString = tString + "wait";
break;
default:
- tString = (new StringBuilder()).append(tString).append("wherearewenow").toString();
+ tString = tString + "wherearewenow";
break;
}
if (tString.startsWith("streaming.")) {
@@ -815,11 +805,11 @@ public class GT_Client extends GT_Proxy
private static int shouldHeldItemHideThings() {
try {
- EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+ final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player == null) return 0;
- ItemStack tCurrentItem = player.getCurrentEquippedItem();
+ final ItemStack tCurrentItem = player.getCurrentEquippedItem();
if (tCurrentItem == null) return 0;
- int[] ids = OreDictionary.getOreIDs(tCurrentItem);
+ final int[] ids = OreDictionary.getOreIDs(tCurrentItem);
int hide = 0;
for (int i : ids) {
if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) {
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 40b7381e48..34c1cc3a41 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -406,6 +406,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
ItemList.RC_Bed_Wood.set(GT_ModHandler.getModItem(MOD_ID_RC, "part.railbed", 1L, 0));
ItemList.RC_Bed_Stone.set(GT_ModHandler.getModItem(MOD_ID_RC, "part.railbed", 1L, 1));
ItemList.RC_Rebar.set(GT_ModHandler.getModItem(MOD_ID_RC, "part.rebar", 1L));
+ ItemList.TC_Thaumometer.set(GT_ModHandler.getModItem(MOD_ID_TC, "ItemThaumometer", 1L, 0));
ItemList.Tool_Sword_Steel.set(GT_ModHandler.getModItem(MOD_ID_RC, "tool.steel.sword", 1L));
ItemList.Tool_Pickaxe_Steel.set(GT_ModHandler.getModItem(MOD_ID_RC, "tool.steel.pickaxe", 1L));
ItemList.Tool_Shovel_Steel.set(GT_ModHandler.getModItem(MOD_ID_RC, "tool.steel.shovel", 1L));
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
index ad97bb9572..851b84b5c3 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
@@ -9,11 +9,13 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IDebugableBlock;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IDebugableTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_Generic_Block;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.BaseTileEntity;
+import gregtech.api.metatileentity.CoverableTileEntity;
import gregtech.api.util.GT_BaseCrop;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
@@ -48,6 +50,7 @@ import java.util.Collections;
import java.util.List;
import static gregtech.GT_Mod.GT_FML_LOGGER;
+import static gregtech.api.enums.GT_Values.SIDE_UP;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
@Optional.Interface(iface = "com.cricketcraft.chisel.api.IFacade", modid = "ChiselAPI")
@@ -87,7 +90,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof BaseTileEntity)) {
((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
}
@@ -95,7 +98,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aBlock) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof BaseMetaPipeEntity)) {
((BaseMetaPipeEntity) tTileEntity).onNeighborBlockChange(aX, aY, aZ);
}
@@ -217,7 +220,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) {
super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2);
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
return tTileEntity != null && tTileEntity.receiveClientEvent(aData1, aData2);
}
@@ -225,7 +228,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void addCollisionBoxesToList(
World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity &&
((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
((IGregTechTileEntity) tTileEntity)
@@ -237,7 +240,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity &&
((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
@@ -248,7 +251,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity &&
((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
@@ -258,12 +261,9 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override //THIS
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) {
- TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ);
- if (tTileEntity instanceof IGregTechTileEntity &&
- (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity)
- .getCollisionBoundingBoxFromPool(
- ((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0);
+ final TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IGregTechTileEntity && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ final AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0);
minX = bbb.minX; //This essentially sets block bounds
minY = bbb.minY;
minZ = bbb.minZ;
@@ -282,7 +282,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity &&
((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
@@ -331,7 +331,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
return tTileEntity instanceof BaseMetaTileEntity &&
((BaseMetaTileEntity) tTileEntity).privateAccess() &&
!((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) ?
@@ -339,14 +339,13 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
}
@Override
- public boolean onBlockActivated(
- World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) {
return false;
}
if (aPlayer.isSneaking()) {
- ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
if (
tCurrentItem != null &&
!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) &&
@@ -369,7 +368,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer);
}
@@ -377,7 +376,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getMetaTileID();
}
@@ -386,10 +385,9 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof BaseMetaTileEntity) {
- GT_Log.exp.printf("Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n",
- aX, aY, aZ, aWorld.provider.dimensionId);
+ GT_Log.exp.printf("Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", aX, aY, aZ, aWorld.provider.dimensionId);
((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
}
super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion);
@@ -398,19 +396,20 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
- IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
+ final IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
mTemporaryTileEntity.set(tGregTechTileEntity);
if (!(tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_SuperChest || tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_QuantumChest)) {
for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) {
- ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
+ final ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) {
- EntityItem tItemEntity = new EntityItem(aWorld,
- aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F,
- aY + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F,
- aZ + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F,
- new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
+ final EntityItem tItemEntity = new EntityItem(
+ aWorld,
+ aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F,
+ aY + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F,
+ aZ + 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());
}
@@ -430,12 +429,12 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) {
return ((IGregTechTileEntity) tTileEntity).getDrops();
}
- IGregTechTileEntity tGregTechTileEntity = mTemporaryTileEntity.get();
- ArrayList<ItemStack> tDrops;
+ final IGregTechTileEntity tGregTechTileEntity = mTemporaryTileEntity.get();
+ final ArrayList<ItemStack> tDrops;
if (tGregTechTileEntity == null) {
tDrops = (ArrayList<ItemStack>) Collections.<ItemStack>emptyList();
} else {
@@ -459,7 +458,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide);
}
@@ -471,7 +470,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
if (aSide < 0 || aSide > 5) {
return 0;
}
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
}
@@ -483,7 +482,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
if (aSide < 0 || aSide > 5) {
return 0;
}
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
}
@@ -493,7 +492,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
if (!aWorld.isRemote) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && (chance < 1.0F)) {
if (tTileEntity instanceof BaseMetaTileEntity && (GregTech_API.sMachineNonWrenchExplosions)) {
GT_Log.exp.printf("Explosion at : %d | %d | %d DIMID: %s NonWrench picking/Rain!%n",
@@ -511,7 +510,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) {
return true;
}
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null) {
if (tTileEntity instanceof BaseMetaTileEntity) {
return true;
@@ -543,7 +542,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
}
@@ -552,7 +551,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof BaseMetaTileEntity) {
return ((BaseMetaTileEntity) tTileEntity).getLightValue();
}
@@ -571,7 +570,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
public float getExplosionResistance(
Entity par1Entity, World aWorld, int aX, int aY, int aZ,
double explosionX, double explosionY, double explosionZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6);
}
@@ -591,58 +590,24 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (!(tTileEntity instanceof IGregTechTileEntity)) {
- return;
- }
- IGregTechTileEntity iGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
- if (aPlayer == null) {
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.UP.ordinal());
- return;
- }
- int yawQuadrant = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- int pitch = Math.round(aPlayer.rotationPitch);
- if (pitch >= 65 && iGregTechTileEntity.isValidFacing((byte) ForgeDirection.UP.ordinal())) {
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.UP.ordinal());
- return;
- }
- if (pitch <= -65 && iGregTechTileEntity.isValidFacing((byte) ForgeDirection.DOWN.ordinal())) {
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.DOWN.ordinal());
- return;
- }
- switch (yawQuadrant) {
- case 0:
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.NORTH.ordinal());
- break;
- case 1:
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.EAST.ordinal());
- break;
- case 2:
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.SOUTH.ordinal());
- break;
- case 3:
- iGregTechTileEntity.setFrontFacing((byte) ForgeDirection.WEST.ordinal());
- break;
- default:
- break;
- }
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (!(tTileEntity instanceof IGregTechTileEntity)) return;
+ final IGregTechTileEntity iGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
+ iGregTechTileEntity.setFrontFacing(BaseTileEntity.getSideForPlayerPlacing(aPlayer, SIDE_UP, iGregTechTileEntity.getValidFacings()));
}
@Override
- public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
- TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
- if (tTileEntity instanceof BaseMetaTileEntity) {
- return ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
- }
- if (tTileEntity instanceof BaseMetaPipeEntity) {
- return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
+ public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
+ final TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof IDebugableTileEntity) {
+ return ((IDebugableTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
}
return (ArrayList<String>) Collections.<String>emptyList();
}
@Override
public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) {
if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((~aColor) & 0xF)) {
return false;
@@ -655,18 +620,18 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public Block getFacade(IBlockAccess aWorld, int aX, int aY, int aZ, int side) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity instanceof IGregTechTileEntity) {
- byte aSide = (byte) side;
- IGregTechTileEntity tile = (IGregTechTileEntity) tTileEntity;
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof CoverableTileEntity) {
+ final byte aSide = (byte) side;
+ final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity;
if (side != -1) {
- Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile);
+ final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile);
if (facadeBlock != null) return facadeBlock;
} else {
// we do not allow more than one type of facade per block, so no need to check every side
// see comment in gregtech.common.covers.GT_Cover_FacadeBase.isCoverPlaceable
for (byte i = 0; i < 6; i++) {
- Block facadeBlock = tile.getCoverBehaviorAtSideNew(i).getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile);
+ final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i).getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile);
if (facadeBlock != null) {
return facadeBlock;
}
@@ -678,19 +643,19 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
public int getFacadeMetadata(IBlockAccess aWorld, int aX, int aY, int aZ, int side) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity instanceof IGregTechTileEntity) {
- byte aSide = (byte) side;
- IGregTechTileEntity tile = (IGregTechTileEntity) tTileEntity;
+ final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity instanceof CoverableTileEntity) {
+ final byte aSide = (byte) side;
+ final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity;
if (side != -1) {
- Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile);
+ final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile);
if (facadeBlock != null)
return tile.getCoverBehaviorAtSideNew(aSide).getFacadeMeta(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile);
} else {