rift blade creates rifts, doors can teleport carts and items

Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
StevenRS11
2013-03-09 23:04:20 -05:00
parent c926e71021
commit ddc7bf0f64
16 changed files with 958 additions and 132 deletions

View File

@@ -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) {} public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
/** /**

View File

@@ -73,11 +73,6 @@ public class ChaosDoor extends dimDoor
int num = par1World.getBlockMetadata(par2, par3-1, par4); 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) 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); this.onPoweredBlockChange(par1World, par2, par3, par4, false);
@@ -102,7 +97,7 @@ public class ChaosDoor extends dimDoor
{ {
foundRandomDest=true; 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) if(dimHelper.getWorld(link.locDimID)!=null)
{ {
@@ -116,6 +111,6 @@ public class ChaosDoor extends dimDoor
} }
} }
} }
}
} }

View File

@@ -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 var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
int num = par1World.getBlockMetadata(par2, par3-1, par4); 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); //int destinationID= dimHelper.instance.getDestIDFromCoords(par2, par3, par4, par1World);
this.onPoweredBlockChange(par1World, par2, par3, par4, false); this.onPoweredBlockChange(par1World, par2, par3, par4, false);
@@ -117,11 +113,11 @@ public class ExitDoor extends dimDoor
if(linkData!=null) if(linkData!=null)
{ {
if(dimHelper.dimList.containsKey(linkData.destDimID)) if(dimHelper.dimList.containsKey(linkData.destDimID))
dimHelper.instance.teleportToPocket(par1World, linkData, player); dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
} }
}
} }
} }

View File

@@ -10,6 +10,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -23,6 +24,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemRiftBlade extends itemDimDoor public class ItemRiftBlade extends itemDimDoor
{ {
private int weaponDamage;
private final EnumToolMaterial toolMaterial= EnumToolMaterial.GOLD;
private Material doorMaterial; private Material doorMaterial;
Random rand = new Random(); Random rand = new Random();
public ItemRiftBlade(int par1, Material par2Material) public ItemRiftBlade(int par1, Material par2Material)
@@ -31,6 +34,7 @@ public class ItemRiftBlade extends itemDimDoor
this.setMaxStackSize(1); this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png"); // this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport); this.setCreativeTab(CreativeTabs.tabTransport);
this.weaponDamage =8;
// this.iconIndex=5; // this.iconIndex=5;
@@ -55,7 +59,7 @@ public class ItemRiftBlade extends itemDimDoor
} }
public int getDamageVsEntity(Entity par1Entity) public int getDamageVsEntity(Entity par1Entity)
{ {
return 6; return 8;
} }
@@ -119,10 +123,95 @@ public class ItemRiftBlade extends itemDimDoor
return true; 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) public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{ {
Boolean didFindThing=false;
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false ); MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null) if(hit!=null)
{ {
@@ -153,6 +242,7 @@ public class ItemRiftBlade extends itemDimDoor
{ {
placeDoorBlock(par2World, par4, par5, par6, var12, var11); placeDoorBlock(par2World, par4, par5, par6, var12, var11);
didFindThing=true;
par1ItemStack.damageItem(10, par3EntityPlayer); 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) if(!par3EntityPlayer.worldObj.isRemote)
{ {
List<EntityLiving> 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<EntityLiving> 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); list.remove(par3EntityPlayer);
for(EntityLiving ent : list) for(EntityLiving ent : list)
{ {
Vec3 var3 = par3EntityPlayer.getLook(1.0F).normalize(); 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); 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(); double var5 = var4.lengthVector();
var4 = var4.normalize(); var4 = var4.normalize();
@@ -183,15 +279,26 @@ public class ItemRiftBlade extends itemDimDoor
{ {
System.out.println(list.size()); System.out.println(list.size());
ItemRiftBlade.class.cast(par1ItemStack.getItem()).teleportToEntity(par1ItemStack,ent, par3EntityPlayer); ItemRiftBlade.class.cast(par1ItemStack.getItem()).teleportToEntity(par1ItemStack,ent, par3EntityPlayer);
didFindThing=true;
break; break;
//ItemRiftBlade.class.cast(item.getItem()).teleportTo(event.entityPlayer, ent.posX, ent.posY, ent.posZ); //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 @Override
@@ -203,7 +310,10 @@ public class ItemRiftBlade extends itemDimDoor
{ {
return EnumToolMaterial.GOLD.getEnchantability(); return EnumToolMaterial.GOLD.getEnchantability();
} }
public String func_77825_f()
{
return EnumToolMaterial.GOLD.toString();
}
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{ {
return true; return true;
@@ -228,6 +338,8 @@ public class ItemRiftBlade extends itemDimDoor
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par3World.isRemote) if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par3World.isRemote)
{ {
int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;

View File

@@ -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) 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)); System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6));
return true; 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");

View File

@@ -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)
{
}
}

View File

@@ -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);
}
}

View File

@@ -48,14 +48,9 @@ public class TransientDoor extends ExitDoor
int num = par1World.getBlockMetadata(par2, par3, par4); int num = par1World.getBlockMetadata(par2, par3, par4);
// System.out.println("metadata "+num+" orientation "+var12); // 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)) if(dimHelper.dimList.containsKey(linkData.destDimID))
{ {
dimHelper.instance.teleportToPocket(par1World, linkData, player); dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
par1World.setBlockWithNotify(par2, par3, par4, 0); par1World.setBlockWithNotify(par2, par3, par4, 0);
} }
} }
@@ -76,7 +71,7 @@ public class TransientDoor extends ExitDoor
{ {
if(dimHelper.dimList.containsKey(linkData.destDimID)) if(dimHelper.dimList.containsKey(linkData.destDimID))
{ {
dimHelper.instance.teleportToPocket(par1World, linkData, player); dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
par1World.setBlockWithNotify(par2, par3, par4, 0); 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) public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5)
{ {

View File

@@ -30,6 +30,7 @@ public class dimDoor extends BlockContainer
} }
@Override @Override
public String getTextureFile() 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 var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
int num = par1World.getBlockMetadata(par2, par3-1, par4); int num=0;
if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.dimDoorID) 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);
}
if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12)
{
player= (EntityPlayer) par5Entity;
//int destinationID= dimHelper.instance.getDestIDFromCoords(par2, par3, par4, par1World); //int destinationID= dimHelper.instance.getDestIDFromCoords(par2, par3, par4, par1World);
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
this.onPoweredBlockChange(par1World, par2, par3, par4, false); this.onPoweredBlockChange(par1World, par2, par3, par4, false);
LinkData linkData= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World);
dimHelper.instance.teleportToPocket(par1World, linkData, player); }
else if (!(par5Entity instanceof EntityPlayer)&&num>3)
{
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
} dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
} }
} }
} }
@@ -458,11 +476,11 @@ public class dimDoor extends BlockContainer
{ {
if (!var5) 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 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 else
@@ -476,11 +494,11 @@ public class dimDoor extends BlockContainer
{ {
if (!var5) 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 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 else
@@ -494,11 +512,11 @@ public class dimDoor extends BlockContainer
{ {
if (!var5) 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 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 else
@@ -512,11 +530,11 @@ public class dimDoor extends BlockContainer
{ {
if (!var5) 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 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 else
@@ -634,7 +652,7 @@ public class dimDoor extends BlockContainer
*/ */
public int getMobilityFlag() public int getMobilityFlag()
{ {
return 1; return 2;
} }
/** /**

View File

@@ -45,19 +45,16 @@ public class dimHatch extends BlockTrapDoor
if(!par1World.isRemote&&(num>3&&num<8||num>11)&&par1World.provider instanceof pocketProvider) 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); this.onPoweredBlockChange(par1World, par2, par3, par4, false);
DimData dimData = (DimData) dimHelper.instance.dimList.get(par1World.provider.dimensionId); DimData dimData = (DimData) dimHelper.instance.dimList.get(par1World.provider.dimensionId);
LinkData exitLink=dimData.exitDimLink; LinkData exitLink=dimData.exitDimLink;
dimHelper.instance.teleportToPocket(par1World, exitLink, playerMP); dimHelper.instance.teleportToPocket(par1World, exitLink, par5Entity);
}
} }
} }

View File

@@ -16,11 +16,21 @@ import java.util.Random;
import java.util.Set; import java.util.Set;
import net.minecraft.block.Block; 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.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; 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.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.Teleporter;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk; 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)); 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. * 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. * 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 * @param orientation- the orientation of the door used to teleport, determines player orientation and door placement on arrival
* @Return * @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 y=linkData.destYCoord;
int z=linkData.destZCoord; 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); 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
{
playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, destinationID, new pocketTeleporter((WorldServer) world, linkData));
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F);
int playerXCoord=MathHelper.floor_double(player.posX); this.teleportEntity(world, entity, linkData);
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)) entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.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);
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"); //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. * Creates a link at the location, pointing to the destination. Does NOT create a pair, so must be called twice.
* @param locationDimID * @param locationDimID

View File

@@ -53,7 +53,7 @@ import cpw.mods.fml.relauncher.Side;
public class mod_pocketDim 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 //need to clean up
@SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy") @SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
@@ -71,6 +71,7 @@ public class mod_pocketDim
public static int blockRiftID; public static int blockRiftID;
public static int transientDoorID; public static int transientDoorID;
public static int itemRiftBladeID; public static int itemRiftBladeID;
// public static int railRenderID;
public static int itemStableFabricID; public static int itemStableFabricID;
public static int itemExitDoorID; public static int itemExitDoorID;
@@ -80,6 +81,8 @@ public class mod_pocketDim
public static int chaosDoorID; public static int chaosDoorID;
public static int blockLimboID; public static int blockLimboID;
public static int dimHatchID; public static int dimHatchID;
// public static int dimRailID;
public static int riftSpreadFactor; public static int riftSpreadFactor;
public static int DoorRenderID=55; public static int DoorRenderID=55;
public static int HOW_MUCH_TNT; public static int HOW_MUCH_TNT;
@@ -98,6 +101,8 @@ public class mod_pocketDim
public static Block blockRift; public static Block blockRift;
public static Block blockLimbo; public static Block blockLimbo;
public static Block dimDoor; public static Block dimDoor;
// public static Block dimRail;
public static Block blockDimWall; public static Block blockDimWall;
public static Block dimHatch; public static Block dimHatch;
public static Block blockDimWallPerm; public static Block blockDimWallPerm;
@@ -165,6 +170,8 @@ public class mod_pocketDim
public static boolean enableRiftBlade; public static boolean enableRiftBlade;
// public static boolean enableDimRail;
public static boolean enableDimTrapDoor; public static boolean enableDimTrapDoor;
public static boolean enableDoorOpenGL; public static boolean enableDoorOpenGL;
@@ -210,6 +217,7 @@ public class mod_pocketDim
config.load(); 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.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.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); this.enableRiftBlade = config.get("BOOLEAN", "true to enable rift blade crafting", true).getBoolean(true);
@@ -219,9 +227,11 @@ public class mod_pocketDim
this.enableWoodenDimDoor = config.get("BOOLEAN", "true to enable wooden 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); 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(); chaosDoorID = config.getBlock("Chaos Door", 1978).getInt();
dimDoorID = config.getBlock("Dimensional Door", 1970).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(); linkDimDoorID= config.getBlock("Dimensional Door Link", 1972).getInt();
blockDimWallID=config.getBlock("Fabric of Reality", 1973).getInt(); blockDimWallID=config.getBlock("Fabric of Reality", 1973).getInt();
ExitDoorID = config.getBlock("Warp Door", 1975).getInt(); ExitDoorID = config.getBlock("Warp Door", 1975).getInt();
@@ -230,7 +240,6 @@ public class mod_pocketDim
transientDoorID = config.getBlock("transientDoorID", 1979).getInt(); transientDoorID = config.getBlock("transientDoorID", 1979).getInt();
itemRiftBladeID=config.getItem("Rift Blade", 5676).getInt(); itemRiftBladeID=config.getItem("Rift Blade", 5676).getInt();
itemChaosDoorID=config.getItem("Chaos Door", 5673).getInt(); itemChaosDoorID=config.getItem("Chaos Door", 5673).getInt();
itemRiftRemoverID=config.getItem("Rift Remover", 5671).getInt(); itemRiftRemoverID=config.getItem("Rift Remover", 5671).getInt();
itemStableFabricID=config.getItem("Stable Fabric", 5672).getInt(); itemStableFabricID=config.getItem("Stable Fabric", 5672).getInt();
@@ -277,6 +286,7 @@ public class mod_pocketDim
chaosDoor = (new ChaosDoor(chaosDoorID, Material.iron).setHardness(.2F).setBlockName("chaosDoor").setLightValue(.0F).setRequiresSelfNotify()); 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"); 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"); 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"); itemDimDoor = (new itemDimDoor(itemDimDoorID, Material.iron)).setItemName("itemDimDoor");
itemExitDoor = (new itemExitDoor(itemExitDoorID, Material.wood)).setItemName("itemDimDoorexit"); itemExitDoor = (new itemExitDoor(itemExitDoorID, Material.wood)).setItemName("itemDimDoorexit");
@@ -291,6 +301,7 @@ public class mod_pocketDim
proxy.registerRenderers(); proxy.registerRenderers();
GameRegistry.registerWorldGenerator(this.riftGen); GameRegistry.registerWorldGenerator(this.riftGen);
//GameRegistry.registerBlock(dimRail, "Dimensional Rail");
GameRegistry.registerBlock(chaosDoor, "Unstable Door"); GameRegistry.registerBlock(chaosDoor, "Unstable Door");
GameRegistry.registerBlock(ExitDoor, "Warp Door"); GameRegistry.registerBlock(ExitDoor, "Warp Door");
GameRegistry.registerBlock(linkExitDoor, "Warp Door link"); GameRegistry.registerBlock(linkExitDoor, "Warp Door link");
@@ -329,7 +340,7 @@ public class mod_pocketDim
LanguageRegistry.addName(itemExitDoor , "Warp Door"); LanguageRegistry.addName(itemExitDoor , "Warp Door");
LanguageRegistry.addName(itemLinkSignature , "Rift Signature"); LanguageRegistry.addName(itemLinkSignature , "Rift Signature");
LanguageRegistry.addName(itemRiftRemover , "Rift Remover"); LanguageRegistry.addName(itemRiftRemover , "Rift Remover");
LanguageRegistry.addName(itemStableFabric , "Unstable Fabric"); LanguageRegistry.addName(itemStableFabric , "Stable Fabric");
LanguageRegistry.addName(itemChaosDoor , "Unstable Door"); LanguageRegistry.addName(itemChaosDoor , "Unstable Door");
LanguageRegistry.addName(itemDimDoor, "Dimensional Door"); LanguageRegistry.addName(itemDimDoor, "Dimensional Door");
LanguageRegistry.addName(itemRiftBlade , "Rift Blade"); LanguageRegistry.addName(itemRiftBlade , "Rift Blade");
@@ -338,6 +349,8 @@ public class mod_pocketDim
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT); TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER); TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
// GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimRail");
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor"); GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
@@ -354,6 +367,21 @@ public class mod_pocketDim
}); });
} }
/**
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) if(this.enableUnstableDoor)
{ {
GameRegistry.addRecipe(new ItemStack(itemChaosDoor, 1), new Object[] GameRegistry.addRecipe(new ItemStack(itemChaosDoor, 1), new Object[]

View File

@@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim; package StevenDimDoors.mod_pocketDim;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.Teleporter; import net.minecraft.world.Teleporter;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -31,22 +32,24 @@ public class pocketTeleporter extends Teleporter
* Create a new portal near an entity. * Create a new portal near an entity.
*/ */
@Override @Override
public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
{ {
EntityPlayer player = (EntityPlayer) par1Entity; 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("Teleporting with link oreintation "+id);
// System.out.println(id);
player.rotationYaw=(id*90)+90; player.rotationYaw=(id*90)+90;
if(id==2||id==6) if(id==2||id==6)
{ {
player.setPositionAndUpdate( x+1.5, y-1, z+.5 ); 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 @Override
public boolean func_85188_a(Entity par1Entity) public boolean func_85188_a(Entity par1Entity)
{ {

View File

@@ -21,6 +21,7 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.preloadTexture(RIFT2_PNG); MinecraftForgeClient.preloadTexture(RIFT2_PNG);
} }
@@ -43,6 +44,7 @@ public class ClientProxy extends CommonProxy
mod_pocketDim.blockDimWallPerm.blockIndexInTexture=0; mod_pocketDim.blockDimWallPerm.blockIndexInTexture=0;
mod_pocketDim.blockRift.blockIndexInTexture=200; mod_pocketDim.blockRift.blockIndexInTexture=200;
mod_pocketDim.dimDoor.blockIndexInTexture=18; mod_pocketDim.dimDoor.blockIndexInTexture=18;
// mod_pocketDim.dimRail.blockIndexInTexture=13;
mod_pocketDim.ExitDoor.blockIndexInTexture=19; mod_pocketDim.ExitDoor.blockIndexInTexture=19;
mod_pocketDim.chaosDoor.blockIndexInTexture=30; mod_pocketDim.chaosDoor.blockIndexInTexture=30;
mod_pocketDim.transientDoor.blockIndexInTexture=200; mod_pocketDim.transientDoor.blockIndexInTexture=200;

View File

@@ -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);
}
}
}