diff options
| author | miozune <miozune@gmail.com> | 2023-06-30 09:23:45 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-30 09:23:45 +0900 |
| commit | 5036c2adee48f43f1772c0574ba6627f44455615 (patch) | |
| tree | 982f905c667f065fd830691ba12a2612bf8630ee /src/main/java/gtPlusPlus/xmod/gregtech/common | |
| parent | 904c9429c742d7e9e84fdeb584fe4c4ed2625bcd (diff) | |
| download | GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.tar.gz GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.tar.bz2 GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.zip | |
Remove Breaker Box (#683)
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
4 files changed, 1 insertions, 1377 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 2af07b1ea2..757b3eb3bf 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -1,54 +1,20 @@ package gtPlusPlus.xmod.gregtech.common; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - 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.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; import gregtech.api.enums.TAE; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.util.GTPP_Recipe; import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.LangUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; import gtPlusPlus.xmod.gregtech.common.helpers.MachineUpdateHandler; import ic2.core.init.BlocksItems; @@ -56,51 +22,16 @@ import ic2.core.init.InternalName; public class Meta_GT_Proxy { - 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<BaseCustomTileEntity> sBaseMetaTileEntityClass; - private static Class<BaseCustomPower_MTE> sBaseMetaTileEntityClass2; - public static AchievementHandler mAssemblyAchievements; - public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>(); - - @SideOnly(Side.CLIENT) - public static IIconRegister sBlockIcons, sItemIcons; - public Meta_GT_Proxy() {} - public static Block sBlockMachines; - public static void preInit() { - - // New GT++ Block, yay! (Progress) - // sBlockMachines = new GTPP_Block_Machines(); fixIC2FluidNames(); - - 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.err.println( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - CORE.crash( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - } - - GT_Log.out.println("GT++ Mod: Registering custom BaseMetaTileEntities."); - GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); - GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); CoverManager.generateCustomCovers(); } public static void init() { - setValidHeatingCoilMetas(); PollutionUtils.setPollutionFluids(); fixIC2FluidNames(); Utils.registerEvent(new MachineUpdateHandler()); @@ -160,454 +91,4 @@ public class Meta_GT_Proxy { } } - - public static boolean generatePlasmaRecipesForAdvVacFreezer() { - - AutoMap<GT_Recipe> aFreezerMapRebaked = new AutoMap<GT_Recipe>(); - AutoMap<GT_Recipe> aRemovedRecipes = new AutoMap<GT_Recipe>(); - - // Find recipes containing Plasma and map them - for (GT_Recipe y : GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList) { - if (y.mFluidInputs.length > 0) { - for (FluidStack r : y.mFluidInputs) { - if (r.getUnlocalizedName().toLowerCase().contains("plasma")) { - aRemovedRecipes.put(y); - continue; - } - } - aFreezerMapRebaked.put(y); - } - } - - AutoMap<GTPP_Recipe> aNewRecipes = new AutoMap<GTPP_Recipe>(); - int aAtomicMass = 0; - int aAtomicTier = 0; - - final FluidStack NULL_PLASMA = Materials._NULL.getPlasma(1); - - for (String s : ELEMENT.NAMES) { - - aAtomicMass++; - aAtomicTier = (aAtomicMass / 30) + 1; - FluidStack aMoltenFluid = null; - FluidStack aPlasma = null; - - // Try Get Material via Gregtech - Materials aGregMaterial = MaterialUtils.getMaterial(s); - if (aGregMaterial != null) { - aMoltenFluid = aGregMaterial.getMolten(1); - if (aMoltenFluid == null) { - aMoltenFluid = aGregMaterial.getFluid(1); - if (aMoltenFluid == null) { - aMoltenFluid = aGregMaterial.getGas(1); - if (aMoltenFluid == null) { - aMoltenFluid = aGregMaterial.getSolid(1); - } - } - } - aPlasma = aGregMaterial.getPlasma(100); - } - - // Just wildcard values - if (aMoltenFluid == null || aPlasma == null) { - if (aMoltenFluid == null) { - aMoltenFluid = FluidUtils.getWildcardFluidStack(s, 1); - } - if (aPlasma == null) { - aPlasma = FluidUtils.getFluidStack("plasma." + s.toLowerCase(), 1); - } - } - - // Skip this material - if (aMoltenFluid == null || aPlasma == null || aPlasma.isFluidEqual(NULL_PLASMA)) { - Logger.INFO( - "Could not generate Advanced Vacuum Freezer recipe. Cooling " + s - + " plasma. Molten Form Exists? " - + (aMoltenFluid != null) - + " | Plasma Exists? " - + (aPlasma != null)); - continue; - } else { - // Build a new plasma recipe - int aTotalTickTime = (20 * 1 + (aAtomicMass)); - GTPP_Recipe aTempRecipe = new GTPP_Recipe( - true, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] { 10000 }, - new FluidStack[] { aPlasma, FluidUtils.getFluidStack("cryotheum", aTotalTickTime) }, - new FluidStack[] { aMoltenFluid }, - aTotalTickTime, - (int) GT_Values.V[4 + aAtomicTier], - aAtomicMass); - - // Add it to the map if it's valid - if (aTempRecipe != null) { - aNewRecipes.put(aTempRecipe); - } - } - } - - // Add the new recipes to the map we will rebake over the original - for (GTPP_Recipe w : aNewRecipes) { - aFreezerMapRebaked.put(w); - } - - // Best not touch the original map if we don't have a valid map to override it with. - if (aFreezerMapRebaked.size() > 0) { - - int aOriginalCount = GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size(); - - // Empty the original map - GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.clear(); - - // Rebake the real map - for (GT_Recipe w : aFreezerMapRebaked) { - GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.add(w); - } - - return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size() >= aOriginalCount; - } - - return false; - } - - 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); - CORE.crash( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - 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); - CORE.crash( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - throw new RuntimeException(e); - } - } - } - - public static void setValidHeatingCoilMetas() { - for (int i = 0; i <= 6; i++) { - GT_ValidHeatingCoilMetas.put(i); - } - for (int i = 7; i <= 8; i++) { - GT_ValidHeatingCoilMetas.put(i); - } - } - - static GT_Proxy[] mProxies = new GT_Proxy[2]; - - public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { - mCustomGregtechMetaTooltips.put(aNbtTagName, aData); - } - - public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List<Object> aList, - boolean par4) { - try { - int tDamage = aStack.getItemDamage(); - if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { - return; - } - - if (GregTech_API.METATILEENTITIES[tDamage] != null) { - IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); - if (tTileEntity.getDescription() != null) { - int i = 0; - for (String tDescription : tTileEntity.getDescription()) { - if (GT_Utility.isStringValid(tDescription)) { - if (tDescription.contains("%%%")) { - String[] tString = tDescription.split("%%%"); - if (tString.length >= 2) { - StringBuffer tBuffer = new StringBuffer(); - Object tRep[] = new String[tString.length / 2]; - for (int j = 0; j < tString.length; j++) if (j % 2 == 0) tBuffer.append(tString[j]); - else { - tBuffer.append(" %s"); - tRep[j / 2] = tString[j]; - } - aList.add( - String.format( - GT_LanguageManager.addStringLocalization( - "TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, - tBuffer.toString(), - !GregTech_API.sPostloadFinished), - tRep)); - } - } else { - String tTranslated = GT_LanguageManager.addStringLocalization( - "TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, - tDescription, - !GregTech_API.sPostloadFinished); - aList.add(tTranslated.equals("") ? tDescription : tTranslated); - } - } else i++; - } - } - - 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); } - * if (tTileEntity.getOutputVoltage() > 0L) { - * aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", - * !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" - * + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY); - * } if (tTileEntity.getOutputAmperage() > 1L) { - * 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) { - if (aNBT.getBoolean("mMuffler")) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_MUFFLER", - "has Muffler Upgrade", - !GregTech_API.sPostloadFinished)); - } - if (aNBT.getBoolean("mSteamConverter")) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_STEAMCONVERTER", - "has Steam Upgrade", - !GregTech_API.sPostloadFinished)); - } - int tAmount = 0; - if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add( - tAmount + " " - + GT_LanguageManager.addStringLocalization( - "GT_TileEntity_STEAMTANKS", - "Steam Tank Upgrades", - !GregTech_API.sPostloadFinished)); - } - - FluidStack afluid = net.minecraftforge.fluids.FluidStack - .loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - if (afluid != null) { - int tFluidAmount = afluid.amount; - if (tFluidAmount > 0) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_FLUIDTANK", - "Tank Fluid: " + tFluidAmount + "L " + afluid.getLocalizedName() + "", - !GregTech_API.sPostloadFinished)); - } - } - } - - // 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/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java deleted file mode 100644 index 732dfb2ae8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java +++ /dev/null @@ -1,578 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.ArrayList; -import java.util.List; - -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; - -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.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.util.GT_Utility; -import gregtech.common.blocks.GT_Material_Machines; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; - -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; - } - - @Override - 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"; - } - } - - @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) { - ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); - } - } - - @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))) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - } - } - - @Override - 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; - } - - @Override - 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; - } - - @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; - } - - @Override - public int getRenderType() { - return GTPP_Render_MachineBlock.INSTANCE == null ? super.getRenderType() - : GTPP_Render_MachineBlock.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; - } - - @Override - public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - 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; - } - - @Override - public boolean canProvidePower() { - return true; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(World aWorld, int aMeta) { - return this.createTileEntity(aWorld, aMeta); - } - - @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int ordinalSide) { - return BlockIcons.MACHINE_LV_SIDE.getIcon(); - } - - @Override - public IIcon getIcon(int ordinalSide, int aMeta) { - return 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; - } - - @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); - } else { - 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); - return tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null - ? ((IGregTechTi |
