no message

This commit is contained in:
Technus 2016-09-05 22:35:41 +02:00
parent 66f7ef1cc0
commit 81dc8a48b1
6 changed files with 68 additions and 39 deletions

View file

@ -1,5 +1,6 @@
package gregtech.common.tileentities.machines.basic;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
@ -33,7 +34,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
public int mTargetZ = 0;
public int mTargetD = 0;
public boolean mDebug = false;
public boolean hasEgg = false;
public boolean hasBlock = false;
public int mMaxLoss = 50;
public int mMaxLossDistance = 10000;
public boolean mPassiveEnergyUse = true;
@ -54,7 +55,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
if (aBaseMetaTileEntity.isClientSide()) return true;
this.hasEgg = checkForEgg();
this.hasBlock = checkForBlock();
aBaseMetaTileEntity.openGUI(aPlayer);
return true;
}
@ -122,15 +123,15 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
this.mTargetZ = getBaseMetaTileEntity().getZCoord();
this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId;
}
this.hasEgg = checkForEgg();
this.hasBlock = checkForBlock();
}
}
public boolean checkForEgg() {
public boolean checkForBlock() {
for (byte i = -5; i <= 5; i = (byte) (i + 1)) {
for (byte j = -5; j <= 5; j = (byte) (j + 1)) {
for (byte k = -5; k <= 5; k = (byte) (k + 1)) {
if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) {
if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == GregTech_API.sBlockMetal5 && getBaseMetaTileEntity().getMetaIDOffset(i, j, k) == 8) {//require osmiridium block
return true;
}
}
@ -140,7 +141,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
}
public boolean hasDimensionalTeleportCapability() {
return (this.mDebug) || (this.hasEgg) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000);
return (this.mDebug) || (this.hasBlock) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000);
}
public boolean isDimensionalTeleportAvailable() {
@ -155,12 +156,12 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
super.onPostTick(aBaseMetaTileEntity, aTick);
if (getBaseMetaTileEntity().isServerSide()) {
if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
this.hasEgg = checkForEgg();
this.hasBlock = checkForBlock();
}
if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) {
if (getBaseMetaTileEntity().getStoredEU() > (V[mTier] * 16)) {
if (mPassiveEnergyUse) {
getBaseMetaTileEntity().decreaseStoredEnergyUnits(2L<<mTier, false);
getBaseMetaTileEntity().decreaseStoredEnergyUnits(2L<<(mTier-1), false);
}
if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))) {
mFluid.amount--;
@ -186,11 +187,11 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
if (tTile != null && tTile instanceof IEnergyConnected) {
int tLoss = 1;
if (mMaxLossDistance != 0) {
tLoss = GT_Utility.safeInt(10 + tDistance * (mMaxLoss - 10) / mMaxLossDistance);
tLoss = GT_Utility.safeInt(10L + (tDistance * Math.max(mMaxLoss - 10L,0) / mMaxLossDistance));
}
if(getBaseMetaTileEntity().isUniversalEnergyStored(V[mTier] + (((V[mTier] * tLoss) / 100)))){
if(getBaseMetaTileEntity().isUniversalEnergyStored(V[mTier] + ((V[mTier] * tLoss) / 100))){
if (((IEnergyConnected) tTile).injectEnergyUnits((byte) 6, V[mTier], 1) > 0) {
getBaseMetaTileEntity().decreaseStoredEnergyUnits(V[mTier] + (((V[mTier] * tLoss) / 100)), false);
getBaseMetaTileEntity().decreaseStoredEnergyUnits(V[mTier] + ((V[mTier] * tLoss) / 100), false);
}
}
}

View file

@ -155,7 +155,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosY,
((ChunkPosition) this.mPumpList.remove(this.mPumpList.size() - 1)).chunkPosZ))) {
}
this.mPumpTimer = GT_Utility.safeInt(160L / (long)Math.pow(2, this.mTier) );
this.mPumpTimer = GT_Utility.safeInt(160 / (long)Math.pow(2, this.mTier) );
this.mPumpTimer = mPumpTimer==0 ? 1 : mPumpTimer;
}
}
}

View file

