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_Proxy.java6
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Machines.java387
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Material_Machines.java2
-rw-r--r--src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java3
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java11
-rw-r--r--src/main/java/gregtech/common/render/GT_Renderer_Block.java102
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java64
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java28
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java2
11 files changed, 374 insertions, 238 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 181dc9fe2b..e4e3592eb3 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -253,6 +253,12 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean gt6Cable = true;
public boolean ic2EnergySourceCompat = true;
public boolean costlyCableConnection = false;
+
+ /**
+ * This enables ambient-occlusion smooth lighting on tiles
+ */
+ public boolean mRenderTileAmbientOcclusion = true;
+
public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15
public static Map<String, Integer> oreDictBurnTimes = new HashMap<>();
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 993f9baf38..0d673a020e 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
@@ -39,13 +39,15 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider {
- public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal();
+ private static final ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<>();
+ private boolean renderAsNormalBlock;
public GT_Block_Machines() {
super(GT_Item_Machines.class, "gt.blockmachines", new GT_Material_Machines());
@@ -55,8 +57,11 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
setStepSound(soundTypeMetal);
setCreativeTab(GregTech_API.TAB_GREGTECH);
this.isBlockContainer = true;
+ this.renderAsNormalBlock = true;
+ this.useNeighborBrightness = true;
}
+ @Override
public String getHarvestTool(int aMeta) {
if (aMeta >= 8 && aMeta <= 11) {
return "cutter";
@@ -64,14 +69,17 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
return "wrench";
}
+ @Override
public int getHarvestLevel(int aMeta) {
return aMeta % 4;
}
+ @Override
protected boolean canSilkHarvest() {
return false;
}
+ @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);
if ((tTileEntity instanceof BaseTileEntity)) {
@@ -79,6 +87,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);
if ((tTileEntity instanceof BaseMetaPipeEntity)) {
@@ -86,6 +95,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
}
}
+ @Override
public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
super.onBlockAdded(aWorld, aX, aY, aZ);
if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
@@ -93,22 +103,27 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
}
}
+ @Override
public String getUnlocalizedName() {
return "gt.blockmachines";
}
+ @Override
public String getLocalizedName() {
return StatCollector.translateToLocal(getUnlocalizedName() + ".name");
}
+ @Override
public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
return 0;
}
+ @Override
public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0) ? 100 : 0;
+ return GregTech_API.sMachineFlammable && (aWorld.getBlockMetadata(aX, aY, aZ) == 0) ? 100 : 0;
}
+ @Override
public int getRenderType() {
if (GT_Renderer_Block.INSTANCE == null) {
return super.getRenderType();
@@ -116,80 +131,109 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
return GT_Renderer_Block.INSTANCE.mRenderID;
}
+ @Override
public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
+ return GregTech_API.sMachineFlammable && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
}
+ @Override
public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
+ return GregTech_API.sMachineFlammable && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
}
+ @Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
+ @Override
public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) {
return true;
}
+ @Override
public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
+ @Override
public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
+ @Override
public boolean hasTileEntity(int aMeta) {
return true;
}
+ @Override
public boolean hasComparatorInputOverride() {
return true;
}
+ @Override
public boolean renderAsNormalBlock() {
- return false;
+ return renderAsNormalBlock;
+ }
+
+ public GT_Block_Machines setRenderAsNormalBlock(boolean aBool) {
+ renderAsNormalBlock = aBool;
+ return this;
}
+ @Override
public boolean canProvidePower() {
return true;
}
+ @Override
public boolean isOpaqueCube() {
return false;
}
+ @Override
public TileEntity createNewTileEntity(World aWorld, int aMeta) {
return createTileEntity(aWorld, aMeta);
}
+ @SideOnly(Side.CLIENT)
+ @Override
public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
}
+ @SideOnly(Side.CLIENT)
+ @Override
public IIcon getIcon(int aSide, int aMeta) {
return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
}
+ @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);
- return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false;
+ return tTileEntity != null && tTileEntity.receiveClientEvent(aData1, aData2);
}
- public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) {
+ @SuppressWarnings("unchecked") // Old API uses raw List type
+ @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);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
+ if (tTileEntity instanceof IGregTechTileEntity &&
+ ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
+ ((IGregTechTileEntity) tTileEntity)
+ .addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
return;
}
super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
}
+ @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ if (tTileEntity instanceof IGregTechTileEntity &&
+ ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
@@ -197,10 +241,10 @@ 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)
- {
+ public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ if (tTileEntity instanceof IGregTechTileEntity &&
+ ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
}
return super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ);
@@ -209,27 +253,32 @@ 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);
- minX=bbb.minX;//This essentially sets block bounds
- minY=bbb.minY;
- minZ=bbb.minZ;
- maxX=bbb.maxX;
- maxY=bbb.maxY;
- maxZ=bbb.maxZ;
+ if (tTileEntity instanceof IGregTechTileEntity &&
+ (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ 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;
+ maxX = bbb.maxX;
+ maxY = bbb.maxY;
+ maxZ = bbb.maxZ;
return;
}
- super.setBlockBoundsBasedOnState(blockAccess,aX,aY,aZ);
+ super.setBlockBoundsBasedOnState(blockAccess, aX, aY, aZ);
}
@Override
public void setBlockBoundsForItemRender() {
- super.setBlockBounds(0,0,0,1,1,1);
+ super.setBlockBounds(0, 0, 0, 1, 1, 1);
}
+ @Override
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ if (tTileEntity instanceof IGregTechTileEntity &&
+ ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) {
((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
return;
}
@@ -237,69 +286,74 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
}
@SideOnly(Side.CLIENT)
+ @Override
public void registerBlockIcons(IIconRegister aIconRegister) {
- if (GregTech_API.sPostloadFinished) {
- GT_Log.out.println("GT_Mod: Setting up Icon Register for Blocks");
- GregTech_API.sBlockIcons = aIconRegister;
-
- GT_Log.out.println("GT_Mod: Registering MetaTileEntity specific Textures");
- try {
- for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) {
- if (tMetaTileEntity != null) {
- tMetaTileEntity.registerIcons(aIconRegister);
- }
- }
- } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
- GT_Log.out.println("GT_Mod: Registering Crop specific Textures");
- try {
- for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) {
- tCrop.registerSprites(aIconRegister);
+ if (!GregTech_API.sPostloadFinished) return;
+ GT_Log.out.println("GT_Mod: Setting up Icon Register for Blocks");
+ GregTech_API.setBlockIconRegister(aIconRegister);
+
+ GT_Log.out.println("GT_Mod: Registering MetaTileEntity specific Textures");
+ try {
+ for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) {
+ if (tMetaTileEntity != null) {
+ tMetaTileEntity.registerIcons(aIconRegister);
}
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
}
- GT_Log.out.println("GT_Mod: Starting Block Icon Load Phase");
- GT_FML_LOGGER.info("GT_Mod: Starting Block Icon Load Phase");
- try {
- for (Runnable tRunnable : GregTech_API.sGTBlockIconload) {
- tRunnable.run();
- }
- } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
- GT_Log.out.println("GT_Mod: Finished Block Icon Load Phase");
- GT_FML_LOGGER.info("GT_Mod: Finished Block Icon Load Phase");
+ } catch (Exception e) {
+ e.printStackTrace(GT_Log.err);
}
+ GT_Log.out.println("GT_Mod: Registering Crop specific Textures");
+ try {
+ for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) {
+ tCrop.registerSprites(aIconRegister);
+ }
+ } catch (Exception e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ GT_Log.out.println("GT_Mod: Starting Block Icon Load Phase");
+ GT_FML_LOGGER.info("GT_Mod: Starting Block Icon Load Phase");
+ try {
+ for (Runnable tRunnable : GregTech_API.sGTBlockIconload) {
+ tRunnable.run();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ GT_Log.out.println("GT_Mod: Finished Block Icon Load Phase");
+ GT_FML_LOGGER.info("GT_Mod: Finished Block Icon Load Phase");
}
- public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
- return super.getBlockHardness(aWorld, aX, aY, aZ);
- }
-
+ @Override
public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof BaseMetaTileEntity)) && (((BaseMetaTileEntity) tTileEntity).privateAccess()) && (!((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true))) {
- return -1.0F;
- }
- return super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ);
+ return tTileEntity instanceof BaseMetaTileEntity &&
+ ((BaseMetaTileEntity) tTileEntity).privateAccess() &&
+ !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) ?
+ -1.0F : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ);
}
- public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
+ @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);
if (tTileEntity == null) {
return false;
}
- if(aPlayer.isSneaking()){
- ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
- if(tCurrentItem!=null){
- if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)){
- return false;
- }
- }
+ if (aPlayer.isSneaking()) {
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (
+ tCurrentItem != null &&
+ !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) &&
+ !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) &&
+ !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) &&
+ !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)
+ ) return false;
}
if ((tTileEntity instanceof IGregTechTileEntity)) {
if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) {
return false;
}
- if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) {
+ if ((!aWorld.isRemote) && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer)) {
return true;
}
return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, par2, par3);
@@ -307,46 +361,55 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
return false;
}
+ @Override
public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer);
}
}
+ @Override
public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getMetaTileID();
}
return 0;
}
+ @Override
public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
- GT_Log.exp.println("Explosion at :"+aX + " | " + aY+ " | " + aZ +" DIMID: " + aWorld.provider.dimensionId+ " due to near explosion!");
+ 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);
((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
}
super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion);
}
+ @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);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
mTemporaryTileEntity.set(tGregTechTileEntity);
for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) {
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()));
+ 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());
}
- tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
- tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D);
- tItemEntity.motionZ = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
+ tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.05D);
+ tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.25D);
+ tItemEntity.motionZ = (XSTR_INSTANCE.nextGaussian() * 0.05D);
aWorld.spawnEntityInWorld(tItemEntity);
tItem.stackSize = 0;
tGregTechTileEntity.setInventorySlotContents(i, null);
@@ -357,65 +420,76 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
aWorld.removeTileEntity(aX, aY, aZ);
}
+ @Override
public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) {
return ((IGregTechTileEntity) tTileEntity).getDrops();
}
- return mTemporaryTileEntity.get() == null ? new ArrayList() : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops();
+ IGregTechTileEntity tGregTechTileEntity = mTemporaryTileEntity.get();
+ ArrayList<ItemStack> tDrops;
+ if (tGregTechTileEntity == null) {
+ tDrops = (ArrayList<ItemStack>) Collections.<ItemStack>emptyList();
+ } else {
+ tDrops = tGregTechTileEntity.getDrops();
+ mTemporaryTileEntity.remove();
+ }
+ return tDrops;
}
+
@Override
public boolean removedByPlayer(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, boolean aWillHarvest) {
- if (aWillHarvest) {
- return true; // This delays deletion of the block until after getDrops
- } else {
- return super.removedByPlayer(aWorld, aPlayer, aX, aY, aZ, false);
- }
+ // This delays deletion of the block until after getDrops
+ return aWillHarvest || super.removedByPlayer(aWorld, aPlayer, aX, aY, aZ, false);
}
@Override
- public void harvestBlock(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, int aMeta)
- {
+ public void harvestBlock(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, int aMeta) {
super.harvestBlock(aWorld, aPlayer, aX, aY, aZ, aMeta);
aWorld.setBlockToAir(aX, aY, aZ);
}
-
+
+ @Override
public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide);
}
return 0;
}
+ @Override
public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
- if ((aSide < 0) || (aSide > 5)) {
+ if (aSide < 0 || aSide > 5) {
return 0;
}
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
}
return 0;
}
+ @Override
public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
- if ((aSide < 0) || (aSide > 5)) {
+ if (aSide < 0 || aSide > 5) {
return 0;
}
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
}
return 0;
}
+ @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);
- if ((tTileEntity != null) && (chance < 1.0F)) {
- if (((tTileEntity instanceof BaseMetaTileEntity)) && (GregTech_API.sMachineNonWrenchExplosions)) {
- GT_Log.exp.println("Explosion at :"+aX + " | " + aY+ " | " + aZ +" DIMID: "+ aWorld.provider.dimensionId+ " due to NonWrench picking/Rain!");
+ 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",
+ aX, aY, aZ, aWorld.provider.dimensionId);
((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
}
} else {
@@ -424,44 +498,60 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
}
}
+ @Override
public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) {
if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) {
return true;
}
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null) {
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
- return true;
- }
- if (((tTileEntity instanceof BaseMetaPipeEntity)) && ((((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0)) {
+ if (tTileEntity instanceof BaseMetaTileEntity) {
return true;
}
- if (((tTileEntity instanceof ICoverable)) && (((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0)) {
+ if (tTileEntity instanceof BaseMetaPipeEntity &&
+ (((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0) {
return true;
}
+ return tTileEntity instanceof ICoverable &&
+ ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0;
}
return false;
}
+ @Override
+ public boolean isBlockNormalCube() {
+ return true;
+ }
+
+ /**
+ * Returns the default ambient occlusion value based on block opacity
+ */
+ @SideOnly(Side.CLIENT)
+ @Override
+ public float getAmbientOcclusionLightValue()
+ {
+ return this.renderAsNormalBlock() ? 0.2F : 0.5F;
+ }
+
+ @Override
public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return 0;
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
}
return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
}
+ @Override
public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
+ if (tTileEntity instanceof BaseMetaTileEntity) {
return ((BaseMetaTileEntity) tTileEntity).getLightValue();
}
return 0;
}
+ @Override
public TileEntity createTileEntity(World aWorld, int aMeta) {
if (aMeta < 4) {
return GregTech_API.constructBaseMetaTileEntity();
@@ -469,76 +559,87 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
return new BaseMetaPipeEntity();
}
- public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) {
+ @Override
+ 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);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6);
}
return 10.0F;
}
@SideOnly(Side.CLIENT)
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
+ @Override
+ @SuppressWarnings("unchecked") // Old API uses raw List type
+ public void getSubBlocks(Item par1Item, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) {
if (GregTech_API.METATILEENTITIES[i] != null) {
- par3List.add(new ItemStack(par1, 1, i));
+ par3List.add(new ItemStack(par1Item, 1, i));
}
}
}
+ @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 == null) {
+ if (!(tTileEntity instanceof IGregTechTileEntity)) {
return;
}
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity;
- if (aPlayer == null) {
- var6.setFrontFacing((byte) 1);
- } else {
- int var7 = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- int var8 = Math.round(aPlayer.rotationPitch);
- if ((var8 >= 65) && (var6.isValidFacing((byte) 1))) {
- var6.setFrontFacing((byte) 1);
- } else if ((var8 <= -65) && (var6.isValidFacing((byte) 0))) {
- var6.setFrontFacing((byte) 0);
- } else {
- switch (var7) {
- case 0:
- var6.setFrontFacing((byte) 2);
- break;
- case 1:
- var6.setFrontFacing((byte) 5);
- break;
- case 2:
- var6.setFrontFacing((byte) 3);
- break;
- case 3:
- var6.setFrontFacing((byte) 4);
- }
- }
- }
+ 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;
}
}
- public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
+ @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)) {
+ if (tTileEntity instanceof BaseMetaTileEntity) {
return ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
}
- if ((tTileEntity instanceof BaseMetaPipeEntity)) {
+ if (tTileEntity instanceof BaseMetaPipeEntity) {
return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
}
- return null;
+ 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);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((aColor ^ 0xFFFFFFFF) & 0xF)) {
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((~aColor) & 0xF)) {
return false;
}
- ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((aColor ^ 0xFFFFFFFF) & 0xF));
+ ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((~aColor) & 0xF));
return true;
}
return false;
diff --git a/src/main/java/gregtech/common/blocks/GT_Material_Machines.java b/src/main/java/gregtech/common/blocks/GT_Material_Machines.java
index 8de7421dc4..b9a78f02b3 100644
--- a/src/main/java/gregtech/common/blocks/GT_Material_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Material_Machines.java
@@ -12,6 +12,6 @@ public class GT_Material_Machines extends Material {
}
public boolean isOpaque() {
- return false;
+ return true;
}
}
diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java
index 5cdb042551..3bc59a7402 100644
--- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java
+++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java
@@ -9,7 +9,6 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_StdRenderedTexture;
-import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
@@ -282,6 +281,6 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
return new ITexture[]{((GT_Block_Ores_Abstract) aBlock).getTextureSet()[((this.mMetaData / 1000) % 16)], aIconSet};
}
}
- return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_RenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex])};
+ return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_StdRenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex])};
}
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
index f8784d570f..4ddc54e2a1 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
@@ -18,6 +18,7 @@ import net.minecraftforge.fluids.IFluidHandler;
public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
public final int mTransferRate;
+ private boolean allowFluid = false;
public GT_Cover_FluidRegulator(int aTransferRate) {
this.mTransferRate = aTransferRate;
@@ -36,15 +37,16 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
if (aCoverVariable > 0) {
tTank2 = aTileEntity.getITankContainerAtSide(aSide);
tTank1 = (IFluidHandler) aTileEntity;
- directionFrom = ForgeDirection.UNKNOWN;
+ directionFrom = ForgeDirection.getOrientation(aSide);
directionTo = ForgeDirection.getOrientation(aSide).getOpposite();
} else {
tTank1 = aTileEntity.getITankContainerAtSide(aSide);
tTank2 = (IFluidHandler) aTileEntity;
directionFrom = ForgeDirection.getOrientation(aSide).getOpposite();
- directionTo = ForgeDirection.UNKNOWN;
+ directionTo = ForgeDirection.getOrientation(aSide);
}
if (tTank1 != null && tTank2 != null) {
+ allowFluid = true;
FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aCoverVariable), false);
if (tLiquid != null) {
tLiquid = tLiquid.copy();
@@ -53,6 +55,7 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
tTank2.fill(directionTo, tTank1.drain(directionFrom, tLiquid.amount, true), true);
}
}
+ allowFluid = false;
}
}
return aCoverVariable;
@@ -120,11 +123,11 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
}
public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
- return false;
+ return allowFluid;
}
public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
- return false;
+ return allowFluid;
}
public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
index 4c6a237818..6cb161fcb8 100644
--- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java
+++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
@@ -2,6 +2,7 @@ package gregtech.common.render;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -12,6 +13,7 @@ import gregtech.common.blocks.GT_Block_Machines;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
@@ -420,101 +422,84 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) {
- return;
- }
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) return;
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ));
}
- if (aIcon != null) {
- for (ITexture iTexture : aIcon) {
- if (iTexture != null) {
- iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ);
- }
+ if (aIcon == null) return;
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ);
}
}
}
public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1))) {
- return;
- }
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1))) return;
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ));
}
- if (aIcon != null) {
- for (ITexture iTexture : aIcon) {
- if (iTexture != null) {
- iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ);
- }
+ if (aIcon == null) return;
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ);
}
}
}
public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2))) {
- return;
- }
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2))) return;
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ));
}
- if (aIcon != null) {
- for (ITexture iTexture : aIcon) {
- if (iTexture != null) {
- iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ);
- }
+ if (aIcon == null) return;
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ);
}
}
}
public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3))) {
- return;
- }
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3))) return;
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ));
}
- if (aIcon != null) {
- for (ITexture iTexture : aIcon) {
- if (iTexture != null) {
- iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ);
- }
+ if (aIcon == null) return;
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ);
}
}
}
public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4))) {
- return;
- }
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4))) return;
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ));
}
- if (aIcon != null) {
- for (ITexture iTexture : aIcon) {
- if (iTexture != null) {
- iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ);
- }
+ if (aIcon == null) return;
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ);
}
}
}
public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5))) {
- return;
- }
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5))) return;
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ));
}
- if (aIcon != null) {
- for (ITexture iTexture : aIcon) {
- if (iTexture != null) {
- iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ);
- }
+ if (aIcon == null) return;
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ);
}
}
}
public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) {
+ aRenderer.enableAO = false;
if ((aBlock instanceof GT_Block_Machines)) {
if ((aMeta > 0) && (aMeta < GregTech_API.METATILEENTITIES.length) && (GregTech_API.METATILEENTITIES[aMeta] != null) &&
(!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) {
@@ -566,15 +551,18 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
}
public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) {
- TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (aTileEntity == null) {
- return false;
- }
- if (aTileEntity instanceof IGregTechTileEntity && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer))) {
- return true;
- }
- if ((aTileEntity instanceof IPipeRenderedTileEntity)) {
- return renderPipeBlock(aWorld, aX, aY, aZ, aBlock, (IPipeRenderedTileEntity) aTileEntity, aRenderer);
+ aRenderer.enableAO = Minecraft.isAmbientOcclusionEnabled() && GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion;
+ TileEntity tileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tileEntity == null) return false;
+ if (tileEntity instanceof IGregTechTileEntity) {
+ IMetaTileEntity metaTileEntity;
+ if ((metaTileEntity = ((IGregTechTileEntity) tileEntity).getMetaTileEntity()) != null &&
+ metaTileEntity.renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer)) {
+ return true;
+ }
+ }
+ if ((tileEntity instanceof IPipeRenderedTileEntity)) {
+ return renderPipeBlock(aWorld, aX, aY, aZ, aBlock, (IPipeRenderedTileEntity) tileEntity, aRenderer);
}
return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
index 38f36ca936..34f99510ea 100644
--- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
+++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
@@ -32,11 +32,11 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc
public GT_MetaTileEntity_Hatch_OutputBus_ME(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 1, new String[]{
- "Item Output for Multiblocks", "Stores directly into ME"});
+ "Item Output for Multiblocks", "Stores directly into ME"}, 0);
}
public GT_MetaTileEntity_Hatch_OutputBus_ME(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aDescription, aTextures);
+ super(aName, aTier, aDescription, 0, aTextures);
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index 9b9442fef2..755fae8bce 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -2,10 +2,7 @@ package gregtech.common.tileentities.machines.basic;
import com.google.common.collect.ArrayListMultimap;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -31,8 +28,33 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachine {
+
public GT_MetaTileEntity_Disassembler(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 1, "Disassembles Machines at " + Math.min(50 + 10 * aTier,100) + "% Efficiency", 1, 9, "Disassembler.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER));
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 1,
+ new String[]{
+ "Disassembles Machines up to " + GT_Values.TIER_COLORS[aTier] + GT_Values.VOLTAGE_NAMES[aTier],
+ "Can also disassemble most assembler recipes!"
+ },
+ 1,
+ 9,
+ "Disassembler.png",
+ "",
+
+ //Textures
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER)
+ );
}
public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
@@ -179,36 +201,30 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi
inputsStacks = recipesColl.stream()
.map(x -> x.mInputs)
.collect(Collectors.toSet());
- ItemStack input = inputs[i];
- ItemData data = GT_OreDictUnificator.getItemData(input);
- if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) {
- output[i] = input;
- continue;
- }
- handleReplacement(inputsStacks, data, output, input, i);
+ handleRecipeTransformationInternal(inputs, output, inputsStacks, i);
}
addOthersAndHandleAlwaysReplace(inputs, output);
}
/**
* Public Interface for ReverseRecipes, do not call inside of this class.
- * @param inputs
- * @param output
- * @param inputsStacks
*/
public static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks) {
- for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) {
- ItemStack input = inputs[i];
- ItemData data = GT_OreDictUnificator.getItemData(input);
- if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) {
- output[i] = input;
- continue;
- }
- handleReplacement(inputsStacks, data, output, input, i);
- }
+ for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++)
+ handleRecipeTransformationInternal(inputs, output, inputsStacks, i);
addOthersAndHandleAlwaysReplace(inputs, output);
}
+ private static void handleRecipeTransformationInternal(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks, int i) {
+ ItemStack input = inputs[i];
+ ItemData data = GT_OreDictUnificator.getItemData(input);
+ if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) {
+ output[i] = input;
+ return;
+ }
+ handleReplacement(inputsStacks, data, output, input, i);
+ }
+
private static void addOthersAndHandleAlwaysReplace(ItemStack[] inputs, ItemStack[] output){
for (int i = 0; i < inputs.length; i++) {
//Adds rest of Items
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index 0eb4092e26..52a256f5a3 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -215,9 +215,16 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
if (!this.wasPumping) {
tMovedOneDown = moveOneDown();
if (!tMovedOneDown) {
- getBaseMetaTileEntity().disableWorking();
- if (debugBlockPump) {
- GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks");
+ if (canMoveDown(getBaseMetaTileEntity().getXCoord(), Math.max(getYOfPumpHead() - 1, 1), getBaseMetaTileEntity().getZCoord())) {
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: No pipe left. Idle for a little longer.");
+ }
+ this.mPumpTimer = 160;
+ } else {
+ getBaseMetaTileEntity().disableWorking();
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks");
+ }
}
} else if (debugBlockPump) {
GT_Log.out.println("PUMP: Moved down");
@@ -530,6 +537,21 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
this.mSecondaryPumpedBlock = null;
}
+ /** only check if block below can be replaced with pipe tip. pipe stockpile condition is ignored */
+ private boolean canMoveDown(int aX, int aY, int aZ) {
+ if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), aX, aY, aZ, true)) return false;
+
+ Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
+
+ return GT_Utility.isBlockValid(aBlock) &&
+ (aBlock == Blocks.water ||
+ aBlock == Blocks.flowing_water ||
+ aBlock == Blocks.lava ||
+ aBlock == Blocks.flowing_lava ||
+ aBlock instanceof IFluidBlock ||
+ aBlock.isAir(getBaseMetaTileEntity().getWorld(), aX, aY, aZ));
+ }
+
private boolean consumeFluid(int aX, int aY, int aZ) {
// Try to consume a fluid at a location
// Returns true if something was consumed, otherwise false
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index c90df2a7a7..c13d537119 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -253,6 +253,7 @@ public class GT_MetaTileEntity_AssemblyLine
}
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mDataAccessHatches.clear();
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
if (xDir != 0) {
@@ -435,4 +436,4 @@ public class GT_MetaTileEntity_AssemblyLine
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
index 7c6168bacb..1876a16c1b 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
@@ -21,7 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-@Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2")
+@Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true)
public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEMonitor<appeng.api.storage.data.IAEItemStack> {
private Map<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> listeners = null;
public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) {