diff --git a/StevenDimDoors/mod_pocketDim/BlockDimWallPerm.java b/StevenDimDoors/mod_pocketDim/BlockDimWallPerm.java index 2a1c015..8133055 100644 --- a/StevenDimDoors/mod_pocketDim/BlockDimWallPerm.java +++ b/StevenDimDoors/mod_pocketDim/BlockDimWallPerm.java @@ -22,6 +22,13 @@ public class BlockDimWallPerm extends Block } + public int quantityDropped(Random par1Random) + { + + + return 0; + + } public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} /** diff --git a/StevenDimDoors/mod_pocketDim/ChaosDoor.java b/StevenDimDoors/mod_pocketDim/ChaosDoor.java index 4faf698..75ff7d5 100644 --- a/StevenDimDoors/mod_pocketDim/ChaosDoor.java +++ b/StevenDimDoors/mod_pocketDim/ChaosDoor.java @@ -73,12 +73,7 @@ public class ChaosDoor extends dimDoor int num = par1World.getBlockMetadata(par2, par3-1, par4); if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.chaosDoorID) { - EntityPlayer player; - if(par5Entity instanceof EntityPlayer) - { - player= (EntityPlayer) par5Entity; - this.onPoweredBlockChange(par1World, par2, par3, par4, false); boolean foundRandomDest=false; @@ -102,7 +97,7 @@ public class ChaosDoor extends dimDoor { foundRandomDest=true; - dimHelper.instance.teleportToPocket(par1World, new LinkData(link.destDimID,link.locDimID,link.destXCoord,link.destYCoord,link.destZCoord,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket), player); + dimHelper.instance.teleportToPocket(par1World, new LinkData(link.destDimID,link.locDimID,link.destXCoord,link.destYCoord,link.destZCoord,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket), par5Entity); if(dimHelper.getWorld(link.locDimID)!=null) { @@ -116,6 +111,6 @@ public class ChaosDoor extends dimDoor } } } - } + } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/DimRail.java b/StevenDimDoors/mod_pocketDim/DimRail.java new file mode 100644 index 0000000..e69de29 diff --git a/StevenDimDoors/mod_pocketDim/ExitDoor.java b/StevenDimDoors/mod_pocketDim/ExitDoor.java index e70c9d6..113aea6 100644 --- a/StevenDimDoors/mod_pocketDim/ExitDoor.java +++ b/StevenDimDoors/mod_pocketDim/ExitDoor.java @@ -102,13 +102,9 @@ public class ExitDoor extends dimDoor int var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); int num = par1World.getBlockMetadata(par2, par3-1, par4); - if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.ExitDoorID) + if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.ExitDoorID||!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.ExitDoorID&&!(par5Entity instanceof EntityPlayer) ) { - EntityPlayer player; - if(par5Entity instanceof EntityPlayerMP) - { - - player= (EntityPlayer) par5Entity; + //int destinationID= dimHelper.instance.getDestIDFromCoords(par2, par3, par4, par1World); this.onPoweredBlockChange(par1World, par2, par3, par4, false); @@ -117,11 +113,11 @@ public class ExitDoor extends dimDoor if(linkData!=null) { if(dimHelper.dimList.containsKey(linkData.destDimID)) - dimHelper.instance.teleportToPocket(par1World, linkData, player); + dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); } - } + } } diff --git a/StevenDimDoors/mod_pocketDim/ItemRiftBlade.java b/StevenDimDoors/mod_pocketDim/ItemRiftBlade.java index 1045d6a..fddad8c 100644 --- a/StevenDimDoors/mod_pocketDim/ItemRiftBlade.java +++ b/StevenDimDoors/mod_pocketDim/ItemRiftBlade.java @@ -10,6 +10,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.EnumAction; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -23,6 +24,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class ItemRiftBlade extends itemDimDoor { + private int weaponDamage; + private final EnumToolMaterial toolMaterial= EnumToolMaterial.GOLD; private Material doorMaterial; Random rand = new Random(); public ItemRiftBlade(int par1, Material par2Material) @@ -31,6 +34,7 @@ public class ItemRiftBlade extends itemDimDoor this.setMaxStackSize(1); // this.setTextureFile("/PocketBlockTextures.png"); this.setCreativeTab(CreativeTabs.tabTransport); + this.weaponDamage =8; // this.iconIndex=5; @@ -55,7 +59,7 @@ public class ItemRiftBlade extends itemDimDoor } public int getDamageVsEntity(Entity par1Entity) { - return 6; + return 8; } @@ -119,10 +123,95 @@ public class ItemRiftBlade extends itemDimDoor return true; } + public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + return par1ItemStack; + } + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } + + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) + { + System.out.println(par4); + + if(dimHelper.dimList.get(par2World.provider.dimensionId)!=null&&!par2World.isRemote) + { + + System.out.println("stopped"); + if(par3EntityPlayer.getItemInUseDuration()>15) + { + + Vec3 var2 = par3EntityPlayer.getLook(1.0F); + + double cooef = -2; + var2.xCoord*=cooef; + var2.yCoord*=cooef; + var2.zCoord*=cooef; + double var5 = par3EntityPlayer.posX - var2.xCoord; + double var9 = par3EntityPlayer.posZ - var2.zCoord; + double var7 =par3EntityPlayer.posY-var2.yCoord+2; + + int x = MathHelper.floor_double(var5); + int y = MathHelper.floor_double(var7); + int z = MathHelper.floor_double(var9); + + System.out.println(x+" "+y+" "+z); + int rotation = (int) (MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); + LinkData link = new LinkData(par2World.provider.dimensionId, 0, x, y, z, x, y, z, true); + + if(dimHelper.dimList.get(par2World.provider.dimensionId).depth==0) + { + link.linkOrientation= rotation; + dimHelper.instance.createPocket(link,true, false); + System.out.println("doingDown"); + + } + else if(dimHelper.dimList.get(par2World.provider.dimensionId).depth==1) + { + link.linkOrientation= rotation; + dimHelper.instance.createLink(link); + System.out.println("doingup"); + int ExitDimID= dimHelper.dimList.get(par2World.provider.dimensionId).exitDimLink.destDimID; + + dimHelper.instance.createLink(link.locDimID, ExitDimID, x, y, z, x, y, z,rotation); + dimHelper.instance.createLink(ExitDimID, link.locDimID, x, y, z, x, y, z,dimHelper.instance.flipDoorMetadata(rotation)); + + + } + else if(dimHelper.dimList.get(par2World.provider.dimensionId).isPocket) + { + link.linkOrientation= rotation; + dimHelper.instance.createPocket(link,false, false); + } + + + + + + placeDoorBlock(par2World, x, y, z, rotation, mod_pocketDim.transientDoor); + } + else + { + + } + } + + + } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + Boolean didFindThing=false; MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false ); if(hit!=null) { @@ -153,6 +242,7 @@ public class ItemRiftBlade extends itemDimDoor { placeDoorBlock(par2World, par4, par5, par6, var12, var11); + didFindThing=true; par1ItemStack.damageItem(10, par3EntityPlayer); @@ -161,20 +251,26 @@ public class ItemRiftBlade extends itemDimDoor } } } + else if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.transientDoorID) + { + didFindThing=true; + } } + + if(!par3EntityPlayer.worldObj.isRemote) { - List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox( par3EntityPlayer.posX-7,par3EntityPlayer.posY-7, par3EntityPlayer.posZ-7, par3EntityPlayer.posX+7,par3EntityPlayer.posY+7, par3EntityPlayer.posZ+7)); - list.remove(par3EntityPlayer); + List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox( par3EntityPlayer.posX-8,par3EntityPlayer.posY-8, par3EntityPlayer.posZ-8, par3EntityPlayer.posX+8,par3EntityPlayer.posY+8, par3EntityPlayer.posZ+8)); + list.remove(par3EntityPlayer); - for(EntityLiving ent : list) - { - - Vec3 var3 = par3EntityPlayer.getLook(1.0F).normalize(); + for(EntityLiving ent : list) + { + + Vec3 var3 = par3EntityPlayer.getLook(1.0F).normalize(); Vec3 var4 = par3EntityPlayer.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - par3EntityPlayer.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( par3EntityPlayer.posY + (double) par3EntityPlayer.getEyeHeight()), ent.posZ - par3EntityPlayer.posZ); double var5 = var4.lengthVector(); var4 = var4.normalize(); @@ -183,15 +279,26 @@ public class ItemRiftBlade extends itemDimDoor { System.out.println(list.size()); ItemRiftBlade.class.cast(par1ItemStack.getItem()).teleportToEntity(par1ItemStack,ent, par3EntityPlayer); + didFindThing=true; break; //ItemRiftBlade.class.cast(item.getItem()).teleportTo(event.entityPlayer, ent.posX, ent.posY, ent.posZ); } - } + } } - return par1ItemStack; + // if(dimHelper.dimList.get(par2World.provider.dimensionId)!=null&&!par2World.isRemote&&!didFindThing) + { + System.out.println("using"); + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + + } + + + + + return par1ItemStack; } @Override @@ -203,7 +310,10 @@ public class ItemRiftBlade extends itemDimDoor { return EnumToolMaterial.GOLD.getEnchantability(); } - + public String func_77825_f() + { + return EnumToolMaterial.GOLD.toString(); + } public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return true; @@ -223,6 +333,8 @@ public class ItemRiftBlade extends itemDimDoor var11 = mod_pocketDim.transientDoor; + + diff --git a/StevenDimDoors/mod_pocketDim/ItemStableFabric.java b/StevenDimDoors/mod_pocketDim/ItemStableFabric.java index 5f2a575..c1eacad 100644 --- a/StevenDimDoors/mod_pocketDim/ItemStableFabric.java +++ b/StevenDimDoors/mod_pocketDim/ItemStableFabric.java @@ -24,11 +24,7 @@ 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) { - if(!par3World.isRemote) - { - LinkData link = new LinkData(par3World.provider.dimensionId, 0, par4, par5+2, par6, par4, par5+2, par6, true); - link =dimHelper.instance.createPocket(link,true, true); - } + System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6)); return true; } @@ -43,9 +39,7 @@ public class ItemStableFabric extends Item - par3List.add("DEBUG/ADMIN ONLY ITEM"); - par3List.add ("on use creates a "); - par3List.add ("random dungeon rift"); + diff --git a/StevenDimDoors/mod_pocketDim/RailTeleporter.java b/StevenDimDoors/mod_pocketDim/RailTeleporter.java new file mode 100644 index 0000000..ad903e6 --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/RailTeleporter.java @@ -0,0 +1,105 @@ +package StevenDimDoors.mod_pocketDim; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.Teleporter; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class RailTeleporter extends Teleporter +{ + int x,y,z; + World world; + LinkData sendingLink; + + + public RailTeleporter(WorldServer par1WorldServer, LinkData link) + + { + + + super(par1WorldServer); + this.x=link.destXCoord; + this.y=link.destYCoord; + this.z=link.destZCoord; + this.sendingLink=link; + world = par1WorldServer; + } + + + /** + * Create a new portal near an entity. + */ + @Override + public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) + { + + + int id; + + + id=dimHelper.instance.getDestOrientation(sendingLink); + //System.out.println("Teleporting with link oreintation "+id); + + + par1Entity.rotationYaw=(id*90)+90; + if(id==2||id==6) + { + + + this.setEntityPosition(par1Entity, x+2.5, y, z+.5 ); + + + } + else if(id==3||id==7) + { + + this.setEntityPosition(par1Entity, x+.5, y, z+2.5 ); + + + } + else if(id==0||id==4) + { + + this.setEntityPosition(par1Entity,x-1.5, y, z+.5); + + } + else if(id==1||id==5) + { + + this.setEntityPosition(par1Entity,x+.5, y, z-1.5); + + + } + else + { + + this.setEntityPosition(par1Entity,x, y, z); + + } + + par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false); + } + + + + + public void setEntityPosition(Entity entity, double x, double y, double z) + { + entity.lastTickPosX = entity.prevPosX = entity.posX = x; + entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset; + entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z; + entity.setPosition(x, y, z); + } + @Override + public boolean func_85188_a(Entity par1Entity) + { + return true; + } + @Override + public void func_85189_a(long par1) + { + + } +} diff --git a/StevenDimDoors/mod_pocketDim/TileEntityDimRail.java b/StevenDimDoors/mod_pocketDim/TileEntityDimRail.java new file mode 100644 index 0000000..4ae98cb --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/TileEntityDimRail.java @@ -0,0 +1,68 @@ +package StevenDimDoors.mod_pocketDim; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class TileEntityDimRail extends TileEntity + +{ + + public int orientation; + public boolean hasExit; + + + + + + public boolean canUpdate() + { + return false; + } + + public void updateEntity() + { + + + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + int i = nbt.getInteger(("Size")); + + try + { + + this.orientation = nbt.getInteger("orientation"); + + this.hasExit = nbt.getBoolean("hasExit"); + + + + + + + } + catch (Exception e) + { + + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + int i = 0; + super.writeToNBT(nbt); + + + nbt.setBoolean("hasExit", this.hasExit); + + nbt.setInteger("orientation", this.orientation); + + + + + } +} diff --git a/StevenDimDoors/mod_pocketDim/TransientDoor.java b/StevenDimDoors/mod_pocketDim/TransientDoor.java index 8577346..7491424 100644 --- a/StevenDimDoors/mod_pocketDim/TransientDoor.java +++ b/StevenDimDoors/mod_pocketDim/TransientDoor.java @@ -48,14 +48,9 @@ public class TransientDoor extends ExitDoor int num = par1World.getBlockMetadata(par2, par3, par4); // System.out.println("metadata "+num+" orientation "+var12); - if(!par1World.isRemote&&(num)==var12) + if(!par1World.isRemote&&(num)==var12||!par1World.isRemote&&!(par5Entity instanceof EntityPlayer)) { - EntityPlayer player; - if(par5Entity instanceof EntityPlayerMP) - { - - player= (EntityPlayer) par5Entity; - //int destinationID= dimHelper.instance.getDestIDFromCoords(par2, par3, par4, par1World); + @@ -64,7 +59,7 @@ public class TransientDoor extends ExitDoor { if(dimHelper.dimList.containsKey(linkData.destDimID)) { - dimHelper.instance.teleportToPocket(par1World, linkData, player); + dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); par1World.setBlockWithNotify(par2, par3, par4, 0); } } @@ -76,7 +71,7 @@ public class TransientDoor extends ExitDoor { if(dimHelper.dimList.containsKey(linkData.destDimID)) { - dimHelper.instance.teleportToPocket(par1World, linkData, player); + dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); par1World.setBlockWithNotify(par2, par3, par4, 0); } } @@ -87,7 +82,7 @@ public class TransientDoor extends ExitDoor } - } + public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5) { diff --git a/StevenDimDoors/mod_pocketDim/dimDoor.java b/StevenDimDoors/mod_pocketDim/dimDoor.java index 786fa94..7bc3876 100644 --- a/StevenDimDoors/mod_pocketDim/dimDoor.java +++ b/StevenDimDoors/mod_pocketDim/dimDoor.java @@ -30,6 +30,7 @@ public class dimDoor extends BlockContainer } + @Override public String getTextureFile() { @@ -73,24 +74,41 @@ public class dimDoor extends BlockContainer { int var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); - int num = par1World.getBlockMetadata(par2, par3-1, par4); - if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.dimDoorID) + int num=0; + LinkData linkData=null; + + if(par1World.getBlockId(par2, par3-1, par4)==this.blockID) { - EntityPlayer player; + num=par1World.getBlockMetadata(par2, par3-1, par4); + linkData= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); + } - if(par5Entity instanceof EntityPlayerMP) - { + if(par1World.getBlockId(par2, par3+1, par4)==this.blockID) + { + num=par1World.getBlockMetadata(par2, par3, par4); + linkData= dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World); + } - player= (EntityPlayer) par5Entity; + if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12) + { + //int destinationID= dimHelper.instance.getDestIDFromCoords(par2, par3, par4, par1World); - this.onPoweredBlockChange(par1World, par2, par3, par4, false); + - LinkData linkData= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); - dimHelper.instance.teleportToPocket(par1World, linkData, player); - + + + dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); + this.onPoweredBlockChange(par1World, par2, par3, par4, false); - } + + } + else if (!(par5Entity instanceof EntityPlayer)&&num>3) + { + this.onPoweredBlockChange(par1World, par2, par3, par4, false); + + + dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity); } } } @@ -125,7 +143,7 @@ public class dimDoor extends BlockContainer { int var12 = (int) (MathHelper.floor_double((double)((par5EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); if(par1World.getBlockMetadata(par2, par3, par4)==var12) - { + { var12=dimHelper.instance.flipDoorMetadata(var12); } par1World.setBlockMetadataWithNotify(par2, par3, par4, var12); @@ -458,11 +476,11 @@ public class dimDoor extends BlockContainer { if (!var5) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + this.setBlockBounds(0.001F, 0.0F, 0.0F, 1.0F, 1.0F, var2); } else { - this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + this.setBlockBounds(0.001F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); } } else @@ -476,11 +494,11 @@ public class dimDoor extends BlockContainer { if (!var5) { - this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.setBlockBounds(1.0F - var2, 0.0F, 0.001F, 1.0F, 1.0F, 1.0F); } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + this.setBlockBounds(0.0F, 0.0F, 0.001F, var2, 1.0F, 1.0F); } } else @@ -494,11 +512,11 @@ public class dimDoor extends BlockContainer { if (!var5) { - this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, .99F, 1.0F, 1.0F); } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + this.setBlockBounds(0.0F, 0.0F, 0.0F, .99F, 1.0F, var2); } } else @@ -512,11 +530,11 @@ public class dimDoor extends BlockContainer { if (!var5) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 0.99F); } else { - this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 0.99F); } } else @@ -634,7 +652,7 @@ public class dimDoor extends BlockContainer */ public int getMobilityFlag() { - return 1; + return 2; } /** diff --git a/StevenDimDoors/mod_pocketDim/dimHatch.java b/StevenDimDoors/mod_pocketDim/dimHatch.java index e379a68..060a08b 100644 --- a/StevenDimDoors/mod_pocketDim/dimHatch.java +++ b/StevenDimDoors/mod_pocketDim/dimHatch.java @@ -45,19 +45,16 @@ public class dimHatch extends BlockTrapDoor if(!par1World.isRemote&&(num>3&&num<8||num>11)&&par1World.provider instanceof pocketProvider) { - EntityPlayerMP playerMP; - if(par5Entity instanceof EntityPlayerMP) - { - playerMP= (EntityPlayerMP) par5Entity; + this.onPoweredBlockChange(par1World, par2, par3, par4, false); DimData dimData = (DimData) dimHelper.instance.dimList.get(par1World.provider.dimensionId); LinkData exitLink=dimData.exitDimLink; - dimHelper.instance.teleportToPocket(par1World, exitLink, playerMP); + dimHelper.instance.teleportToPocket(par1World, exitLink, par5Entity); - } + } } diff --git a/StevenDimDoors/mod_pocketDim/dimHelper.java b/StevenDimDoors/mod_pocketDim/dimHelper.java index a3c8e7b..faae78e 100644 --- a/StevenDimDoors/mod_pocketDim/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/dimHelper.java @@ -16,11 +16,21 @@ import java.util.Random; import java.util.Set; import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.packet.Packet41EntityEffect; +import net.minecraft.network.packet.Packet43Experience; +import net.minecraft.network.packet.Packet9Respawn; +import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; +import net.minecraft.world.Teleporter; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; @@ -141,7 +151,148 @@ public class dimHelper extends DimensionManager playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, mod_pocketDim.limboDimID, new pocketTeleporter((WorldServer) this.getWorld(mod_pocketDim.limboDimID), linkData)); } + private void teleportEntity(World oldWorld, Entity entity, LinkData link) + { + + if(this.getWorld(link.destDimID)==null) + { + this.initDimension(link.destDimID); + } + World newWorld = this.getWorld(link.destDimID); + Entity mount = entity.ridingEntity; + Entity rider = entity.riddenByEntity; + if (entity.ridingEntity != null) + { + entity.mountEntity(null); + mount.riddenByEntity = null; + teleportEntity(oldWorld, mount, link); + } + + if (entity.riddenByEntity != null) + { + rider.mountEntity(null); + entity.riddenByEntity = null; + teleportEntity(oldWorld, rider, link); + } + + boolean changingworlds = entity.worldObj != newWorld; + + entity.worldObj.updateEntityWithOptionalForce(entity, false); + if ((entity instanceof EntityPlayerMP)) + { + EntityPlayerMP player = (EntityPlayerMP)entity; + player.closeScreen(); + if (changingworlds) + { + player.dimension = link.destDimID; + player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType())); + + ((WorldServer)entity.worldObj).getPlayerManager().removePlayer(player); + } + } + if(changingworlds) + { + if ((entity instanceof EntityPlayer)) + { + EntityPlayer player = (EntityPlayer)entity; + player.closeScreen(); + oldWorld.playerEntities.remove(player); + oldWorld.updateAllPlayersSleepingFlag(); + } + int i = entity.chunkCoordX; + int j = entity.chunkCoordZ; + if ((entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists(i, j))) + { + oldWorld.getChunkFromChunkCoords(i, j).removeEntity(entity); + oldWorld.getChunkFromChunkCoords(i, j).isModified = true; + } + oldWorld.loadedEntityList.remove(entity); + oldWorld.releaseEntitySkin(entity); + entity.isDead = false; + } + ((WorldServer)newWorld).theChunkProviderServer.loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4); + + + + + if (changingworlds) + { + if (!(entity instanceof EntityPlayer)) + { + NBTTagCompound entityNBT = new NBTTagCompound(); + entity.isDead = false; + entity.addEntityID(entityNBT); + entity.isDead = true; + entity = EntityList.createEntityFromNBT(entityNBT, newWorld); + if (entity == null) + { + return; + } + } + + + + newWorld.spawnEntityInWorld(entity); + entity.setWorld(newWorld); + + } + + + + + + if ((entity instanceof EntityPlayerMP)) + { + EntityPlayerMP player = (EntityPlayerMP)entity; + + if (changingworlds) + { + player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer)newWorld); + } + } + + + + if (((entity instanceof EntityPlayerMP)) && (changingworlds)) + { + EntityPlayerMP player = (EntityPlayerMP)entity; + player.theItemInWorldManager.setWorld((WorldServer)newWorld); + player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer)newWorld); + player.mcServer.getConfigurationManager().syncPlayerInventory(player); + Iterator var14 = player.getActivePotionEffects().iterator(); + + while (var14.hasNext()) + { + PotionEffect var13 = (PotionEffect)var14.next(); + player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, var13)); + } + player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel)); + } + + + new pocketTeleporter((WorldServer) newWorld, link).placeInPortal(entity, 0, 0, 0, 0); + + + if ((entity != null) && (mount != null)) + { + entity.mountEntity(mount); + mount.updateRiderPosition(); + if ((entity instanceof EntityPlayerMP)) + { + FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().serverUpdateMountedMovingPlayer((EntityPlayerMP)entity); + } + } + if ((entity != null) && (rider != null)) + { + rider.mountEntity(entity); + entity.updateRiderPosition(); + if ((rider instanceof EntityPlayerMP)) + { + FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().serverUpdateMountedMovingPlayer((EntityPlayerMP)rider); + } + } + } /** * Primary function used to teleport the player using doors. Performes numerous null checks, and also generates the destination door/pocket if it has not done so already. * Also ensures correct orientation relative to the door using the pocketTeleporter. @@ -151,7 +302,7 @@ public class dimHelper extends DimensionManager * @param orientation- the orientation of the door used to teleport, determines player orientation and door placement on arrival * @Return */ - public void teleportToPocket(World world,LinkData linkData, EntityPlayer player) + public void teleportToPocket(World world,LinkData linkData, Entity entity) { @@ -164,9 +315,9 @@ public class dimHelper extends DimensionManager int y=linkData.destYCoord; int z=linkData.destZCoord; - if(linkData.destDimID==mod_pocketDim.limboDimID) + if(linkData.destDimID==mod_pocketDim.limboDimID&&entity instanceof EntityPlayerMP) { - this.teleportToLimbo(world, linkData, player); + this.teleportToLimbo(world, linkData, EntityPlayerMP.class.cast(entity)); } @@ -178,61 +329,38 @@ public class dimHelper extends DimensionManager this.generateDoor(world,linkData); - if(player instanceof EntityPlayerMP) - { + + + + + - EntityPlayerMP playerMP = (EntityPlayerMP) player; - - if(linkData.destDimID==world.provider.dimensionId) - { - (new pocketTeleporter((WorldServer) world,linkData)).placeInPortal(playerMP, x, y, z, 0); - //tele.placeInPortal(playerMP, x, y, z, 0); - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F); - - } - else - { - - - + this.teleportEntity(world, entity, linkData); - playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, destinationID, new pocketTeleporter((WorldServer) world, linkData)); + entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F); + int playerXCoord=MathHelper.floor_double(entity.posX); + int playerYCoord=MathHelper.floor_double(entity.posY); + int playerZCoord=MathHelper.floor_double(entity.posZ); - int playerXCoord=MathHelper.floor_double(player.posX); - int playerYCoord=MathHelper.floor_double(player.posY); - int playerZCoord=MathHelper.floor_double(player.posZ); - - if(Block.blocksList.length>player.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)&&!player.worldObj.isAirBlock(playerXCoord,playerYCoord,playerZCoord)) + if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord+1,playerZCoord)) { - if(Block.blocksList[player.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)].isOpaqueCube()) + if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)].isOpaqueCube()) { - player.worldObj.setBlockWithNotify(playerXCoord,playerYCoord+1,playerZCoord,0); + entity.worldObj.setBlockWithNotify(playerXCoord,playerYCoord+1,playerZCoord,0); } } - if(player.worldObj.getBlockId(x, y, z)==mod_pocketDim.dimDoorID||player.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) { - if(this.getLinkDataFromCoords(x, y, z, player.worldObj)!=null) + if(this.getLinkDataFromCoords(x, y, z, entity.worldObj)!=null) { //System.out.println("updated link orientation"); - this.getLinkDataFromCoords(x, y, z, player.worldObj).linkOrientation= player.worldObj.getBlockMetadata(x, y -1, z); + this.getLinkDataFromCoords(x, y, z, entity.worldObj).linkOrientation= entity.worldObj.getBlockMetadata(x, y -1, z); } - } - } - } - if(rand.nextBoolean()) - { - player.addExperience(1); - } - else if(player.experience>2) - { - player.addExperience(-1); - } - else - { - player.addExperience(1); + + + } } @@ -242,6 +370,9 @@ public class dimHelper extends DimensionManager } } + + + /** * Creates a link at the location, pointing to the destination. Does NOT create a pair, so must be called twice. * @param locationDimID diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 79901b1..7e03e1e 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -53,7 +53,7 @@ import cpw.mods.fml.relauncher.Side; public class mod_pocketDim { - public static final String version = "1.4.6R1.2.2RC1"; + public static final String version = "1.4.6R1.3.0D1"; //need to clean up @SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy") public static CommonProxy proxy; @@ -71,6 +71,7 @@ public class mod_pocketDim public static int blockRiftID; public static int transientDoorID; public static int itemRiftBladeID; + // public static int railRenderID; public static int itemStableFabricID; public static int itemExitDoorID; @@ -80,6 +81,8 @@ public class mod_pocketDim public static int chaosDoorID; public static int blockLimboID; public static int dimHatchID; + // public static int dimRailID; + public static int riftSpreadFactor; public static int DoorRenderID=55; public static int HOW_MUCH_TNT; @@ -98,6 +101,8 @@ public class mod_pocketDim public static Block blockRift; public static Block blockLimbo; public static Block dimDoor; +// public static Block dimRail; + public static Block blockDimWall; public static Block dimHatch; public static Block blockDimWallPerm; @@ -164,6 +169,8 @@ public class mod_pocketDim public static boolean enableUnstableDoor; public static boolean enableRiftBlade; + + // public static boolean enableDimRail; public static boolean enableDimTrapDoor; @@ -210,6 +217,7 @@ public class mod_pocketDim config.load(); + // this.enableDimRail = config.get("BOOLEAN", "true to enable dim rail crafting", true).getBoolean(true); this.enableDimTrapDoor = config.get("BOOLEAN", "true to enable trap door crafting", true).getBoolean(true); this.enableIronDimDoor = config.get("BOOLEAN", "true to enable iron dim door crafting", true).getBoolean(true); this.enableRiftBlade = config.get("BOOLEAN", "true to enable rift blade crafting", true).getBoolean(true); @@ -218,10 +226,12 @@ public class mod_pocketDim this.enableUnstableDoor = config.get("BOOLEAN", "true to enable unstable door crafting", true).getBoolean(true); this.enableWoodenDimDoor = config.get("BOOLEAN", "true to enable wooden door crafting", true).getBoolean(true); this.enableDoorOpenGL = config.get("BOOLEAN", "Toggles the door render effect", true).getBoolean(true); + + // dimRailID = config.getBlock("Dimensional Rail", 1980).getInt(); chaosDoorID = config.getBlock("Chaos Door", 1978).getInt(); dimDoorID = config.getBlock("Dimensional Door", 1970).getInt(); - dimHatchID = config.getBlock("Transdimensional Hatch", 1971).getInt(); + dimHatchID = config.getBlock("Transdimensional Trapdoor", 1971).getInt(); linkDimDoorID= config.getBlock("Dimensional Door Link", 1972).getInt(); blockDimWallID=config.getBlock("Fabric of Reality", 1973).getInt(); ExitDoorID = config.getBlock("Warp Door", 1975).getInt(); @@ -230,7 +240,6 @@ public class mod_pocketDim transientDoorID = config.getBlock("transientDoorID", 1979).getInt(); itemRiftBladeID=config.getItem("Rift Blade", 5676).getInt(); - itemChaosDoorID=config.getItem("Chaos Door", 5673).getInt(); itemRiftRemoverID=config.getItem("Rift Remover", 5671).getInt(); itemStableFabricID=config.getItem("Stable Fabric", 5672).getInt(); @@ -277,7 +286,8 @@ public class mod_pocketDim chaosDoor = (new ChaosDoor(chaosDoorID, Material.iron).setHardness(.2F).setBlockName("chaosDoor").setLightValue(.0F).setRequiresSelfNotify()); dimDoor = (new dimDoor(dimDoorID, Material.iron)).setHardness(1.0F).setRequiresSelfNotify().setBlockName("dimDoor"); dimHatch = (new dimHatch(dimHatchID, 84, Material.iron)).setHardness(1.0F).setRequiresSelfNotify().setBlockName("dimHatch"); - + // dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F).setRequiresSelfNotify().setBlockName("dimRail"); + itemDimDoor = (new itemDimDoor(itemDimDoorID, Material.iron)).setItemName("itemDimDoor"); itemExitDoor = (new itemExitDoor(itemExitDoorID, Material.wood)).setItemName("itemDimDoorexit"); itemLinkSignature = (new itemLinkSignature(itemLinkSignatureID, Material.wood)).setItemName("itemLinkSignature"); @@ -290,7 +300,8 @@ public class mod_pocketDim proxy.loadTextures(); proxy.registerRenderers(); GameRegistry.registerWorldGenerator(this.riftGen); - + + //GameRegistry.registerBlock(dimRail, "Dimensional Rail"); GameRegistry.registerBlock(chaosDoor, "Unstable Door"); GameRegistry.registerBlock(ExitDoor, "Warp Door"); GameRegistry.registerBlock(linkExitDoor, "Warp Door link"); @@ -329,7 +340,7 @@ public class mod_pocketDim LanguageRegistry.addName(itemExitDoor , "Warp Door"); LanguageRegistry.addName(itemLinkSignature , "Rift Signature"); LanguageRegistry.addName(itemRiftRemover , "Rift Remover"); - LanguageRegistry.addName(itemStableFabric , "Unstable Fabric"); + LanguageRegistry.addName(itemStableFabric , "Stable Fabric"); LanguageRegistry.addName(itemChaosDoor , "Unstable Door"); LanguageRegistry.addName(itemDimDoor, "Dimensional Door"); LanguageRegistry.addName(itemRiftBlade , "Rift Blade"); @@ -338,6 +349,8 @@ public class mod_pocketDim TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT); TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER); + // GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimRail"); + GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor"); GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); @@ -353,6 +366,21 @@ public class mod_pocketDim " ", "yxy", " ", 'x', this.itemStableFabric, 'y', Item.doorSteel }); } + + /** + if(this.enableDimRail) + { + GameRegistry.addRecipe(new ItemStack(dimRail, 1), new Object[] + { + " ", "yxy", " ", 'x', this.itemDimDoor, 'y', Block.rail + }); + + GameRegistry.addRecipe(new ItemStack(dimRail, 1), new Object[] + { + " ", "yxy", " ", 'x', this.itemExitDoor, 'y', Block.rail + }); + } + **/ if(this.enableUnstableDoor) { diff --git a/StevenDimDoors/mod_pocketDim/pocketTeleporter.java b/StevenDimDoors/mod_pocketDim/pocketTeleporter.java index 0ff179d..2ccfc14 100644 --- a/StevenDimDoors/mod_pocketDim/pocketTeleporter.java +++ b/StevenDimDoors/mod_pocketDim/pocketTeleporter.java @@ -1,6 +1,7 @@ package StevenDimDoors.mod_pocketDim; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.Teleporter; import net.minecraft.world.World; @@ -31,22 +32,24 @@ public class pocketTeleporter extends Teleporter * Create a new portal near an entity. */ @Override - public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) - { - EntityPlayer player = (EntityPlayer) par1Entity; + public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) + { + if(par1Entity instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) par1Entity; - int id; + int id; - id=dimHelper.instance.getDestOrientation(sendingLink); + id=dimHelper.instance.getDestOrientation(sendingLink); //System.out.println("Teleporting with link oreintation "+id); - // System.out.println(id); - player.rotationYaw=(id*90)+90; - if(id==2||id==6) - { - player.setPositionAndUpdate( x+1.5, y-1, z+.5 ); + + player.rotationYaw=(id*90)+90; + if(id==2||id==6) + { + player.setPositionAndUpdate( x+1.5, y-1, z+.5 ); } @@ -77,9 +80,110 @@ public class pocketTeleporter extends Teleporter - + } + else if(par1Entity instanceof EntityMinecart) + { + int id; + + id=dimHelper.instance.getDestOrientation(sendingLink); + + + par1Entity.rotationYaw=(id*90)+90; + + if(id==2||id==6) + { + this.setEntityPosition(par1Entity, x+1.5, y, z+.5 ); + par1Entity.motionX =2; + } + else if(id==3||id==7) + { + + this.setEntityPosition(par1Entity, x+.5, y, z+1.5 ); + par1Entity.motionZ =2; + + } + else if(id==0||id==4) + { + + this.setEntityPosition(par1Entity,x-.5, y, z+.5); + par1Entity.motionX =-2; + } + else if(id==1||id==5) + { + this.setEntityPosition(par1Entity,x+.5, y, z-.5); + par1Entity.motionZ =-2; + } + else + { + this.setEntityPosition(par1Entity,x, y, z); + + } + + + + + } + + + else if(par1Entity instanceof Entity) + { + int id; + + + id=dimHelper.instance.getDestOrientation(sendingLink); + //System.out.println("Teleporting with link oreintation "+id); + + + par1Entity.rotationYaw=(id*90)+90; + + if(id==2||id==6) + { + this.setEntityPosition(par1Entity, x+1.5, y, z+.5 ); + + + } + else if(id==3||id==7) + { + + this.setEntityPosition(par1Entity, x+.5, y, z+1.5 ); + + + } + else if(id==0||id==4) + { + + this.setEntityPosition(par1Entity,x-.5, y, z+.5); + + } + else if(id==1||id==5) + { + this.setEntityPosition(par1Entity,x+.5, y, z-.5); + + + } + else + { + this.setEntityPosition(par1Entity,x, y, z); + + } + + + + + } + par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false); } + public void setEntityPosition(Entity entity, double x, double y, double z) + { + entity.lastTickPosX = entity.prevPosX = entity.posX = x; + entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset; + entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z; + entity.setPosition(x, y, z); + } + + + @Override public boolean func_85188_a(Entity par1Entity) { diff --git a/StevenDimDoors/mod_pocketDimClient/ClientProxy.java b/StevenDimDoors/mod_pocketDimClient/ClientProxy.java index 58260f8..d74c639 100644 --- a/StevenDimDoors/mod_pocketDimClient/ClientProxy.java +++ b/StevenDimDoors/mod_pocketDimClient/ClientProxy.java @@ -19,6 +19,7 @@ public class ClientProxy extends CommonProxy MinecraftForgeClient.preloadTexture(RIFT_PNG); MinecraftForgeClient.preloadTexture(RIFT2_PNG); + } @@ -43,6 +44,7 @@ public class ClientProxy extends CommonProxy mod_pocketDim.blockDimWallPerm.blockIndexInTexture=0; mod_pocketDim.blockRift.blockIndexInTexture=200; mod_pocketDim.dimDoor.blockIndexInTexture=18; + // mod_pocketDim.dimRail.blockIndexInTexture=13; mod_pocketDim.ExitDoor.blockIndexInTexture=19; mod_pocketDim.chaosDoor.blockIndexInTexture=30; mod_pocketDim.transientDoor.blockIndexInTexture=200; diff --git a/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java b/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java new file mode 100644 index 0000000..af2d625 --- /dev/null +++ b/StevenDimDoors/mod_pocketDimClient/RenderDimRail.java @@ -0,0 +1,274 @@ +package StevenDimDoors.mod_pocketDimClient; + +import java.nio.FloatBuffer; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + +import StevenDimDoors.mod_pocketDim.TileEntityDimDoor; +import StevenDimDoors.mod_pocketDim.dimDoor; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderDimRail extends TileEntitySpecialRenderer +{ + FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16); + + /** + * Renders the dimdoor. + */ + public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, double y, double z, float par8) + { + try + { + dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord); + + } + catch(Exception e) + { + e.printStackTrace(); + } + + + float playerX = (float)this.tileEntityRenderer.playerX; + float playerY = (float)this.tileEntityRenderer.playerY; + float playerZ = (float)this.tileEntityRenderer.playerZ; + + float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ); + GL11.glDisable(GL11.GL_LIGHTING); + Random rand = new Random(31100L); + float var13 = 0.75F; + + for (int count = 0; count < 16; ++count) + { + GL11.glPushMatrix(); + float var15 = (float)(16 - count); + float var16 = 0.2625F; + float var17 = 1.0F / (var15 + 1.0F); + + if (count == 0) + { + this.bindTextureByName("/RIFT.png"); + var17 = 0.1F; + var15 = 25.0F; + var16 = 0.125F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + if (count == 1) + { + this.bindTextureByName("/WARP.png"); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + var16 = .5F; + } + + float startY = (float)(+(y + (double)var13)); + float ratioY = startY + ActiveRenderInfo.objectY; + float ratioY2 = startY + var15 + ActiveRenderInfo.objectY; + float yConverted = ratioY / ratioY2; + + float startZ = (float)(+(z + (double)var13)); + float ratioZ = startZ + ActiveRenderInfo.objectZ; + float ratioZ2 = startZ + var15 + ActiveRenderInfo.objectZ; + float zConverted = ratioZ / ratioZ2; + + float startX = (float)(+(x + (double)var13)); + float ratioX = startX + ActiveRenderInfo.objectX; + float ratioX2 = startX + var15 + ActiveRenderInfo.objectX; + float xConverted = ratioX / ratioX2; + + + + + yConverted += (float)(y + (double)var13); + xConverted += (float)(x + (double)var13); + zConverted += (float)(z + (double)var13); + + GL11.glTranslatef( (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F,0, 0.0F); + GL11.glTranslatef(0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F, 0.0F); + + GL11.glTranslatef(0,0, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F); + + GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + switch ((tile.orientation%4)+4) + { + case 4: + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + + break; + case 5: + + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + break; + case 6: + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + + break; + case 7: + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F)); + break; + + + + } + + + GL11.glEnable(GL11.GL_TEXTURE_GEN_S); + GL11.glEnable(GL11.GL_TEXTURE_GEN_T); + GL11.glEnable(GL11.GL_TEXTURE_GEN_R); + GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 200000L) / 200000.0F*var15, 0.0F); + GL11.glScalef(var16, var16, var16); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + GL11.glRotatef((float)(count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + + Tessellator var24 = Tessellator.instance; + var24.startDrawingQuads(); + + + + float var21 = rand.nextFloat() * 0.5F + 0.1F; + float var22 = rand.nextFloat() * 0.4F + 0.4F; + float var23 = rand.nextFloat() * 0.6F + 0.5F; + + if (count == 0) + { + var23 = 1.0F; + var22 = 1.0F; + yConverted = 1.0F; + } + var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F); + if(tile.openOrClosed) + { + + switch (tile.orientation) + { + case 0: + + var24.addVertex(x+.01F, y-1 , z); + var24.addVertex(x+.01, y-1, z+1.0D); + var24.addVertex(x+.01 , y+1 , z + 1.0D); + var24.addVertex(x+.01 , y+1 , z); + break; + case 1: + var24.addVertex(x , y+1 , z+.01); + var24.addVertex(x+1 , y+1 , z+.01); + var24.addVertex(x+1, y-1, z+.01); + var24.addVertex(x, y-1, z+.01); + + + + break; + case 2: // + var24.addVertex(x+.99 , y+1 , z); + var24.addVertex(x+.99 , y+1 , z + 1.0D); + var24.addVertex(x+.99, y-1, z+1.0D); + var24.addVertex(x+.99, y-1, z); + break; + case 3: + var24.addVertex(x, y-1, z+.99); + var24.addVertex(x+1, y-1, z+.99); + var24.addVertex(x+1 , y+1 , z+.99); + var24.addVertex(x , y+1 , z+.99); + break; + case 4:// + // GL11.glTranslatef(); + + var24.addVertex(x+.15F, y-1 , z); + var24.addVertex(x+.15, y-1, z+1.0D); + var24.addVertex(x+.15 , y+1 , z + 1.0D); + var24.addVertex(x+.15 , y+1 , z); + break; + case 5: + var24.addVertex(x , y+1 , z+.15); + var24.addVertex(x+1 , y+1 , z+.15); + var24.addVertex(x+1, y-1, z+.15); + var24.addVertex(x, y-1, z+.15); + + + + break; + case 6: // + var24.addVertex(x+.85 , y+1 , z); + var24.addVertex(x+.85 , y+1 , z + 1.0D); + var24.addVertex(x+.85, y-1, z+1.0D); + var24.addVertex(x+.85, y-1, z); + break; + case 7: + var24.addVertex(x, y-1, z+.85); + var24.addVertex(x+1, y-1, z+.85); + var24.addVertex(x+1 , y+1 , z+.85); + var24.addVertex(x , y+1 , z+.85); + break; + default: + break; + } + } + + + + + + + var24.draw(); + + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_GEN_S); + GL11.glDisable(GL11.GL_TEXTURE_GEN_T); + GL11.glDisable(GL11.GL_TEXTURE_GEN_R); + GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); + GL11.glEnable(GL11.GL_LIGHTING); + } + + private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) + { + this.field_76908_a.clear(); + this.field_76908_a.put(par1).put(par2).put(par3).put(par4); + this.field_76908_a.flip(); + return this.field_76908_a; + } + + public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) + { + if(mod_pocketDim.enableDoorOpenGL) + { + this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8); + } + } +}