Progress on the New Save Format and Minor Fixes #88

Merged
SenseiKiwi merged 11 commits from rewrite into DevBranch 2013-09-12 03:14:50 +00:00
8 changed files with 26 additions and 14 deletions
Showing only changes of commit b73e79e5c2 - Show all commits

View File

@@ -2,12 +2,15 @@ package StevenDimDoors.mod_pocketDim.blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold;
public class BlockGoldDimDoor extends BaseDimDoor implements IDimDoor public class BlockGoldDimDoor extends BaseDimDoor implements IDimDoor
{ {
@@ -37,5 +40,11 @@ public class BlockGoldDimDoor extends BaseDimDoor implements IDimDoor
{ {
return this.properties.GoldDoorItemID; return this.properties.GoldDoorItemID;
} }
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityDimDoorGold();
}
} }

View File

@@ -45,6 +45,7 @@ public class ItemRiftSignature extends Item
@Override @Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{ {
//TODO- recognize doors and intelligently place rifts on them.
// We must use onItemUseFirst() instead of onItemUse() because Minecraft checks // We must use onItemUseFirst() instead of onItemUse() because Minecraft checks
// whether the user is in creative mode after calling onItemUse() and undoes any // whether the user is in creative mode after calling onItemUse() and undoes any
// damage we might set to indicate the rift sig has been activated. Otherwise, // damage we might set to indicate the rift sig has been activated. Otherwise,

View File

@@ -148,6 +148,7 @@ public class mod_pocketDim
@PreInit @PreInit
public void onPreInitialization(FMLPreInitializationEvent event) public void onPreInitialization(FMLPreInitializationEvent event)
{ {
this.instance = this;
//This should be the FIRST thing that gets done. //This should be the FIRST thing that gets done.
properties = DDProperties.initialize(event.getSuggestedConfigurationFile()); properties = DDProperties.initialize(event.getSuggestedConfigurationFile());
@@ -386,7 +387,6 @@ public class mod_pocketDim
//Register loot chests //Register loot chests
DDLoot.registerInfo(); DDLoot.registerInfo();
} }
@ServerStopping @ServerStopping
public void onServerStopping(FMLServerStoppingEvent event) public void onServerStopping(FMLServerStoppingEvent event)
{ {
@@ -403,6 +403,8 @@ public class mod_pocketDim
@ServerStarting @ServerStarting
public void onServerStarting(FMLServerStartingEvent event) public void onServerStarting(FMLServerStartingEvent event)
{ {
//TODO- load dims with forced chunks on server startup here
/* /*
CommandResetDungeons.instance().register(event); CommandResetDungeons.instance().register(event);
CommandCreateDungeonRift.instance().register(event); CommandCreateDungeonRift.instance().register(event);

View File

@@ -21,16 +21,19 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor
public void updateEntity() public void updateEntity()
{ {
if(this.chunkTicket==null) if(PocketManager.getDimensionData(this.worldObj)!=null&&PocketManager.getDimensionData(this.worldObj).isPocketDimension()&&!this.worldObj.isRemote)
{ {
chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL); 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);
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord >> 4, zCoord >> 4));
forceChunkLoading(chunkTicket);
} }
chunkTicket.getModData().setInteger("goldDimDoorX", xCoord);
chunkTicket.getModData().setInteger("goldDimDoorY", yCoord);
chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord);
this.forceChunkLoading(chunkTicket);
} }
public void forceChunkLoading(Ticket chunkTicket) public void forceChunkLoading(Ticket chunkTicket)
@@ -48,10 +51,7 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor
{ {
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((xCoord >> 4)+chunks, (zCoord >> 4)+chunks)); ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((xCoord >> 4)+chunks, (zCoord >> 4)+chunks));
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB