release canidate for 1.5.1- fixed rift render bug, and dimension exit rift handling improved

Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
StevenRS11
2013-04-29 19:03:38 -04:00
parent 57d01bf1e7
commit c3fda5abff
8 changed files with 155 additions and 85 deletions

View File

@@ -11,10 +11,7 @@ import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
public class ConnectionHandler
implements IConnectionHandler
public class ConnectionHandler implements IConnectionHandler
{
private static boolean connected = false;

View File

@@ -850,26 +850,23 @@ public class SchematicLoader
{
LinkData randomLink=dimHelper.instance.getRandomLinkData(false);
if(randomLink!=null&&dimHelper.instance.getDimDepth(world.provider.dimensionId)>4)
{
dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID=randomLink.locDimID;
}
if(dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID)==null)
{
dimHelper.initDimension((dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID));
}
LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), 0, point.getZ(),true);
dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID).getChunkProvider().loadChunk(point.getX() >> 4, point.getZ() >> 4);
LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID).getHeightValue(point.getX(), point.getZ())+1, point.getZ(),true);
if(rand.nextBoolean()&&randomLink!=null)
{
sideLink.destDimID=randomLink.locDimID;
System.out.println("randomLink");
}
dimHelper.getWorld((sideLink.destDimID)).getChunkProvider().loadChunk(point.getX() >> 4, point.getZ() >> 4);
sideLink.destYCoord=dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID).getHeightValue(point.getX(), point.getZ())+1;
sideLink.linkOrientation=world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ());
dimHelper.instance.createLink(sideLink);
dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation));
setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(),Block.stoneBrick.blockID,0);
// setBlockDirectly(world,point.getX(), point.getY()-1, point.getZ(),mod_pocketDim.ExitDoorID,sideLink.linkOrientation);
// setBlockDirectly(world,point.getX(), point.getY(), point.getZ(),mod_pocketDim.ExitDoorID,8);

View File

@@ -110,24 +110,25 @@ public class dimDoor extends BlockContainer
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
//if(par5Entity instanceof EntityLiving)
{
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
}
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
}
else if (!(par5Entity instanceof EntityPlayer)&&num>3)
{
if(par5Entity instanceof EntityLiving)
{
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
}
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
}
}
}

View File

@@ -0,0 +1,60 @@
package StevenDimDoors.mod_pocketDim.commands;
import java.util.ArrayList;
import cpw.mods.fml.common.FMLCommonHandler;
import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.dimHelper;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class CommandAddDungeonRift extends CommandBase
{
public String getCommandName()//the name of our command
{
return "add_dungeon_rift";
}
@Override
public void processCommand(ICommandSender var1, String[] var2)
{
LinkData link = new LinkData(this.getCommandSenderAsPlayer(var1).worldObj.provider.dimensionId, 0,
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posX),
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posY)+1,
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posZ),
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posX),
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posY)+1,
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posZ),true);
link = dimHelper.instance.createPocket(link,true, true);
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("Created dungeon rift");
// this.getCommandSenderAsPlayer(var1).sendChatToPlayer(String.valueOf(var2));
// this.getCommandSenderAsPlayer(var1).sendChatToPlayer(String.valueOf(var2.length));
// this.getCommandSenderAsPlayer(var1).sendChatToPlayer("Removed "+linksRemoved+" rifts.");
// TODO Auto-generated method stub
}
}

View File

