Privatized some variables
As a contingency against misuse
This commit is contained in:
parent
111f2f9b51
commit
ecc9ea39cf
5 changed files with 25 additions and 13 deletions
|
@ -166,7 +166,7 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
|
|||
world.setBlockState(pos, ModBlocks.blockRift.getDefaultState());
|
||||
DDTileEntityBase newRift = (DDTileEntityBase) world.getTileEntity(pos);
|
||||
newRift.loadDataFrom(origRift);
|
||||
DimDoors.log(this.getClass(), "New Rift rift-ID after breaking door " + newRift.riftID);
|
||||
DimDoors.log(this.getClass(), "New Rift rift-ID after breaking door " + newRift.getRiftID());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public abstract class ItemDoorBase extends ItemDoor {
|
|||
//start logging code
|
||||
if (possibleOldRift instanceof DDTileEntityBase) { //
|
||||
DDTileEntityBase oldRift = (DDTileEntityBase) possibleOldRift;
|
||||
DimDoors.log(this.getClass(), "Old Rift rift-ID before placement: " + oldRift.riftID);
|
||||
DimDoors.log(this.getClass(), "Old Rift rift-ID before placement: " + oldRift.getRiftID());
|
||||
}
|
||||
//end of logging code
|
||||
EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw);
|
||||
|
@ -123,12 +123,12 @@ public abstract class ItemDoorBase extends ItemDoor {
|
|||
DDTileEntityBase newTileEntityDimDoor = (DDTileEntityBase) worldIn.getTileEntity(pos.up());
|
||||
if (possibleOldRift instanceof DDTileEntityBase) { //
|
||||
DDTileEntityBase oldRift = (DDTileEntityBase) possibleOldRift;
|
||||
DimDoors.log(this.getClass(), "Old Rift rift-ID after placement: " + oldRift.riftID);
|
||||
DimDoors.log(this.getClass(), "Old Rift rift-ID after placement: " + oldRift.getRiftID());
|
||||
newTileEntityDimDoor.loadDataFrom(oldRift);
|
||||
} else {
|
||||
newTileEntityDimDoor.register();
|
||||
}
|
||||
DimDoors.log(this.getClass(), "New Door rift-ID after placement: " + newTileEntityDimDoor.riftID);
|
||||
DimDoors.log(this.getClass(), "New Door rift-ID after placement: " + newTileEntityDimDoor.getRiftID());
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else {
|
||||
|
|
|
@ -61,12 +61,12 @@ public class ItemRiftConnectionTool extends ItemTool {
|
|||
}
|
||||
|
||||
private ActionResult<ItemStack> selectRift(ItemStack stack, World worldIn, DDTileEntityBase rift, EntityPlayer playerIn) {
|
||||
DimDoors.log(this.getClass(), "Selecting rift with ID: " + rift.riftID);
|
||||
DimDoors.log(this.getClass(), "Selecting rift with ID: " + rift.getRiftID());
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if (compound.getBoolean("isInConnectMode")) {
|
||||
if (compound.hasKey("RiftID")) {
|
||||
int primaryRiftID = compound.getInteger("RiftID");
|
||||
int secondaryRiftID = rift.riftID;
|
||||
int secondaryRiftID = rift.getRiftID();
|
||||
if (!worldIn.isRemote) {
|
||||
DimDoors.log(this.getClass(), "Pairing rifts with IDs: " + primaryRiftID + " and " + secondaryRiftID);
|
||||
RiftRegistry.Instance.pair(primaryRiftID, secondaryRiftID);
|
||||
|
@ -74,11 +74,11 @@ public class ItemRiftConnectionTool extends ItemTool {
|
|||
compound.removeTag("RiftID");
|
||||
stack.damageItem(1, playerIn);
|
||||
} else {
|
||||
compound.setInteger("RiftID", rift.riftID);
|
||||
compound.setInteger("RiftID", rift.getRiftID());
|
||||
}
|
||||
} else {
|
||||
if (!worldIn.isRemote) {
|
||||
RiftRegistry.Instance.unpair(rift.riftID);
|
||||
RiftRegistry.Instance.unpair(rift.getRiftID());
|
||||
}
|
||||
stack.damageItem(1, playerIn);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ import net.minecraft.world.World;
|
|||
|
||||
public abstract class DDTileEntityBase extends TileEntity {
|
||||
|
||||
public boolean isPaired = false;
|
||||
public int riftID = -1; //should not start at 0
|
||||
public int pairedRiftID = -1;
|
||||
private boolean isPaired = false;
|
||||
private int riftID = -1; //should not start at 0
|
||||
private int pairedRiftID = -1;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -87,6 +87,18 @@ public abstract class DDTileEntityBase extends TileEntity {
|
|||
}
|
||||
}
|
||||
|
||||
public int getRiftID() {
|
||||
return riftID;
|
||||
}
|
||||
|
||||
public int getPairedRiftID() {
|
||||
return pairedRiftID;
|
||||
}
|
||||
|
||||
public boolean isPaired() {
|
||||
return isPaired;
|
||||
}
|
||||
|
||||
public Location getTeleportTarget() {
|
||||
return new Location(this.getWorld().provider.getDimension(), this.getPos());
|
||||
}
|
||||
|
|
|
@ -66,10 +66,10 @@ public class TileEntityDimDoor extends DDTileEntityBase {
|
|||
|
||||
@Override
|
||||
public boolean tryTeleport(Entity entity) {
|
||||
if (!isPaired) {
|
||||
if (!isPaired()) {
|
||||
//@todo try to automatically pair this door somehow
|
||||
}
|
||||
RiftRegistry.Instance.teleportEntityToRift(entity, pairedRiftID);
|
||||
RiftRegistry.Instance.teleportEntityToRift(entity, getPairedRiftID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue