Added gold dim doors, fixes
Deleted the sun and adding gold dim doors
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
package StevenDimDoors.mod_pocketDim.tileentities;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
|
||||
public class TileEntityDimDoorGold extends TileEntityDimDoor
|
||||
{
|
||||
|
||||
private Ticket chunkTicket;
|
||||
|
||||
public boolean canUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
if(this.chunkTicket==null)
|
||||
{
|
||||
chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL);
|
||||
}
|
||||
|
||||
chunkTicket.getModData().setInteger("goldDimDoorX", xCoord);
|
||||
chunkTicket.getModData().setInteger("goldDimDoorY", yCoord);
|
||||
chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord);
|
||||
|
||||
this.forceChunkLoading(chunkTicket);
|
||||
}
|
||||
|
||||
public void forceChunkLoading(Ticket chunkTicket)
|
||||
{
|
||||
if(PocketManager.getDimensionData(this.worldObj)==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!PocketManager.getDimensionData(this.worldObj).isPocketDimension())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(int chunks = (PocketBuilder.DEFAULT_POCKET_SIZE%16)+1;chunks>0;chunks--)
|
||||
{
|
||||
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((xCoord >> 4)+chunks, (zCoord >> 4)+chunks));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
ForgeChunkManager.releaseTicket(chunkTicket);
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
int i = nbt.getInteger(("Size"));
|
||||
|
||||
try
|
||||
{
|
||||
this.openOrClosed = nbt.getBoolean("openOrClosed");
|
||||
|
||||
this.orientation = nbt.getInteger("orientation");
|
||||
|
||||
this.hasExit = nbt.getBoolean("hasExit");
|
||||
|
||||
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
int i = 0;
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("openOrClosed", this.openOrClosed);
|
||||
|
||||
nbt.setBoolean("hasExit", this.hasExit);
|
||||
|
||||
nbt.setInteger("orientation", this.orientation);
|
||||
|
||||
nbt.setBoolean("isDungeonChainLink", isDungeonChainLink);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user