@@ -132,30 +132,7 @@ public class dimHelper extends DimensionManager
}
public void teleportToLimbo(World world,LinkData linkData, EntityPlayer player)
{
/**
EntityPlayerMP playerMP = (EntityPlayerMP) player;
player.fallDistance=-700;
//World worldLimbo= this.getWorld(mod_pocketDim.limboDimID);
mod_pocketDim.limbo=this.getWorld(mod_pocketDim.limboDimID);
if(mod_pocketDim.limbo==null)
{
this.initDimension(mod_pocketDim.limboDimID);
}
else if (mod_pocketDim.limbo.provider==null)
{
this.initDimension(mod_pocketDim.limboDimID);
}
//System.out.println(worldLimbo.getHeightValue( MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posZ)));
playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, mod_pocketDim.limboDimID, new pocketTeleporter((WorldServer) this.getWorld(mod_pocketDim.limboDimID), linkData));
**/
}
private Entity teleportEntity(World oldWorld, Entity entity, LinkData link) //this beautiful teleport method is based off of xCompWiz's teleport function.
{
Entity cart;
@@ -219,7 +196,6 @@ public class dimHelper extends DimensionManager
oldWorld.playerEntities.remove(player);
WorldServer.class.cast(oldWorld).getPlayerManager().removePlayer(player);
newWorld.getPlayerManager().addPlayer(player);
player.theItemInWorldManager.setWorld(newWorld);
player.theItemInWorldManager.setWorld((WorldServer)newWorld);
@@ -343,7 +319,6 @@ public class dimHelper extends DimensionManager
if(this.dimList.containsKey(destinationID))
{
this.generatePocket(linkData);
this.generateDoor(world,linkData);
if(mod_pocketDim.teleTimer==0||entity instanceof EntityPlayer)
@@ -366,6 +341,8 @@ public class dimHelper extends DimensionManager
{
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
}
System.out.println(entity.worldObj.getWorldInfo().getDimension());
System.out.println(entity.worldObj.provider.dimensionId);
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
@@ -374,20 +351,41 @@ public class dimHelper extends DimensionManager
int playerYCoord=MathHelper.floor_double(entity.posY);
int playerZCoord=MathHelper.floor_double(entity.posZ);
if(!entity.worldObj.isBlockOpaqueCube(playerXCoord, playerYCoord-1,playerZCoord ))
if(!entity.worldObj.isBlockOpaqueCube(playerXCoord, playerYCoord-1,playerZCoord )&&this.dimList.get(linkData.locDimID).isDimRandomRift&&!linkData.hasGennedDoor)
{
for(int count=0;count<20;count++)
{
if(entity.worldObj.isBlockOpaqueCube(playerXCoord, playerYCoord-1-count,playerZCoord))
{
break;
}
if(count==19)
{
entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID);
}
}
entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID);
}
this.generateDoor(world,linkData);
if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord+1,playerZCoord))
{
if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)].isOpaqueCube())
{
entity.worldObj.setBlock(playerXCoord,playerYCoord+1,playerZCoord,0);
}
}
if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord,playerZCoord))
{
if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)].isOpaqueCube())
{
entity.worldObj.setBlock(playerXCoord,playerYCoord,playerZCoord,0);
}
}
if(entity.worldObj.getBlockId(x, y, z)==mod_pocketDim.dimDoorID||entity.worldObj.getBlockId(x, y, z)==mod_pocketDim.ExitDoorID)

View File

@@ -32,9 +32,9 @@ public class ItemStableFabric extends Item
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6));
System.out.println("Block texture data is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getBlockTexture(par3World,par4, par5, par6,par7).getIconName());
System.out.println("Block name is is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getUnlocalizedName2());
//System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6));
//System.out.println("Block texture data is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getBlockTexture(par3World,par4, par5, par6,par7).getIconName());
//System.out.println("Block name is is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getUnlocalizedName2());
return true;
}

View File

@@ -44,6 +44,7 @@ import StevenDimDoors.mod_pocketDim.blocks.dimDoor;
import StevenDimDoors.mod_pocketDim.blocks.dimHatch;
import StevenDimDoors.mod_pocketDim.blocks.linkDimDoor;
import StevenDimDoors.mod_pocketDim.blocks.linkExitDoor;
import StevenDimDoors.mod_pocketDim.commands.CommandAddDungeonRift;
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteAllLinks;
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimData;
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
@@ -89,6 +90,7 @@ public class mod_pocketDim
public static final ICommand pruneDimsCommand = new CommandPruneDims();
public static final ICommand removeAllLinksCommand = new CommandDeleteAllLinks();
public static final ICommand deleteDimDataCommand = new CommandDeleteDimData();
public static final ICommand addDungeonRift = new CommandAddDungeonRift();
public static int providerID;
@@ -503,13 +505,16 @@ public class mod_pocketDim
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockDimWall
});
/**
GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[]
{
" y ", "yxy", " y ", 'x', Item.eyeOfEnder, 'y', this.blockLimbo
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockLimbo
});
**/
GameRegistry.addRecipe(new ItemStack(this.itemStabilizedLinkSignature,1), new Object[]
{
" y ", "yxy", " y ", 'x', this.itemLinkSignature, 'y', this.itemStableFabric
});
this.blocksImmuneToRift.add(this.blockDimWallID);
this.blocksImmuneToRift.add(this.blockDimWallPermID);
@@ -662,6 +667,7 @@ public class mod_pocketDim
event.registerServerCommand(pruneDimsCommand);
event.registerServerCommand(removeAllLinksCommand);
event.registerServerCommand(deleteDimDataCommand);
event.registerServerCommand(addDungeonRift);
dimHelper.instance.load();