From c3fda5abff005df27888a436e21e9ae5dcbee52e Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Mon, 29 Apr 2013 19:03:38 -0400 Subject: [PATCH] release canidate for 1.5.1- fixed rift render bug, and dimension exit rift handling improved Signed-off-by: StevenRS11 --- .../mod_pocketDim/ConnectionHandler.java | 5 +- .../mod_pocketDim/SchematicLoader.java | 25 ++++--- .../mod_pocketDim/blocks/dimDoor.java | 9 +-- .../commands/CommandAddDungeonRift.java | 60 +++++++++++++++++ StevenDimDoors/mod_pocketDim/dimHelper.java | 58 ++++++++--------- .../mod_pocketDim/items/ItemStableFabric.java | 6 +- .../mod_pocketDim/mod_pocketDim.java | 12 +++- .../mod_pocketDimClient/RiftFX.java | 65 +++++++++++-------- 8 files changed, 155 insertions(+), 85 deletions(-) create mode 100644 StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java diff --git a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java index f56b1c98..6b042483 100644 --- a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java +++ b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java @@ -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; diff --git a/StevenDimDoors/mod_pocketDim/SchematicLoader.java b/StevenDimDoors/mod_pocketDim/SchematicLoader.java index c98c19e1..069cd12b 100644 --- a/StevenDimDoors/mod_pocketDim/SchematicLoader.java +++ b/StevenDimDoors/mod_pocketDim/SchematicLoader.java @@ -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); diff --git a/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java b/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java index b7d2c76e..97037849 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java @@ -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); + + } } } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java new file mode 100644 index 00000000..bd04cffa --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java @@ -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 + + } +} \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/dimHelper.java b/StevenDimDoors/mod_pocketDim/dimHelper.java index a57a8f96..e30a3175 100644 --- a/StevenDimDoors/mod_pocketDim/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/dimHelper.java @@ -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) diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java index 6d22feb9..b85249d7 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java @@ -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; } diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index fff5fedf..ce439ac4 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -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(); diff --git a/StevenDimDoors/mod_pocketDimClient/RiftFX.java b/StevenDimDoors/mod_pocketDimClient/RiftFX.java index 59c6fbda..f645ffac 100644 --- a/StevenDimDoors/mod_pocketDimClient/RiftFX.java +++ b/StevenDimDoors/mod_pocketDimClient/RiftFX.java @@ -11,7 +11,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class RiftFX extends EntityFireworkSparkFX +public class RiftFX extends EntityFX { private int field_92049_a = 160; 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) { - super(par1World, par2, par4, par6, par12, par12, par12, par14EffectRenderer); + super(par1World, par2, par4, par6); this.motionX = par8; this.motionY = par10; 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) { + + 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) { - float var8 = (float)(super.particleTextureIndexX % 16) / 16.0F; - float var9 = var8 + 0.0624375F; - float var10 = (float)(this.particleTextureIndexX / 16) / 16.0F; - float var11 = var10 + 0.0624375F; - float var12 = 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); - float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); - float var16 = .0F; + float f6 = (float)this.particleTextureIndexX / 16.0F; + float f7 = f6 + 0.0624375F; + float f8 = (float)this.particleTextureIndexY / 16.0F; + float f9 = f8 + 0.0624375F; + float f10 = 0.1F * this.particleScale; + + if (this.particleTextureIndex != null) + { + 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 { - if(dimHelper.dimList.get(this.worldObj.provider.dimensionId).isPocket) - { - var16=.7F; - } - else - { - - } + if(dimHelper.dimList.get(this.worldObj.provider.dimensionId).isPocket) + { + f14=.7F; + } + else + { + + } } catch(Exception E) { - + } - par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7); - - 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)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10); - 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)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11); + 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)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8); + 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)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9); } - /** * Called to update the entity's position/logic. */