Changed name and fixed block update issues when setting door rotation

Also improved random rift code

Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
StevenRS11 2013-04-01 16:45:16 -04:00
parent d3123a33f2
commit 19b099479f
38 changed files with 64 additions and 51 deletions

View file

@ -228,34 +228,27 @@ public class DimData implements Serializable
public ArrayList<LinkData> printAllLinkData()
{
ArrayList links = new ArrayList();
Iterator itr= this.linksInThisDim.keySet().iterator();
while (itr.hasNext())
if(this.linksInThisDim==null)
{
HashMap first = this.linksInThisDim.get((Integer)itr.next());
Iterator itrfirst= first.keySet().iterator();
while (itrfirst.hasNext())
{
HashMap second = (HashMap) first.get((Integer)itrfirst.next());
Iterator itrsecond= second.keySet().iterator();
while (itrsecond.hasNext())
{
//TODO make a for(each : in) loops, and make it so that it returns the links instead of printing them
LinkData link = (LinkData) second.get((Integer)itrsecond.next());
links.add(link);
}
}
return links;
}
for(HashMap<Integer, HashMap<Integer, LinkData>> first : this.linksInThisDim.values())
{
for(HashMap<Integer, LinkData> second : first.values())
{
for(LinkData linkData :second.values())
{
links.add(linkData);
}
}
}
return links;
}

View file

@ -35,12 +35,13 @@ public class PacketHandler implements IPacketHandler
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
if (packet.channel.equals("GenericRandom"))
if (packet.channel.equals("DimDoorPackets"))
{
handleRandom(packet,player);
}
}
private void handleRandom(Packet250CustomPayload packet, Player player)
@ -231,7 +232,7 @@ public class PacketHandler implements IPacketHandler
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="GenericRandom";
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
@ -267,7 +268,7 @@ public class PacketHandler implements IPacketHandler
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="GenericRandom";
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
@ -307,7 +308,7 @@ public class PacketHandler implements IPacketHandler
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="GenericRandom";
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
@ -348,7 +349,7 @@ public class PacketHandler implements IPacketHandler
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="GenericRandom";
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();
@ -396,7 +397,7 @@ public class PacketHandler implements IPacketHandler
dataOut.writeObject(dim);
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="GenericRandom";
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);

View file

@ -32,7 +32,7 @@ public class dimHatch extends BlockTrapDoor
{
int var10 = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlockMetadataWithNotify(par2, par3, par4, var10 ^ 4,1);
par1World.setBlockMetadataWithNotify(par2, par3, par4, var10 ^ 4,2);
par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0);
return true;
}
@ -65,7 +65,7 @@ public class dimHatch extends BlockTrapDoor
if (var7 != par5)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 ^ 4,1);
par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 ^ 4,2);
par1World.playAuxSFXAtEntity((EntityPlayer)null, 1003, par2, par3, par4, 0);
}
}

View file

