parent
bc33222dfe
commit
11d2e6a516
1 changed files with 9 additions and 9 deletions
|
@ -44,7 +44,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
|
||||||
public int mTargetZ = 0;
|
public int mTargetZ = 0;
|
||||||
public int mTargetD = 0;
|
public int mTargetD = 0;
|
||||||
public boolean mDebug = false;
|
public boolean mDebug = false;
|
||||||
public boolean hasEgg = false;
|
public boolean hasBlock = false;
|
||||||
|
|
||||||
public GT_MetaTileEntity_Teleporter(int aID, String aName, String aNameRegional, int aTier) {
|
public GT_MetaTileEntity_Teleporter(int aID, String aName, String aNameRegional, int aTier) {
|
||||||
super(aID, aName, aNameRegional, aTier, 3, "Teleport long distances with this little device.");
|
super(aID, aName, aNameRegional, aTier, 3, "Teleport long distances with this little device.");
|
||||||
|
@ -136,7 +136,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
|
||||||
@Override
|
@Override
|
||||||
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
|
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
|
||||||
if (aBaseMetaTileEntity.isClientSide()) return true;
|
if (aBaseMetaTileEntity.isClientSide()) return true;
|
||||||
this.hasEgg = checkForEgg();
|
this.hasBlock = checkForBlock();
|
||||||
aBaseMetaTileEntity.openGUI(aPlayer);
|
aBaseMetaTileEntity.openGUI(aPlayer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -201,15 +201,15 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
|
||||||
this.mTargetZ = getBaseMetaTileEntity().getZCoord();
|
this.mTargetZ = getBaseMetaTileEntity().getZCoord();
|
||||||
this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId;
|
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 i = -5; i <= 5; i = (byte) (i + 1)) {
|
||||||
for (byte j = -5; j <= 5; j = (byte) (j + 1)) {
|
for (byte j = -5; j <= 5; j = (byte) (j + 1)) {
|
||||||
for (byte k = -5; k <= 5; k = (byte) (k + 1)) {
|
for (byte k = -5; k <= 5; k = (byte) (k + 1)) {
|
||||||
if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) {
|
if (getBaseMetaTileEntity().getBlock(i, j, k).getUnlocalizedName() == "gt.blockmetal5.2.name") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDimensionalTeleportCapability() {
|
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() {
|
public boolean isDimensionalTeleportAvailable() {
|
||||||
|
@ -234,11 +234,11 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
|
||||||
super.onPostTick(aBaseMetaTileEntity, aTick);
|
super.onPostTick(aBaseMetaTileEntity, aTick);
|
||||||
if (getBaseMetaTileEntity().isServerSide()) {
|
if (getBaseMetaTileEntity().isServerSide()) {
|
||||||
if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
|
if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
|
||||||
this.hasEgg = checkForEgg();
|
this.hasBlock = checkForBlock();
|
||||||
}
|
}
|
||||||
if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) {
|
if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) {
|
||||||
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048, false)) {
|
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048, false)) {
|
||||||
if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) {
|
if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasBlock || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) {
|
||||||
mFluid.amount--;
|
mFluid.amount--;
|
||||||
if (mFluid.amount < 1) {
|
if (mFluid.amount < 1) {
|
||||||
mFluid = null;
|
mFluid = null;
|
||||||
|
@ -268,7 +268,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
|
||||||
if (((tObject instanceof Entity)) && (!((Entity) tObject).isDead)) {
|
if (((tObject instanceof Entity)) && (!((Entity) tObject).isDead)) {
|
||||||
Entity tEntity = (Entity) tObject;
|
Entity tEntity = (Entity) tObject;
|
||||||
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * weightCalculation(tEntity)), false)) {
|
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * weightCalculation(tEntity)), false)) {
|
||||||
if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) {
|
if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasBlock || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) {
|
||||||
mFluid.amount = mFluid.amount - ((int) Math.min(1000, (tDistance * tDistance * weightCalculation(tEntity) / 8192)));
|
mFluid.amount = mFluid.amount - ((int) Math.min(1000, (tDistance * tDistance * weightCalculation(tEntity) / 8192)));
|
||||||
if (mFluid.amount < 1) {
|
if (mFluid.amount < 1) {
|
||||||
mFluid = null;
|
mFluid = null;
|
||||||
|
|
Loading…
Reference in a new issue