@ -39,8 +39,13 @@ public class GT_MetaTileEntity_Replicator
Materials tMaterial = (Materials) Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0);
long tMass = tMaterial.getMass();
if ((tFluid.amount >= tMass) && (tMass > 0L)) {
this.mEUt = ((int) gregtech.api.enums.GT_Values.V[this.mTier]);
this.mMaxProgresstime = ((int) (tMass * 512L / (1 << this.mTier - 1)));
this.mEUt = GT_Utility.safeInt(gregtech.api.enums.GT_Values.V[this.mTier],1);
this.mMaxProgresstime = GT_Utility.safeInt(tMass * 1024L / (1 << this.mTier),1);
if (mMaxProgresstime == Integer.MAX_VALUE - 1 || mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L)) == null) {
if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) != null) {
if ((this.mOutputFluid = GT_Utility.getFluidForFilledItem(this.mOutputItems[0], true)) == null) {

View file

@ -50,15 +50,19 @@ public class GT_MetaTileEntity_RockBreaker
tOutput = new ItemStack(Blocks.obsidian, 1);
if (canOutput(new ItemStack[]{tOutput})) {
getInputAt(0).stackSize -= 1;
calculateOverclockedNess(32,128);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
this.mOutputItems[0] = tOutput;
this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
return 2;
}
} else if (canOutput(new ItemStack[]{tOutput})) {
calculateOverclockedNess(32,16);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
this.mOutputItems[0] = tOutput;
this.mMaxProgresstime = (16 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
return 2;
}
}

View file

@ -54,8 +54,10 @@ public class GT_MetaTileEntity_Scanner
NBTTagCompound tNBT = new NBTTagCompound();
((IIndividual) tIndividual).writeToNBT(tNBT);
this.mOutputItems[0].setTagCompound(tNBT);
this.mMaxProgresstime = (500 / (1 << this.mTier - 1));
this.mEUt = (2 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(2,500);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
this.mOutputItems[0] = GT_Utility.copy(new Object[]{aStack});
@ -77,8 +79,10 @@ public class GT_MetaTileEntity_Scanner
}
if (tNBT.getByte("scan") < 4) {
tNBT.setByte("scan", (byte) 4);
this.mMaxProgresstime = (160 / (1 << this.mTier - 1));
this.mEUt = (8 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(8,160);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
} else {
this.mMaxProgresstime = 1;
this.mEUt = 1;
@ -92,8 +96,10 @@ public class GT_MetaTileEntity_Scanner
if (ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) {
aStack.stackSize -= 1;
this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
this.mMaxProgresstime = (512 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(32,512);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
ItemData tData = GT_OreDictUnificator.getAssociation(aStack);
@ -104,8 +110,10 @@ public class GT_MetaTileEntity_Scanner
this.mOutputItems[0] = ItemList.Tool_DataOrb.get(1L, new Object[0]);
Behaviour_DataOrb.setDataTitle(this.mOutputItems[0], "Elemental-Scan");
Behaviour_DataOrb.setDataName(this.mOutputItems[0], tData.mMaterial.mMaterial.mElement.name());
this.mMaxProgresstime = ((int) (tData.mMaterial.mMaterial.getMass() * 8192L / (1 << this.mTier - 1)));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(32,GT_Utility.safeInt(tData.mMaterial.mMaterial.getMass() * 8192L));
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
}
@ -113,8 +121,10 @@ public class GT_MetaTileEntity_Scanner
if (ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) {
aStack.stackSize -= 1;
this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(32,128);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
if (aStack.getItem() == Items.written_book) {
@ -123,8 +133,10 @@ public class GT_MetaTileEntity_Scanner
this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
this.mOutputItems[0].setTagCompound(aStack.getTagCompound());
this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(32,128);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
if (aStack.getItem() == Items.filled_map) {
@ -133,8 +145,10 @@ public class GT_MetaTileEntity_Scanner
this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort(new NBTTagCompound(), "map_id", (short) aStack.getItemDamage()));
this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(32,128);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
}
@ -145,8 +159,10 @@ public class GT_MetaTileEntity_Scanner
aStack.stackSize -= 1;
this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{aStack});
this.mMaxProgresstime = (1000 / (1 << this.mTier - 1));
this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(32,1000);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
@ -193,8 +209,10 @@ public class GT_MetaTileEntity_Scanner
this.mOutputItems[0].setTagCompound(tNBT);
aStack.stackSize -= 1;
this.mMaxProgresstime = (tRecipe.mResearchTime / (1 << this.mTier - 1));
this.mEUt = (30 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
calculateOverclockedNess(30,tRecipe.mResearchTime);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
getSpecialSlot().stackSize -= 1;
return 2;
}

View file

@ -266,7 +266,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
int tStacksize = mInventory[0].stackSize;
GT_Utility.moveOneItemStack(this, tTile, (byte) 0, (byte) 0, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
if (mInventory[0] == null || mInventory[0].stackSize < tStacksize) {
getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * (tStacksize - (mInventory[0] == null ? 0 : mInventory[0].stackSize))), false);
getBaseMetaTileEntity().decreaseStoredEnergyUnits((long)tDistance * tDistance * ((long)tStacksize - (mInventory[0] == null ? 0 : mInventory[0].stackSize)), false);
}
}
@ -274,9 +274,9 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
for (Object tObject : getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) + 2))) {
if (((tObject instanceof Entity)) && (!((Entity) tObject).isDead)) {
Entity tEntity = (Entity) tObject;
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * weightCalculation(tEntity)), false)) {
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((long)(tDistance * tDistance * weightCalculation(tEntity)), false)) {
if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasBlock || mFluid.isFluidEqual(Materials.Iron.getPlasma(1)))) {
mFluid.amount = mFluid.amount - ((int) Math.min(1000, (tDistance * tDistance * weightCalculation(tEntity) / 8192)));
mFluid.amount = mFluid.amount - (GT_Utility.safeInt(Math.min(1000L, (long)(tDistance * tDistance * weightCalculation(tEntity) / 8192))));
if (mFluid.amount < 1) {
mFluid = null;
}