diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
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, aX, aY, aZ, inputAABB, outputAABB, collider); + } + } + + 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 + ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) + : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + + @SideOnly(Side.CLIENT) + public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null + ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) + : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + + 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); + this.minX = bbb.minX; + this.minY = bbb.minY; + this.minZ = bbb.minZ; + this.maxX = bbb.maxX; + this.maxY = bbb.maxY; + this.maxZ = bbb.maxZ; + } else { + super.setBlockBoundsBasedOnState(blockAccess, aX, aY, aZ); + } + } + + public void setBlockBoundsForItemRender() { + super.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + 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) { + ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + } else { + super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + } + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister aIconRegister) { + + } + + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return super.getBlockHardness(aWorld, aX, aY, aZ); + } + + public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(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) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity == null) { + return false; + } else { + if (aPlayer.isSneaking()) { + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if (tCurrentItem == null) { + return false; + } + + if (!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) + && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { + return false; + } + } + + return tTileEntity instanceof IGregTechTileEntity + ? (((IGregTechTileEntity) tTileEntity).getTimer() < 50L + ? false + : (!aWorld.isRemote && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer) + ? true + : ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, + par2, par3))) + : false; + } + } + + public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity) { + ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); + } + + } + + public int getDamageValue(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileID() : 0; + } + + public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof BaseMetaTileEntity) { + ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + } + + super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); + } + + 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) { + IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; + XSTR tRandom = new XSTR(); + 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, + (double) ((float) aX + tRandom.nextFloat() * 0.8F + 0.1F), + (double) ((float) aY + tRandom.nextFloat() * 0.8F + 0.1F), + (double) ((float) aZ + tRandom.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 = tRandom.nextGaussian() * 0.0500000007450581D; + tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D; + tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581D; + aWorld.spawnEntityInWorld(tItemEntity); + tItem.stackSize = 0; + tGregTechTileEntity.setInventorySlotContents(i, (ItemStack) null); + } + } + } + + super.breakBlock(aWorld, aX, aY, aZ, par5, par6); + aWorld.removeTileEntity(aX, aY, aZ); + } + + public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getDrops() + : (mTemporaryTileEntity.get() == null + ? new ArrayList() + : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops()); + } + + public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide) + : 0; + } + + public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + if (aSide >= 0 && aSide <= 5) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)) + : 0; + } else { + return 0; + } + } + + public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + if (aSide >= 0 && aSide <= 5) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity) + .getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)) + : 0; + } else { + return 0; + } + } + + 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) { + ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + } + } else { + super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7); + } + } + + } + + public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { + if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) { + return true; + } else { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null) { + if (tTileEntity instanceof BaseMetaTileEntity) { + return true; + } + + if (tTileEntity instanceof BaseMetaPipeEntity + && (((BaseMetaPipeEntity) tTileEntity).mConnections & -64) != 0) { + return true; + } + + if (tTileEntity instanceof ICoverable + && ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0) { + return true; + } + } + + return false; + } + } + + public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity == null + ? 0 + : (tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getLightOpacity() + : (aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0)); + } + + public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof BaseMetaTileEntity ? ((BaseMetaTileEntity) tTileEntity).getLightValue() : 0; + } + + public TileEntity createTileEntity(World aWorld, int aMeta) { + return (TileEntity) (aMeta >= 4 ? Meta_GT_Proxy.constructBaseMetaTileEntity() : Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); + } + + 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); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6) + : 10.0F; + } + + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 100; ++i) { + if (GregTech_API.METATILEENTITIES[(30400 + i)] != null) { + par3List.add(new ItemStack(par1, 1, i)); + } + } + + } + + 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) { + IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity; + if (aPlayer == null) { + var6.setFrontFacing((byte) 1); + } else { + int var7 = MathHelper.floor_double((double) (aPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + 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); + } + } + } + } + + } + } + + public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) { + TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof BaseMetaTileEntity + ? ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel) + : (tTileEntity instanceof BaseMetaPipeEntity + ? ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel) + : null); + } + + 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 & 15)) { + return false; + } else { + ((IGregTechTileEntity) tTileEntity).setColorization((byte) (~aColor & 15)); + return true; + } + } else { + return false; + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java new file mode 100644 index 0000000000..ba3b05ff8e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java @@ -0,0 +1,229 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_ItsNotMyFaultException; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class GTPP_Item_Machines extends ItemBlock { + public GTPP_Item_Machines(Block par1) { + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.setCreativeTab(GregTech_API.TAB_GREGTECH); + } + + @SuppressWarnings("unchecked") + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) { + try { + int e = this.getDamage(aStack) + 30400; //Add Offset + if (e <= 0 || e >= GregTech_API.METATILEENTITIES.length) { + return; + } + + if (GregTech_API.METATILEENTITIES[e] != null) { + + IGregTechTileEntity aNBT = GregTech_API.METATILEENTITIES[e].getBaseMetaTileEntity(); + + final long tVoltage = aNBT.getInputVoltage(); + byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage))); + + /*if (aNBT.getDescription() != null) { + int tAmount = 0; + String[] arg7 = aNBT.getDescription(); + int arg8 = arg7.length-1; + + if (arg7 != null && arg7.length > 0) { + for (String t : arg7) { + aList.add(t); + } + + } + else { + aList.add("ERROR"); + } + + for (int y = 0; y < arg8; y++) { + String tDescription = arg7[y]; + + if (tDescription != null) { + aList.add(tDescription+"|"+arg8); + continue; + } + else { + continue; + } + } + }*/ + + if (aNBT.getEUCapacity() > 0L) { + + //Custom handling + if ((e - 30400) <= 100) { + + + if ((e - 30400) <= 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 (aNBT.getInputVoltage() > 0L) { + String inA = "0"; + if (aNBT.getInputAmperage() >= 1L) { + inA = " at " + EnumChatFormatting.YELLOW + aNBT.getInputAmperage() + EnumChatFormatting.GRAY +" Amps"; + } + else { + inA = " at " + EnumChatFormatting.WHITE + aNBT.getInputAmperage() + EnumChatFormatting.GRAY +" Amps"; + } + String a1 = "Voltage IN: "+EnumChatFormatting.GREEN + aNBT.getInputVoltage() + + " (" + GT_Values.VN[GT_Utility.getTier(aNBT.getInputVoltage())] + ")" + + EnumChatFormatting.GRAY + inA; + aList.add(a1); + } + + if (aNBT.getOutputVoltage() > 0L) { + String outA = "0"; + if (aNBT.getOutputAmperage() >= 1L) { + outA = " at " + EnumChatFormatting.YELLOW + aNBT.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps"; + } + else { + outA = " at " + EnumChatFormatting.WHITE + aNBT.getOutputAmperage() + EnumChatFormatting.GRAY +" Amps"; + } + String a1 = "Voltage OUT: "+EnumChatFormatting.GREEN + aNBT.getOutputVoltage() + + " (" + GT_Values.VN[GT_Utility.getTier(aNBT.getOutputVoltage())] + ")" + + EnumChatFormatting.GRAY + outA; + aList.add(a1); + } + + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+"0", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); + + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE2", "Internal Capacity: ", + !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + aNBT.getEUCapacity() + + EnumChatFormatting.GRAY + " EU"); + } + } + + NBTTagCompound arg16 = aStack.getTagCompound(); + if (arg16 != null) { + if (arg16.getBoolean("mMuffler")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", + !GregTech_API.sPostloadFinished)); + } + + if (arg16.getBoolean("mSteamConverter")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", + "has Steam Upgrade", !GregTech_API.sPostloadFinished)); + } + + boolean arg17 = false; + byte arg18; + if ((arg18 = arg16.getByte("mSteamTanks")) > 0) { + aList.add(arg18 + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", + "Steam Tank Upgrades", !GregTech_API.sPostloadFinished)); + } + } + + + aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine"); + + } catch (Throwable arg15) { + arg15.printStackTrace(GT_Log.err); + } + + } + + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ) { + return false; + } + + public String getUnlocalizedName(ItemStack aStack) { + short tDamage = (short) (this.getDamage(aStack) + 30400); //Add Offset; + return tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length + ? (GregTech_API.METATILEENTITIES[tDamage] != null + ? "gtpp.blockmachines" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName() + : "") + : ""; + } + + public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + super.onCreated(aStack, aWorld, aPlayer); + short tDamage = (short) ((short) this.getDamage(aStack) + 30400); //Add Offset; + if (tDamage < 0 + || tDamage >= GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[tDamage] != null) { + GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer); + } + + } + + public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, + float hitX, float hitY, float hitZ, int aMeta) { + short tDamage = (short) ((short) this.getDamage(aStack) + 30400); //Add Offset; + if (tDamage > 0) { + if (GregTech_API.METATILEENTITIES[tDamage] == null) { + return false; + } + + byte tMetaData = 32; + //byte tMetaData = GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType(); + Logger.INFO("Using Meta: "+tMetaData+" for ID "+tDamage+" | "+GregTech_API.METATILEENTITIES[tDamage].getInventoryName()); + if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tMetaData, 3)) { + return false; + } + + if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) { + throw new GT_ItsNotMyFaultException( + "Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it."); + } + + if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) { + throw new GT_ItsNotMyFaultException( + "Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it."); + } + + IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null) { + tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage); + if (aPlayer != null) { + tTileEntity.setOwnerName(aPlayer.getDisplayName()); + } + + tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound()); + } + } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) { + return false; + } + + if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) { + this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack); + this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage); + } + + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index b54eb770ec..7f426f8abb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -292,6 +292,7 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregtechItemList.NanoTube_Finished.set(this.addItem(102, "Carbon Nanotubes", "Multi-walled Zigzag nanotubes, possibly Carbon's final form", new Object[0])); GregtechItemList.Carbyne_Tube_Finished.set(this.addItem(103, "Linear Acetylenic Carbon (LAC/Carbyne)", "LAC chains grown inside Multi-walled Carbon Nanotubes, highly stable", new Object[0])); GregtechItemList.Carbyne_Sheet_Finished.set(this.addItem(104, "Carbyne Composite Panel", "Nanotubes which contain LAC, arranged side by side and compressed further", new Object[0])); + GregtechItemList.Laser_Lens_Special.set(this.addItem(105, "Quantum Anomaly", "Probably should shoot it with lasers", new Object[0])); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java index 612defcb89..22ce41282f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -1,14 +1,45 @@ package gtPlusPlus.xmod.gregtech.common.render; -import static gtPlusPlus.GTplusplus.*; - +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigInteger; +import java.net.URL; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; import java.util.HashMap; +import java.util.Map; import java.util.UUID; +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import javax.xml.bind.DatatypeConverter; + +import org.apache.commons.io.IOUtils; import org.lwjgl.opengl.GL11; import com.mojang.authlib.GameProfile; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.CORE.ConfigSwitches; +import gtPlusPlus.core.proxy.ClientProxy; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.data.FileUtils; +import gtPlusPlus.core.util.sys.NetworkUtils; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderManager; @@ -17,110 +48,122 @@ import net.minecraft.potion.Potion; import net.minecraft.server.MinecraftServer; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.RenderPlayerEvent; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; +public class GTPP_CapeRenderer extends RenderPlayer { -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import net.minecraftforge.client.event.RenderPlayerEvent; + private final ResourceLocation[] mCapes = { + new ResourceLocation("miscutils:textures/OrangeHD.png"), + new ResourceLocation("miscutils:textures/FancyCapeHD.png"), + new ResourceLocation("miscutils:textures/TesterCapeHD.png"), + new ResourceLocation("miscutils:textures/DevCapeHD.png"), + new ResourceLocation("miscutils:textures/PatreonCapeHD.png") }; -public class GTPP_CapeRenderer -extends RenderPlayer { - private final ResourceLocation[] mCapes = {new ResourceLocation("miscutils:textures/OrangeHD.png"), new ResourceLocation("miscutils:textures/FancyCapeHD.png"), new ResourceLocation("miscutils:textures/TesterCapeHD.png"), new ResourceLocation("miscutils:textures/DevCapeHD.png"), new ResourceLocation("miscutils:textures/PatreonCapeHD.png")}; - - private static final HashMap<String, ResourceLocation> mLocalClientPlayerCache; + private final ArrayList<String> mData; - static { - mLocalClientPlayerCache = new HashMap<String, ResourceLocation>(); - } - public GTPP_CapeRenderer() { setRenderManager(RenderManager.instance); - BuildCapeList(); + downloadCapeList(); + ArrayList<String> aTemp = new ArrayList<String>(); + try { + aTemp = returnDatData(); + } + catch (Throwable t) { + aTemp = new ArrayList<String>(); + } + mData = aTemp; } private static boolean hasResourceChecked = false; + private boolean hasCape = false; + private ResourceLocation tResource = null; public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; - ResourceLocation tResource = null; - if (!ConfigSwitches.enableCustomCapes){ + if (!ConfigSwitches.enableCustomCapes) { aEvent.setCanceled(true); - return ; + Logger.INFO("A1"); + return; + } + + if (hasResourceChecked) { + if (!hasCape && !CORE.DEVENV) { + aEvent.setCanceled(true); + Logger.INFO("A2"); + return; + } } + // Make sure we don't keep checking on clients who dont have capes. + if (!hasResourceChecked) { - //Make sure we don't keep checking on clients who dont have capes. - if (!hasResourceChecked) { - AutoMap<Pair<String, ResourceLocation>> localGatherMap = new AutoMap<Pair<String, ResourceLocation>>(); - String mTemp = ""; - //If list's have not been built yet for some reason, we best do it now. - if (mDevCapes.size() <= 1) { - BuildCapeList(); - } - //Iterates all players in all lists, caches result. - for (Pair<String, String> mName : mOrangeCapes){ - mTemp = getPlayerName(mName.getKey(), mName.getValue()); - localGatherMap.put(new Pair<String, ResourceLocation>(mTemp, this.mCapes[0])); - } - for (Pair<String, String> mName : mMiscCapes){ - mTemp = getPlayerName(mName.getKey(), mName.getValue()); - localGatherMap.put(new Pair<String, ResourceLocation>(mTemp, this.mCapes[1])); - } - for (Pair<String, String> mName : mBetaTestCapes){ - mTemp = getPlayerName(mName.getKey(), mName.getValue()); - localGatherMap.put(new Pair<String, ResourceLocation>(mTemp, this.mCapes[2])); + // Time to Spliterate some data + Map<String, ResourceLocation> aPlayerData = new HashMap<String, ResourceLocation>(); + Map<String, String> aNameMap = new HashMap<String, String>(); + int i = 0; + for (String s : mData) { + String[] aSplit = s.split("@"); + int a[] = new int[] { 0, mCapes.length - 1 }; + int aID = Integer.parseInt(aSplit[1]); + String aPlayerName = this.getPlayerName("iteration-" + (i++), aSplit[0]); + aNameMap.put(aSplit[0], aPlayerName); + aPlayerData.put(aPlayerName, this.mCapes[Math.max(a[0], Math.min(aID, a[1]))]); + } + + // Set flag to only render this event if player has a cape. + for (String s : aNameMap.values()) { + if (s.toLowerCase().equals(ClientProxy.playerName)) { + hasCape = true; + tResource = aPlayerData.get(ClientProxy.playerName); + break; } - for (Pair<String, String> mName : mDevCapes){ - mTemp = getPlayerName(mName.getKey(), mName.getValue()); - localGatherMap.put(new Pair<String, ResourceLocation>(mTemp, this.mCapes[3])); + } + + // Dev capes for dev mode. + if (CORE.DEVENV) { + hasCape = true; + tResource = mCapes[3]; + } + + // Safety Check + if (tResource == null) { + if (aPlayerData.get(aPlayer.getDisplayName()) != null) { + tResource = aPlayerData.get(aPlayer.getDisplayName()); + } else { + hasCape = false; } - for (Pair<String, String> mName : mPatreonCapes){ - mTemp = getPlayerName(mName.getKey(), mName.getValue()); - localGatherMap.put(new Pair<String, ResourceLocation>(mTemp, this.mCapes[4])); - } - if (localGatherMap.size() > 0) { - for (Pair<String, ResourceLocation> p : localGatherMap) { - if (p != null) { - mLocalClientPlayerCache.put(p.getKey().toLowerCase(), p.getValue()); - } - } - } - //Only run once. + } + + // Only run once. hasResourceChecked = true; - } - - if (mLocalClientPlayerCache.size() > 0) { - String name = aPlayer.getDisplayName().toLowerCase(); - if (mLocalClientPlayerCache.containsKey(name)) { - tResource = mLocalClientPlayerCache.get(name); - } - } - - if (GT_Utility.getFullInvisibility(aPlayer) || aPlayer.isInvisible() || GT_Utility.getPotion(aPlayer, Integer.valueOf(Potion.invisibility.id).intValue())) { + } + + if (GT_Utility.getFullInvisibility(aPlayer) || aPlayer.isInvisible() + || GT_Utility.getPotion(aPlayer, Integer.valueOf(Potion.invisibility.id).intValue())) { aEvent.setCanceled(true); + Logger.INFO("A3"); return; } + float aPartialTicks = aEvent.partialRenderTick; - try { + try { if (tResource == null && CORE.DEVENV) { tResource = mCapes[3]; } - + if ((tResource != null) && (!aPlayer.getHideCape())) { bindTexture(tResource); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.0F, 0.125F); - double d0 = aPlayer.field_71091_bM + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) * aPartialTicks - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks); - double d1 = aPlayer.field_71096_bN + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) * aPartialTicks - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) * aPartialTicks); - double d2 = aPlayer.field_71097_bO + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) * aPartialTicks - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) * aPartialTicks); - float f6 = aPlayer.prevRenderYawOffset + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks; + double d0 = aPlayer.field_71091_bM + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) * aPartialTicks + - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks); + double d1 = aPlayer.field_71096_bN + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) * aPartialTicks + - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) * aPartialTicks); + double d2 = aPlayer.field_71097_bO + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) * aPartialTicks + - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) * aPartialTicks); + float f6 = aPlayer.prevRenderYawOffset + + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks; double d3 = MathHelper.sin(f6 * CORE.PI / 180.0F); double d4 = -MathHelper.cos(f6 * CORE.PI / 180.0F); float f7 = (float) d1 * 10.0F; @@ -136,7 +179,9 @@ extends RenderPlayer { f8 = 0.0F; } float f10 = aPlayer.prevCameraYaw + (aPlayer.cameraYaw - aPlayer.prevCameraYaw) * aPartialTicks; - f7 += MathHelper.sin((aPlayer.prevDistanceWalkedModified + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) * aPartialTicks) * 6.0F) * 32.0F * f10; + f7 += MathHelper.sin((aPlayer.prevDistanceWalkedModified + + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) * aPartialTicks) * 6.0F) + * 32.0F * f10; if (aPlayer.isSneaking()) { f7 += 25.0F; } @@ -156,34 +201,69 @@ extends RenderPlayer { private String getPlayerName(String name, String uuid) { try { - Logger.WORLD("[Capes++] Trying to UUID check "+name+"."); - if (uuid != null) { - if (uuid.length() > 0) { - UUID g = UUID.fromString(uuid); - if (g != null) { - Logger.WORLD("[Capes++] Mojang/Cache checking for "+name+"."); - GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152652_a(g); + Logger.WORLD("[Capes++] Trying to UUID check " + name + "."); + if (uuid != null) { + if (uuid.length() > 0) { + UUID g = UUID.fromString(uuid); + if (g != null) { + Logger.WORLD("[Capes++] Mojang/Cache checking for " + name + "."); + GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152652_a(g); + if (profile != null) { + Logger.INFO("[Capes++] Found for UUID check: " + profile.getName() + "."); + return profile.getName(); + } + } else { + g = UUID.fromString(uuid.replace("-", "")); + if (g != null) { + Logger.WORLD("[Capes++] Mojang/Cache checking for " + name + "."); + GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152652_a(g); + if (profile != null) { + Logger.INFO("[Capes++] Found for UUID check 2: " + profile.getName() + "."); + return profile.getName(); + } + } + } + } + } + if (name != null) { + if (name.length() > 0) { + Logger.WORLD("[Capes++] Mojang/Cache checking for " + name + "."); + GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a(name); if (profile != null) { - Logger.INFO("[Capes++] Found for UUID check: "+profile.getName()+"."); + Logger.INFO("[Capes++] Found for name check: " + profile.getName() + "."); return profile.getName(); - } + } } - } - } - if (name != null) { - if (name.length() > 0) { - Logger.WORLD("[Capes++] Mojang/Cache checking for "+name+"."); - GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a(name); - if (profile != null) { - Logger.INFO("[Capes++] Found for name check: "+profile.getName()+"."); - return profile.getName(); - } - } - } - Logger.WORLD("[Capes++] Failed UUID check for "+name+"."); + } + Logger.WORLD("[Capes++] Failed UUID check for " + name + "."); + } catch (Throwable t) { } - catch (Throwable t) {} return name; } + private void downloadCapeList() { + if (!NetworkUtils.checkNetworkIsAvailableWithValidInterface()) { + return; + } + try { + File dat = new File(Utils.getMcDir(), "GTPP.dat"); + if (FileUtils.doesFileExist(dat)) { + Date dateLastMod = new Date(dat.lastModified()); + Date dateNow = new Date(System.currentTimeMillis() - (7l * 24 * 60 * 60 * 1000)); + if (!dateLastMod.before(dateNow)) { + return; + } + } + InputStream inputStream = new URL("https://alkcorp.overminddl1.com/GTPP.dat").openStream(); + FileOutputStream fileOS = new FileOutputStream(dat); + IOUtils.copy(inputStream, fileOS); + + } catch (Throwable t) { + Logger.INFO("Unable to download GT++ cape list."); + } + } + + /* TODO: fix this stuff \u002a\u002f\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0044\u0061\u0074\u0044\u0061\u0074\u0061\u0028\u0029\u007b\u000a\u0009\u0009\u0046\u0069\u006c\u0065\u0020\u0064\u0061\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0046\u0069\u006c\u0065\u0028\u0055\u0074\u0069\u006c\u0073\u002e\u0067\u0065\u0074\u004d\u0063\u0044\u0069\u0072\u0028\u0029\u002c\u0020\u0022\u0047\u0054\u0050\u0050\u002e\u0064\u0061\u0074\u0022\u0029\u003b\u000a\u0009\u0009\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0020\u0048\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0028\u0029\u003b\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u0028\u0042\u0075\u0066\u0066\u0065\u0072\u0065\u0064\u0052\u0065\u0061\u0064\u0065\u0072\u0020\u0062\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0042\u0075\u0066\u0066\u0065\u0072\u0065\u0064\u0052\u0065\u0061\u0064\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0046\u0069\u006c\u0065\u0052\u0065\u0061\u0064\u0065\u0072\u0028\u0064\u0061\u0074\u0029\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u006c\u0069\u006e\u0065\u003b\u000a\u0009\u0009\u0009\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0028\u006c\u0069\u006e\u0065\u0020\u003d\u0020\u0062\u0072\u002e\u0072\u0065\u0061\u0064\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u0021\u003d\u0020\u006e\u0075\u006c\u006c\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0048\u002e\u0061\u0064\u0064\u0028\u006c\u0069\u006e\u0065\u0029\u003b\u000a\u0009\u0009\u0009\u007d\u000a\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0049\u004f\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u000a\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u0053\u0070\u006c\u0069\u0074\u0044\u0061\u0074\u0061\u0043\u0068\u0065\u0063\u006b\u005b\u005d\u0020\u003d\u0020\u0048\u002e\u0067\u0065\u0074\u0028\u0030\u0029\u002e\u0073\u0070\u006c\u0069\u0074\u0028\u0022\u0025\u0022\u0029\u003b\u000a\u0009\u0009\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0020\u0061\u0043\u006c\u0065\u0061\u006e\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0028\u0029\u003b\u000a\u0009\u0009\u0066\u006f\u0072\u0020\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0020\u003a\u0020\u0061\u0053\u0070\u006c\u0069\u0074\u0044\u0061\u0074\u0061\u0043\u0068\u0065\u0063\u006b\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0073\u0020\u0021\u003d\u0020\u006e\u0075\u006c\u006c\u0020\u0026\u0026\u0020\u0073\u002e\u006c\u0065\u006e\u0067\u0074\u0068\u0028\u0029\u0020\u003e\u0020\u0030\u0020\u0026\u0026\u0020\u0021\u0073\u002e\u0065\u0071\u0075\u0061\u006c\u0073\u0028\u0022\u0020\u0022\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0061\u0043\u006c\u0065\u0061\u006e\u0044\u0061\u0074\u0061\u002e\u0061\u0064\u0064\u0028\u0073\u0029\u003b\u000a\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u004d\u0041\u0049\u004e\u005f\u0053\u0054\u0041\u0054\u0049\u0043\u005f\u0049\u0056\u0020\u003d\u0020\u0022\u0030\u0031\u0030\u0030\u0030\u0030\u0030\u0031\u0020\u0030\u0031\u0030\u0031\u0030\u0030\u0031\u0022\u003b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u004d\u0041\u0049\u004e\u005f\u0053\u0054\u0041\u0054\u0049\u0043\u005f\u004b\u0045\u0059\u0020\u003d\u0020\u0022\u0030\u0031\u0030\u0030\u0030\u0031\u0030\u0030\u0020\u0030\u0031\u0031\u0030\u0031\u0031\u0031\u0022\u003b\u000a\u0009\u0009\u000a\u0009\u0009\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0020\u0061\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0041\u0072\u0072\u0061\u0079\u004c\u0069\u0073\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0028\u0029\u003b\u000a\u0009\u0009\u0066\u006f\u0072\u0020\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0068\u0020\u003a\u0020\u0061\u0043\u006c\u0065\u0061\u006e\u0044\u0061\u0074\u0061\u0029\u0020\u007b\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u003d\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0028\u0068\u002c\u0020\u004d\u0041\u0049\u004e\u005f\u0053\u0054\u0041\u0054\u0049\u0043\u005f\u0049\u0056\u002c\u0020\u004d\u0041\u0049\u004e\u005f\u0053\u0054\u0041\u0054\u0049\u0043\u005f\u004b\u0045\u0059\u0029\u003b\u000a\u0009\u0009\u0009\u0061\u0044\u0061\u0074\u0061\u002e\u0061\u0064\u0064\u0028\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0061\u0044\u0061\u0074\u0061\u003b\u0009\u0009\u000a\u0009\u007d\u000a\u0009\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u006d\u0064\u0035\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0069\u006e\u0070\u0075\u0074\u0029\u0020\u0074\u0068\u0072\u006f\u0077\u0073\u0020\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u007b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u006d\u0064\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u004d\u0044\u0035\u0022\u0029\u003b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u006d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u003d\u0020\u006d\u0064\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0069\u006e\u0070\u0075\u0074\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0029\u0029\u003b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0028\u0031\u002c\u0020\u006d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0029\u003b\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0066\u006f\u0072\u006d\u0061\u0074\u0028\u0022\u0025\u0030\u0033\u0032\u0078\u0022\u002c\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0029\u003b\u000a\u0009\u007d\u000a\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0069\u006e\u0069\u0074\u0043\u0069\u0070\u0068\u0065\u0072\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0069\u006e\u0074\u0020\u006d\u006f\u0064\u0065\u002c\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0056\u0065\u0063\u0074\u006f\u0072\u0053\u0074\u0072\u0069\u006e\u0067\u002c\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u000a\u0009\u0009\u0009\u0074\u0068\u0072\u006f\u0077\u0073\u0020\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u002c\u0020\u004e\u006f\u0053\u0075\u0063\u0068\u0050\u0061\u0064\u0064\u0069\u006e\u0067\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u002c\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u004b\u0065\u0079\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u002c\u000a\u0009\u0009\u0009\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0050\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u007b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0073\u006b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0028\u0074\u006f\u0042\u0079\u0074\u0065\u0041\u0072\u0072\u0061\u0079\u0028\u006d\u0064\u0035\u0028\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u0029\u002c\u0020\u0022\u0041\u0045\u0053\u0022\u0029\u003b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0049\u0076\u0050\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0053\u0070\u0065\u0063\u0020\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0056\u0065\u0063\u0074\u006f\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0049\u0076\u0050\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0053\u0070\u0065\u0063\u0028\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0056\u0065\u0063\u0074\u006f\u0072\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0029\u0029\u003b\u000a\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0041\u0045\u0053\u002f\u0043\u0046\u0042\u0038\u002f\u004e\u006f\u0050\u0061\u0064\u0064\u0069\u006e\u0067\u0022\u0029\u003b\u000a\u0009\u0009\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0069\u006e\u0069\u0074\u0028\u006d\u006f\u0064\u0065\u002c\u0020\u0073\u006b\u0065\u0079\u0053\u0070\u0065\u0063\u002c\u0020\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0056\u0065\u0063\u0074\u006f\u0072\u0029\u003b\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u003b\u000a\u0009\u007d\u000a\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0074\u006f\u0042\u0079\u0074\u0065\u0041\u0072\u0072\u0061\u0079\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0029\u0020\u007b\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0044\u0061\u0074\u0061\u0074\u0079\u0070\u0065\u0043\u006f\u006e\u0076\u0065\u0072\u0074\u0065\u0072\u002e\u0070\u0061\u0072\u0073\u0065\u0048\u0065\u0078\u0042\u0069\u006e\u0061\u0072\u0079\u0028\u0073\u0029\u003b\u000a\u0009\u007d\u000a\u0009\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061\u002c\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0056\u0065\u0063\u0074\u006f\u0072\u002c\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u0020\u007b\u000a\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0069\u006e\u0069\u0074\u0043\u0069\u0070\u0068\u0065\u0072\u0028\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0044\u0045\u0043\u0052\u0059\u0050\u0054\u005f\u004d\u004f\u0044\u0045\u002c\u0020\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0056\u0065\u0063\u0074\u006f\u0072\u002c\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u003b\u000a\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0042\u0079\u0074\u0065\u0041\u0072\u0072\u0061\u0079\u0020\u003d\u0020\u0042\u0061\u0073\u0065\u0036\u0034\u002e\u0067\u0065\u0074\u0044\u0065\u0063\u006f\u0064\u0065\u0072\u0028\u0029\u002e\u0064\u0065\u0063\u006f\u0064\u0065\u0028\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061\u0029\u003b\u000a\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0042\u0079\u0074\u0065\u0041\u0072\u0072\u0061\u0079\u0020\u003d\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0064\u006f\u0046\u0069\u006e\u0061\u006c\u0028\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0042\u0079\u0074\u0065\u0041\u0072\u0072\u0061\u0079\u0029\u003b\u000a\u0009\u0009\u0009\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0042\u0079\u0074\u0065\u0041\u0072\u0072\u0061\u0079\u002c\u0020\u0022\u0055\u0054\u0046\u0038\u0022\u0029\u003b\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061\u003b\u000a\u0009\u007d\u002f\u002a */ + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java new file mode 100644 index 0000000000..c884114b79 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java @@ -0,0 +1,659 @@ +package gtPlusPlus.xmod.gregtech.common.render; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; +import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import gregtech.common.blocks.GT_Block_Machines; +import gregtech.common.blocks.GT_Block_Ores_Abstract; +import gregtech.common.blocks.GT_TileEntity_Ores; +import gregtech.common.render.GT_Renderer_Block; +import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; + +public class GTPP_Render_MachineBlock extends GT_Renderer_Block { + + public static GTPP_Render_MachineBlock INSTANCE; + public final int mRenderID = RenderingRegistry.getNextAvailableRenderId(); + + public GTPP_Render_MachineBlock() { + INSTANCE = this; + RenderingRegistry.registerBlockHandler(this); + } + + private static ITexture[] getTexture(IMetaTileEntity arg0, int arg1, int arg2, int arg3, boolean arg4, boolean arg5) { + IGregTechTileEntity arg0b = arg0.getBaseMetaTileEntity(); + return arg0.getTexture(arg0b, (byte) arg1, (byte) arg2, (byte) arg3, arg4, arg5); + } + + private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) { + if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length) { + IMetaTileEntity tMetaTileEntity = GregTech_API.METATILEENTITIES[aMeta]; + if (tMetaTileEntity != null) { + aBlock.setBlockBoundsForItemRender(); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + if (tMetaTileEntity.getBaseMetaTileEntity() instanceof IPipeRenderedTileEntity) { + float tThickness = ((IPipeRenderedTileEntity) tMetaTileEntity.getBaseMetaTileEntity()) + .getThickNess(); + float sp = (1.0F - tThickness) / 2.0F; + aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 0, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 1, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 2, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 3, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 4, 9, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 5, 9, -1, true, false), + true); + Tessellator.instance.draw(); + } else { + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 0, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 1, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 2, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 3, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 4, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 5, 4, -1, true, false), + true); + Tessellator.instance.draw(); + } + + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + } + + public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + RenderBlocks aRenderer) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof ITexturedTileEntity + ? renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, + new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)}) + : false; + } + + public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + RenderBlocks aRenderer, ITexture[][] aTextures) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true); + return true; + } + + public static boolean renderPipeBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + IPipeRenderedTileEntity aTileEntity, RenderBlocks aRenderer) { + byte aConnections = aTileEntity.getConnections(); + if ((aConnections & 192) != 0) { + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } else { + float tThickness = aTileEntity.getThickNess(); + if (tThickness >= 0.99F) { + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } else { + float sp = (1.0F - tThickness) / 2.0F; + byte tConnections = 0; + + for (byte tIsCovered = 0; tIsCovered < 6; ++tIsCovered) { + if ((aConnections & 1 << tIsCovered) != 0) { + tConnections = (byte) (tConnections | 1 << (tIsCovered + 2) % 6); + } + } + + boolean[] arg14 = new boolean[6]; + + for (byte tIcons = 0; tIcons < 6; ++tIcons) { + arg14[tIcons] = aTileEntity.getCoverIDAtSide(tIcons) != 0; + } + + if (arg14[0] && arg14[1] && arg14[2] && arg14[3] && arg14[4] && arg14[5]) { + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } else { + ITexture[][] arg15 = new ITexture[6][]; + ITexture[][] tCovers = new ITexture[6][]; + + for (byte i = 0; i < 6; ++i) { + tCovers[i] = aTileEntity.getTexture(aBlock, i); + arg15[i] = aTileEntity.getTextureUncovered(i); + } + + if (tConnections == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } else if (tConnections == 3) { + aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } + } else if (tConnections == 12) { + aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, 1.0F, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + } + } else if (tConnections == 48) { + aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + } + } else { + if ((tConnections & 1) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + } else { + aBlock.setBlockBounds(0.0F, sp, sp, sp, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + } + } + + if ((tConnections & 2) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } else { + aBlock.setBlockBounds(sp + tThickness, sp, sp, 1.0F, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } + } + + if ((tConnections & 4) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + } else { + aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, sp, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + } + } + + if ((tConnections & 8) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + } else { + aBlock.setBlockBounds(sp, sp + tThickness, sp, sp + tThickness, 1.0F, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + } + } + + if ((tConnections & 16) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + } else { + aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, sp); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + } + } + + if ((tConnections & 32) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + } else { + aBlock.setBlockBounds(sp, sp, sp + tThickness, sp + tThickness, sp + tThickness, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + } + } + } + + if (arg14[0]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + } + + if (arg14[1]) { + aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + } + + if (arg14[2]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + } + + if (arg14[3]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + } + + if (arg14[4]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (arg14[5]) { + aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + return true; + } + } + } + } + + 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; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + 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; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + 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; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); + } + + aRenderer.flipTexture = !aFullBlock; + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + 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; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + 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; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + 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; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); + } + + aRenderer.flipTexture = !aFullBlock; + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { + aMeta += 30400; + if (aBlock instanceof GT_Block_Machines || aBlock instanceof GTPP_Block_Machines) { + if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length + && GregTech_API.METATILEENTITIES[aMeta] != null + && !GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer)) { + renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer); + } + } + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, + RenderBlocks aRenderer) { + TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return aTileEntity == null + ? false + : (aTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, + aBlock, aRenderer) + ? true + : (aTileEntity instanceof IPipeRenderedTileEntity + ? renderPipeBlock(aWorld, aX, aY, aZ, aBlock, + (IPipeRenderedTileEntity) aTileEntity, aRenderer) + : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); + } + + public boolean shouldRender3DInInventory(int aModel) { + return true; + } + + public int getRenderId() { + return this.mRenderID; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java index 8f7539f268..c97723b042 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java @@ -629,8 +629,7 @@ public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_Basi "Generates a Tesseract for the attached Inventory", "Connect with pipes to insert items", "Consumes "+TESSERACT_ENERGY_COST+"EU/t for same dimension transfers", - "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", - CORE.GT_Tooltip }; + "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java index f5cc4a0cd5..ed8b2db41f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java @@ -498,8 +498,7 @@ public class GT_MetaTileEntity_TesseractTerminal extends GT_MetaTileEntity_Basic "Connect with pipes to extract items or fluids", "Outputs from the back face", "Consumes "+TESSERACT_ENERGY_COST+"EU/t for same dimension transfers", - "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", - CORE.GT_Tooltip }; + "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java index faefea6bba..282268fb3d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java @@ -1,6 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.automation; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_ThreadedSuperBuffer; import gtPlusPlus.xmod.gregtech.api.gui.GUI_ThreadedSuperBuffer; import gtPlusPlus.xmod.gregtech.common.StaticFields59; @@ -22,7 +21,7 @@ public class GT_MetaTileEntity_ThreadedSuperBuffer extends GT_MetaTileEntity_Thr "Buffers up to 256 Item Stacks", "Use Screwdriver to regulate output stack size", "Consumes 1EU per moved Item", - CORE.GT_Tooltip}); + }); } public GT_MetaTileEntity_ThreadedSuperBuffer(final String aName, final int aTier, final int aInvSlotCount, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java index 542c90d977..a0ca249aec 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java @@ -53,7 +53,7 @@ public class GT_MetaTileEntity_Boiler_Base extends GT_MetaTileEntity_Boiler { return new String[]{ this.mDescription, "Consumes "+(mSteamPerSecond/160)+"L of water per second", - "Produces "+this.mPollutionPerSecond+" pollution/sec", CORE.GT_Tooltip}; + "Produces "+this.mPollutionPerSecond+" pollution/sec",}; } public ITexture getOverlayIcon() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 29c2eb963a..45a73f9e35 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -68,7 +68,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public String[] getDescription() { - return new String[]{this.mDescription, "Produces "+(this.getPollution()*20)+" pollution/sec", "Fuel Efficiency: "+this.getEfficiency() + "%", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Produces "+(this.getPollution()*20)+" pollution/sec", "Fuel Efficiency: "+this.getEfficiency() + "%"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index 27a576da8a..5ebdbf0ef8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -38,7 +38,7 @@ extends GT_MetaTileEntity_BasicGenerator @Override public String[] getDescription() { - return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java index 006d4b612c..f3fd95f0c1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java @@ -173,7 +173,7 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator "RTG changes output voltage depending on fuel", "Generates power at " + this.getEfficiency() + "% Efficiency per tick", "Output Voltage: "+this.getOutputTier()+" EU/t", - CORE.GT_Tooltip}; + }; } public GregtechMetaTileEntity_RTG(int aID, String aName, String aNameRegional, int aTier) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java index d557cbaa7d..1ee27afbf0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; - +import net.minecraft.util.EnumChatFormatting; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -48,7 +48,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Use Screwdriver to change voltage", CORE.GT_Tooltip}; + return new String[] {this.mDescription, "Use Screwdriver to change voltage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"}; } /* @@ -56,8 +56,8 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { */ @Override public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - CustomIcon g = TexturesGtBlock.Casing_Material_RedSteel; - CustomIcon h = TexturesGtBlock.Casing_Material_Grisium; + CustomIcon h = TexturesGtBlock.Casing_Material_RedSteel; + CustomIcon g = TexturesGtBlock.Casing_Material_Grisium; CustomIcon k; boolean j = MathUtils.isNumberEven(this.mTier); final ITexture[][][] rTextures = new ITexture[2][17][]; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java index e75106382a..129446c40d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java @@ -72,7 +72,7 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered String.format("Accelerating things (Radius: %d EU/t: %d Speed Bonus: x%d)", mTier, getEnergyDemand(mTier, false), mAccelerateStatic[mTier]), "Use a screwdriver to change mode", "To accelerate TileEntities, this machine has to be adjacent to it", - "This machine accepts up to 8 Amps", "Accelerating TileEntities doubles Energy-Demand", CORE.GT_Tooltip}; + "This machine accepts up to 8 Amps", "Accelerating TileEntities doubles Energy-Demand"}; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index a55876ac35..022dcaaef2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -2,19 +2,22 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.general.ItemAirFilter; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; @@ -26,10 +29,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_BasicMachine { - protected int mPollutionReduction = 0; + public int mPollutionReduction = 0; protected int mBaseEff = 2500; protected int mOptimalAirFlow = 0; protected boolean mHasPollution = false; @@ -38,9 +43,6 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi protected boolean mSaveRotor = false; - private int mDamageFactorLow = 5; - private float mDamageFactorHigh = (float) 0.6000000238418579; - public GregtechMetaAtmosphericReconditioner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 2, "Making sure you don't live in Gwalior - Uses 2A", 2, 0, "Recycler.png", "", new ITexture[]{ @@ -63,22 +65,31 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi super(aName, aTier, 2, aDescription, aTextures, 2, 0, aGUIName, aNEIName); }*/ + @SuppressWarnings("deprecation") @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMetaAtmosphericReconditioner(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName); } + @SuppressWarnings("deprecation") @Override public String[] getDescription() { + + boolean highTier = this.mTier >= 7; + + return new String[]{ this.mDescription, + highTier ? "Will attempt to remove 1/4 pollution from 8 surrounding chunks" : "", + highTier ? "If these chunks are not loaded, they will be ignored" : "", "Requires a turbine rotor and an Air Filter [T1/T2] to run.", "The turbine rotor must be manually inserted/replaced", - "Can be configured with a screwdriver to change modes", + "Can be configured with a soldering iron to change modes", "Low Efficiency: Removes half pollution, Turbine takes 50% dmg", "High Efficiency: Removes full pollution, Turbine takes 100% dmg", "Turbine Rotor will not break in LE mode", - CORE.GT_Tooltip}; + + }; } @Override @@ -97,7 +108,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi @Override public long maxAmperesIn() { - return 4; + return 2; } @Override @@ -129,42 +140,56 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Get Current Pollution Amount. int mCurrentPollution = getCurrentChunkPollution(); + boolean isIdle = true; //Get Inventory Item ItemStack stackRotor = this.mInventory[SLOT_ROTOR]; - ItemStack stackFilter = this.mInventory[SLOT_FILTER]; - - //Enable machine animation/graphic - if (this.mHasPollution && mCurrentPollution > 0 && hasRotor(stackRotor) && hasAirFilter(stackFilter)){ - aBaseMetaTileEntity.setActive(true); - } - else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ - aBaseMetaTileEntity.setActive(false); - } + ItemStack stackFilter = this.mInventory[SLOT_FILTER]; //Power Drain - long drainEU = V[mTier]; + long drainEU = maxEUInput() * maxAmperesIn(); if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU){ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits(drainEU, false)){ - //Utils.LOG_WARNING("Draining "+drainEU+" EU"); + isIdle = false; + } + else { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); } } else if (!aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU/4){ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits((drainEU/4), false)){ - //Utils.LOG_WARNING("Draining "+(drainEU/4)+" EU"); + isIdle = false; + } + else { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); } } else { aBaseMetaTileEntity.setActive(false); - } - - + this.sendSound((byte) -122); + } + //Only try once/sec. - if (aTick % 20L == 0L){ - + if (!isIdle && aTick % 20L == 0L){ + //Check if machine can work. if ((aBaseMetaTileEntity.isAllowedToWork())){ + //Enable machine animation/graphic + if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution){ + if (!this.getBaseMetaTileEntity().isActive()) { + aBaseMetaTileEntity.setActive(true); + } + } + else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ + if (!this.getBaseMetaTileEntity().isActive()) { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); + } + } + //If Active. if (aBaseMetaTileEntity.isActive()){ @@ -187,31 +212,35 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi Logger.WARNING("mOptimalAirFlow[1]:"+mOptimalAirFlow); //Calculate The Voltage we are running - long tVoltage = maxEUInput(); + long tVoltage = drainEU; byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); //Check Sides for Air, //More air means more pollution processing. int mAirSides = getFreeSpaces(); + int reduction = 0; + //If no sides are free, how will you process the atmosphere? if (mAirSides > 0){ - mPollutionReduction += (((mTier*2)*100)*mAirSides); //Was originally *100 - Logger.WARNING("mPollutionReduction[1]:"+mPollutionReduction); + reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); //Was originally *100 + Logger.WARNING("mPollutionReduction[1]:"+reduction); //I stole this code - mPollutionReduction = (MathUtils.safeInt((long)mPollutionReduction*this.mBaseEff)/100000)*mAirSides*tTier; - //Utils.LOG_WARNING("mPollutionReduction[2]:"+mPollutionReduction); - //mPollutionReduction = GT_Utility.safeInt((long)mPollutionReduction*this.mOptimalAirFlow/10000); - //Utils.LOG_WARNING("mPollutionReduction[3]:"+mPollutionReduction); + reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); + Logger.WARNING("reduction[2]:"+reduction); + reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + Logger.WARNING("reduction[3]:"+reduction); + mPollutionReduction = reduction; + //Set a temp to remove variable to aleviate duplicate code. int toRemove = 0; Logger.WARNING("mCurrentPollution[4]:"+mCurrentPollution); - if (mPollutionReduction <= mCurrentPollution){ + if (reduction <= mCurrentPollution){ //Clean some Air. - toRemove = mPollutionReduction; + toRemove = reduction; } else { //Makes sure we don't get negative pollution. @@ -236,22 +265,78 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Utils.LOG_WARNING("Wrong Tool metaitem Found."); } } - } + } + else if (!aBaseMetaTileEntity.isActive()) { + return; + } } //End of can work block. else { //Disable Machine. //aBaseMetaTileEntity.setActive(false); } } //End of 1/sec action block. + else { + + if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution && !isIdle && aBaseMetaTileEntity.isAllowedToWork()){ + aBaseMetaTileEntity.setActive(true); + } + else if (isIdle || !this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ + aBaseMetaTileEntity.setActive(false); + } + + } + if (this.getBaseMetaTileEntity().isActive()) { + if (MathUtils.randInt(0, 5) <= 2) { + this.sendSound((byte) -120); + } + } + } //End of is serverside block. } public int getCurrentChunkPollution(){ - return getCurrentChunkPollution(this.getBaseMetaTileEntity()); + int mCurrentChunkPollution = 0; + if (this.mTier < 7) { + mCurrentChunkPollution = PollutionUtils.getPollution(getBaseMetaTileEntity()); + } + else { + AutoMap<Chunk> aSurrounding = new AutoMap<Chunk>(); + World aWorld = this.getBaseMetaTileEntity().getWorld(); + int xPos = this.getBaseMetaTileEntity().getXCoord(); + int zPos = this.getBaseMetaTileEntity().getZCoord(); + Chunk a1 = aWorld.getChunkFromBlockCoords(xPos-32, zPos-32); + Chunk a2 = aWorld.getChunkFromBlockCoords(xPos-32, zPos); + Chunk a3 = aWorld.getChunkFromBlockCoords(xPos-32, zPos+32); + Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos-32); + Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos); + Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos+32); + Chunk c1 = aWorld.getChunkFromBlockCoords(xPos+32, zPos-32); + Chunk c2 = aWorld.getChunkFromBlockCoords(xPos+32, zPos); + Chunk c3 = aWorld.getChunkFromBlockCoords(xPos+32, zPos+32); + aSurrounding.put(a1); + aSurrounding.put(a2); + aSurrounding.put(a3); + aSurrounding.put(b1); + aSurrounding.put(b2); + aSurrounding.put(b3); + aSurrounding.put(c1); + aSurrounding.put(c2); + aSurrounding.put(c3); + for (Chunk r : aSurrounding) { + mCurrentChunkPollution += getPollutionInChunk(r); + } + } + if (mCurrentChunkPollution > 0){ + mHasPollution = true; + } + else { + mHasPollution = false; + } + return mCurrentChunkPollution; } - public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity){ - int mCurrentChunkPollution = PollutionUtils.getPollution(aBaseMetaTileEntity); + public int getPollutionInChunk(Chunk aChunk){ + int mCurrentChunkPollution = PollutionUtils.getPollution(aChunk); if (mCurrentChunkPollution > 0){ mHasPollution = true; } @@ -260,7 +345,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } return mCurrentChunkPollution; } - + public boolean hasRotor(ItemStack rotorStack){ if(rotorStack != null){ if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){ @@ -272,6 +357,22 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public boolean damageTurbineRotor(){ try{ + + boolean creativeRotor = false; + ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; + if (rotorStack == null) { + return false; + } + else { + if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + creativeRotor = true; + } + } + } + if(mInventory[SLOT_ROTOR].getItem() instanceof GT_MetaGenerated_Tool_01 && ((GT_MetaGenerated_Tool) mInventory[SLOT_ROTOR].getItem()).getToolStats(mInventory[SLOT_ROTOR]).getSpeedMultiplier()>0 && GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[SLOT_ROTOR]).mToolSpeed>0 ) { @@ -280,16 +381,16 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi double fDam = Math.floor(Math.abs(MathUtils.randFloat(1f, 2f) - MathUtils.randFloat(1f, 2f)) * (1f + 2f - 1f) + 1f); damageValue -= fDam; - //Logger.INFO("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); + //Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); /*Materials M1 = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[this.SLOT_ROTOR]); Materials M2 = GT_MetaGenerated_Tool.getSecondaryMaterial(this.mInventory[this.SLOT_ROTOR]); - Logger.INFO("Trying to do "+damageValue+" damage to the rotor. [2]");*/ + Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. [2]");*/ //Damage Rotor //int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage(); - long rotorDamage = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); - long rotorDurabilityMax = GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); + long rotorDamage = creativeRotor ? 0 : GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); + long rotorDurabilityMax = creativeRotor ? Integer.MAX_VALUE : GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); long rotorDurability = (rotorDurabilityMax - rotorDamage); Logger.WARNING("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability); if (rotorDurability >= damageValue){ @@ -297,6 +398,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi if (!mSaveRotor){ Logger.WARNING("Damaging Rotor."); + + if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null); long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); @@ -310,6 +413,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { Logger.WARNING("Damaging Rotor."); if (rotorDurability > 1000){ + if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue/2, 0, null); long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); if (tempDur < rotorDurabilityMax){ @@ -324,7 +428,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } - if (rotorDurability <= 0 && !mSaveRotor) { + if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) { Logger.WARNING("Destroying Rotor."); this.mInventory[this.SLOT_ROTOR] = null; return false; @@ -372,14 +476,92 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } public boolean removePollution(int toRemove){ + + if (this == null || this.getBaseMetaTileEntity() == null || this.getBaseMetaTileEntity().getWorld() == null) { + return false; + } + + if (this.mTier < 7) { + int startPollution = getCurrentChunkPollution(); + PollutionUtils.removePollution(this.getBaseMetaTileEntity(), toRemove); + int after = getCurrentChunkPollution(); + return (after<startPollution); + } + else { + int chunksWithRemoval = 0; + int totalRemoved = 0; + AutoMap<Chunk> aSurrounding = new AutoMap<Chunk>(); + Chunk aThisChunk = this.getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord()); + int mainChunkX = aThisChunk.xPosition; + int mainChunkZ = aThisChunk.zPosition; + + World aWorld = this.getBaseMetaTileEntity().getWorld(); + int xPos = this.getBaseMetaTileEntity().getXCoord(); + int zPos = this.getBaseMetaTileEntity().getZCoord(); + + Chunk a1 = aWorld.getChunkFromBlockCoords(xPos-32, zPos-32); + Chunk a2 = aWorld.getChunkFromBlockCoords(xPos-32, zPos); + Chunk a3 = aWorld.getChunkFromBlockCoords(xPos-32, zPos+32); + Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos-32); + Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos); + Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos+32); + Chunk c1 = aWorld.getChunkFromBlockCoords(xPos+32, zPos-32); + Chunk c2 = aWorld.getChunkFromBlockCoords(xPos+32, zPos); + Chunk c3 = aWorld.getChunkFromBlockCoords(xPos+32, zPos+32); + + aSurrounding.put(a1); + aSurrounding.put(a2); + aSurrounding.put(a3); + aSurrounding.put(b1); + aSurrounding.put(b2); + aSurrounding.put(b3); + aSurrounding.put(c1); + aSurrounding.put(c2); + aSurrounding.put(c3); + + for (Chunk r : aSurrounding) { + if (!r.isChunkLoaded) { + continue; + } + + int startPollution = getPollutionInChunk(r); + if (startPollution == 0) { + continue; + } + + Logger.WARNING("Trying to remove pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+startPollution); + int after = 0; + boolean isMainChunk = r.isAtLocation(mainChunkX, mainChunkZ); + + int removal = Math.max(0, !isMainChunk ? (toRemove/4) : toRemove); + if (removePollution(r, removal)) { + chunksWithRemoval++; + after = getPollutionInChunk(r); + } + else { + after = 0; + } + if (startPollution - after > 0) { + totalRemoved += (startPollution - after); + } + Logger.WARNING("Removed "+(startPollution - after)+" pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+after); + } + return totalRemoved > 0 && chunksWithRemoval > 0; + } + } + + public boolean removePollution(Chunk aChunk, int toRemove){ int before = getCurrentChunkPollution(); - PollutionUtils.addPollution(this.getBaseMetaTileEntity(), -toRemove); + PollutionUtils.removePollution(aChunk, toRemove); int after = getCurrentChunkPollution(); return (after<before); } public boolean hasAirFilter(ItemStack filter){ + if (filter == null) { + return false; + } if (filter.getItem() instanceof ItemAirFilter){ return true; } @@ -388,6 +570,26 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public boolean damageAirFilter(){ ItemStack filter = this.mInventory[this.SLOT_FILTER]; + if (filter == null) { + return false; + } + + boolean creativeRotor = false; + ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; + if (rotorStack != null) { + if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + creativeRotor = true; + } + } + } + + if (creativeRotor) { + return true; + } + if (filter.getItem() instanceof ItemAirFilter){ @@ -398,7 +600,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi this.mInventory[this.SLOT_FILTER] = null; return false; } - else if (filter.getItemDamage() == 1 && currentUse >= 150-1){ + else if (filter.getItemDamage() == 1 && currentUse >= 2500-1){ this.mInventory[this.SLOT_FILTER] = null; return false; } @@ -432,7 +634,13 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + } + + @Override + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { this.mSaveRotor = Utils.invertBoolean(mSaveRotor); if (mSaveRotor){ PlayerUtils.messagePlayer(aPlayer, "Running in low efficiency mode, rotors will not break."); @@ -440,8 +648,76 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { PlayerUtils.messagePlayer(aPlayer, "Running in high efficiency mode, rotors will break."); } + return true; + } + + @Override + public void doSound(byte aIndex, double aX, double aY, double aZ) { + if (aIndex == -120) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(103)), MathUtils.randInt(5, 50), 0.05F, aX, aY, aZ); + } else if (aIndex == -121 || aIndex == -122) { + //GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(108)), 0, 0.5F, aX, aY, aZ); + } /*else if (aIndex == -122) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(6)), 100, 1.0F, aX, aY, aZ); + }*/ else { + super.doSound((byte) 0, aX, aY, aZ); + } + } + + @Override + public boolean canHaveInsufficientEnergy() { + // TODO Auto-generated method stub + return super.canHaveInsufficientEnergy(); + } + + @Override + public String[] getInfoData() { + AutoMap<String> aTooltipSuper = new AutoMap<String>(); + for (String s : super.getInfoData()) { + aTooltipSuper.put(s); + } + int mAirSides = getFreeSpaces(); + int reduction = 0; - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + try { + long tVoltage = maxEUInput(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); + reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); + reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + + aTooltipSuper.put("Maximum pollution removed per second: "+reduction); + } + catch (Throwable t) { + aTooltipSuper.put("Maximum pollution removed per second: "+mPollutionReduction); + } + aTooltipSuper.put("Air Sides: "+mAirSides); + return aTooltipSuper.toArray(); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + if (aSide <= 1) { + return false; + } + return super.allowCoverOnSide(aSide, aCoverID); + } + + @Override + public ITexture[] getTopFacingInactive(byte aColor) { + return super.getTopFacingInactive(aColor); + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + aNBT.setInteger("mOptimalAirFlow", this.mOptimalAirFlow); + aNBT.setBoolean("mSaveRotor", mSaveRotor); + super.setItemNBT(aNBT); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java index 3e94cef7bb..9c246ba913 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java @@ -34,7 +34,7 @@ public class GregtechMetaCondensor extends GregtechMetaBoilerBase{ @Override public String[] getDescription() { - return new String[]{this.mDescription, "IC2 Steam + Water = Normal Steam.", "Requires no power to run, although it's not very fast.", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "IC2 Steam + Water = Normal Steam.", "Requires no power to run, although it's not very fast.", }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java index 82565bb1d9..c7f63e3bc2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java @@ -39,7 +39,7 @@ public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { @Override public String[] getDescription() { - return new String[] {this.mDescription, "A useful debug machine to create pollution.", CORE.GT_Tooltip}; + return new String[] {this.mDescription, "A useful debug machine to create pollution."}; } @Override @@ -117,7 +117,7 @@ public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (pollutionMultiplier >= 9){ + if (pollutionMultiplier > 99){ pollutionMultiplier = 1; } else { @@ -354,27 +354,9 @@ public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { super.onPostTick(aBaseMetaTileEntity, aTick); if (this.getBaseMetaTileEntity().isServerSide()) { //TickTimer - 20 times a second - if (this.mTickTimer >= 0 || this.mTickTimer <= 19){ - this.mTickTimer++; - } - else { - this.mTickTimer = 0; - //Perform pollution update once a second + this.mTickTimer++; + if (mTickTimer % 20 == 0){ this.mCurrentPollution = getCurrentChunkPollution(); - this.mSecondTimer++; - } - //Update Pollution array once a minute - if (this.mSecondTimer >= 60){ - Utils.sendServerMessage("Udating Average of pollution array. Using Array slot"+this.mArrayPos); - this.mSecondTimer = 0; - if (this.mArrayPos<this.mAveragePollutionArray.length){ - this.mAveragePollutionArray[this.mArrayPos] = this.mCurrentPollution; - this.mArrayPos++; - } - else if (this.mArrayPos==this.mAveragePollutionArray.length){ - this.mAveragePollutionArray[this.mArrayPos] = this.mCurrentPollution; - this.mArrayPos = 0; - } } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java index ee2ea1da55..2f9bbcc9fb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java @@ -43,7 +43,7 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity { public String[] getDescription() { return new String[] {this.mDescription, "Right click to check pollution levels.", "Configure with screwdriver to set redstone output amount.", - "Does not use power.", CORE.GT_Tooltip}; + "Does not use power."}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java index b7c31e8514..8456f40797 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityThaumcraftResearcher.java @@ -25,7 +25,7 @@ public class GregtechMetaTileEntityThaumcraftResearcher extends GregtechMetaTile @Override public String[] getDescription() { - return new String[] {this.mDescription, "Generates Thaumcraft research notes, because it's magic.", CORE.GT_Tooltip}; + return new String[] {this.mDescription, "Generates Thaumcraft research notes, because it's magic."}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java index 0786d46fc4..81f594bc7e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java @@ -42,7 +42,7 @@ public class GregtechMetaTileEntity_BasicWasher extends GT_MetaTileEntity_BasicM @Override public String[] getDescription() { - return new String[]{this.mDescription, "Grants no byproducts, but it is fast.", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Grants no byproducts, but it is fast.", }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java index faeaf1d605..b4e819a459 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java @@ -55,7 +55,7 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti public String[] getDescription() { return new String[] { this.mDescription, "Not Very Fast, but not very big either.", "Each side pair in/out puts to different slots.", "Top & Bottom Sides are Outputs.", - "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2.", CORE.GT_Tooltip }; + "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2." }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java index 7ccee3f4b4..5a0f888ddb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java @@ -55,7 +55,7 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux public String[] getDescription() { return new String[] { this.mDescription, "Not Very Fast, but not very big either.", "Each side pair in/out puts to different slots.", "Top & Bottom Sides are Outputs.", - "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2.", CORE.GT_Tooltip }; + "Front & Back are Input Plasma 1.", "Sides are Input Plasma 2." }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java index 96192c5128..25c14a68e7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java @@ -49,7 +49,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity { "Mixed: Provides both 2A of long range and 1A per player locally.", "Mixed mode is more conservative of power and as a result only", "Gets half the distances each singular mode gets.", - CORE.GT_Tooltip}; + }; } public int getTier(){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java index 98057836ec..5d6904bd46 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java @@ -54,7 +54,7 @@ extends MetaTileEntity { "Multiblock: 3x3x5 hollow with opening on top", "Same shape as Bronze/Bricked blast furnace, except one ring of 8 taller.", "40 Iron Plated Bricks required", - CORE.GT_Tooltip}; + }; } else { return new String[]{"Sloooowly, Skip the Bronze age, Get some Steel!", @@ -67,7 +67,7 @@ extends MetaTileEntity { "as Iron is. This machine takes 5x longer than the bronze", "blast furnace as a result.", "----", - CORE.GT_Tooltip}; + }; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index 3bfac81837..7fdabceebb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -174,10 +174,10 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { return false; } - if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), + /*if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), CASING_TEXTURE_ID)) { return false; - } + }*/ byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); if (!CORE.GTNH) { @@ -203,7 +203,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase case 6: this.mHeatingCapacity = 9001; break; - default: + default:Logger.INFO("Heating Coils are bad."); return false; } } else { @@ -236,31 +236,33 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase this.mHeatingCapacity = 15001; break; default: + Logger.INFO("Heating Coils are bad."); return false; } } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != StaticFields59 - .getBlockCasings5()) { + if ((i != 0) || (j != 0)) { + //Coils 1 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing."); return false; } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != tUsedMeta) { + + //Coils 2 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing."); return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != StaticFields59 - .getBlockCasings5()) { + } + + //Top Layer + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasings3Misc, 11)) { + Logger.INFO("Top Layer missing."); return false; } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { - return false; - } - if (!isValidBlockForStructure(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasings3Misc, 11)) { - Logger.INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); - return false; - } + } } } @@ -269,9 +271,9 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase if ((xDir + i != 0) || (zDir + j != 0)) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0,zDir + j); if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasings3Misc, 11)) { - Logger.INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); + Logger.INFO("Bottom Layer missing."); return false; - } + } } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java index c7b4f166b4..aad16d3a56 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java @@ -86,7 +86,7 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus "1-16 Output Hatches", "1-16 Energy Hatches", "All Hatches must be "+aTierName+" or better", - CORE.GT_Tooltip}; + }; //"32768 EU/t and 80mio EU Cap per Energy Hatch" } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index e351d6e988..c424172241 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -248,9 +248,9 @@ extends GregtechMeta_MultiBlockBase { } //Top Layer - final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 2, zDir + j); - if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(15), false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasingsMisc, 15)) { - Logger.INFO("Heating Coils missing."); + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(15), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasingsMisc, 15)) { + Logger.INFO("Top Layer missing."); return false; } } @@ -260,9 +260,9 @@ extends GregtechMeta_MultiBlockBase { for (int j = -1; j < 2; j++) { if (((xDir + i) != 0) || ((zDir + j) != 0)) { //Bottom Layer - final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 2, zDir + j); - if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(15), false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasingsMisc, 15)) { - Logger.INFO("Heating Coils missing."); + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(15), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasingsMisc, 15)) { + Logger.INFO("Bottom Layer missing."); return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index 25e838e57a..1623e7cb54 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -16,6 +16,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; @@ -24,6 +25,10 @@ import gregtech.api.util.Recipe_GT; import gregtech.common.gui.GT_GUIContainer_FusionReactor; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.item.chemistry.IonParticles; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_Cyclotron; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -35,7 +40,7 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase { - public int mEUStore; + public long mEUStore; public GregtechMetaTileEntity_Cyclotron(int aID, String aName, String aNameRegional, int tier) { super(aID, aName, aNameRegional); @@ -71,7 +76,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + return new CONTAINER_Cyclotron(aPlayerInventory, aBaseMetaTileEntity); } @Override @@ -92,17 +97,19 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas @Override public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setLong("mEUStore", mEUStore); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { + mEUStore = aNBT.getLong("mEUStore"); super.loadNBTData(aNBT); } @Override public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - Logger.INFO("Checking form of Cyclotron."); + log("Checking form of Cyclotron."); int xCenter = getBaseMetaTileEntity().getXCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX * 5; int yCenter = getBaseMetaTileEntity().getYCoord(); int zCenter = getBaseMetaTileEntity().getZCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ * 5; @@ -111,56 +118,56 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas && ((isAdvancedMachineCasing(xCenter, yCenter, zCenter + 5)) || (zCenter + 5 == getBaseMetaTileEntity().getZCoord())) && ((isAdvancedMachineCasing(xCenter, yCenter, zCenter - 5)) || (zCenter - 5 == getBaseMetaTileEntity().getZCoord())) && (checkCoils(xCenter, yCenter, zCenter)) && (checkHulls(xCenter, yCenter, zCenter)) && (checkUpperOrLowerHulls(xCenter, yCenter + 1, zCenter)) && (checkUpperOrLowerHulls(xCenter, yCenter - 1, zCenter)) - && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 3, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 3, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 5, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 5, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 3, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 3, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 5, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 5, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter + 3, yCenter, zCenter + 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 3, yCenter, zCenter + 4, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter + 5, yCenter, zCenter + 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 5, yCenter, zCenter + 4, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter + 3, yCenter, zCenter - 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 3, yCenter, zCenter - 4, aBaseMetaTileEntity)) - && (addIfEnergyInjector(xCenter + 5, yCenter, zCenter - 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 5, yCenter, zCenter - 4, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter + 1, yCenter, zCenter - 5, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 1, yCenter, zCenter + 5, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter - 1, yCenter, zCenter - 5, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 1, yCenter, zCenter + 5, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter + 1, yCenter, zCenter - 7, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 1, yCenter, zCenter + 7, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter - 1, yCenter, zCenter - 7, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 1, yCenter, zCenter + 7, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter + 5, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 5, yCenter, zCenter + 1, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter - 5, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 5, yCenter, zCenter + 1, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter + 7, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 7, yCenter, zCenter + 1, aBaseMetaTileEntity)) - && (addIfExtractor(xCenter - 7, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 7, yCenter, zCenter + 1, aBaseMetaTileEntity)) - && (addIfInjector(xCenter + 1, yCenter + 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 1, yCenter + 1, zCenter + 6, aBaseMetaTileEntity)) - && (addIfInjector(xCenter - 1, yCenter + 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter - 1, yCenter + 1, zCenter + 6, aBaseMetaTileEntity)) - && (addIfInjector(xCenter - 6, yCenter + 1, zCenter + 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter + 1, zCenter + 1, aBaseMetaTileEntity)) - && (addIfInjector(xCenter - 6, yCenter + 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter + 1, zCenter - 1, aBaseMetaTileEntity)) - && (addIfInjector(xCenter + 1, yCenter - 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 1, yCenter - 1, zCenter + 6, aBaseMetaTileEntity)) - && (addIfInjector(xCenter - 1, yCenter - 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter - 1, yCenter - 1, zCenter + 6, aBaseMetaTileEntity)) - && (addIfInjector(xCenter - 6, yCenter - 1, zCenter + 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter + 1, aBaseMetaTileEntity)) - && (addIfInjector(xCenter - 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) + && (isAdvancedMachineCasing(xCenter + 4, yCenter, zCenter + 3)) && (isAdvancedMachineCasing(xCenter + 4, yCenter, zCenter - 3)) + && (isAdvancedMachineCasing(xCenter + 4, yCenter, zCenter + 5)) && (isAdvancedMachineCasing(xCenter + 4, yCenter, zCenter - 5)) + && (isAdvancedMachineCasing(xCenter - 4, yCenter, zCenter + 3)) && (isAdvancedMachineCasing(xCenter - 4, yCenter, zCenter - 3)) + && (isAdvancedMachineCasing(xCenter - 4, yCenter, zCenter + 5)) && (isAdvancedMachineCasing(xCenter - 4, yCenter, zCenter - 5)) + && (isAdvancedMachineCasing(xCenter + 3, yCenter, zCenter + 4)) && (isAdvancedMachineCasing(xCenter - 3, yCenter, zCenter + 4)) + && (isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter + 4)) && (isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter + 4)) + && (isAdvancedMachineCasing(xCenter + 3, yCenter, zCenter - 4)) && (isAdvancedMachineCasing(xCenter - 3, yCenter, zCenter - 4)) + && (isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter - 4)) && (isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter - 4)) + && (isAdvancedMachineCasing(xCenter + 1, yCenter, zCenter - 5)) && (isAdvancedMachineCasing(xCenter + 1, yCenter, zCenter + 5)) + && (isAdvancedMachineCasing(xCenter - 1, yCenter, zCenter - 5)) && (isAdvancedMachineCasing(xCenter - 1, yCenter, zCenter + 5)) + && (isAdvancedMachineCasing(xCenter + 1, yCenter, zCenter - 7)) && (isAdvancedMachineCasing(xCenter + 1, yCenter, zCenter + 7)) + && (isAdvancedMachineCasing(xCenter - 1, yCenter, zCenter - 7)) && (isAdvancedMachineCasing(xCenter - 1, yCenter, zCenter + 7)) + && (isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter - 1)) && (isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter + 1)) + && (isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter - 1)) && (isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter + 1)) + && (isAdvancedMachineCasing(xCenter + 7, yCenter, zCenter - 1)) && (isAdvancedMachineCasing(xCenter + 7, yCenter, zCenter + 1)) + && (isAdvancedMachineCasing(xCenter - 7, yCenter, zCenter - 1)) && (isAdvancedMachineCasing(xCenter - 7, yCenter, zCenter + 1)) + && (isAdvancedMachineCasing(xCenter + 1, yCenter + 1, zCenter - 6)) && (isAdvancedMachineCasing(xCenter + 1, yCenter + 1, zCenter + 6)) + && (isAdvancedMachineCasing(xCenter - 1, yCenter + 1, zCenter - 6)) && (isAdvancedMachineCasing(xCenter - 1, yCenter + 1, zCenter + 6)) + && (isAdvancedMachineCasing(xCenter - 6, yCenter + 1, zCenter + 1)) && (isAdvancedMachineCasing(xCenter + 6, yCenter + 1, zCenter + 1)) + && (isAdvancedMachineCasing(xCenter - 6, yCenter + 1, zCenter - 1)) && (isAdvancedMachineCasing(xCenter + 6, yCenter + 1, zCenter - 1)) + && (isAdvancedMachineCasing(xCenter + 1, yCenter - 1, zCenter - 6)) && (isAdvancedMachineCasing(xCenter + 1, yCenter - 1, zCenter + 6)) + && (isAdvancedMachineCasing(xCenter - 1, yCenter - 1, zCenter - 6)) && (isAdvancedMachineCasing(xCenter - 1, yCenter - 1, zCenter + 6)) + && (isAdvancedMachineCasing(xCenter - 6, yCenter - 1, zCenter + 1)) && (isAdvancedMachineCasing(xCenter + 6, yCenter - 1, zCenter + 1)) + && (isAdvancedMachineCasing(xCenter - 6, yCenter - 1, zCenter - 1)) && (isAdvancedMachineCasing(xCenter + 6, yCenter - 1, zCenter - 1)) && (this.mEnergyHatches.size() >= 1) && (this.mOutputBusses.size() >= 1) && (this.mInputHatches.size() >= 1) && (this.mInputBusses.size() >= 1)) { int mEnergyHatches_sS = this.mEnergyHatches.size(); for (int i = 0; i < mEnergyHatches_sS; i++) { if (this.mEnergyHatches.get(i).mTier < tier()){ - Logger.INFO("bad energy hatch"); + log("bad energy hatch"); return false; } } int mOutputHatches_sS = this.mOutputBusses.size(); for (int i = 0; i < mOutputHatches_sS; i++) { if (this.mOutputBusses.get(i).mTier < tier()){ - Logger.INFO("bad output hatch"); + log("bad output hatch"); return false; } } int mInputHatches_sS = this.mInputHatches.size(); for (int i = 0; i < mInputHatches_sS; i++) { if (this.mInputHatches.get(i).mTier < tier()){ - Logger.INFO("bad input hatch"); + log("bad input hatch"); return false; } } int mInputBusses_sS = this.mInputBusses.size(); for (int i = 0; i < mInputBusses_sS; i++) { if (this.mInputBusses.get(i).mTier < tier()){ - Logger.INFO("bad input hatch"); + log("bad input hatch"); return false; } } @@ -170,11 +177,11 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas mHardHammer = true; mSolderingTool = true; mCrowbar = true; - Logger.INFO("Built Cyclotron."); + log("Built Cyclotron."); turnCasingActive(true); return true; } - Logger.INFO("Failed building Cyclotron."); + log("Failed building Cyclotron."); return false; } @@ -212,36 +219,34 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas && (isAdvancedMachineCasing(aX - 2, aY, aZ + 4)) && (isAdvancedMachineCasing(aX + 2, aY, aZ - 4)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 4)); } - private boolean addIfEnergyInjector(int aX, int aY, int aZ, IGregTechTileEntity aBaseMetaTileEntity) { - if (addEnergyInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntity(aX, aY, aZ), TAE.GTPP_INDEX(26))) { - return true; - } - return isAdvancedMachineCasing(aX, aY, aZ); - } - - private boolean addIfInjector(int aX, int aY, int aZ, IGregTechTileEntity aTileEntity) { - if (addInputToMachineList(aTileEntity.getIGregTechTileEntity(aX, aY, aZ), TAE.GTPP_INDEX(26))) { - return true; - } - return isAdvancedMachineCasing(aX, aY, aZ); - } - - private boolean addIfExtractor(int aX, int aY, int aZ, IGregTechTileEntity aTileEntity) { - if (addOutputToMachineList(aTileEntity.getIGregTechTileEntity(aX, aY, aZ), TAE.GTPP_INDEX(26))) { - return true; - } - return isAdvancedMachineCasing(aX, aY, aZ); - } - private boolean isAdvancedMachineCasing(int aX, int aY, int aZ) { final Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); final int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ); - final IGregTechTileEntity tTileEntity2 = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ); - return isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(26), true, aBlock, aMeta, getCasing(), getCasingMeta()); + final IGregTechTileEntity tTileEntity2 = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ); + + boolean debug = isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(26), true, aBlock, aMeta, getCasing(), getCasingMeta()); + + /*if (!debug) { + this.getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, ModBlocks.blockCompressedObsidian); + log(""+aX+"/"+aY+"/"+aZ); + }*/ + + return debug; } private boolean isCyclotronCoil(int aX, int aY, int aZ) { - return (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCyclotronCoil() && (getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCyclotronCoilMeta())); + + final Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); + final int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ); + + boolean debug = isValidBlockForStructure(null, 0, false, aBlock, aMeta, getCyclotronCoil(), getCyclotronCoilMeta()); + + /*if (!debug) { + this.getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, ModBlocks.blockCompressedObsidian); + log(""+aX+"/"+aY+"/"+aZ); + }*/ + + return debug; } public Block getCasing() { @@ -270,6 +275,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas "Which will be extracted from the Isochronous Cyclotron", "------------------------------------------------------------", "Consists of the same layout as a Fusion Reactor", + "Any external casing can be a hatch/bus, unlike Fusion", "Cyclotron Machine Casings around Cyclotron Coil Blocks", "All Hatches must be IV or better", "1-16 Input Hatches", @@ -296,12 +302,9 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas public IIconContainer getIconOverlay() { if (this.getBaseMetaTileEntity().isActive()){ - return TexturesGtBlock.Overlay_Machine_Dimensional_Orange; + return TexturesGtBlock.Overlay_MatterFab_Active_Animated; } - return TexturesGtBlock.Overlay_Machine_Dimensional_Blue; - //mobessence - - + return TexturesGtBlock.Overlay_MatterFab_Animated; } @Override @@ -311,7 +314,13 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas @Override public boolean checkRecipe(ItemStack aStack) { - //Logger.INFO("Recipe Check."); + + /*if (CORE.DEVENV) { + return this.checkRecipeGeneric(); + }*/ + + + //log("Recipe Check."); ArrayList<ItemStack> tItemList = getStoredInputs(); ItemStack[] tItemInputs = tItemList.toArray(new ItemStack[tItemList.size()]); ArrayList<FluidStack> tInputList = getStoredFluids(); @@ -352,6 +361,28 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } } + for (ItemStack s : outputs) { + if (s != null) { + if (s.getItem() instanceof IonParticles) { + long aCharge = IonParticles.getChargeState(s); + if (aCharge == 0) { + IonParticles.setChargeState(s, MathUtils.getRandomFromArray(new int[] { + -5, -5, + -4, -4, -4, + -3, -3, -3, -3, -3, + -2, -2, -2, -2, -2, -2, -2, + -1, -1, -1, -1, -1, -1, -1, -1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, + 5, 5, 5, + 6, 6})); + } + } + } + } + this.mOutputItems = outputs; this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)}; return true; @@ -374,7 +405,13 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if (mEfficiency < 0) - mEfficiency = 0; + mEfficiency = 0; + + //Time Counter + this.mTotalRunTime++; + + onRunningTick(null); + if (mRunningOnLoad && checkMultiblock(aBaseMetaTileEntity, mInventory[1])) { this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); checkRecipe(mInventory[1]); @@ -388,6 +425,10 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas mEnergyHatches.clear(); mMufflerHatches.clear(); mMaintenanceHatches.clear(); + mChargeHatches.clear(); + mDischargeHatches.clear(); + mControlCoreBus.clear(); + mMultiDynamoHatches.clear(); mMachine = checkMultiblock(aBaseMetaTileEntity, mInventory[1]); } if (mStartUpCheck < 0) { @@ -395,9 +436,9 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas if (this.mEnergyHatches != null) { for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { - if (aBaseMetaTileEntity.getStoredEU() + (2048) < maxEUStore() - && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048, false)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(2048, true); + if (aBaseMetaTileEntity.getStoredEU() + (2048*4) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits((2048*4), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits((2048*4), true); } } } @@ -405,7 +446,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas stopMachine(); } if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { + if (mMaxProgresstime > 0) { this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { if (mOutputItems != null) @@ -454,6 +495,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas stopMachine(); } } + doRandomMaintenanceDamage(); aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); @@ -461,7 +503,36 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } @Override - public boolean onRunningTick(ItemStack aStack) { + public boolean onRunningTick(ItemStack aStack) { + if (this.mOutputBusses.size() > 0) { + for (GT_MetaTileEntity_Hatch_OutputBus g : this.mOutputBusses) { + if (g != null) { + for (ItemStack s : g.mInventory) { + if (s != null) { + if (s.getItem() instanceof IonParticles) { + long aCharge = IonParticles.getChargeState(s); + if (aCharge == 0) { + IonParticles.setChargeState(s, MathUtils.getRandomFromArray(new int[] { + -5, -5, + -4, -4, -4, + -3, -3, -3, -3, -3, + -2, -2, -2, -2, -2, -2, -2, + -1, -1, -1, -1, -1, -1, -1, -1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, + 5, 5, 5, + 6, 6})); + } + } + } + } + } + } + } + PollutionUtils.addPollution(getBaseMetaTileEntity(), this.getPollutionPerTick(aStack)); + return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java index ec28967bb7..9ac67cf874 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java @@ -582,7 +582,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G "Radius is " + (this.getRadiusInChunks() << 4) + " blocks", "Every tick, this machine altenates betweem consumption of Pyrotheum & Cryotheum", "Pyrotheum is used to bore through the Mantle of the world", - "Cryotheum is used to keep the internal components cool", CORE.GT_Tooltip }; + "Cryotheum is used to keep the internal components cool",}; } static { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index 81559db1a5..8294773be3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -32,10 +32,10 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { String aTankPortableness = CORE.GTNH ? "non-portable" : "portable"; if (this.mFluid == null) { - aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", CORE.GT_Tooltip}; + aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank."}; } else { - aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L", CORE.GT_Tooltip}; + aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L"}; } return aTip; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index 52c1c8818a..1d2fad941b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -41,7 +41,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Accepts/Outputs 4Amp", CORE.GT_Tooltip}; + return new String[] {this.mDescription, "Accepts/Outputs 4Amp",}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java index 80448727cc..b52ed040f4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java @@ -18,7 +18,7 @@ extends GregtechMetaSafeBlockBase { @Override public String[] getDescription() { - return new String[] {this.mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription}; } public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java index 2c24809f9a..43d5cffe82 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java @@ -207,7 +207,7 @@ public class GT4Entity_Shelf extends GT_MetaTileEntity_BasicHull_NonElectric { "Right click to store/remove something", "Ctrl + Rmb to check contents", "Ctrl + Rmb with a screwdriver to lock", - CORE.GT_Tooltip }; + }; } @Override |