Fixed null DDProperties reference in DimData
Fixed null DDProperties reference in DimData. Changed the code so that it requests an instance in each of its functions instead of relying on loading a reference when it's first instantiated. I'm not sure how the null references are slipping through, that shouldn't be possible.
This commit is contained in:
parent
5f5569e9b9
commit
cb966210bd
1 changed files with 7 additions and 30 deletions
|
@ -33,8 +33,6 @@ public class DimData implements Serializable
|
||||||
|
|
||||||
static final long serialVersionUID = 454342L;
|
static final long serialVersionUID = 454342L;
|
||||||
|
|
||||||
private static DDProperties properties = null;
|
|
||||||
|
|
||||||
public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData)
|
public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData)
|
||||||
{
|
{
|
||||||
this.dimID=dimID;
|
this.dimID=dimID;
|
||||||
|
@ -42,9 +40,6 @@ public class DimData implements Serializable
|
||||||
this.isPocket=isPocket;
|
this.isPocket=isPocket;
|
||||||
|
|
||||||
this.exitDimLink= exitLinkData;
|
this.exitDimLink= exitLinkData;
|
||||||
|
|
||||||
if (properties == null)
|
|
||||||
properties = DDProperties.instance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ)
|
public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ)
|
||||||
|
@ -59,6 +54,7 @@ public class DimData implements Serializable
|
||||||
int i=-range;
|
int i=-range;
|
||||||
int j=-range;
|
int j=-range;
|
||||||
int k=-range;
|
int k=-range;
|
||||||
|
DDProperties properties = DDProperties.instance();
|
||||||
|
|
||||||
while (i<range)
|
while (i<range)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +62,7 @@ public class DimData implements Serializable
|
||||||
{
|
{
|
||||||
while (k<range)
|
while (k<range)
|
||||||
{
|
{
|
||||||
if(world.getBlockId(x+i, y+j, z+k)==properties.RiftBlockID&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
|
if (world.getBlockId(x+i, y+j, z+k) == properties.RiftBlockID && MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
|
||||||
{
|
{
|
||||||
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
|
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +94,7 @@ public class DimData implements Serializable
|
||||||
int i=-range;
|
int i=-range;
|
||||||
int j=-range;
|
int j=-range;
|
||||||
int k=-range;
|
int k=-range;
|
||||||
|
DDProperties properties = DDProperties.instance();
|
||||||
|
|
||||||
while (i<range)
|
while (i<range)
|
||||||
{
|
{
|
||||||
|
@ -167,44 +164,24 @@ public class DimData implements Serializable
|
||||||
|
|
||||||
public LinkData addLinkToDim( int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, int linkOrientation)
|
public LinkData addLinkToDim( int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, int linkOrientation)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LinkData linkData= new LinkData(this.dimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord,destinationZCoord,this.isPocket,linkOrientation);
|
LinkData linkData= new LinkData(this.dimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord,destinationZCoord,this.isPocket,linkOrientation);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return this.addLinkToDim(linkData);
|
return this.addLinkToDim(linkData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLimbo()
|
public boolean isLimbo()
|
||||||
{
|
{
|
||||||
if(this.dimID==properties.LimboDimensionID)
|
return (this.dimID == DDProperties.instance().LimboDimensionID);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLinkAtCoords(LinkData link)
|
public void removeLinkAtCoords(LinkData link)
|
||||||
{
|
{
|
||||||
this.removeLinkAtCoords(link.locDimID, link.locXCoord, link.locYCoord, link.locZCoord);
|
this.removeLinkAtCoords(link.locDimID, link.locXCoord, link.locYCoord, link.locZCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLinkAtCoords(int locationID, int locationXCoord, int locationYCoord, int locationZCoord)
|
public void removeLinkAtCoords(int locationID, int locationXCoord, int locationYCoord, int locationZCoord)
|
||||||
{
|
{
|
||||||
|
if (this.linksInThisDim.containsKey(locationZCoord))
|
||||||
|
|
||||||
if(this.linksInThisDim.containsKey(locationZCoord))
|
|
||||||
{
|
{
|
||||||
this.dimY=this.linksInThisDim.get(locationZCoord);
|
this.dimY=this.linksInThisDim.get(locationZCoord);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue