diff options
author | miozune <miozune@gmail.com> | 2023-06-30 09:23:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-30 09:23:45 +0900 |
commit | 5036c2adee48f43f1772c0574ba6627f44455615 (patch) | |
tree | 982f905c667f065fd830691ba12a2612bf8630ee /src/main/java/gtPlusPlus | |
parent | 904c9429c742d7e9e84fdeb584fe4c4ed2625bcd (diff) | |
download | GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.tar.gz GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.tar.bz2 GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.zip |
Remove Breaker Box (#683)
Diffstat (limited to 'src/main/java/gtPlusPlus')
15 files changed, 1 insertions, 2642 deletions
diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index 4383c31c3d..4b48a97305 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -29,7 +29,6 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.FishPondFakeRecipe; import gregtech.api.util.GTPP_Recipe; @@ -155,10 +154,6 @@ public class GTplusplus implements ActionListener { public GTplusplus() { super(); INIT_PHASE.SUPER.setPhaseActive(true); - - for (int i = 12; i < 16; i++) { - GregTech_API.registerTileEntityConstructor(i, Meta_GT_Proxy::constructCustomGregtechMetaTileEntityByMeta); - } } // Pre-Init @@ -317,46 +312,6 @@ public class GTplusplus implements ActionListener { mInvalidCount[6] = RecipeGen_MultisUsingFluidInsteadOfCells.generateRecipesNotUsingCells( GTPP_Recipe.GTPP_Recipe_Map.sReactorProcessingUnitRecipes, GTPP_Recipe.GTPP_Recipe_Map.sNuclearSaltProcessingPlantRecipes); - /* - * //Large Centrifuge generation mOriginalCount[0] = - * GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(); for (GT_Recipe x : - * GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.mRecipeList) { if (x != null) { if - * (ItemUtils.checkForInvalidItems(x.mInputs, x.mOutputs)) { if - * (CORE.RA.addMultiblockCentrifugeRecipe(x.mInputs, x.mFluidInputs, x.mFluidOutputs, x.mOutputs, x.mChances, - * x.mDuration, x.mEUt, x.mSpecialValue)) { mValidCount[0]++; } else { mInvalidCount[0]++; } } else { - * Logger.INFO("[Recipe] Error generating Large Centrifuge recipe."); - * Logger.INFO("Inputs: "+ItemUtils.getArrayStackNames(x.mInputs)); - * Logger.INFO("Fluid Inputs: "+ItemUtils.getArrayStackNames(x.mFluidInputs)); - * Logger.INFO("Outputs: "+ItemUtils.getArrayStackNames(x.mOutputs)); - * Logger.INFO("Fluid Outputs: "+ItemUtils.getArrayStackNames(x.mFluidOutputs)); } } else { mInvalidCount[0]++; - * } } if (GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mRecipeList.size() < 1) { for (GT_Recipe - * a : GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mRecipeList) { - * GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.add(a); } } //Large Electrolyzer generation - * mOriginalCount[1] = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(); for (GT_Recipe x : - * GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList) { if (x != null) { if - * (ItemUtils.checkForInvalidItems(x.mInputs, x.mOutputs)) { if - * (CORE.RA.addMultiblockElectrolyzerRecipe(x.mInputs, x.mFluidInputs, x.mFluidOutputs, x.mOutputs, x.mChances, - * x.mDuration, x.mEUt, x.mSpecialValue)) { mValidCount[1]++; } else { mInvalidCount[1]++; } } else { - * Logger.INFO("[Recipe] Error generating Large Electrolyzer recipe."); - * Logger.INFO("Inputs: "+ItemUtils.getArrayStackNames(x.mInputs)); - * Logger.INFO("Fluid Inputs: "+ItemUtils.getArrayStackNames(x.mFluidInputs)); - * Logger.INFO("Outputs: "+ItemUtils.getArrayStackNames(x.mOutputs)); - * Logger.INFO("Fluid Outputs: "+ItemUtils.getArrayStackNames(x.mFluidOutputs)); } } else { mInvalidCount[1]++; - * } } if (GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList.size() < 1) { for - * (GT_Recipe a : GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList) { - * GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.add(a); } } //Advanced Vacuum Freezer - * generation mOriginalCount[2] = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.mRecipeList.size(); for (GT_Recipe x : - * GT_Recipe.GT_Recipe_Map.sVacuumRecipes.mRecipeList) { if (x != null && - * RecipeUtils.doesGregtechRecipeHaveEqualCells(x)) { if (ItemUtils.checkForInvalidItems(x.mInputs, x.mOutputs)) - * { if (CORE.RA.addAdvancedFreezerRecipe(x.mInputs, x.mFluidInputs, x.mFluidOutputs, x.mOutputs, x.mChances, - * x.mDuration, x.mEUt, x.mSpecialValue)) { mValidCount[2]++; } } else { mInvalidCount[2]++; } } else { - * mInvalidCount[2]++; } } //Redo plasma recipes in Adv. Vac. - * //Meta_GT_Proxy.generatePlasmaRecipesForAdvVacFreezer(); String[] machineName = new String[] {"Centrifuge", - * "Electrolyzer", "Vacuum Freezer"}; for (int i=0;i<3;i++) { - * Logger.INFO("[Recipe] Generated "+mValidCount[i]+" recipes for the Industrial "+machineName[i] - * +". The original machine can process "+mOriginalCount[i]+" recipes, meaning "+mInvalidCount[i] - * +" are invalid for this Multiblock's processing in some way."); } - */ } protected void dumpGtRecipeMap(final GT_Recipe_Map r) { diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index eef430bd4e..5f9cfb732e 100644 --- a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -89,7 +89,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLargeTurbinesAndHe import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMolecularTransformer; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechNuclearSaltProcessingPlant; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPollutionDevices; -import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPowerBreakers; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPowerSubStation; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechQuantumForceTransformer; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechRTG; @@ -200,7 +199,6 @@ public class COMPAT_HANDLER { GregtechIndustrialArcFurnace.run(); GregtechSolarTower.run(); GregtechLargeTurbinesAndHeatExchanger.run(); - GregtechPowerBreakers.run(); GregtechAlgaeContent.run(); GregtechIndustrialAlloySmelter.run(); GregtechIsaMill.run(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 2343b6e76e..d1c8504e88 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -765,18 +765,6 @@ public enum GregtechItemList implements GregtechItemContainer { ColdTrap_IV, ColdTrap_ZPM, - // Breakers - BreakerBox_ULV, - BreakerBox_LV, - BreakerBox_MV, - BreakerBox_HV, - BreakerBox_EV, - BreakerBox_IV, - BreakerBox_LuV, - BreakerBox_ZPM, - BreakerBox_UV, - BreakerBox_MAX, - // Solar Generators GT_Solar_ULV, GT_Solar_LV, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IBaseCustomMetaTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IBaseCustomMetaTileEntity.java deleted file mode 100644 index e210dfb487..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IBaseCustomMetaTileEntity.java +++ /dev/null @@ -1,6 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces; - -public interface IBaseCustomMetaTileEntity { - - public boolean doesExplode(); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java deleted file mode 100644 index 0c4a66d890..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ /dev/null @@ -1,206 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Random; - -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.metatileentity.BaseMetaTileEntity; -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.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; -import ic2.api.Direction; - -public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCustomMetaTileEntity { - - protected NBTTagCompound mRecipeStuff2; - private static final Field ENTITY_ITEM_HEALTH_FIELD_2; - - static { - Field f = null; - try { - f = EntityItem.class.getDeclaredField("field_70291_e"); - f.setAccessible(true); - } catch (Exception var4) { - try { - f = EntityItem.class.getDeclaredField("health"); - f.setAccessible(true); - } catch (Exception var3) { - var4.printStackTrace(); - var3.printStackTrace(); - } - } - - ENTITY_ITEM_HEALTH_FIELD_2 = f; - } - - public BaseCustomTileEntity() { - super(); - Logger.MACHINE_INFO("Created new BaseCustomTileEntity"); - } - - @Override - public boolean doesExplode() { - return true; - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - try { - super.writeToNBT(aNBT); - } catch (Throwable arg7) { - GT_Log.err.println( - "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - arg7.printStackTrace(GT_Log.err); - } - - try { - if (!aNBT.hasKey("ModVersion")) aNBT.setString("ModVersion", CORE.VERSION); - } catch (Throwable arg6) { - GT_Log.err.println( - "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - arg6.printStackTrace(GT_Log.err); - } - } - - @Override - public void doEnergyExplosion() { - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [doEnergyExplosion]"); - return; - } - if (this.getUniversalEnergyCapacity() > 0L - && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { - this.doExplosion( - this.getOutput() * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 - : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); - GT_Mod arg9999 = GT_Mod.instance; - GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), - "electricproblems"); - } - } - - @Override - public void doExplosion(long aAmount) { - - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [doExplosion]"); - return; - } - - if (this.canAccessData()) { - if (GregTech_API.sMachineWireFire && this.mMetaTileEntity.isElectric()) { - try { - this.mReleaseEnergy = true; - Util.emitEnergyToNetwork(GT_Values.V[5], Math.max(1L, this.getStoredEU() / GT_Values.V[5]), this); - } catch (Exception arg4) { - ; - } - } - - this.mReleaseEnergy = false; - this.mMetaTileEntity.onExplosion(); - int i; - - if (GT_Mod.gregtechproxy.mExplosionItemDrop) { - for (i = 0; i < this.getSizeInventory(); ++i) { - ItemStack tItem = this.getStackInSlot(i); - if (tItem != null && tItem.stackSize > 0 && this.isValidSlot(i)) { - this.dropItems(tItem); - this.setInventorySlotContents(i, (ItemStack) null); - } - } - } - - if (this.mRecipeStuff2 != null) { - for (i = 0; i < 9; ++i) { - this.dropItems(GT_Utility.loadItem(this.mRecipeStuff2, "Ingredient." + i)); - } - } - - PollutionUtils.addPollution(this, 100000); - this.mMetaTileEntity.doExplosion(aAmount); - } - } - - @Override - public void dropItems(ItemStack tItem) { - if (tItem != null) { - Random tRandom = new Random(); - EntityItem tItemEntity = new EntityItem( - this.worldObj, - (double) ((float) this.xCoord + tRandom.nextFloat() * 0.8F + 0.1F), - (double) ((float) this.yCoord + tRandom.nextFloat() * 0.8F + 0.1F), - (double) ((float) this.zCoord + 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; - tItemEntity.hurtResistantTime = 999999; - tItemEntity.lifespan = 60000; - - try { - if (ENTITY_ITEM_HEALTH_FIELD_2 != null) { - ENTITY_ITEM_HEALTH_FIELD_2.setInt(tItemEntity, 99999999); - } - } catch (Exception var5) { - ; - } - - this.worldObj.spawnEntityInWorld(tItemEntity); - tItem.stackSize = 0; - } - } - - @Override - public ArrayList<ItemStack> getDrops() { - ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, this.getMetaTileID()); - // Currently not using my custom block. - // ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, - // this.getMetaTileID()); - boolean fail = true; - - ArrayList<ItemStack> aSuperDrops = super.getDrops(); - if (aSuperDrops != null && !aSuperDrops.isEmpty()) { - ItemStack aSuperStack = super.getDrops().get(0); - if (aSuperStack != null && aSuperStack.hasTagCompound()) { - NBTTagCompound aSuperNBT = aSuperStack.getTagCompound(); - if (aSuperNBT != null && !aSuperNBT.hasNoTags()) { - NBTTagCompound tNBT = (NBTTagCompound) aSuperNBT.copy(); - if (tNBT != null && !tNBT.hasNoTags()) { - if (this.hasValidMetaTileEntity()) { - this.mMetaTileEntity.setItemNBT(tNBT); - rStack.setTagCompound(tNBT); - fail = false; - aDrops.add(rStack); - } - } - } - } - } - if (fail) { - aDrops.add(rStack); - } - return aDrops; - } - - @Override - public boolean isTeleporterCompatible(Direction aSide) { - return this.canAccessData() && this.mMetaTileEntity.isTeleporterCompatible(); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java deleted file mode 100644 index 079a9946d1..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ /dev/null @@ -1,291 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; -import ic2.api.Direction; - -public class BaseCustomPower_MTE extends BaseCustomTileEntity { - - public BaseCustomPower_MTE() { - super(); - Logger.INFO("Created new BaseCustomPower_MTE"); - } - - @Override - public boolean doesExplode() { - return false; - } - - public long injectEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) { - if (mMetaTileEntity == null) { - Logger.INFO("Bad Tile"); - } - if (this.canAccessData() && this.mMetaTileEntity.isElectric() - && this.inputEnergyFrom(side) - && aAmperage > 0L - && aVoltage > 0L - && this.getStoredEU() < this.getEUCapacity() - && this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage()) { - Logger.INFO("Injecting Energy Units"); - return super.injectEnergyUnits(side, aVoltage, aAmperage); - } else { - Logger.INFO("canAccessData(): " + canAccessData()); - Logger.INFO("isElectric(): " + this.mMetaTileEntity.isElectric()); - Logger.INFO("InputEnergyFromSide(" + side + "): " + this.inputEnergyFrom(side)); - Logger.INFO("aAmperage: " + aAmperage); - Logger.INFO("aVoltage: " + aVoltage); - Logger.INFO("this.getStoredEU() < this.getEUCapacity(): " + (this.getStoredEU() < this.getEUCapacity())); - Logger.INFO( - "this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: " - + (this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); - Logger.INFO("this.mMetaTileEntity.maxAmperesIn(): " + (this.mMetaTileEntity.maxAmperesIn())); - Logger.INFO("this.mAcceptedAmperes: " + (this.getInputAmperage())); - return 0L; - } - } - - public boolean drainEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) { - Logger.INFO("Draining Energy Units 4"); - if (this.canAccessData() && this.mMetaTileEntity.isElectric() - && this.outputsEnergyTo(side) - && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { - if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { - this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] - + aVoltage * aAmperage); - return true; - } else { - return false; - } - } else { - return false; - } - } - - @Override - public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { - Logger.INFO("Draining Energy Units 3"); - // TODO Auto-generated method stub - return super.decreaseStoredEnergyUnits(aEnergy, aIgnoreTooLessEnergy); - } - - @Override - public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { - // TODO Auto-generated method stub - return super.increaseStoredEnergyUnits(aEnergy, aIgnoreTooMuchEnergy); - } - - @Override - public boolean inputEnergyFrom(ForgeDirection side) { - // TODO Auto-generated method stub - return super.inputEnergyFrom(side); - } - - @Override - public boolean outputsEnergyTo(ForgeDirection side) { - Logger.INFO("Draining Energy Units 2"); - // TODO Auto-generated method stub - return super.outputsEnergyTo(side); - } - - @Override - public long getOutputAmperage() { - // TODO Auto-generated method stub - return super.getOutputAmperage(); - } - - @Override - public long getOutputVoltage() { - // TODO Auto-generated method stub - return super.getOutputVoltage(); - } - - @Override - public long getInputAmperage() { - // TODO Auto-generated method stub - return super.getInputAmperage(); - } - - @Override - public long getInputVoltage() { - // TODO Auto-generated method stub - return super.getInputVoltage(); - } - - @Override - public long getUniversalEnergyStored() { - // TODO Auto-generated method stub - return super.getUniversalEnergyStored(); - } - - @Override - public long getUniversalEnergyCapacity() { - // TODO Auto-generated method stub - return super.getUniversalEnergyCapacity(); - } - - @Override - public long getStoredEU() { - // TODO Auto-generated method stub - return super.getStoredEU(); - } - - @Override - public long getEUCapacity() { - // TODO Auto-generated method stub - return super.getEUCapacity(); - } - - @Override - public boolean setStoredEU(long aEnergy) { - // TODO Auto-generated method stub - return super.setStoredEU(aEnergy); - } - - @Override - public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { - Logger.INFO("Draining Energy Units 1"); - // TODO Auto-generated method stub - return super.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy); - } - - @Override - public boolean decreaseStoredSteam(long aEnergy, boolean aIgnoreTooLessEnergy) { - // TODO Auto-generated method stub - return super.decreaseStoredSteam(aEnergy, aIgnoreTooLessEnergy); - } - - @Override - public void doEnergyExplosion() { - // TODO Auto-generated method stub - super.doEnergyExplosion(); - } - - @Override - public void doExplosion(long aAmount) { - // TODO Auto-generated method stub - super.doExplosion(aAmount); - } - - @Override - public byte getLightValue() { - // TODO Auto-generated method stub - return super.getLightValue(); - } - - @Override - public long getAverageElectricInput() { - // TODO Auto-generated method stub - return super.getAverageElectricInput(); - } - - @Override - public long getAverageElectricOutput() { - // TODO Auto-generated method stub - return super.getAverageElectricOutput(); - } - - @Override - public double getOutputEnergyUnitsPerTick() { - // TODO Auto-generated method stub - return super.getOutputEnergyUnitsPerTick(); - } - - @Override - public double demandedEnergyUnits() { - // TODO Auto-generated method stub - return super.demandedEnergyUnits(); - } - - @Override - public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { - // TODO Auto-generated method stub - return super.injectEnergyUnits(aDirection, aAmount); - } - - @Override - public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { - // TODO Auto-generated method stub - return super.acceptsEnergyFrom(aEmitter, aDirection); - } - - @Override - public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { - // TODO Auto-generated method stub - return super.emitsEnergyTo(aReceiver, aDirection); - } - - @Override - public double getOfferedEnergy() { - // TODO Auto-generated method stub - return super.getOfferedEnergy(); - } - - @Override - public void drawEnergy(double amount) { - // TODO Auto-generated method stub - super.drawEnergy(amount); - } - - @Override - public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { - // TODO Auto-generated method stub - return super.injectEnergy(aForgeDirection, aAmount); - } - - @Override - public int addEnergy(int aEnergy) { - // TODO Auto-generated method stub - return super.addEnergy(aEnergy); - } - - @Override - public boolean isAddedToEnergyNet() { - // TODO Auto-generated method stub - return super.isAddedToEnergyNet(); - } - - @Override - public int demandsEnergy() { - // TODO Auto-generated method stub - return super.demandsEnergy(); - } - - @Override - public int getMaxSafeInput() { - // TODO Auto-generated method stub - return super.getMaxSafeInput(); - } - - @Override - public int getMaxEnergyOutput() { - // TODO Auto-generated method stub - return super.getMaxEnergyOutput(); - } - - @Override - public int injectEnergy(Direction aDirection, int aAmount) { - // TODO Auto-generated method stub - return super.injectEnergy(aDirection, aAmount); - } - - @Override - public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { - // TODO Auto-generated method stub - return super.acceptsEnergyFrom(aReceiver, aDirection); - } - - @Override - public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { - // TODO Auto-generated method stub - return super.emitsEnergyTo(aReceiver, aDirection); - } - - @Override - public boolean isUniversalEnergyStored(long aEnergyAmount) { - // TODO Auto-generated method stub - return super.isUniversalEnergyStored(aEnergyAmount); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java deleted file mode 100644 index 9a09ad6538..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; - -import static gregtech.api.enums.GT_Values.GT; - -import gregtech.api.interfaces.ITexture; -import gtPlusPlus.api.objects.data.AutoMap; - -public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPower { - - /** - * Value between [0 - 9] to describe the Tier of this Machine. - */ - public final byte mTier; - - /** - * A simple Description. - */ - public final String[] mDescriptionArray; - - /** - * Contains all Textures used by this Block. - */ - public final ITexture[][][] mTextures; - - public GTPP_MTE_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aInvSlotCount); - mTier = (byte) Math.max(0, Math.min(aTier, 9)); - mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; - // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); - else mTextures = null; - } - - public GTPP_MTE_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String[] aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aInvSlotCount); - mTier = (byte) Math.max(0, Math.min(aTier, 9)); - mDescriptionArray = aDescription == null ? new String[0] : aDescription; - - // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); - else mTextures = null; - } - - public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { - super(aName, aInvSlotCount); - mTier = (byte) aTier; - mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; - mTextures = aTextures; - } - - public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aInvSlotCount); - mTier = (byte) aTier; - mDescriptionArray = aDescription == null ? new String[0] : aDescription; - mTextures = aTextures; - } - - @Override - public byte getTileEntityBaseType() { - return 12; - } - - @Override - public long getInputTier() { - return mTier; - } - - @Override - public long getOutputTier() { - return mTier; - } - - @Override - public String[] getDescription() { - AutoMap<String> aTooltip = new AutoMap<String>(); - String[] s1 = null; - s1 = new String[aTooltip.size()]; - int u = 0; - for (String s : aTooltip) { - s1[u] = s; - } - return s1; - } - - /** - * Used Client Side to get a Texture Set for this Block. Called after setting the Tier and the Description so that - * those two are accessible. - * - * @param aTextures is the optional Array you can give to the Constructor. - */ - public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java deleted file mode 100644 index 79975d3ac8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; - -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.SoundResource; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { - - public MetaTileEntityCustomPower(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { - super(aID, aBasicName, aRegionalName, aInvSlotCount); - this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); - this.getBaseMetaTileEntity().setMetaTileID((short) aID); - } - - public MetaTileEntityCustomPower(String aStack, int aInvSlotCount) { - super(aStack, aInvSlotCount); - } - - @Override - public long getMinimumStoredEU() { - return 0L; - } - - public boolean doesExplode() { - return this.getBaseCustomMetaTileEntity().doesExplode(); - } - - @Override - public void doExplosion(long aExplosionPower) { - - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [doExplosion]"); - return; - } - - float tStrength = aExplosionPower - < GT_Values.V[0] - ? 1.0F - : (aExplosionPower < GT_Values.V[1] ? 2.0F - : (aExplosionPower < GT_Values.V[2] ? 3.0F - : (aExplosionPower < GT_Values.V[3] ? 4.0F - : (aExplosionPower < GT_Values.V[4] ? 5.0F - : (aExplosionPower < GT_Values.V[4] * 2L ? 6.0F - : (aExplosionPower < GT_Values.V[5] ? 7.0F - : (aExplosionPower < GT_Values.V[6] ? 8.0F - : (aExplosionPower < GT_Values.V[7] - ? 9.0F - : 10.0F)))))))); - int tX = this.getBaseMetaTileEntity().getXCoord(); - short tY = this.getBaseMetaTileEntity().getYCoord(); - int tZ = this.getBaseMetaTileEntity().getZCoord(); - World tWorld = this.getBaseMetaTileEntity().getWorld(); - GT_Utility.sendSoundToPlayers(tWorld, SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, 1.0F, -1.0F, tX, tY, tZ); - tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) { - tWorld.createExplosion( - (Entity) null, - (double) tX + 0.5D, - (double) tY + 0.5D, - (double) tZ + 0.5D, - tStrength, - true); - } - } - - @Override - public void onExplosion() { - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [onExplosion]"); - return; - } - super.onExplosion(); - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public long getEUVar() { - return super.getEUVar(); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java deleted file mode 100644 index 3d78c7e6a6..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ /dev/null @@ -1,328 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock implements IAddUIWidgets { - - public boolean mCharge = false; - public boolean mDecharge = false; - public int mBatteryCount = 0; - public int mChargeableCount = 0; - private long count = 0L; - private long mStored = 0L; - private long mMax = 0L; - - public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, String aDescription, - int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription, new ITexture[0]); - } - - public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, - int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - final String[] desc = new String[6]; - int tTier = this.mTier; - desc[0] = "" + EnumChatFormatting.BOLD + "16 Fuse Slots"; - desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW - + (GT_Values.V[tTier]) - + EnumChatFormatting.GRAY - + " EU/t"; - desc[2] = "However this " + EnumChatFormatting.ITALIC - + EnumChatFormatting.RED - + "MUST" - + EnumChatFormatting.GRAY - + " be in a single Amp"; - desc[3] = "This machine can accept upto a single amp of " + GT_Values.VN[Math.min(tTier + 2, 15)] - + " as a result"; - desc[4] = "Breaker Loss: " + EnumChatFormatting.RED - + "" - + (GT_Values.V[tTier] / 16) - + EnumChatFormatting.GRAY - + " EU/t"; - desc[5] = CORE.GT_Tooltip.get(); - return desc; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[2][17][]; - - for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] - : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)] }; - - rTextures[1][i + 1] = new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] - : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - return rTextures; - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - return this.mTextures[side == facing ? 1 : 0][aColorIndex + 1]; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicBreaker( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures, - this.mInventory.length); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - public boolean isInputFacing(ForgeDirection side) { - return side != this.getBaseMetaTileEntity().getFrontFacing(); - } - - public boolean isOutputFacing(ForgeDirection side) { - return side == this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return GT_Values.V[this.mTier] * 16L * 16; - } - - @Override - public long maxEUStore() { - return GT_Values.V[this.mTier] * 64L * 16; - } - - @Override - public long maxEUInput() { - return GT_Values.V[this.mTier] * 16; - } - - @Override - public long maxEUOutput() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxAmperesIn() { - return 16; - } - - @Override - public long maxAmperesOut() { - return 16; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity().getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity().getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) {} - - @Override - public void loadNBTData(NBTTagCompound aNBT) {} - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide()) { - /* - * this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; - * this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; - * this.mBatteryCount = 0; this.mChargeableCount = 0; ItemStack[] arg3 = this.mInventory; int arg4 = - * arg3.length; for (int arg5 = 0; arg5 < arg4; ++arg5) { ItemStack tStack = arg3[arg5]; if - * (GT_ModHandler.isElectricItem(tStack, this.mTier)) { if (GT_ModHandler.isChargerItem(tStack)) { - * ++this.mBatteryCount; } ++this.mChargeableCount; } } - */ - } - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return true; - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - public long[] getStoredEnergy() { - boolean scaleOverflow = false; - boolean storedOverflow = false; - long tScale = this.getBaseMetaTileEntity().getEUCapacity(); - long tStored = this.getBaseMetaTileEntity().getStoredEU(); - long tStep = 0L; - if (this.mInventory != null) { - ItemStack[] arg8 = this.mInventory; - int arg9 = arg8.length; - - for (int arg10 = 0; arg10 < arg9; ++arg10) { - ItemStack aStack = arg8[arg10]; - if (GT_ModHandler.isElectricItem(aStack)) { - if (aStack.getItem() instanceof GT_MetaBase_Item) { - Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack); - if (stats != null) { - if (stats[0].longValue() > 4611686018427387903L) { - scaleOverflow = true; - } - - tScale += stats[0].longValue(); - tStep = ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack); - if (tStep > 4611686018427387903L) { - storedOverflow = true; - } - - tStored += tStep; - } - } else if (aStack.getItem() instanceof IElectricItem) { - tStored += (long) ElectricItem.manager.getCharge(aStack); - tScale += (long) ((IElectricItem) aStack.getItem()).getMaxCharge(aStack); - } - } - } - } - - if (scaleOverflow) { - tScale = Long.MAX_VALUE; - } - - if (storedOverflow) { - tStored = Long.MAX_VALUE; - } - - return new long[] { tStored, tScale }; - } - - @Override - public String[] getInfoData() { - return new String[] { "Tile Type: " + this.getTileEntityBaseType() }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean doesExplode() { - return true; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - getBaseMetaTileEntity().add4by4Slots(builder); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java deleted file mode 100644 index f63a5f7688..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java +++ /dev/null @@ -1,88 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import java.util.Locale; - -import net.minecraft.item.ItemStack; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -public abstract class CustomMetaTileBase extends MetaTileEntity { - - private IBaseCustomMetaTileEntity mBaseCustomMetaTileEntity2; - - /** - * accessibility to this Field is no longer given, see below - */ - private IGregTechTileEntity mBaseCustomMetaTileEntity; - - public CustomMetaTileBase(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { - super(aID, aBasicName, aRegionalName, aInvSlotCount); - GT_LanguageManager.addStringLocalization( - "gtpp.blockmachines." + aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH) + ".name", - aRegionalName); - this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity()); - this.getBaseMetaTileEntity().setMetaTileID((short) aID); - mBaseCustomMetaTileEntity2 = (IBaseCustomMetaTileEntity) getBaseMetaTileEntity(); - } - - @Override - public IGregTechTileEntity getBaseMetaTileEntity() { - return mBaseCustomMetaTileEntity; - } - - public IBaseCustomMetaTileEntity getBaseCustomMetaTileEntity() { - return mBaseCustomMetaTileEntity2; - } - - @Override - public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { - super.setBaseMetaTileEntity(aBaseMetaTileEntity); - if (mBaseCustomMetaTileEntity != null && aBaseMetaTileEntity == null - && mBaseCustomMetaTileEntity.getMetaTileEntity() != null) { - mBaseCustomMetaTileEntity.getMetaTileEntity().inValidate(); - mBaseCustomMetaTileEntity.setMetaTileEntity(null); - } - mBaseCustomMetaTileEntity = aBaseMetaTileEntity; - if (mBaseCustomMetaTileEntity != null) { - mBaseCustomMetaTileEntity.setMetaTileEntity(this); - } - } - - public CustomMetaTileBase(String aName, int aInvSlotCount) { - super(aName, aInvSlotCount); - } - - @Override - public ItemStack getStackForm(long aAmount) { - return new ItemStack(Meta_GT_Proxy.sBlockMachines, (int) aAmount, this.getBaseMetaTileEntity().getMetaTileID()); - } - - @Override - public String getLocalName() { - return GT_LanguageManager.getTranslation("gtpp.blockmachines." + this.mName + ".name"); - } - - /** - * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. - * <p/> - * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantlee 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle 2 = - * BaseMetaTileEntity, Wrench lvl 2 to dismantle 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle 4 = - * BaseMetaPipeEntity, Wrench lvl 0 to dismantle 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle 6 = - * BaseMetaPipeEntity, Wrench lvl 2 to dismantle 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle 8 = - * BaseMetaPipeEntity, Cutter lvl 0 to dismantle 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle 10 = - * BaseMetaPipeEntity, Cutter lvl 2 to dismantle 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle - * - * == Reserved for Alk now - * - * 12 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle 13 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle 14 = - * BaseMetaPipeEntity, Wrench lvl 2 to dismantle 15 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle - */ - @Override - public byte getTileEntityBaseType() { - return 12; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 2af07b1ea2..757b3eb3bf 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -1,54 +1,20 @@ package gtPlusPlus.xmod.gregtech.common; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; import gregtech.api.enums.TAE; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.util.GTPP_Recipe; import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.LangUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; import gtPlusPlus.xmod.gregtech.common.helpers.MachineUpdateHandler; import ic2.core.init.BlocksItems; @@ -56,51 +22,16 @@ import ic2.core.init.InternalName; public class Meta_GT_Proxy { - public static List<Runnable> GT_BlockIconload = new ArrayList<>(); - public static List<Runnable> GT_ItemIconload = new ArrayList<>(); - - public static AutoMap<Integer> GT_ValidHeatingCoilMetas = new AutoMap<Integer>(); - - private static Class<BaseCustomTileEntity> sBaseMetaTileEntityClass; - private static Class<BaseCustomPower_MTE> sBaseMetaTileEntityClass2; - public static AchievementHandler mAssemblyAchievements; - public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>(); - - @SideOnly(Side.CLIENT) - public static IIconRegister sBlockIcons, sItemIcons; - public Meta_GT_Proxy() {} - public static Block sBlockMachines; - public static void preInit() { - - // New GT++ Block, yay! (Progress) - // sBlockMachines = new GTPP_Block_Machines(); fixIC2FluidNames(); - - GT_Log.out.println("GT++ Mod: Register TileEntities."); - BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity(); - BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower(); - - GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity."); - if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) { - GT_Log.err.println( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - CORE.crash( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - } - - GT_Log.out.println("GT++ Mod: Registering custom BaseMetaTileEntities."); - GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); - GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); CoverManager.generateCustomCovers(); } public static void init() { - setValidHeatingCoilMetas(); PollutionUtils.setPollutionFluids(); fixIC2FluidNames(); Utils.registerEvent(new MachineUpdateHandler()); @@ -160,454 +91,4 @@ public class Meta_GT_Proxy { } } - - public static boolean generatePlasmaRecipesForAdvVacFreezer() { - - AutoMap<GT_Recipe> aFreezerMapRebaked = new AutoMap<GT_Recipe>(); - AutoMap<GT_Recipe> aRemovedRecipes = new AutoMap<GT_Recipe>(); - - // Find recipes containing Plasma and map them - for (GT_Recipe y : GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList) { - if (y.mFluidInputs.length > 0) { - for (FluidStack r : y.mFluidInputs) { - if (r.getUnlocalizedName().toLowerCase().contains("plasma")) { - aRemovedRecipes.put(y); - continue; - } - } - aFreezerMapRebaked.put(y); - } - } - - AutoMap<GTPP_Recipe> aNewRecipes = new AutoMap<GTPP_Recipe>(); - int aAtomicMass = 0; - int aAtomicTier = 0; - - final FluidStack NULL_PLASMA = Materials._NULL.getPlasma(1); - - for (String s : ELEMENT.NAMES) { - - aAtomicMass++; - aAtomicTier = (aAtomicMass / 30) + 1; - FluidStack aMoltenFluid = null; - FluidStack aPlasma = null; - - // Try Get Material via Gregtech - Materials aGregMaterial = MaterialUtils.getMaterial(s); - if (aGregMaterial != null) { - aMoltenFluid = aGregMaterial.getMolten(1); - if (aMoltenFluid == null) { - aMoltenFluid = aGregMaterial.getFluid(1); - if (aMoltenFluid == null) { - aMoltenFluid = aGregMaterial.getGas(1); - if (aMoltenFluid == null) { - aMoltenFluid = aGregMaterial.getSolid(1); - } - } - } - aPlasma = aGregMaterial.getPlasma(100); - } - - // Just wildcard values - if (aMoltenFluid == null || aPlasma == null) { - if (aMoltenFluid == null) { - aMoltenFluid = FluidUtils.getWildcardFluidStack(s, 1); - } - if (aPlasma == null) { - aPlasma = FluidUtils.getFluidStack("plasma." + s.toLowerCase(), 1); - } - } - - // Skip this material - if (aMoltenFluid == null || aPlasma == null || aPlasma.isFluidEqual(NULL_PLASMA)) { - Logger.INFO( - "Could not generate Advanced Vacuum Freezer recipe. Cooling " + s - + " plasma. Molten Form Exists? " - + (aMoltenFluid != null) - + " | Plasma Exists? " - + (aPlasma != null)); - continue; - } else { - // Build a new plasma recipe - int aTotalTickTime = (20 * 1 + (aAtomicMass)); - GTPP_Recipe aTempRecipe = new GTPP_Recipe( - true, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] { 10000 }, - new FluidStack[] { aPlasma, FluidUtils.getFluidStack("cryotheum", aTotalTickTime) }, - new FluidStack[] { aMoltenFluid }, - aTotalTickTime, - (int) GT_Values.V[4 + aAtomicTier], - aAtomicMass); - - // Add it to the map if it's valid - if (aTempRecipe != null) { - aNewRecipes.put(aTempRecipe); - } - } - } - - // Add the new recipes to the map we will rebake over the original - for (GTPP_Recipe w : aNewRecipes) { - aFreezerMapRebaked.put(w); - } - - // Best not touch the original map if we don't have a valid map to override it with. - if (aFreezerMapRebaked.size() > 0) { - - int aOriginalCount = GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size(); - - // Empty the original map - GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.clear(); - - // Rebake the real map - for (GT_Recipe w : aFreezerMapRebaked) { - GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.add(w); - } - - return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size() >= aOriginalCount; - } - - return false; - } - - public static TileEntity constructCustomGregtechMetaTileEntityByMeta(int aMeta) { - if (aMeta == 12) { - return Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower(); - } else { - return Meta_GT_Proxy.constructBaseMetaTileEntity(); - } - } - - public static BaseCustomTileEntity constructBaseMetaTileEntity() { - if (sBaseMetaTileEntityClass == null) { - try { - sBaseMetaTileEntityClass = BaseCustomTileEntity.class; - return (BaseCustomTileEntity) BaseCustomTileEntity.class.newInstance(); - } catch (Throwable arg1) { - try { - Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0]; - g.setAccessible(true); - return (BaseCustomTileEntity) g.newInstance(); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | SecurityException e) {} - } - } - try { - return (BaseCustomTileEntity) ((BaseCustomTileEntity) sBaseMetaTileEntityClass.newInstance()); - } catch (Throwable arg0) { - arg0.printStackTrace(GT_Log.err); - try { - Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0]; - g.setAccessible(true); - return (BaseCustomTileEntity) g.newInstance(); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | SecurityException e) { - GT_Log.err - .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); - e.printStackTrace(GT_Log.err); - CORE.crash( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - throw new RuntimeException(e); - } - } - } - - public static BaseCustomPower_MTE constructBaseMetaTileEntityCustomPower() { - if (sBaseMetaTileEntityClass2 == null) { - try { - sBaseMetaTileEntityClass2 = BaseCustomPower_MTE.class; - return (BaseCustomPower_MTE) BaseCustomPower_MTE.class.newInstance(); - } catch (Throwable arg1) { - try { - Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0]; - g.setAccessible(true); - return (BaseCustomPower_MTE) g.newInstance(); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | SecurityException e) { - // e.printStackTrace(); - } - } - } - - try { - return (BaseCustomPower_MTE) ((BaseCustomPower_MTE) sBaseMetaTileEntityClass2.newInstance()); - } catch (Throwable arg0) { - arg0.printStackTrace(GT_Log.err); - try { - Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0]; - g.setAccessible(true); - return (BaseCustomPower_MTE) g.newInstance(); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | SecurityException e) { - GT_Log.err - .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); - e.printStackTrace(GT_Log.err); - CORE.crash( - "GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft."); - throw new RuntimeException(e); - } - } - } - - public static void setValidHeatingCoilMetas() { - for (int i = 0; i <= 6; i++) { - GT_ValidHeatingCoilMetas.put(i); - } - for (int i = 7; i <= 8; i++) { - GT_ValidHeatingCoilMetas.put(i); - } - } - - static GT_Proxy[] mProxies = new GT_Proxy[2]; - - public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { - mCustomGregtechMetaTooltips.put(aNbtTagName, aData); - } - - public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List<Object> aList, - boolean par4) { - try { - int tDamage = aStack.getItemDamage(); - if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { - return; - } - - if (GregTech_API.METATILEENTITIES[tDamage] != null) { - IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); - if (tTileEntity.getDescription() != null) { - int i = 0; - for (String tDescription : tTileEntity.getDescription()) { - if (GT_Utility.isStringValid(tDescription)) { - if (tDescription.contains("%%%")) { - String[] tString = tDescription.split("%%%"); - if (tString.length >= 2) { - StringBuffer tBuffer = new StringBuffer(); - Object tRep[] = new String[tString.length / 2]; - for (int j = 0; j < tString.length; j++) if (j % 2 == 0) tBuffer.append(tString[j]); - else { - tBuffer.append(" %s"); - tRep[j / 2] = tString[j]; - } - aList.add( - String.format( - GT_LanguageManager.addStringLocalization( - "TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, - tBuffer.toString(), - !GregTech_API.sPostloadFinished), - tRep)); - } - } else { - String tTranslated = GT_LanguageManager.addStringLocalization( - "TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, - tDescription, - !GregTech_API.sPostloadFinished); - aList.add(tTranslated.equals("") ? tDescription : tTranslated); - } - } else i++; - } - } - - if (tTileEntity.getEUCapacity() > 0L) { - - final long tVoltage = tTileEntity.getInputVoltage(); - byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage))); - - // Custom handling - if (tDamage < 30500 && tDamage >= 30400) { - int aOffset = tDamage - 30400; - if ((aOffset) <= 10) { - tTier -= 2; - aList.add(EnumChatFormatting.BOLD + "16" + " Fuse Slots" + EnumChatFormatting.GRAY); - aList.add( - "Per each fuse, you may insert " + EnumChatFormatting.YELLOW - + (GT_Values.V[tTier]) - + EnumChatFormatting.GRAY - + " EU/t"); - aList.add( - "However this " + EnumChatFormatting.ITALIC - + EnumChatFormatting.RED - + "MUST" - + EnumChatFormatting.GRAY - + " be in a single Amp"); - aList.add( - "This machine can accept upto a single amp of " - + GT_Values.VN[Math.min(tTier + 2, 12)] - + " as a result"); - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_Breaker_Loss", - "Breaker Loss: " + EnumChatFormatting.RED - + "" - + (GT_Values.V[Math.max(tTier - 1, 0)] / 10) - + EnumChatFormatting.GRAY - + " EU/t", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - } - - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_Special_Power_1", - EnumChatFormatting.RED + "Special Power Handling, please read manual", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - // aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", - // EnumChatFormatting.RED+"Special Power Handling, please read manual", - // !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - // aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", - // EnumChatFormatting.RED+"Special Power Handling, please read manual", - // !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - } - - if (tTileEntity.getInputVoltage() > 0L) { - String inA = "0"; - if (tTileEntity.getInputAmperage() >= 1L) { - inA = " at " + EnumChatFormatting.YELLOW - + tTileEntity.getInputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } else { - inA = " at " + EnumChatFormatting.WHITE - + tTileEntity.getInputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } - String a1 = "Voltage IN: " + EnumChatFormatting.GREEN - + tTileEntity.getInputVoltage() - + " (" - + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] - + ")" - + EnumChatFormatting.GRAY - + inA; - aList.add(a1); - } - - if (tTileEntity.getOutputVoltage() > 0L) { - String outA = "0"; - if (tTileEntity.getOutputAmperage() >= 1L) { - outA = " at " + EnumChatFormatting.YELLOW - + tTileEntity.getOutputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } else { - outA = " at " + EnumChatFormatting.WHITE - + tTileEntity.getOutputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } - String a1 = "Voltage OUT: " + EnumChatFormatting.GREEN - + tTileEntity.getOutputVoltage() - + " (" - + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] - + ")" - + EnumChatFormatting.GRAY - + outA; - aList.add(a1); - } - - if (tTileEntity.getOutputVoltage() > 0L) { - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_Lossess_EU", - "Transmission Loss: " + EnumChatFormatting.DARK_BLUE - + "" - + (tDamage < 30500 && tDamage >= 30400 ? 0 : 1), - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - } - - if (tTileEntity.getEUCapacity() > 0) { - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_EUp_STORE2", - "Internal Capacity: ", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE - + tTileEntity.getEUCapacity() - + EnumChatFormatting.GRAY - + " EU"); - } - } - - /* - * if (tTileEntity.getEUCapacity() > 0L) { if (tTileEntity.getInputVoltage() > 0L) { - * aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", - * !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + - * GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY); } - * if (tTileEntity.getOutputVoltage() > 0L) { - * aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", - * !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" - * + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY); - * } if (tTileEntity.getOutputAmperage() > 1L) { - * aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", - * !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + - * EnumChatFormatting.GRAY); } - * aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", - * !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + - * EnumChatFormatting.GRAY); } - */ - - } - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - if (aNBT.getBoolean("mMuffler")) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_MUFFLER", - "has Muffler Upgrade", - !GregTech_API.sPostloadFinished)); - } - if (aNBT.getBoolean("mSteamConverter")) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_STEAMCONVERTER", - "has Steam Upgrade", - !GregTech_API.sPostloadFinished)); - } - int tAmount = 0; - if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add( - tAmount + " " - + GT_LanguageManager.addStringLocalization( - "GT_TileEntity_STEAMTANKS", - "Steam Tank Upgrades", - !GregTech_API.sPostloadFinished)); - } - - FluidStack afluid = net.minecraftforge.fluids.FluidStack - .loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - if (afluid != null) { - int tFluidAmount = afluid.amount; - if (tFluidAmount > 0) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_FLUIDTANK", - "Tank Fluid: " + tFluidAmount + "L " + afluid.getLocalizedName() + "", - !GregTech_API.sPostloadFinished)); - } - } - } - - // Add Custom Here - - // Add Custom Tooltips - for (String s : mCustomGregtechMetaTooltips.keySet()) { - if (aNBT.hasKey(s)) { - String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s)); - aList.add(aTip); - } - } - - // Add GT++ Stuff - - if (tDamage >= 30400 && tDamage < 30500) { - aList.add(EnumChatFormatting.UNDERLINE + "Special GT++ Machine"); - } - if ((tDamage >= 750 && tDamage < 1000) || (tDamage >= 30000 && tDamage < 31000)) { - aList.add(CORE.GT_Tooltip); - } - - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java deleted file mode 100644 index 732dfb2ae8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java +++ /dev/null @@ -1,578 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.IDebugableBlock; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_Generic_Block; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.BaseTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Material_Machines; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; - -public class GTPP_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider { - - public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>(); - - public GTPP_Block_Machines() { - super(GTPP_Item_Machines.class, "gtpp.blockmachines", new GT_Material_Machines()); - GregTech_API.registerMachineBlock(this, -1); - this.setHardness(1.0F); - this.setResistance(10.0F); - this.setStepSound(soundTypeMetal); - this.setCreativeTab(GregTech_API.TAB_GREGTECH); - this.isBlockContainer = true; - } - - @Override - public String getHarvestTool(int aMeta) { - switch (aMeta / 4) { - case 0: - return "wrench"; - case 1: - return "wrench"; - case 2: - return "cutter"; - case 3: - return "axe"; - default: - return "wrench"; - } - } - - @Override - public int getHarvestLevel(int aMeta) { - return aMeta % 4; - } - - @Override - protected boolean canSilkHarvest() { - return false; - } - - @Override - public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof BaseTileEntity) { - ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); - } - } - - @Override - public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { - super.onBlockAdded(aWorld, aX, aY, aZ); - if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - } - } - - @Override - public String getUnlocalizedName() { - int tDamage = 0; - String aUnlocalName = (tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length) - ? (GregTech_API.METATILEENTITIES[tDamage] != null - ? ("gtpp.blockmachines.name" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName()) - : ("gtpp.blockmachines.name")) - : ""; - - Logger.INFO("Unlocal Name: " + aUnlocalName); - return aUnlocalName; - } - - @Override - public String getLocalizedName() { - String aName = StatCollector.translateToLocal(this.getUnlocalizedName() + ".name");; - if (aName.toLowerCase().contains(".name")) { - aName = StatCollector.translateToLocal(getUnlocalizedName() + ".name"); - } - if (aName.toLowerCase().contains(".name")) { - aName = StatCollector.translateToLocal("gt.blockmachines" + ".name"); - } - if (aName.toLowerCase().contains(".name")) { - aName = "BAD"; - } - Logger.INFO("Name: " + aName); - return aName; - } - - @Override - public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - return 0; - } - - @Override - public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 100 : 0; - } - - @Override - public int getRenderType() { - return GTPP_Render_MachineBlock.INSTANCE == null ? super.getRenderType() - : GTPP_Render_MachineBlock.INSTANCE.mRenderID; - } - - @Override - public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) { - return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; - } - - @Override - public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; - } - - @Override - public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } - - @Override - public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) { - return true; - } - - @Override - public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } - - @Override - public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } - - @Override - public boolean hasTileEntity(int aMeta) { - return true; - } - - @Override - public boolean hasComparatorInputOverride() { - return true; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @Override - public boolean canProvidePower() { - return true; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(World aWorld, int aMeta) { - return this.createTileEntity(aWorld, aMeta); - } - - @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int ordinalSide) { - return BlockIcons.MACHINE_LV_SIDE.getIcon(); - } - - @Override - public IIcon getIcon(int ordinalSide, int aMeta) { - return BlockIcons.MACHINE_LV_SIDE.getIcon(); - } - - @Override - public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) { - super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false; - } - - @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, - Entity collider) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { - ((IGregTechTileEntity) tTileEntity) - .addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - } else { - super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - } - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null - ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) - : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - @Override - @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); - } - - @Override - 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); - } - } - - @Override - public void setBlockBoundsForItemRender() { - super.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - - @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { - ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); - } else { - super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) {} - - @Override - public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { - return super.getBlockHardness(aWorld, aX, aY, aZ); - } - - @Override - public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTileEntity).privateAccess() - && !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) ? -1.0F - : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); - } - - @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int ordinalSide, - 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, - ForgeDirection.getOrientation(ordinalSide), - par1, - par2, - par3))) - : false; - } - } - - @Override - public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); - } - } - - @Override - 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; - } - - @Override - public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof BaseMetaTileEntity) { - ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); - } - - super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); - } - - @Override - public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - 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); - } - - @Override - 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()); - } - - @Override - public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int ordinalSide) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity).getComparatorValue(ForgeDirection.getOrientation(ordinalSide)) - : 0; - } - - @Override - public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { - if (ordinalSide >= 0 && ordinalSide <= 5) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity) - .getOutputRedstoneSignal(ForgeDirection.getOrientation(ordinalSide).getOpposite()) - : 0; - } else { - return 0; - } - } - - @Override - public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { - if (ordinalSide >= 0 && ordinalSide <= 5) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity) - .getStrongOutputRedstoneSignal(ForgeDirection.getOrientation(ordinalSide).getOpposite()) - : 0; - } else { - return 0; - } - } - - @Override - public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) { - if (!aWorld.isRemote) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null && chance < 1.0F) { - if (tTileEntity instanceof BaseMetaTileEntity && GregTech_API.sMachineNonWrenchExplosions) { - ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); - } - } else { - super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7); - } - } - } - - @Override - public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection side) { - 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(side) != 0) { - return true; - } - } - - return false; - } - } - - @Override - 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)); - } - - @Override - 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; - } - - @Override - public TileEntity createTileEntity(World aWorld, int aMeta) { - return (TileEntity) (aMeta >= 4 ? Meta_GT_Proxy.constructBaseMetaTileEntity() - : Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); - } - - @Override - public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, - double explosionY, double explosionZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity).getBlastResistance(ForgeDirection.UNKNOWN) - : 10.0F; - } - - @Override - @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)); - } - } - } - - @Override - public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null) { - if (tTileEntity instanceof IGregTechTileEntity) { - IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity; - if (aPlayer == null) { - var6.setFrontFacing(ForgeDirection.UP); - } 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(ForgeDirection.UP)) { - var6.setFrontFacing(ForgeDirection.UP); - } else if (var8 <= -65 && var6.isValidFacing(ForgeDirection.DOWN)) { - var6.setFrontFacing(ForgeDirection.DOWN); - } else { - switch (var7) { - case 0: - var6.setFrontFacing(ForgeDirection.NORTH); - break; - case 1: - var6.setFrontFacing(ForgeDirection.EAST); - break; - case 2: - var6.setFrontFacing(ForgeDirection.SOUTH); - break; - case 3: - var6.setFrontFacing(ForgeDirection.WEST); - } - } - } - } - } - } - - @Override - 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); - } - - @Override - public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) (~aColor & 15)) { - return false; - } else { - ((IGregTechTileEntity) tTileEntity).setColorization((byte) (~aColor & 15)); - return true; - } - } else { - return false; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java deleted file mode 100644 index e0fc48aa45..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java +++ /dev/null @@ -1,278 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -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; - -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; - -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); - } - - @Override - @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); - } - } - - @Override - 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; - } - - @Override - 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() - : "") - : ""; - } - - @Override - 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); - } - } - - @Override - 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; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java index a7458fa10b..b3fe3dd935 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java @@ -37,7 +37,6 @@ import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.common.blocks.GT_Block_Machines; import gregtech.common.render.GT_Renderer_Block; -import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines; import gtPlusPlus.xmod.gregtech.common.helpers.GT_MethodHelper; public class GTPP_Render_MachineBlock extends GT_Renderer_Block { @@ -1205,7 +1204,7 @@ public class GTPP_Render_MachineBlock extends GT_Renderer_Block { @Override 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 (aBlock instanceof GT_Block_Machines) { if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[aMeta] != null && !GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer)) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerBreakers.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerBreakers.java deleted file mode 100644 index 1f3ad0a5f2..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerBreakers.java +++ /dev/null @@ -1,99 +0,0 @@ -package gtPlusPlus.xmod.gregtech.registration.gregtech; - -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBreaker; - -public class GregtechPowerBreakers { - - public static void run() { - Logger.INFO("Gregtech5u Content | Registering Power Breakers."); - run1(); - } - - private static void run1() { - // 30200 - int aStartID = 30400; - GregtechItemList.BreakerBox_ULV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.00", - "Ultra Low Voltage Breaker Box", - 0, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_LV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.01", - "Low Voltage Breaker Box", - 1, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_MV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.02", - "Medium Voltage Breaker Box", - 2, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_HV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.03", - "High Voltage Breaker Box", - 3, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_EV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.04", - "Extreme Voltage Breaker Box", - 4, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_IV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.05", - "Insane Voltage Breaker Box", - 5, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_LuV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.06", - "Ludicrous Voltage Breaker Box", - 6, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_ZPM.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.07", - "ZPM Voltage Breaker Box", - 7, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_UV.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.08", - "Ultimate Voltage Breaker Box", - 8, - "", - 16)).getStackForm(1L)); - GregtechItemList.BreakerBox_MAX.set( - (new GT_MetaTileEntity_BasicBreaker( - aStartID++, - "breaker.tier.09", - GT_Values.VN[9] + " Breaker Box", - 9, - "", - 16)).getStackForm(1L)); - } -} |