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.IConnectionHandler;
import cpw.mods.fml.common.network.Player; import cpw.mods.fml.common.network.Player;
public class ConnectionHandler public class ConnectionHandler implements IConnectionHandler
implements IConnectionHandler
{ {
private static boolean connected = false; private static boolean connected = false;

View file

@ -850,26 +850,23 @@ public class SchematicLoader
{ {
LinkData randomLink=dimHelper.instance.getRandomLinkData(false); LinkData randomLink=dimHelper.instance.getRandomLinkData(false);
if(randomLink!=null&&dimHelper.instance.getDimDepth(world.provider.dimensionId)>4)
{ 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.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));
}
dimHelper.getWorld(dimHelper.dimList.get(world.provider.dimensionId).exitDimLink.destDimID).getChunkProvider().loadChunk(point.getX() >> 4, point.getZ() >> 4); if(rand.nextBoolean()&&randomLink!=null)
{
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); 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()); sideLink.linkOrientation=world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ());
dimHelper.instance.createLink(sideLink); 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)); 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()-1, point.getZ(),mod_pocketDim.ExitDoorID,sideLink.linkOrientation);
// setBlockDirectly(world,point.getX(), point.getY(), point.getZ(),mod_pocketDim.ExitDoorID,8); // 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) //if(par5Entity instanceof EntityLiving)
{ {
this.onPoweredBlockChange(par1World, par2, par3, par4, false); this.onPoweredBlockChange(par1World, par2, par3, par4, false);
} }
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
} }
else if (!(par5Entity instanceof EntityPlayer)&&num>3) else if (!(par5Entity instanceof EntityPlayer)&&num>3)
{ {
if(par5Entity instanceof EntityLiving) if(par5Entity instanceof EntityLiving)
{ {
this.onPoweredBlockChange(par1World, par2, par3, par4, false); this.onPoweredBlockChange(par1World, par2, par3, par4, false);
} }
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); 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. private Entity teleportEntity(World oldWorld, Entity entity, LinkData link) //this beautiful teleport method is based off of xCompWiz's teleport function.
{ {
Entity cart; Entity cart;
@ -219,7 +196,6 @@ public class dimHelper extends DimensionManager
oldWorld.playerEntities.remove(player); oldWorld.playerEntities.remove(player);
WorldServer.class.cast(oldWorld).getPlayerManager().removePlayer(player); WorldServer.class.cast(oldWorld).getPlayerManager().removePlayer(player);
newWorld.getPlayerManager().addPlayer(player); newWorld.getPlayerManager().addPlayer(player);
player.theItemInWorldManager.setWorld(newWorld);
player.theItemInWorldManager.setWorld((WorldServer)newWorld); player.theItemInWorldManager.setWorld((WorldServer)newWorld);
@ -343,7 +319,6 @@ public class dimHelper extends DimensionManager
if(this.dimList.containsKey(destinationID)) if(this.dimList.containsKey(destinationID))
{ {
this.generatePocket(linkData); this.generatePocket(linkData);
this.generateDoor(world,linkData);
if(mod_pocketDim.teleTimer==0||entity instanceof EntityPlayer) if(mod_pocketDim.teleTimer==0||entity instanceof EntityPlayer)
@ -366,6 +341,8 @@ public class dimHelper extends DimensionManager
{ {
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity); 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); 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 playerYCoord=MathHelper.floor_double(entity.posY);
int playerZCoord=MathHelper.floor_double(entity.posZ); int playerZCoord=MathHelper.floor_double(entity.posZ);
if(!entity.worldObj.isBlockOpaqueCube(playerXCoord, playerYCoord-1,playerZCoord )&&this.dimList.get(linkData.locDimID).isDimRandomRift&&!linkData.hasGennedDoor)
if(!entity.worldObj.isBlockOpaqueCube(playerXCoord, playerYCoord-1,playerZCoord ))
{ {
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.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()) if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)].isOpaqueCube())
{ {
entity.worldObj.setBlock(playerXCoord,playerYCoord+1,playerZCoord,0); 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) 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) 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 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 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 name is is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getUnlocalizedName2());
return true; 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.dimHatch;
import StevenDimDoors.mod_pocketDim.blocks.linkDimDoor; import StevenDimDoors.mod_pocketDim.blocks.linkDimDoor;
import StevenDimDoors.mod_pocketDim.blocks.linkExitDoor; import StevenDimDoors.mod_pocketDim.blocks.linkExitDoor;
import StevenDimDoors.mod_pocketDim.commands.CommandAddDungeonRift;
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteAllLinks; import StevenDimDoors.mod_pocketDim.commands.CommandDeleteAllLinks;
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimData; import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimData;
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts; 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 pruneDimsCommand = new CommandPruneDims();
public static final ICommand removeAllLinksCommand = new CommandDeleteAllLinks(); public static final ICommand removeAllLinksCommand = new CommandDeleteAllLinks();
public static final ICommand deleteDimDataCommand = new CommandDeleteDimData(); public static final ICommand deleteDimDataCommand = new CommandDeleteDimData();
public static final ICommand addDungeonRift = new CommandAddDungeonRift();
public static int providerID; public static int providerID;
@ -503,13 +505,16 @@ public class mod_pocketDim
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockDimWall " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockDimWall
}); });
/**
GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[] 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.blockDimWallID);
this.blocksImmuneToRift.add(this.blockDimWallPermID); this.blocksImmuneToRift.add(this.blockDimWallPermID);
@ -662,6 +667,7 @@ public class mod_pocketDim
event.registerServerCommand(pruneDimsCommand); event.registerServerCommand(pruneDimsCommand);
event.registerServerCommand(removeAllLinksCommand); event.registerServerCommand(removeAllLinksCommand);
event.registerServerCommand(deleteDimDataCommand); event.registerServerCommand(deleteDimDataCommand);
event.registerServerCommand(addDungeonRift);
dimHelper.instance.load(); dimHelper.instance.load();

View file

@ -11,7 +11,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class RiftFX extends EntityFireworkSparkFX public class RiftFX extends EntityFX
{ {
private int field_92049_a = 160; private int field_92049_a = 160;
private boolean field_92054_ax; private boolean field_92054_ax;
@ -25,7 +25,7 @@ public class RiftFX extends EntityFireworkSparkFX
public RiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer) public RiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer)
{ {
super(par1World, par2, par4, par6, par12, par12, par12, par14EffectRenderer); super(par1World, par2, par4, par6);
this.motionX = par8; this.motionX = par8;
this.motionY = par10; this.motionY = par10;
this.motionZ = par12; this.motionZ = par12;
@ -82,44 +82,55 @@ public class RiftFX extends EntityFireworkSparkFX
{ {
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{ {
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
} }
} }
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{ {
float var8 = (float)(super.particleTextureIndexX % 16) / 16.0F; float f6 = (float)this.particleTextureIndexX / 16.0F;
float var9 = var8 + 0.0624375F; float f7 = f6 + 0.0624375F;
float var10 = (float)(this.particleTextureIndexX / 16) / 16.0F; float f8 = (float)this.particleTextureIndexY / 16.0F;
float var11 = var10 + 0.0624375F; float f9 = f8 + 0.0624375F;
float var12 = 0.1F * this.particleScale; float f10 = 0.1F * this.particleScale;
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); if (this.particleTextureIndex != null)
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); {
float var16 = .0F; f6 = this.particleTextureIndex.getMinU();
f7 = this.particleTextureIndex.getMaxU();
f8 = this.particleTextureIndex.getMinV();
f9 = this.particleTextureIndex.getMaxV();
}
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float f14 = .0F;
try try
{ {
if(dimHelper.dimList.get(this.worldObj.provider.dimensionId).isPocket) if(dimHelper.dimList.get(this.worldObj.provider.dimensionId).isPocket)
{ {
var16=.7F; f14=.7F;
} }
else else
{ {
} }
} }
catch(Exception E) catch(Exception E)
{ {
} }
par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7); par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, (float) .7);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10); par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10); par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11);
} }
/** /**
* Called to update the entity's position/logic. * Called to update the entity's position/logic.
*/ */