@ -626,15 +626,15 @@ public class dimHelper extends DimensionManager
int blockToReplace= this.getWorld(destinationID).getBlockId(destX, destY, destZ);
if(blockToReplace!=mod_pocketDim.dimDoorID&&blockToReplace!=mod_pocketDim.linkExitDoorID&&blockToReplace!=mod_pocketDim.linkDimDoorID&&blockToReplace!=mod_pocketDim.ExitDoorID&&blockToReplace!=mod_pocketDim.transientDoorID)
{
this.getWorld(destinationID).setBlock(destX, destY-1, destZ, doorTypeToPlace,dimHelper.instance.flipDoorMetadata(world.getBlockMetadata(locX, locY-1, locZ)),0);
this.getWorld(destinationID).setBlock(destX, destY, destZ, doorTypeToPlace,world.getBlockMetadata(locX, locY, locZ),0);
this.getWorld(destinationID).setBlock(destX, destY-1, destZ, doorTypeToPlace,dimHelper.instance.flipDoorMetadata(world.getBlockMetadata(locX, locY-1, locZ)),2);
this.getWorld(destinationID).setBlock(destX, destY, destZ, doorTypeToPlace,world.getBlockMetadata(locX, locY, locZ),2);
// System.out.println("Genned door");
}
if(id==mod_pocketDim.transientDoorID&&!dimHelper.dimList.get((destinationID)).hasBeenFilled)
{
this.getWorld(destinationID).setBlock(destX, destY-1, destZ, id,dimHelper.instance.flipDoorMetadata(world.getBlockMetadata(locX, locY-1, locZ)),0);
this.getWorld(destinationID).setBlock(destX, destY, destZ, id,world.getBlockMetadata(locX, locY, locZ),0);
this.getWorld(destinationID).setBlock(destX, destY-1, destZ, id,dimHelper.instance.flipDoorMetadata(world.getBlockMetadata(locX, locY-1, locZ)),2);
this.getWorld(destinationID).setBlock(destX, destY, destZ, id,world.getBlockMetadata(locX, locY, locZ),2);
}
linkData.hasGennedDoor=true;
@ -1182,14 +1182,31 @@ public class dimHelper extends DimensionManager
while (!foundRandomDest&&size>0&&i<100)
{
i++;
DimData dimData = dimHelper.dimList.get(rand.nextInt(size));
ArrayList linksInDim = dimData.printAllLinkData();
DimData dimData;
ArrayList linksInDim=new ArrayList();
for(size--;size>=0;)
{
dimData = dimHelper.dimList.get(rand.nextInt(dimList.size()));
if(dimData==null)
{
break;
}
linksInDim = dimData.printAllLinkData();
if(!linksInDim.isEmpty())
{
break;
}
}
if(linksInDim.isEmpty())
{
break;
}
LinkData link1 = (LinkData) linksInDim.get(rand.nextInt(linksInDim.size()));
if(link1!=null)

View file

@ -48,14 +48,14 @@ import StevenDimDoors.mod_pocketDim.commands.CommandPruneDims;
@SidedPacketHandler(channels = {"pocketDim" }, packetHandler = ClientPacketHandler.class),
serverPacketHandlerSpec =
@SidedPacketHandler(channels = {"pocketDim" }, packetHandler = ServerPacketHandler.class),
channels={"GenericRandom"}, packetHandler = PacketHandler.class, connectionHandler=ConnectionHandler.class)
channels={"DimDoorPackets"}, packetHandler = PacketHandler.class, connectionHandler=ConnectionHandler.class)
public class mod_pocketDim
{
public static final String version = "1.4.7R1.3.3B2";
public static final String modid = "Dimensional_Doors";
public static final String version = "1.5.1R1.3.3B2";
public static final String modid = "DimensionalDoors";
//need to clean up
@SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy")
@ -218,12 +218,14 @@ public class mod_pocketDim
MinecraftForge.EVENT_BUS.register(new EventHookContainer());
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
@ -302,7 +304,7 @@ public class mod_pocketDim
blockRift = (new BlockRift(blockRiftID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = (new BlockLimbo(blockLimboID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
chaosDoor = (new ChaosDoor(chaosDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
dimDoor = (new dimDoor(dimDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimDoor");
dimDoor = (new dimDoor(dimDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
dimHatch = (new dimHatch(dimHatchID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");

View file

@ -7,16 +7,16 @@
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/packaging" />
<property name="src.dir" value="src" />
<property name="forge.version" value="1.4.7-6.6.2.534" />
<property name="forge.version" value="1.5.1-7.7.1.617" />
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
<property name="mcp.version" value="726a" />
<property name="mcp.version" value="744" />
<property name="forge.dir" value="${build.dir}/forge" />
<property name="mcp.dir" value="${forge.dir}/mcp" />
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft" />
<property name="resources.dir" value="resources" />
<property name="package.meta-inf" value="META-INF" />
<property name="build.ver" value="1.4.7" />
<property name="build.ver" value="1.5.1" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="download.dir" value="downloads" />
@ -25,7 +25,7 @@
<property file="${forge.dir}/forgeversion.properties" />
<condition property="forge.already.installed">
<equals arg1="${forge.build.number}" arg2="534" />
<equals arg1="${forge.build.number}" arg2="617" />
</condition>
<property name="verclass.dir" value="${mcpsrc.dir}/StevenDimDoors/mod_pocketDim/" />

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

View file

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

View file

Before

Width:  |  Height:  |  Size: 540 B

After

Width:  |  Height:  |  Size: 540 B

View file

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 676 B

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 210 B

View file

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View file

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

View file

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View file

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B