Try to add Oil Drill. Works but not pumping oil
This commit is contained in:
parent
6427be7b6d
commit
26f65443ff
7 changed files with 797 additions and 384 deletions
|
@ -660,7 +660,7 @@ public enum ItemList implements IItemContainer {
|
|||
Teleporter,
|
||||
Cover_NeedsMaintainance,
|
||||
Casing_Turbine,
|
||||
MobRep_LV, MobRep_MV, MobRep_HV, MobRep_EV, MobRep_IV, LargeGasTurbine, LargeHPSteamTurbine, LargePlasmaTurbine, Cover_PlayerDetector, Machine_Multi_HeatExchanger, AdvancedMiner2, Uraniumcell_1, Uraniumcell_2, Uraniumcell_4, Moxcell_1, Moxcell_2, Moxcell_4;
|
||||
MobRep_LV, MobRep_MV, MobRep_HV, MobRep_EV, MobRep_IV, LargeGasTurbine, LargeHPSteamTurbine, LargePlasmaTurbine, Cover_PlayerDetector, Machine_Multi_HeatExchanger, OilDrill, AdvancedMiner2, Uraniumcell_1, Uraniumcell_2, Uraniumcell_4, Moxcell_1, Moxcell_2, Moxcell_4;
|
||||
|
||||
|
||||
public static final ItemList[]
|
||||
|
|
|
@ -512,6 +512,10 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
Snow(728, TextureSet.SET_FINE, 1.0F, 0, 0, 1 | 16, 250, 250, 250, 0, "Snow", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite, 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.GELUM, 1))),
|
||||
Sodalite(525, TextureSet.SET_LAPIS, 1.0F, 0, 1, 1 | 4 | 8, 20, 20, 255, 0, "Sodalite", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue, 1, Arrays.asList(new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Sodium, 4), new MaterialStack(Chlorine, 1))),
|
||||
SodiumPersulfate(718, TextureSet.SET_FLUID, 1.0F, 0, 2, 16, 255, 255, 255, 0, "Sodium Persulfate", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange, 1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4))),
|
||||
OilHeavy ( 730, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Heavy Oil" , 3, 32, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ),
|
||||
OilMedium ( 731, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Raw Oil" , 3, 24, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ),
|
||||
OilLight ( 732, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Light Oil" , 3, 16, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ),
|
||||
NatruralGas ( 733, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 255, 255, 0, "Natural Gas" , 1, 15, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite ),
|
||||
SodiumSulfide(719, TextureSet.SET_FLUID, 1.0F, 0, 2, 16, 255, 255, 255, 0, "Sodium Sulfide", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange, 1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Sulfur, 1))),
|
||||
SolderingAlloy(314, TextureSet.SET_DULL, 1.0F, 0, 1, 1 | 2, 220, 220, 230, 0, "Soldering Alloy", 0, 0, 400, 400, false, false, 1, 1, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Tin, 9), new MaterialStack(Antimony, 1))),
|
||||
Spessartine(838, TextureSet.SET_DULL, 1.0F, 0, 2, 1 | 8, 255, 100, 100, 0, "Spessartine", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed, 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Manganese, 3), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))),
|
||||
|
|
|
@ -5,7 +5,9 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||
import gregtech.api.GregTech_API;
|
||||
import gregtech.api.damagesources.GT_DamageSources;
|
||||
import gregtech.api.enchants.Enchantment_Radioactivity;
|
||||
import gregtech.api.enums.GT_Values;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.api.enums.Materials;
|
||||
import gregtech.api.enums.SubTag;
|
||||
import gregtech.api.events.BlockScanningEvent;
|
||||
import gregtech.api.interfaces.IDebugableBlock;
|
||||
|
@ -17,6 +19,8 @@ import gregtech.api.net.GT_Packet_Sound;
|
|||
import gregtech.api.objects.GT_ItemStack;
|
||||
import gregtech.api.objects.ItemData;
|
||||
import gregtech.api.threads.GT_Runnable_Sound;
|
||||
import gregtech.common.GT_Proxy;
|
||||
|
||||
import ic2.api.recipe.IRecipeInput;
|
||||
import ic2.api.recipe.RecipeInputItemStack;
|
||||
import ic2.api.recipe.RecipeInputOreDict;
|
||||
|
@ -50,6 +54,7 @@ import net.minecraft.tileentity.TileEntityChest;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
@ -82,7 +87,7 @@ public class GT_Utility {
|
|||
private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new HashMap<GT_ItemStack, FluidContainerData>();
|
||||
private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new HashMap<GT_ItemStack, Map<Fluid, FluidContainerData>>();
|
||||
public static volatile int VERSION = 508;
|
||||
public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true;
|
||||
public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false;
|
||||
public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new HashMap<GT_PlayedSound, Integer>();
|
||||
private static int sBookCount = 0;
|
||||
|
||||
|
@ -333,6 +338,11 @@ public class GT_Utility {
|
|||
tClass.getCanonicalName();
|
||||
BC_CHECK = true;
|
||||
} catch (Throwable e) {/**/}
|
||||
try {
|
||||
Class tClass = cofh.api.energy.IEnergyReceiver.class;
|
||||
tClass.getCanonicalName();
|
||||
RF_CHECK = true;
|
||||
} catch (Throwable e) {/**/}
|
||||
CHECK_ALL = false;
|
||||
}
|
||||
}
|
||||
|
@ -802,26 +812,31 @@ public class GT_Utility {
|
|||
return copyMetaData(Items.feather.getDamage(aStack) + 1, aStack);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static synchronized boolean removeIC2BottleRecipe(ItemStack aContainer, ItemStack aInput, Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, ItemStack aOutput){
|
||||
if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false;
|
||||
boolean rReturn = false;
|
||||
Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator();
|
||||
aOutput = GT_OreDictUnificator.get(aOutput);
|
||||
while (tIterator.hasNext()) {
|
||||
Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next();
|
||||
if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) {
|
||||
List<ItemStack> tList = tEntry.getValue().items;
|
||||
if (tList != null) for (ItemStack tOutput : tList)
|
||||
if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) {
|
||||
tIterator.remove();
|
||||
rReturn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false;
|
||||
boolean rReturn = false;
|
||||
Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator();
|
||||
aOutput = GT_OreDictUnificator.get(aOutput);
|
||||
while (tIterator.hasNext()) {
|
||||
Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next();
|
||||
if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) {
|
||||
List<ItemStack> tList = tEntry.getValue().items;
|
||||
if (tList != null) for (ItemStack tOutput : tList)
|
||||
if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) {
|
||||
tIterator.remove();
|
||||
rReturn = true;
|
||||
break;
|
||||
}
|
||||
return rReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
return rReturn;
|
||||
}
|
||||
|
||||
|
||||
public static synchronized boolean removeSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, ItemStack aOutput) {
|
||||
if ((isStackInvalid(aInput) && isStackInvalid(aOutput)) || aRecipeList == null) return false;
|
||||
boolean rReturn = false;
|
||||
|
@ -1496,6 +1511,51 @@ public class GT_Utility {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) {
|
||||
|
||||
|
||||
|
||||
|
||||
Random tRandom = new Random((aWorld.getSeed() + (aX / 96) + (7 * (aZ / 96))));
|
||||
int oil = tRandom.nextInt(3);
|
||||
double amount = tRandom.nextInt(50) + tRandom.nextDouble();
|
||||
oil = tRandom.nextInt(4);
|
||||
// System.out.println("Oil: "+(aX/96)+" "+(aZ/96)+" "+oil+" "+amount);
|
||||
// amount = 40;
|
||||
Fluid tFluid = null;
|
||||
switch (oil) {
|
||||
case 0:
|
||||
tFluid = Materials.NatruralGas.mGas;
|
||||
break;
|
||||
case 1:
|
||||
tFluid = Materials.OilLight.mFluid;
|
||||
break;
|
||||
case 2:
|
||||
tFluid = Materials.OilMedium.mFluid;
|
||||
break;
|
||||
case 3:
|
||||
tFluid = Materials.OilHeavy.mFluid;
|
||||
break;
|
||||
default:
|
||||
tFluid = Materials.Oil.mFluid;
|
||||
}
|
||||
int tAmount = (int) (Math.pow(amount, 5) / 100);
|
||||
ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16);
|
||||
if(GT_Proxy.chunkData.containsKey(tPos)){
|
||||
int[] tInts = GT_Proxy.chunkData.get(tPos);
|
||||
if(tInts.length>0){
|
||||
if(tInts[0]>=0){tAmount = tInts[0];}
|
||||
}
|
||||
|
||||
GT_Proxy.chunkData.remove(tPos);
|
||||
}
|
||||
|
||||
tAmount = tAmount - 5;
|
||||
GT_Proxy.chunkData.put(tPos, new int[]{tAmount});
|
||||
|
||||
|
||||
return new FluidStack(tFluid, tAmount);
|
||||
}
|
||||
|
||||
public static int getCoordinateScan(ArrayList<String> aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) {
|
||||
if (aList == null) return 0;
|
||||
|
@ -1519,187 +1579,192 @@ public class GT_Utility {
|
|||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
if (tTileEntity != null) {
|
||||
try {
|
||||
if (tTileEntity instanceof IFluidHandler) {
|
||||
rEUAmount += 500;
|
||||
FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide));
|
||||
if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) {
|
||||
tList.add("Tank " + i + ": " + GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + " / " + GT_Utility.formatNumbers(tTanks[i].capacity) + " " + getFluidName(tTanks[i].fluid, true));
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.reactor.IReactorChamber) {
|
||||
rEUAmount += 500;
|
||||
tTileEntity = (TileEntity) (((ic2.api.reactor.IReactorChamber) tTileEntity).getReactor());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.reactor.IReactor) {
|
||||
rEUAmount += 500;
|
||||
tList.add("Heat: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeat() + "/" + ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()
|
||||
+ " HEM: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + " Base EU Output: "/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.tile.IWrenchable) {
|
||||
rEUAmount += 100;
|
||||
tList.add("Facing: " + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + " / Chance: " + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + "%");
|
||||
tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? "You can remove this with a Wrench" : "You can NOT remove this with a Wrench");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergyTile) {
|
||||
rEUAmount += 200;
|
||||
//aList.add(((ic2.api.energy.tile.IEnergyTile)tTileEntity).isAddedToEnergyNet()?"Added to E-net":"Not added to E-net! Bug?");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergySink) {
|
||||
rEUAmount += 400;
|
||||
//aList.add("Demanded Energy: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).demandsEnergy());
|
||||
//tList.add("Max Safe Input: " + getTier(((ic2.api.energy.tile.IEnergySink)tTileEntity).getSinkTier()));
|
||||
//tList.add("Max Safe Input: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).getMaxSafeInput());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergySource) {
|
||||
rEUAmount += 400;
|
||||
//aList.add("Max Energy Output: " + ((ic2.api.energy.tile.IEnergySource)tTileEntity).getMaxEnergyOutput());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) {
|
||||
rEUAmount += 200;
|
||||
tList.add("Conduction Loss: " + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) {
|
||||
rEUAmount += 200;
|
||||
tList.add("Contained Energy: " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() + " of " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity());
|
||||
//aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IUpgradableMachine) {
|
||||
rEUAmount += 500;
|
||||
if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add("Has Muffler Upgrade");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IMachineProgress) {
|
||||
rEUAmount += 400;
|
||||
int tValue = 0;
|
||||
if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress()))
|
||||
tList.add("Progress: " + GT_Utility.formatNumbers(tValue) + " / " + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ICoverable) {
|
||||
rEUAmount += 300;
|
||||
String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSide((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity);
|
||||
if (tString != null && !tString.equals(E)) tList.add(tString);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) {
|
||||
tList.add("Max IN: " + ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " EU");
|
||||
tList.add("Max OUT: " + ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " EU at " + ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() + " Amperes");
|
||||
tList.add("Energy: " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + " / " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + "EU");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IGregTechTileEntity) {
|
||||
tList.add("Owned by: " + ((IGregTechTileEntity) tTileEntity).getOwnerName());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) {
|
||||
tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData()));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.crops.ICropTile) {
|
||||
if (((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() < 4) {
|
||||
rEUAmount += 10000;
|
||||
((ic2.api.crops.ICropTile) tTileEntity).setScanLevel((byte) 4);
|
||||
}
|
||||
if (((ic2.api.crops.ICropTile) tTileEntity).getID() >= 0 && ((ic2.api.crops.ICropTile) tTileEntity).getID() < ic2.api.crops.Crops.instance.getCropList().length && ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()] != null) {
|
||||
rEUAmount += 1000;
|
||||
tList.add("Type -- Crop-Name: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].name()
|
||||
+ " Growth: " + ((ic2.api.crops.ICropTile) tTileEntity).getGrowth()
|
||||
+ " Gain: " + ((ic2.api.crops.ICropTile) tTileEntity).getGain()
|
||||
+ " Resistance: " + ((ic2.api.crops.ICropTile) tTileEntity).getResistance()
|
||||
);
|
||||
tList.add("Plant -- Fertilizer: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrientStorage()
|
||||
+ " Water: " + ((ic2.api.crops.ICropTile) tTileEntity).getHydrationStorage()
|
||||
+ " Weed-Ex: " + ((ic2.api.crops.ICropTile) tTileEntity).getWeedExStorage()
|
||||
+ " Scan-Level: " + ((ic2.api.crops.ICropTile) tTileEntity).getScanLevel()
|
||||
);
|
||||
tList.add("Environment -- Nutrients: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrients()
|
||||
+ " Humidity: " + ((ic2.api.crops.ICropTile) tTileEntity).getHumidity()
|
||||
+ " Air-Quality: " + ((ic2.api.crops.ICropTile) tTileEntity).getAirQuality()
|
||||
);
|
||||
String tString = E;
|
||||
for (String tAttribute : ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].attributes()) {
|
||||
tString += ", " + tAttribute;
|
||||
}
|
||||
tList.add("Attributes:" + tString.replaceFirst(",", E));
|
||||
tList.add("Discovered by: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].discoveredBy());
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
}
|
||||
|
||||
if (tTileEntity != null) {
|
||||
try {
|
||||
if (tBlock instanceof IDebugableBlock) {
|
||||
if (tTileEntity instanceof IFluidHandler) {
|
||||
rEUAmount += 500;
|
||||
ArrayList<String> temp = ((IDebugableBlock) tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3);
|
||||
if (temp != null) tList.addAll(temp);
|
||||
FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide));
|
||||
if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) {
|
||||
tList.add("Tank " + i + ": " + GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + " / " + GT_Utility.formatNumbers(tTanks[i].capacity) + " " + getFluidName(tTanks[i].fluid, true));
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.reactor.IReactorChamber) {
|
||||
rEUAmount += 500;
|
||||
tTileEntity = (TileEntity) (((ic2.api.reactor.IReactorChamber) tTileEntity).getReactor());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.reactor.IReactor) {
|
||||
rEUAmount += 500;
|
||||
tList.add("Heat: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeat() + "/" + ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()
|
||||
+ " HEM: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + " Base EU Output: "/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.tile.IWrenchable) {
|
||||
rEUAmount += 100;
|
||||
tList.add("Facing: " + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + " / Chance: " + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + "%");
|
||||
tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? "You can remove this with a Wrench" : "You can NOT remove this with a Wrench");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergyTile) {
|
||||
rEUAmount += 200;
|
||||
//aList.add(((ic2.api.energy.tile.IEnergyTile)tTileEntity).isAddedToEnergyNet()?"Added to E-net":"Not added to E-net! Bug?");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergySink) {
|
||||
rEUAmount += 400;
|
||||
//aList.add("Demanded Energy: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).demandsEnergy());
|
||||
//tList.add("Max Safe Input: " + getTier(((ic2.api.energy.tile.IEnergySink)tTileEntity).getSinkTier()));
|
||||
//tList.add("Max Safe Input: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).getMaxSafeInput());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergySource) {
|
||||
rEUAmount += 400;
|
||||
//aList.add("Max Energy Output: " + ((ic2.api.energy.tile.IEnergySource)tTileEntity).getMaxEnergyOutput());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) {
|
||||
rEUAmount += 200;
|
||||
tList.add("Conduction Loss: " + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) {
|
||||
rEUAmount += 200;
|
||||
tList.add("Contained Energy: " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() + " of " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity());
|
||||
//aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IUpgradableMachine) {
|
||||
rEUAmount += 500;
|
||||
if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add("Has Muffler Upgrade");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IMachineProgress) {
|
||||
rEUAmount += 400;
|
||||
int tValue = 0;
|
||||
if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress()))
|
||||
tList.add("Progress: " + GT_Utility.formatNumbers(tValue) + " / " + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ICoverable) {
|
||||
rEUAmount += 300;
|
||||
String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSide((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity);
|
||||
if (tString != null && !tString.equals(E)) tList.add(tString);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) {
|
||||
tList.add("Max IN: " + ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " EU");
|
||||
tList.add("Max OUT: " + ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " EU at " + ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() + " Amperes");
|
||||
tList.add("Energy: " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + " / " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + "EU");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IGregTechTileEntity) {
|
||||
tList.add("Owned by: " + ((IGregTechTileEntity) tTileEntity).getOwnerName());
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) {
|
||||
tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData()));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
try {
|
||||
if (tTileEntity instanceof ic2.api.crops.ICropTile) {
|
||||
if (((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() < 4) {
|
||||
rEUAmount += 10000;
|
||||
((ic2.api.crops.ICropTile) tTileEntity).setScanLevel((byte) 4);
|
||||
}
|
||||
if (((ic2.api.crops.ICropTile) tTileEntity).getID() >= 0 && ((ic2.api.crops.ICropTile) tTileEntity).getID() < ic2.api.crops.Crops.instance.getCropList().length && ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()] != null) {
|
||||
rEUAmount += 1000;
|
||||
tList.add("Type -- Crop-Name: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].name()
|
||||
+ " Growth: " + ((ic2.api.crops.ICropTile) tTileEntity).getGrowth()
|
||||
+ " Gain: " + ((ic2.api.crops.ICropTile) tTileEntity).getGain()
|
||||
+ " Resistance: " + ((ic2.api.crops.ICropTile) tTileEntity).getResistance()
|
||||
);
|
||||
tList.add("Plant -- Fertilizer: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrientStorage()
|
||||
+ " Water: " + ((ic2.api.crops.ICropTile) tTileEntity).getHydrationStorage()
|
||||
+ " Weed-Ex: " + ((ic2.api.crops.ICropTile) tTileEntity).getWeedExStorage()
|
||||
+ " Scan-Level: " + ((ic2.api.crops.ICropTile) tTileEntity).getScanLevel()
|
||||
);
|
||||
tList.add("Environment -- Nutrients: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrients()
|
||||
+ " Humidity: " + ((ic2.api.crops.ICropTile) tTileEntity).getHumidity()
|
||||
+ " Air-Quality: " + ((ic2.api.crops.ICropTile) tTileEntity).getAirQuality()
|
||||
);
|
||||
String tString = E;
|
||||
for (String tAttribute : ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].attributes()) {
|
||||
tString += ", " + tAttribute;
|
||||
}
|
||||
tList.add("Attributes:" + tString.replaceFirst(",", E));
|
||||
tList.add("Discovered by: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].discoveredBy());
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
|
||||
BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ);
|
||||
tEvent.mEUCost = rEUAmount;
|
||||
MinecraftForge.EVENT_BUS.post(tEvent);
|
||||
if (!tEvent.isCanceled()) aList.addAll(tList);
|
||||
return tEvent.mEUCost;
|
||||
}
|
||||
if (aPlayer.capabilities.isCreativeMode&>_Values.D1) {
|
||||
FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ);
|
||||
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
|
||||
}
|
||||
try {
|
||||
if (tBlock instanceof IDebugableBlock) {
|
||||
rEUAmount += 500;
|
||||
ArrayList<String> temp = ((IDebugableBlock) tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3);
|
||||
if (temp != null) tList.addAll(temp);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
if (D1) e.printStackTrace(GT_Log.err);
|
||||
}
|
||||
|
||||
BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ);
|
||||
tEvent.mEUCost = rEUAmount;
|
||||
MinecraftForge.EVENT_BUS.post(tEvent);
|
||||
if (!tEvent.isCanceled()) aList.addAll(tList);
|
||||
return tEvent.mEUCost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an Array containing the X and the Y Coordinate of the clicked Point, with the top left Corner as Origin, like on the Texture Sheet. return values should always be between [0.0F and 0.99F].
|
||||
|
@ -1786,187 +1851,186 @@ public class GT_Utility {
|
|||
return formatter.format(aNumber);
|
||||
}
|
||||
|
||||
public static class ItemNBT {
|
||||
public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) {
|
||||
if (aNBT == null) {
|
||||
aStack.setTagCompound(null);
|
||||
return;
|
||||
}
|
||||
ArrayList<String> tTagsToRemove = new ArrayList<String>();
|
||||
for (Object tKey : aNBT.func_150296_c()) {
|
||||
NBTBase tValue = aNBT.getTag((String) tKey);
|
||||
if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_())))
|
||||
tTagsToRemove.add((String) tKey);
|
||||
}
|
||||
for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey);
|
||||
aStack.setTagCompound(aNBT.hasNoTags() ? null : aNBT);
|
||||
public static class ItemNBT {
|
||||
public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) {
|
||||
if (aNBT == null) {
|
||||
aStack.setTagCompound(null);
|
||||
return;
|
||||
}
|
||||
|
||||
public static NBTTagCompound getNBT(ItemStack aStack) {
|
||||
NBTTagCompound rNBT = aStack.getTagCompound();
|
||||
return rNBT == null ? new NBTTagCompound() : rNBT;
|
||||
}
|
||||
|
||||
public static void setPunchCardData(ItemStack aStack, String aPunchCardData) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setString("GT.PunchCardData", aPunchCardData);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static String getPunchCardData(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getString("GT.PunchCardData");
|
||||
}
|
||||
|
||||
public static void setLighterFuel(ItemStack aStack, long aFuel) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setLong("GT.LighterFuel", aFuel);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static long getLighterFuel(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getLong("GT.LighterFuel");
|
||||
}
|
||||
|
||||
public static void setMapID(ItemStack aStack, short aMapID) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setShort("map_id", aMapID);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static short getMapID(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
if (!tNBT.hasKey("map_id")) return -1;
|
||||
return tNBT.getShort("map_id");
|
||||
}
|
||||
|
||||
public static void setBookTitle(ItemStack aStack, String aTitle) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setString("title", aTitle);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static String getBookTitle(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getString("title");
|
||||
}
|
||||
|
||||
public static void setBookAuthor(ItemStack aStack, String aAuthor) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setString("author", aAuthor);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static String getBookAuthor(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getString("author");
|
||||
}
|
||||
|
||||
public static void addEnchantment(ItemStack aStack, Enchantment aEnchantment, int aLevel) {
|
||||
NBTTagCompound tNBT = getNBT(aStack), tEnchantmentTag;
|
||||
if (!tNBT.hasKey("ench", 9)) tNBT.setTag("ench", new NBTTagList());
|
||||
NBTTagList tList = tNBT.getTagList("ench", 10);
|
||||
|
||||
boolean temp = true;
|
||||
|
||||
for (int i = 0; i < tList.tagCount(); i++) {
|
||||
tEnchantmentTag = tList.getCompoundTagAt(i);
|
||||
if (tEnchantmentTag.getShort("id") == aEnchantment.effectId) {
|
||||
tEnchantmentTag.setShort("id", (short) aEnchantment.effectId);
|
||||
tEnchantmentTag.setShort("lvl", (byte) aLevel);
|
||||
temp = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (temp) {
|
||||
tEnchantmentTag = new NBTTagCompound();
|
||||
tEnchantmentTag.setShort("id", (short) aEnchantment.effectId);
|
||||
tEnchantmentTag.setShort("lvl", (byte) aLevel);
|
||||
tList.appendTag(tEnchantmentTag);
|
||||
}
|
||||
aStack.setTagCompound(tNBT);
|
||||
ArrayList<String> tTagsToRemove = new ArrayList<String>();
|
||||
for (Object tKey : aNBT.func_150296_c()) {
|
||||
NBTBase tValue = aNBT.getTag((String) tKey);
|
||||
if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_())))
|
||||
tTagsToRemove.add((String) tKey);
|
||||
}
|
||||
for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey);
|
||||
aStack.setTagCompound(aNBT.hasNoTags() ? null : aNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?!
|
||||
*/
|
||||
public static class GT_EnchantmentHelper {
|
||||
private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA();
|
||||
private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB();
|
||||
public static NBTTagCompound getNBT(ItemStack aStack) {
|
||||
NBTTagCompound rNBT = aStack.getTagCompound();
|
||||
return rNBT == null ? new NBTTagCompound() : rNBT;
|
||||
}
|
||||
|
||||
private static void applyBullshit(IBullshit aBullshitModifier, ItemStack aStack) {
|
||||
if (aStack != null) {
|
||||
NBTTagList nbttaglist = aStack.getEnchantmentTagList();
|
||||
if (nbttaglist != null) {
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
try {
|
||||
short short1 = nbttaglist.getCompoundTagAt(i).getShort("id");
|
||||
short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl");
|
||||
if (Enchantment.enchantmentsList[short1] != null)
|
||||
aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2);
|
||||
} catch (Throwable e) {
|
||||
//
|
||||
}
|
||||
public static void setPunchCardData(ItemStack aStack, String aPunchCardData) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setString("GT.PunchCardData", aPunchCardData);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static String getPunchCardData(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getString("GT.PunchCardData");
|
||||
}
|
||||
|
||||
public static void setLighterFuel(ItemStack aStack, long aFuel) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setLong("GT.LighterFuel", aFuel);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static long getLighterFuel(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getLong("GT.LighterFuel");
|
||||
}
|
||||
|
||||
public static void setMapID(ItemStack aStack, short aMapID) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setShort("map_id", aMapID);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static short getMapID(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
if (!tNBT.hasKey("map_id")) return -1;
|
||||
return tNBT.getShort("map_id");
|
||||
}
|
||||
|
||||
public static void setBookTitle(ItemStack aStack, String aTitle) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setString("title", aTitle);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static String getBookTitle(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getString("title");
|
||||
}
|
||||
|
||||
public static void setBookAuthor(ItemStack aStack, String aAuthor) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
tNBT.setString("author", aAuthor);
|
||||
setNBT(aStack, tNBT);
|
||||
}
|
||||
|
||||
public static String getBookAuthor(ItemStack aStack) {
|
||||
NBTTagCompound tNBT = getNBT(aStack);
|
||||
return tNBT.getString("author");
|
||||
}
|
||||
public static void addEnchantment(ItemStack aStack, Enchantment aEnchantment, int aLevel) {
|
||||
NBTTagCompound tNBT = getNBT(aStack), tEnchantmentTag;
|
||||
if (!tNBT.hasKey("ench", 9)) tNBT.setTag("ench", new NBTTagList());
|
||||
NBTTagList tList = tNBT.getTagList("ench", 10);
|
||||
|
||||
boolean temp = true;
|
||||
|
||||
for (int i = 0; i < tList.tagCount(); i++) {
|
||||
tEnchantmentTag = tList.getCompoundTagAt(i);
|
||||
if (tEnchantmentTag.getShort("id") == aEnchantment.effectId) {
|
||||
tEnchantmentTag.setShort("id", (short) aEnchantment.effectId);
|
||||
tEnchantmentTag.setShort("lvl", (byte) aLevel);
|
||||
temp = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (temp) {
|
||||
tEnchantmentTag = new NBTTagCompound();
|
||||
tEnchantmentTag.setShort("id", (short) aEnchantment.effectId);
|
||||
tEnchantmentTag.setShort("lvl", (byte) aLevel);
|
||||
tList.appendTag(tEnchantmentTag);
|
||||
}
|
||||
aStack.setTagCompound(tNBT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?!
|
||||
*/
|
||||
public static class GT_EnchantmentHelper {
|
||||
private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA();
|
||||
private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB();
|
||||
|
||||
private static void applyBullshit(IBullshit aBullshitModifier, ItemStack aStack) {
|
||||
if (aStack != null) {
|
||||
NBTTagList nbttaglist = aStack.getEnchantmentTagList();
|
||||
if (nbttaglist != null) {
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
try {
|
||||
short short1 = nbttaglist.getCompoundTagAt(i).getShort("id");
|
||||
short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl");
|
||||
if (Enchantment.enchantmentsList[short1] != null)
|
||||
aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2);
|
||||
} catch (Throwable e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyArrayOfBullshit(IBullshit aBullshitModifier, ItemStack[] aStacks) {
|
||||
ItemStack[] aitemstack1 = aStacks;
|
||||
int i = aStacks.length;
|
||||
for (int j = 0; j < i; ++j) {
|
||||
ItemStack itemstack = aitemstack1[j];
|
||||
applyBullshit(aBullshitModifier, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyBullshitA(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) {
|
||||
mBullshitIteratorA.mPlayer = aPlayer;
|
||||
mBullshitIteratorA.mEntity = aEntity;
|
||||
if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorA, aPlayer.getLastActiveItems());
|
||||
if (aStack != null) applyBullshit(mBullshitIteratorA, aStack);
|
||||
}
|
||||
|
||||
public static void applyBullshitB(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) {
|
||||
mBullshitIteratorB.mPlayer = aPlayer;
|
||||
mBullshitIteratorB.mEntity = aEntity;
|
||||
if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorB, aPlayer.getLastActiveItems());
|
||||
if (aStack != null) applyBullshit(mBullshitIteratorB, aStack);
|
||||
}
|
||||
|
||||
interface IBullshit {
|
||||
void calculateModifier(Enchantment aEnchantment, int aLevel);
|
||||
}
|
||||
|
||||
static final class BullshitIteratorA implements IBullshit {
|
||||
public EntityLivingBase mPlayer;
|
||||
public Entity mEntity;
|
||||
|
||||
BullshitIteratorA() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateModifier(Enchantment aEnchantment, int aLevel) {
|
||||
aEnchantment.func_151367_b(mPlayer, mEntity, aLevel);
|
||||
}
|
||||
}
|
||||
|
||||
static final class BullshitIteratorB implements IBullshit {
|
||||
public EntityLivingBase mPlayer;
|
||||
public Entity mEntity;
|
||||
|
||||
BullshitIteratorB() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateModifier(Enchantment aEnchantment, int aLevel) {
|
||||
aEnchantment.func_151368_a(mPlayer, mEntity, aLevel);
|
||||
}
|
||||
private static void applyArrayOfBullshit(IBullshit aBullshitModifier, ItemStack[] aStacks) {
|
||||
ItemStack[] aitemstack1 = aStacks;
|
||||
int i = aStacks.length;
|
||||
for (int j = 0; j < i; ++j) {
|
||||
ItemStack itemstack = aitemstack1[j];
|
||||
applyBullshit(aBullshitModifier, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void applyBullshitA(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) {
|
||||
mBullshitIteratorA.mPlayer = aPlayer;
|
||||
mBullshitIteratorA.mEntity = aEntity;
|
||||
if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorA, aPlayer.getLastActiveItems());
|
||||
if (aStack != null) applyBullshit(mBullshitIteratorA, aStack);
|
||||
}
|
||||
|
||||
public static void applyBullshitB(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) {
|
||||
mBullshitIteratorB.mPlayer = aPlayer;
|
||||
mBullshitIteratorB.mEntity = aEntity;
|
||||
if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorB, aPlayer.getLastActiveItems());
|
||||
if (aStack != null) applyBullshit(mBullshitIteratorB, aStack);
|
||||
}
|
||||
|
||||
interface IBullshit {
|
||||
void calculateModifier(Enchantment aEnchantment, int aLevel);
|
||||
}
|
||||
|
||||
static final class BullshitIteratorA implements IBullshit {
|
||||
public EntityLivingBase mPlayer;
|
||||
public Entity mEntity;
|
||||
|
||||
BullshitIteratorA() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateModifier(Enchantment aEnchantment, int aLevel) {
|
||||
aEnchantment.func_151367_b(mPlayer, mEntity, aLevel);
|
||||
}
|
||||
}
|
||||
|
||||
static final class BullshitIteratorB implements IBullshit {
|
||||
public EntityLivingBase mPlayer;
|
||||
public Entity mEntity;
|
||||
|
||||
BullshitIteratorB() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateModifier(Enchantment aEnchantment, int aLevel) {
|
||||
aEnchantment.func_151368_a(mPlayer, mEntity, aLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import gregtech.api.GregTech_API;
|
||||
import gregtech.api.enums.*;
|
||||
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
|
||||
import gregtech.api.interfaces.IProjectileItem;
|
||||
import gregtech.api.interfaces.internal.IGT_Mod;
|
||||
import gregtech.api.interfaces.internal.IThaumcraftCompat;
|
||||
|
@ -27,6 +28,12 @@ import gregtech.api.objects.MaterialStack;
|
|||
import gregtech.api.util.*;
|
||||
import gregtech.common.entities.GT_Entity_Arrow;
|
||||
import gregtech.common.items.GT_MetaGenerated_Tool_01;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -46,6 +53,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
|
@ -58,6 +66,7 @@ import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
|||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.terraingen.OreGenEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
@ -148,6 +157,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
public int mFlintChance = 30;
|
||||
public int mItemDespawnTime = 6000;
|
||||
public int mUpgradeCount = 4;
|
||||
|
||||
private World mUniverse = null;
|
||||
private boolean isFirstServerWorldTick = true;
|
||||
private boolean mOreDictActivated = false;
|
||||
|
@ -158,6 +168,10 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
public boolean mChangeHarvestLevels=false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public GT_Proxy() {
|
||||
GameRegistry.registerFuelHandler(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
@ -561,6 +575,12 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), tBits, new Object[]{"PhP", "SRf", "PdP",
|
||||
Character.valueOf('P'), aMaterial == Materials.Wood ? OrePrefixes.plank.get(aMaterial) : OrePrefixes.plate.get(aMaterial),
|
||||
Character.valueOf('R'), OrePrefixes.ring.get(aMaterial), Character.valueOf('S'), OrePrefixes.screw.get(aMaterial)});
|
||||
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, aMaterial, 1L), Materials.Tin.getMolten(32), GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), 240, 24);
|
||||
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, aMaterial, 1L), Materials.Lead.getMolten(48), GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), 240, 24);
|
||||
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, aMaterial, 1L), Materials.SolderingAlloy.getMolten(16), GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), 240, 24);
|
||||
|
||||
|
||||
|
||||
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L), tBits,
|
||||
new Object[]{"sf", "G ", Character.valueOf('G'), OrePrefixes.gemFlawless.get(aMaterial)});
|
||||
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 2L), tBits,
|
||||
|
@ -1114,20 +1134,21 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
tReRegisteredMaterial = (Materials) i$.next();
|
||||
}
|
||||
aMaterial.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore}));
|
||||
if ((GregTech_API.sThaumcraftCompat != null) && (aPrefix.doGenerateItem(aMaterial)) && (!aPrefix.isIgnored(aMaterial))) {
|
||||
long tAmount = aPrefix.mMaterialAmount < 0L ? 3628800L : aPrefix.mMaterialAmount;
|
||||
List<TC_Aspects.TC_AspectStack> tAspects = new ArrayList();
|
||||
TC_Aspects.TC_AspectStack tAspect;
|
||||
for (Iterator i$ = aPrefix.mAspects.iterator(); i$.hasNext(); tAspect.addToAspectList(tAspects)) {
|
||||
tAspect = (TC_Aspects.TC_AspectStack) i$.next();
|
||||
}
|
||||
tAspect = null;
|
||||
for (Iterator i$ = aMaterial.mAspects.iterator(); i$.hasNext(); tAspect.copy(tAspect.mAmount * tAmount / 3628800L)
|
||||
.addToAspectList(tAspects)) {
|
||||
tAspect = (TC_Aspects.TC_AspectStack) i$.next();
|
||||
}
|
||||
GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore}),
|
||||
tAspects, aEvent.Name);
|
||||
|
||||
if (GregTech_API.sThaumcraftCompat != null && aPrefix.doGenerateItem(aMaterial) && !aPrefix.isIgnored(aMaterial)) {
|
||||
|
||||
List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>();
|
||||
|
||||
for (TC_AspectStack tAspect : aPrefix.mAspects) tAspect.addToAspectList(tAspects);
|
||||
if (aPrefix.mMaterialAmount >= 3628800 || aPrefix.mMaterialAmount < 0) for (TC_AspectStack tAspect : aMaterial.mAspects) tAspect.addToAspectList(tAspects);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(GT_Utility.copyAmount(1, aEvent.Ore), tAspects, aEvent.Name);
|
||||
}
|
||||
switch (aPrefix) {
|
||||
case crystal:
|
||||
|
@ -1511,6 +1532,19 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
}
|
||||
|
||||
public Object getServerGuiElement(int aID, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
|
||||
// if(aID>=1000){
|
||||
// int ID = aID-1000;
|
||||
// switch(ID){
|
||||
// case 0:
|
||||
// return new ContainerBasicArmor(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem()));
|
||||
// case 1:
|
||||
// return new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem()));
|
||||
// case 2:
|
||||
// return new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem()));
|
||||
// default:
|
||||
// return getRightItem(aPlayer, ID);
|
||||
// }
|
||||
// }
|
||||
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
|
||||
if ((tTileEntity instanceof IGregTechTileEntity)) {
|
||||
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
|
||||
|
@ -1520,8 +1554,36 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
public Object getRightItem(EntityPlayer player, int ID){
|
||||
// ItemStack mStack = player.getEquipmentInSlot(ID/100);
|
||||
// if(mStack==null||!(mStack.getItem() instanceof ModularArmor_Item))return null;
|
||||
|
||||
// switch(ID % 100){
|
||||
// case 0:
|
||||
// return new ContainerBasicArmor(player, new InventoryArmor(ModularArmor_Item.class, mStack));
|
||||
// case 1:
|
||||
// return new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack));
|
||||
// case 2:
|
||||
// return new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack));
|
||||
// }
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public Object getClientGuiElement(int aID, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
|
||||
// if(aID>=1000){
|
||||
// int ID = aID-1000;
|
||||
// switch(ID){
|
||||
// case 0:
|
||||
// return new GuiModularArmor(new ContainerBasicArmor(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer);
|
||||
// case 1:
|
||||
// return new GuiElectricArmor1(new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer);
|
||||
// case 2:
|
||||
// return new GuiElectricArmor1(new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer);
|
||||
// default:
|
||||
// return getRightItemGui(aPlayer, ID);
|
||||
// }
|
||||
// }
|
||||
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
|
||||
if ((tTileEntity instanceof IGregTechTileEntity)) {
|
||||
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
|
||||
|
@ -1531,6 +1593,21 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
public Object getRightItemGui(EntityPlayer player, int ID){
|
||||
// ItemStack mStack = player.getEquipmentInSlot(ID/100);
|
||||
// if(mStack==null||!(mStack.getItem() instanceof ModularArmor_Item))return null;
|
||||
|
||||
// switch(ID % 100){
|
||||
// case 0:
|
||||
// return new GuiModularArmor(new ContainerBasicArmor(player, new InventoryArmor(ModularArmor_Item.class, mStack)),player);
|
||||
// case 1:
|
||||
// return new GuiElectricArmor1(new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack)), player);
|
||||
// case 2:
|
||||
// return new GuiElectricArmor1(new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack)), player);
|
||||
// }
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public int getBurnTime(ItemStack aFuel) {
|
||||
if ((aFuel == null) || (aFuel.getItem() == null)) {
|
||||
|
@ -1594,7 +1671,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
rFuelValue = (short) Math.max(rFuelValue, 6000);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustCaesium")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 6000);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 6000);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustSmallCaesium")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 2000);
|
||||
|
@ -1603,22 +1680,22 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
rFuelValue = (short) Math.max(rFuelValue, 888);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "gemLignite")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 300);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 1200);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "crushedLignite")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 300);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 1200);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustImpureLignite")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 300);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 1200);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustLignite")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 300);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 1200);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustSmallLignite")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 75);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 375);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustTinyLignite")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 33);
|
||||
rFuelValue = (short) Math.max(rFuelValue, 375);
|
||||
}
|
||||
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "gemCoal")) {
|
||||
rFuelValue = (short) Math.max(rFuelValue, 1600);
|
||||
|
@ -1807,6 +1884,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
} else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("appliedenergistics2") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.CertusQuartz) {
|
||||
GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false);
|
||||
GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true);
|
||||
} else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals(GT_Values.MOD_ID_TC) && tOre.mPrefix == OrePrefixes.block && tOre.mMaterial == Materials.Thaumium) {
|
||||
GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false);
|
||||
GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true);
|
||||
} else if (GT_OreDictUnificator.isBlacklisted(tOre.mEvent.Ore)) {
|
||||
GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, true);
|
||||
} else {
|
||||
|
@ -1839,7 +1919,28 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
tEvent = (OreDictEventContainer) i$.next();
|
||||
}
|
||||
}
|
||||
public static final HashMap<ChunkPosition, int[]> chunkData = new HashMap<ChunkPosition, int[]>(5000);
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleChunkSaveEvent(ChunkDataEvent.Save event)
|
||||
{
|
||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||
if(chunkData.containsKey(tPos)){
|
||||
int[] tInts = chunkData.get(tPos);
|
||||
if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleChunkLoadEvent(ChunkDataEvent.Load event)
|
||||
{
|
||||
int tOil = -1;
|
||||
if(event.getData().hasKey("GTOIL")){
|
||||
tOil = event.getData().getInteger("GTOIL");}
|
||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||
if(chunkData.containsKey(tPos)){
|
||||
chunkData.remove(tPos);}
|
||||
chunkData.put(tPos, new int[]{ tOil});
|
||||
}
|
||||
public static class OreDictEventContainer {
|
||||
public final OreDictionary.OreRegisterEvent mEvent;
|
||||
public final OrePrefixes mPrefix;
|
||||
|
|
|
@ -0,0 +1,236 @@
|
|||
package gregtech.common.tileentities.machines.multi;
|
||||
|
||||
import gregtech.api.GregTech_API;
|
||||
import gregtech.api.enums.Textures;
|
||||
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
|
||||
import gregtech.api.interfaces.ITexture;
|
||||
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
|
||||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.api.util.GT_ModHandler;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase {
|
||||
|
||||
private boolean completedCycle = false;
|
||||
|
||||
public GT_MetaTileEntity_OilDrill(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional);
|
||||
}
|
||||
|
||||
public GT_MetaTileEntity_OilDrill(String aName) {
|
||||
super(aName);
|
||||
}
|
||||
|
||||
public String[] getDescription() {
|
||||
return new String[]{
|
||||
"Controller Block for the Oil Drilling Rig",
|
||||
"Size: 3x3x7", "Controller (front middle at bottom)",
|
||||
"3x3 Base of Solid Steel Casings",
|
||||
"Also part of Base: Energy Input Hatch",
|
||||
"Fluid Output Hatch and Maintainance Hatch",
|
||||
"3x Solid Steel Casings on top the Center of the base",
|
||||
"Steel Frame Boxes on each side and 3 more on top"};
|
||||
}
|
||||
|
||||
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
|
||||
if (aSide == aFacing) {
|
||||
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)};
|
||||
}
|
||||
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]};
|
||||
}
|
||||
|
||||
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRecipe(ItemStack aStack) {
|
||||
if (mInventory[1] == null || (mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && mInventory[1].stackSize < mInventory[1].getMaxStackSize())) {
|
||||
ArrayList<ItemStack> tItems = getStoredInputs();
|
||||
for (ItemStack tStack : tItems) {
|
||||
if (tStack.isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
|
||||
if (tStack.stackSize < 2) {
|
||||
tStack = null;
|
||||
} else {
|
||||
tStack.stackSize--;
|
||||
}
|
||||
|
||||
}
|
||||
if (mInventory[1] == null) {
|
||||
mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L);
|
||||
} else {
|
||||
mInventory[1].stackSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
|
||||
if (tFluid == null) {
|
||||
return false;
|
||||
}
|
||||
if (getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) {
|
||||
if (completedCycle) {
|
||||
moveOneDown();
|
||||
}
|
||||
tFluid = null;
|
||||
if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4))
|
||||
completedCycle = true;
|
||||
} else if (tFluid.amount < 5000) {
|
||||
return false;
|
||||
} else {
|
||||
tFluid.amount = tFluid.amount / 5000;
|
||||
}
|
||||
long tVoltage = getMaxInputVoltage();
|
||||
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
|
||||
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
|
||||
this.mEfficiencyIncrease = 10000;
|
||||
int tEU = 24;
|
||||
int tDuration = 160;
|
||||
if (tEU <= 16) {
|
||||
this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1));
|
||||
this.mMaxProgresstime = (tDuration / (1 << tTier - 1));
|
||||
} else {
|
||||
this.mEUt = tEU;
|
||||
this.mMaxProgresstime = tDuration;
|
||||
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
|
||||
this.mEUt *= 4;
|
||||
this.mMaxProgresstime /= 2;
|
||||
}
|
||||
}
|
||||
if (this.mEUt > 0) {
|
||||
this.mEUt = (-this.mEUt);
|
||||
}
|
||||
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
|
||||
this.mOutputFluids = new FluidStack[]{tFluid};
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean moveOneDown() {
|
||||
if ((this.mInventory[1] == null) || (this.mInventory[1].stackSize < 1)
|
||||
|| (!GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L)))) {
|
||||
return false;
|
||||
}
|
||||
int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX;
|
||||
int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ;
|
||||
int yHead = getYOfPumpHead();
|
||||
if (yHead <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) {
|
||||
return false;
|
||||
}
|
||||
if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) {
|
||||
return false;
|
||||
}
|
||||
if (yHead != getBaseMetaTileEntity().getYCoord()) {
|
||||
getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L)));
|
||||
}
|
||||
getBaseMetaTileEntity().decrStackSize(1, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getYOfPumpHead() {
|
||||
int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX;
|
||||
int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ;
|
||||
int y = getBaseMetaTileEntity().getYCoord() - 1;
|
||||
while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
|
||||
y--;
|
||||
}
|
||||
if (y == getBaseMetaTileEntity().getYCoord() - 1) {
|
||||
if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) {
|
||||
return y + 1;
|
||||
}
|
||||
} else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility
|
||||
.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[1] != null && this.mInventory[1].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) {
|
||||
getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir,
|
||||
GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)));
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
|
||||
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
||||
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
||||
for (int i = -1; i < 2; i++) {
|
||||
for (int j = -1; j < 2; j++) {
|
||||
if ((xDir + i != 0) || (zDir + j != 0)) {
|
||||
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
|
||||
if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16)) && (!addOutputToMachineList(tTileEntity, 16)) && (!addEnergyInputToMachineList(tTileEntity, 16))) {
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings2) {
|
||||
return false;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int y = 1; y < 4; y++) {
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir) != GregTech_API.sBlockCasings2) {
|
||||
return false;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir + 1, y, zDir) != GregTech_API.sBlockMachines) {
|
||||
return false;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir - 1, y, zDir) != GregTech_API.sBlockMachines) {
|
||||
return false;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir + 1) != GregTech_API.sBlockMachines) {
|
||||
return false;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir - 1) != GregTech_API.sBlockMachines) {
|
||||
return false;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlockOffset(xDir, y + 3, zDir) != GregTech_API.sBlockMachines) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCorrectMachinePart(ItemStack aStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEfficiency(ItemStack aStack) {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollutionPerTick(ItemStack aStack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageToComponent(ItemStack aStack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmountOfOutputs() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean explodesOnComponentBreak(ItemStack aStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
|
||||
return new GT_MetaTileEntity_OilDrill(this.mName);
|
||||
}
|
||||
|
||||
}
|
|
@ -194,6 +194,11 @@ public class GT_Loader_Item_Block_And_Fluid
|
|||
ItemList.sNaturalGas = GT_Mod.gregtechproxy.addFluid("gas_natural_gas", "Natural Gas", null, 2, 295);
|
||||
ItemList.sDrillingFluid = GT_Mod.gregtechproxy.addFluid("liquid_drillingfluid", "Drilling Fluid", null, 1, 295);
|
||||
|
||||
GT_Mod.gregtechproxy.addFluid("liquid_heavy_oil", "Heavy Oil", Materials.OilHeavy, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.OilHeavy, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
GT_Mod.gregtechproxy.addFluid("liquid_medium_oil", "Raw Oil", Materials.OilMedium, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.OilMedium, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
GT_Mod.gregtechproxy.addFluid("liquid_light_oil", "Light Oil", Materials.OilLight, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.OilLight, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
GT_Mod.gregtechproxy.addFluid("gas_natural_gas", "Natural Gas", Materials.NatruralGas, 2, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.NatruralGas, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
|
||||
GT_Mod.gregtechproxy.addFluid("UUAmplifier", "UU Amplifier", Materials.UUAmplifier, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.UUAmplifier, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
GT_Mod.gregtechproxy.addFluid("Chlorine", "Chlorine", Materials.Chlorine, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Chlorine, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
GT_Mod.gregtechproxy.addFluid("Mercury", "Mercury", Materials.Mercury, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Mercury, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
|
||||
|
|
|
@ -952,6 +952,9 @@ public class GT_Loader_MetaTileEntities
|
|||
ItemList.Machine_Multi_HeatExchanger.set(new GT_MetaTileEntity_HeatExchanger(1154, "multimachine.heatexchanger", "Large Heat Exchanger").getStackForm(1L));
|
||||
GT_ModHandler.addCraftingRecipe(ItemList.Machine_Multi_HeatExchanger.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WCW", "CMC", "WCW", Character.valueOf('M'), ItemList.Casing_Pipe_Titanium, Character.valueOf('C'), OrePrefixes.pipeMedium.get(Materials.Titanium), Character.valueOf('W'), ItemList.Electric_Pump_EV});
|
||||
|
||||
ItemList.OilDrill.set(new GT_MetaTileEntity_OilDrill(1157, "multimachine.oildrill", "Oil Drilling Rig").getStackForm(1));
|
||||
GT_ModHandler.addCraftingRecipe(ItemList.OilDrill.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.Hull_MV, 'W', OrePrefixes.frameGt.get(Materials.Steel), 'E', OrePrefixes.circuit.get(Materials.Good), 'C', ItemList.Electric_Motor_MV});
|
||||
|
||||
ItemList.AdvancedMiner2.set(new GT_MetaTileEntity_AdvMiner2(1158, "multimachine.advminer2", "Advanced Miner II").getStackForm(1));
|
||||
GT_ModHandler.addCraftingRecipe(ItemList.AdvancedMiner2.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.Hull_EV, 'W', OrePrefixes.frameGt.get(Materials.Titanium), 'E', OrePrefixes.circuit.get(Materials.Data), 'C', ItemList.Electric_Motor_EV});
|
||||
|
||||
|
|
Loading…
Reference in a new issue