aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java243
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java19
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java534
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java229
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java278
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java659
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java372
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java26
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java40
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java12
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java209
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java2
35 files changed, 2374 insertions, 307 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index 25997e5d35..0556a7f4fe 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -2,6 +2,8 @@ package gtPlusPlus.xmod.gregtech.common;
import static gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow.mOverflowCache;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -10,23 +12,29 @@ import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
+import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Proxy;
+import gregtech.common.blocks.GT_Block_Machines;
+import gregtech.common.render.GT_Renderer_Block;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.ObjMap;
@@ -34,25 +42,153 @@ import gtPlusPlus.api.objects.minecraft.FormattedTooltipString;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.reflect.ProxyFinder;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE;
+import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines;
+import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock;
public class Meta_GT_Proxy {
+ static {
+ instance = new Meta_GT_Proxy();
+ Logger.INFO("GT_PROXY - initialized.");
+ }
+
+ public static final Meta_GT_Proxy instance;
+
public static List<Runnable> GT_BlockIconload = new ArrayList<>();
public static List<Runnable> GT_ItemIconload = new ArrayList<>();
public static AutoMap<Integer> GT_ValidHeatingCoilMetas = new AutoMap<Integer>();
+
+ private static Class sBaseMetaTileEntityClass;
+ private static Class sBaseMetaTileEntityClass2;
public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>();
+
@SideOnly(Side.CLIENT)
public static IIconRegister sBlockIcons, sItemIcons;
public Meta_GT_Proxy() {
- Logger.INFO("GT_PROXY - initialized.");
+
+ }
+
+ public static Block sBlockMachines;
+
+ public void preInit() {
+
+ //New GT++ Block, yay! (Progress)
+ //sBlockMachines = new GTPP_Block_Machines();
+
+ GT_Log.out.println("GT++ Mod: Register TileEntities.");
+ BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity();
+ BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower();
+
+ GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity.");
+ if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) {
+ GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
+ throw new RuntimeException("");
+ }
+
+ GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity.");
+ GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP");
+ GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2");
+ }
+
+ public void init() {
scheduleCoverMapCleaner();
- setValidHeatingCoilMetas();
+ setValidHeatingCoilMetas();
}
+ public void postInit() {
+
+ }
+
+ public static TileEntity constructCustomGregtechMetaTileEntityByMeta(int aMeta) {
+ if (aMeta == 12) {
+ return Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower();
+ }
+ else {
+ return Meta_GT_Proxy.constructBaseMetaTileEntity();
+ }
+ }
+
+ public static BaseCustomTileEntity constructBaseMetaTileEntity() {
+ if (sBaseMetaTileEntityClass == null) {
+ try {
+ sBaseMetaTileEntityClass = BaseCustomTileEntity.class;
+ return (BaseCustomTileEntity) BaseCustomTileEntity.class.newInstance();
+ } catch (Throwable arg1) {
+ try {
+ Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomTileEntity) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ }
+ }
+ }
+ try {
+ return (BaseCustomTileEntity) ((BaseCustomTileEntity) sBaseMetaTileEntityClass.newInstance());
+ } catch (Throwable arg0) {
+ arg0.printStackTrace(GT_Log.err);
+ try {
+ Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomTileEntity) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ GT_Log.err
+ .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
+ e.printStackTrace(GT_Log.err);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public static BaseCustomPower_MTE constructBaseMetaTileEntityCustomPower() {
+ if (sBaseMetaTileEntityClass2 == null) {
+ try {
+ sBaseMetaTileEntityClass2 = BaseCustomPower_MTE.class;
+ return (BaseCustomPower_MTE) BaseCustomPower_MTE.class.newInstance();
+ } catch (Throwable arg1) {
+ try {
+ Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomPower_MTE) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ // e.printStackTrace();
+ }
+ }
+ }
+
+ try {
+ return (BaseCustomPower_MTE) ((BaseCustomPower_MTE) sBaseMetaTileEntityClass2.newInstance());
+ } catch (Throwable arg0) {
+ arg0.printStackTrace(GT_Log.err);
+ try {
+ Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0];
+ g.setAccessible(true);
+ return (BaseCustomPower_MTE) g.newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | SecurityException e) {
+ GT_Log.err
+ .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
+ e.printStackTrace(GT_Log.err);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+
+
+
+
+
+
+
public void setValidHeatingCoilMetas() {
for (int i = 0; i <= 6; i++ ) {
GT_ValidHeatingCoilMetas.put(i);
@@ -182,7 +318,74 @@ public class Meta_GT_Proxy {
}else i++;
}
}
- if (tTileEntity.getEUCapacity() > 0L) {
+
+
+
+ if (tTileEntity.getEUCapacity() > 0L) {
+
+ final long tVoltage = tTileEntity.getInputVoltage();
+ byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage)));
+
+ //Custom handling
+ if (tDamage < 30500 && tDamage >= 30400) {
+ int aOffset = tDamage - 30400;
+ if ((aOffset) <= 10) {
+ tTier -= 2;
+ aList.add(EnumChatFormatting.BOLD+"16"+" Fuse Slots"+EnumChatFormatting.GRAY);
+ aList.add("Per each fuse, you may insert "+EnumChatFormatting.YELLOW+(GT_Values.V[tTier])+EnumChatFormatting.GRAY+" EU/t");
+ aList.add("However this "+EnumChatFormatting.ITALIC+EnumChatFormatting.RED+"MUST"+EnumChatFormatting.GRAY+" be in a single Amp");
+ aList.add("This machine can accept upto a single amp of "+GT_Values.VN[Math.min(tTier+2, 12)]+" as a result");
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Breaker_Loss", "Breaker Loss: "+EnumChatFormatting.RED+""+(GT_Values.V[Math.max(tTier-1, 0)]/10)+EnumChatFormatting.GRAY+" EU/t", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Special_Power_1", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+
+ if (tTileEntity.getInputVoltage() > 0L) {
+ String inA = "0";
+ if (tTileEntity.getInputAmperage() >= 1L) {
+ inA = " at " + EnumChatFormatting.YELLOW + tTileEntity.getInputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ else {
+ inA = " at " + EnumChatFormatting.WHITE + tTileEntity.getInputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ String a1 = "Voltage IN: "+EnumChatFormatting.GREEN + tTileEntity.getInputVoltage()
+ + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")"
+ + EnumChatFormatting.GRAY + inA;
+ aList.add(a1);
+ }
+
+ if (tTileEntity.getOutputVoltage() > 0L) {
+ String outA = "0";
+ if (tTileEntity.getOutputAmperage() >= 1L) {
+ outA = " at " + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ else {
+ outA = " at " + EnumChatFormatting.WHITE + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps";
+ }
+ String a1 = "Voltage OUT: "+EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage()
+ + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")"
+ + EnumChatFormatting.GRAY + outA;
+ aList.add(a1);
+ }
+
+
+ if (tTileEntity.getOutputVoltage() > 0L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+""+(tDamage < 30500 && tDamage >= 30400 ? 0 : 1), !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY);
+ }
+
+ if (tTileEntity.getEUCapacity() > 0) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE2",
+ "Internal Capacity: ", !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE
+ + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY + " EU");
+ }
+ }
+
+ /*if (tTileEntity.getEUCapacity() > 0L) {
if (tTileEntity.getInputVoltage() > 0L) {
aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY);
}
@@ -193,7 +396,8 @@ public class Meta_GT_Proxy {
aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY);
}
aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY);
- }
+ }*/
+
}
NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) {
@@ -216,15 +420,28 @@ public class Meta_GT_Proxy {
}
}
- //Add Custom Tooltips
- for (String s : mCustomGregtechMetaTooltips.keySet()) {
- if (aNBT.hasKey(s)) {
- String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s));
- aList.add(aTip);
- }
- }
-
}
+
+ //Add Custom Here
+
+ //Add Custom Tooltips
+ for (String s : mCustomGregtechMetaTooltips.keySet()) {
+ if (aNBT.hasKey(s)) {
+ String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s));
+ aList.add(aTip);
+ }
+ }
+
+ //Add GT++ Stuff
+
+ if (tDamage >= 30400 && tDamage < 30500) {
+ aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine");
+ }
+ if ((tDamage >= 750 && tDamage < 1000) || (tDamage >= 30000 && tDamage < 31000)) {
+ aList.add(CORE.GT_Tooltip);
+ }
+
+
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
index 4313ca53f6..c1db39b132 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
@@ -17,9 +17,13 @@ import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
public class StaticFields59 {
@@ -31,6 +35,7 @@ public class StaticFields59 {
public static final Field mCasingTexturePages;
public static final Method mCalculatePollutionReduction;
+ public static final Method mAddFurnaceRecipe;
private static final Map<String, Materials> mMaterialCache = new LinkedHashMap<String, Materials>();
@@ -46,6 +51,20 @@ public class StaticFields59 {
mCasingTexturePages = getField(BlockIcons.class, "casingTexturePages");
mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction", int.class);
+
+ Logger.INFO("Initializing a recipe handler for different versions of Gregtech 5.");
+ //Yep...
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ Logger.INFO("Selecting GT 5.7/5.8 Recipe Set");
+ mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class);
+ }
+ else {
+ Logger.INFO("Selecting GT 5.9 Recipe Set");
+ mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class);
+ }
+
+
+
}
public static synchronized final Block getBlockCasings5() {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java
new file mode 100644
index 0000000000..c62d47e904
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java
@@ -0,0 +1,534 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.IDebugableBlock;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+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.objects.XSTR;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.blocks.GT_Item_Machines;
+import gregtech.common.blocks.GT_Material_Machines;
+import gregtech.common.render.GT_Renderer_Block;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.Explosion;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GTPP_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider {
+ public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>();
+
+ public GTPP_Block_Machines() {
+ super(GTPP_Item_Machines.class, "gtpp.blockmachines", new GT_Material_Machines());
+ GregTech_API.registerMachineBlock(this, -1);
+ this.setHardness(1.0F);
+ this.setResistance(10.0F);
+ this.setStepSound(soundTypeMetal);
+ this.setCreativeTab(GregTech_API.TAB_GREGTECH);
+ this.isBlockContainer = true;
+ }
+
+ public String getHarvestTool(int aMeta) {
+ switch (aMeta / 4) {
+ case 0 :
+ return "wrench";
+ case 1 :
+ return "wrench";
+ case 2 :
+ return "cutter";
+ case 3 :
+ return "axe";
+ default :
+ return "wrench";
+ }
+ }
+
+ public int getHarvestLevel(int aMeta) {
+ return aMeta % 4;
+ }
+
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ 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) {
+ ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
+ }
+
+ }
+
+ 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))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+
+ }
+
+ public String getUnlocalizedName() {
+ int tDamage = 0;
+ String aUnlocalName = (tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length)
+ ? (GregTech_API.METATILEENTITIES[tDamage] != null
+ ? ("gtpp.blockmachines.name" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName())
+ : ("gtpp.blockmachines.name")) : "";
+
+ Logger.INFO("Unlocal Name: "+aUnlocalName);
+ return aUnlocalName;
+ }
+
+ public String getLocalizedName() {
+ String aName = StatCollector.translateToLocal(this.getUnlocalizedName() + ".name");;
+ if (aName.toLowerCase().contains(".name")) {
+ aName = StatCollector.translateToLocal(getUnlocalizedName() + ".name");
+ }
+ if (aName.toLowerCase().contains(".name")) {
+ aName = StatCollector.translateToLocal("gt.blockmachines" + ".name");
+ }
+ if (aName.toLowerCase().contains(".name")) {
+ aName = "BAD";
+ }
+ Logger.INFO("Name: "+aName);
+ return aName;
+ }
+
+ public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return 0;
+ }
+
+ 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;
+ }
+
+ public int getRenderType() {
+ return GTPP_Render_MachineBlock.INSTANCE == null ? super.getRenderType() : GTPP_Render_MachineBlock.INSTANCE.mRenderID;
+ }
+
+ public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
+ return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0;
+ }
+
+ public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0;
+ }
+
+ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) {
+ return true;
+ }
+
+ public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean hasTileEntity(int aMeta) {
+ return true;
+ }
+
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public boolean canProvidePower() {
+ return true;
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ public TileEntity createNewTileEntity(World aWorld, int aMeta) {
+ return this.createTileEntity(aWorld, aMeta);
+ }
+
+ public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
+ return BlockIcons.MACHINE_LV_SIDE.getIcon();
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ return BlockIcons.MACHINE_LV_SIDE.getIcon();
+ }
+
+ 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;
+ }
+
+ 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);
+ } else {
+ super.addCollisionBoxesToList(aWorld