Rewrite #79
@@ -1,11 +1,7 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
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.world.Teleporter;
|
import net.minecraft.world.Teleporter;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
|
|
||||||
public class BlankTeleporter extends Teleporter
|
public class BlankTeleporter extends Teleporter
|
||||||
|
|||||||
@@ -78,10 +78,11 @@ public class TransientDoor extends ExitDoor
|
|||||||
IDimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
|
IDimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
|
||||||
if (link != null)
|
if (link != null)
|
||||||
{
|
{
|
||||||
//Turn the transient door into a rift before teleporting the entity
|
DDTeleporter.traverseDimDoor(world, link, entity);
|
||||||
|
//Turn the transient door into a rift AFTER teleporting the entity.
|
||||||
|
//The door's orientation may be needed for generating a room at the link's destination.
|
||||||
world.setBlock(x, y, z, properties.RiftBlockID);
|
world.setBlock(x, y, z, properties.RiftBlockID);
|
||||||
world.setBlockToAir(x, y - 1, z);
|
world.setBlockToAir(x, y - 1, z);
|
||||||
PocketManager.traverseDimDoor(world, link, entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,18 @@ import net.minecraft.client.renderer.texture.IconRegister;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
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.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDTeleporter;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.IDimLink;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
|
|
||||||
public class BlockDimWallPerm extends Block
|
public class BlockDimWallPerm extends Block
|
||||||
{
|
{
|
||||||
|
private static final Random random = new Random();
|
||||||
private static DDProperties properties = null;
|
private static DDProperties properties = null;
|
||||||
|
|
||||||
public BlockDimWallPerm(int i, int j, Material par2Material)
|
public BlockDimWallPerm(int i, int j, Material par2Material)
|
||||||
@@ -43,83 +45,50 @@ public class BlockDimWallPerm extends Block
|
|||||||
/**
|
/**
|
||||||
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
|
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
|
||||||
*/
|
*/
|
||||||
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity entity)
|
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
|
||||||
{
|
{
|
||||||
if (!par1World.isRemote && par1World.provider.dimensionId == properties.LimboDimensionID)
|
if (!world.isRemote && world.provider.dimensionId == properties.LimboDimensionID)
|
||||||
{
|
{
|
||||||
Random rand = new Random();
|
|
||||||
|
|
||||||
IDimLink link = PocketManager.getRandomLinkData(false);
|
|
||||||
if (link == null)
|
|
||||||
{
|
|
||||||
link =new NewLinkData(0,0,0,0);
|
|
||||||
}
|
|
||||||
link.destDimID = 0;
|
|
||||||
link.locDimID = par1World.provider.dimensionId;
|
|
||||||
World overworld = DimensionManager.getWorld(0);
|
World overworld = DimensionManager.getWorld(0);
|
||||||
|
|
||||||
if (overworld == null)
|
|
||||||
{
|
|
||||||
DimensionManager.initDimension(0);
|
|
||||||
overworld = DimensionManager.getWorld(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (overworld != null && entity instanceof EntityPlayerMP)
|
if (overworld != null && entity instanceof EntityPlayerMP)
|
||||||
{
|
{
|
||||||
EntityPlayer player = (EntityPlayer) entity;
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
player.fallDistance = 0;
|
player.fallDistance = 0;
|
||||||
int x = (link.destXCoord + rand.nextInt(properties.LimboReturnRange) - properties.LimboReturnRange/2);
|
int rangeLimit = properties.LimboReturnRange / 2;
|
||||||
int z = (link.destZCoord + rand.nextInt(properties.LimboReturnRange) - properties.LimboReturnRange/2);
|
int destinationX = x + MathHelper.getRandomIntegerInRange(random, -rangeLimit, rangeLimit);
|
||||||
|
int destinationZ = z + MathHelper.getRandomIntegerInRange(random, -rangeLimit, rangeLimit);
|
||||||
|
|
||||||
//make sure I am in the middle of a chunk, and not on a boundary, so it doesn't load the chunk next to me
|
//make sure I am in the middle of a chunk, and not on a boundary, so it doesn't load the chunk next to me
|
||||||
x = x + (x >> 4);
|
destinationX = destinationX + (destinationX >> 4);
|
||||||
z = z + (z >> 4);
|
destinationZ = destinationZ + (destinationZ >> 4);
|
||||||
|
|
||||||
int y = yCoordHelper.getFirstUncovered(0, x, 63, z, true);
|
int destinationY = yCoordHelper.getFirstUncovered(overworld, destinationX, 63, destinationZ, true);
|
||||||
|
|
||||||
player.setPositionAndUpdate( x, y, z );
|
//FIXME: Shouldn't we make the player's destination safe BEFORE teleporting him?!
|
||||||
//this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk
|
//player.setPositionAndUpdate( x, y, z );
|
||||||
link.destXCoord = x;
|
Point4D destination = new Point4D(destinationX, destinationY, destinationZ, 0);
|
||||||
link.destYCoord = y;
|
DDTeleporter.teleport(player, destination);
|
||||||
link.destZCoord = z;
|
|
||||||
PocketManager.teleportEntity(par1World, player, link);
|
|
||||||
|
|
||||||
player.setPositionAndUpdate( x, y, z );
|
//player.setPositionAndUpdate( x, y, z );
|
||||||
|
|
||||||
// Make absolutely sure the player doesn't spawn inside blocks, though to be honest this shouldn't ever have to be a problem...
|
// Make absolutely sure the player doesn't spawn inside blocks, though to be honest this shouldn't ever have to be a problem...
|
||||||
overworld.setBlockToAir(x, y, z);
|
overworld.setBlockToAir(destinationX, destinationY, destinationZ);
|
||||||
overworld.setBlockToAir(x, y + 1, z);
|
overworld.setBlockToAir(destinationX, destinationY + 1, destinationZ);
|
||||||
|
|
||||||
int i=x;
|
|
||||||
int j=y;
|
|
||||||
int k=z;
|
|
||||||
|
|
||||||
for (int xc = -3; xc < 4; xc++)
|
for (int xc = -3; xc < 4; xc++)
|
||||||
{
|
{
|
||||||
for (int zc = -3; zc < 4; zc++)
|
for (int zc = -3; zc < 4; zc++)
|
||||||
{
|
{
|
||||||
for(int yc=0;yc<200;yc++)
|
if (Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 2 ||
|
||||||
|
Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 3)
|
||||||
{
|
{
|
||||||
if (yc==0)
|
overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, properties.LimboBlockID);
|
||||||
{
|
|
||||||
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
|
|
||||||
{
|
|
||||||
overworld.setBlock(i+xc, j-1+yc, k+zc, properties.LimboBlockID);
|
|
||||||
}
|
}
|
||||||
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
|
|
||||||
|
|
||||||
{
|
|
||||||
overworld.setBlock(i+xc, j-1+yc, k+zc, properties.LimboBlockID,2,0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: Why do we do this repeatedly? We also set the fall distance at the start...
|
//FIXME: Why do we do this repeatedly? We also set the fall distance at the start...
|
||||||
player.setPositionAndUpdate( x, y, z );
|
player.setPositionAndUpdate( destinationX, destinationY, destinationZ );
|
||||||
player.fallDistance = 0;
|
player.fallDistance = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDTeleporter;
|
||||||
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.IDimLink;
|
import StevenDimDoors.mod_pocketDim.core.IDimLink;
|
||||||
@@ -61,7 +62,7 @@ public class dimDoor extends BlockContainer
|
|||||||
IDimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
|
IDimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId);
|
||||||
if (link != null)
|
if (link != null)
|
||||||
{
|
{
|
||||||
PocketManager.traverseDimDoor(world, link, entity);
|
DDTeleporter.traverseDimDoor(world, link, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,8 +313,6 @@ public class PocketManager
|
|||||||
NewDimData locationDimData;
|
NewDimData locationDimData;
|
||||||
NewDimData destDimData;
|
NewDimData destDimData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(PocketManager.dimList.containsKey(link.locDimID)&&!DimensionManager.getWorld(link.locDimID).isRemote) //checks to see if dim is already registered. If not, it creates a DimData entry for it later
|
if(PocketManager.dimList.containsKey(link.locDimID)&&!DimensionManager.getWorld(link.locDimID).isRemote) //checks to see if dim is already registered. If not, it creates a DimData entry for it later
|
||||||
{
|
{
|
||||||
//randomizes exit if deep enough
|
//randomizes exit if deep enough
|
||||||
@@ -387,7 +385,7 @@ public class PocketManager
|
|||||||
if (DimensionManager.getCurrentSaveRootDirectory() != null)
|
if (DimensionManager.getCurrentSaveRootDirectory() != null)
|
||||||
{
|
{
|
||||||
isSaving = true;
|
isSaving = true;
|
||||||
HashMap comboSave = new HashMap();
|
HashMap<String, Object> comboSave = new HashMap<String, Object>();
|
||||||
comboSave.put("dimensionData", dimensionData);
|
comboSave.put("dimensionData", dimensionData);
|
||||||
comboSave.put("keyLinkMapping", keyLinkMapping);
|
comboSave.put("keyLinkMapping", keyLinkMapping);
|
||||||
|
|
||||||
@@ -423,7 +421,7 @@ public class PocketManager
|
|||||||
* loads the dim data from the saved hashMap. Also handles compatibility with old saves, see OldSaveHandler
|
* loads the dim data from the saved hashMap. Also handles compatibility with old saves, see OldSaveHandler
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings("unchecked")
|
||||||
public static void load()
|
public static void load()
|
||||||
{
|
{
|
||||||
//FIXME: There are a lot of things to fix here... First, we shouldn't be created so many File instances
|
//FIXME: There are a lot of things to fix here... First, we shouldn't be created so many File instances
|
||||||
@@ -449,7 +447,7 @@ public class PocketManager
|
|||||||
}
|
}
|
||||||
saveFile = new FileInputStream(dataStore);
|
saveFile = new FileInputStream(dataStore);
|
||||||
ObjectSaveInputStream save = new ObjectSaveInputStream(saveFile);
|
ObjectSaveInputStream save = new ObjectSaveInputStream(saveFile);
|
||||||
HashMap comboSave = ((HashMap) save.readObject());
|
HashMap<String, Object> comboSave = (HashMap<String, Object>) save.readObject();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -486,7 +484,7 @@ public class PocketManager
|
|||||||
|
|
||||||
saveFile = new FileInputStream(dataStore);
|
saveFile = new FileInputStream(dataStore);
|
||||||
ObjectSaveInputStream save = new ObjectSaveInputStream(saveFile);
|
ObjectSaveInputStream save = new ObjectSaveInputStream(saveFile);
|
||||||
HashMap comboSave =((HashMap)save.readObject());
|
HashMap<String, Object> comboSave = (HashMap<String, Object>) save.readObject();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public class DungeonHelper
|
|||||||
IDimLink link = dimension.createLink(x, y + 1, z).setLinkType(IDimLink.TYPE_POCKET);
|
IDimLink link = dimension.createLink(x, y + 1, z).setLinkType(IDimLink.TYPE_POCKET);
|
||||||
|
|
||||||
//Place a Warp Door linked to that pocket
|
//Place a Warp Door linked to that pocket
|
||||||
itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.ExitDoor);
|
itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.exitDoor);
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class yCoordHelper
|
|||||||
|
|
||||||
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
|
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
|
||||||
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
|
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
|
||||||
int height = MAXIMUM_UNCOVERED_Y; //world.getHeight();
|
int height = MAXIMUM_UNCOVERED_Y;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
if (!fromTop)
|
if (!fromTop)
|
||||||
|
|||||||
@@ -1,184 +1,19 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.items;
|
package StevenDimDoors.mod_pocketDim.items;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.SchematicLoader;
|
|
||||||
import StevenDimDoors.mod_pocketDim.Spells;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewLinkData;
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import net.minecraftforge.common.RotationHelper;
|
|
||||||
|
|
||||||
public class ItemStableFabric extends Item
|
public class ItemStableFabric extends Item
|
||||||
{
|
{
|
||||||
private Material doorMaterial;
|
public ItemStableFabric(int itemID, int par2)
|
||||||
|
|
||||||
public ItemStableFabric(int par1, int par2)
|
|
||||||
{
|
{
|
||||||
super(par1);
|
super(itemID);
|
||||||
// this.setitemIcon(Item.doorWood.getIconFromDamage(0));
|
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("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)
|
|
||||||
{
|
|
||||||
System.out.println("Block metadata is "+par3World.getBlockMetadata(par4, par5, par6));
|
|
||||||
System.out.println(par3World.getBiomeGenForCoords(par4, par6).biomeName);
|
|
||||||
|
|
||||||
|
|
||||||
this.onItemRightClick(par1ItemStack, par3World, par2EntityPlayer);
|
|
||||||
|
|
||||||
Block block = Block.blocksList[par3World.getBlockId(par4, par5, par6)];
|
|
||||||
|
|
||||||
if(PocketManager.dimList.containsKey(par3World.provider.dimensionId))
|
|
||||||
{
|
|
||||||
if(PocketManager.instance.getDimData(par3World.provider.dimensionId).isPocket)
|
|
||||||
{
|
|
||||||
if(PocketManager.instance.getDimData(par3World.provider.dimensionId).dungeonGenerator!=null)
|
|
||||||
{
|
|
||||||
System.out.println("Dungeon name "+PocketManager.instance.getDimData(par3World.provider.dimensionId).dungeonGenerator.schematicPath);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
//System.out.println("Block texture data is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getBlockTexture(par3World,par4, par5, par6,par7).getIconName());
|
|
||||||
//System.out.println("Block name is is "+Block.blocksList[par3World.getBlockId(par4, par5, par6)].getUnlocalizedName2());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
|
|
||||||
{
|
|
||||||
float var4 = 1.0F;
|
|
||||||
float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
|
|
||||||
float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
|
|
||||||
double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)var4;
|
|
||||||
double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par2EntityPlayer.yOffset;
|
|
||||||
double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)var4;
|
|
||||||
Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11);
|
|
||||||
float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI);
|
|
||||||
float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI);
|
|
||||||
float var16 = -MathHelper.cos(-var5 * 0.017453292F);
|
|
||||||
float var17 = MathHelper.sin(-var5 * 0.017453292F);
|
|
||||||
float var18 = var15 * var16;
|
|
||||||
float var20 = var14 * var16;
|
|
||||||
double var21 = 5.0D;
|
|
||||||
if (par2EntityPlayer instanceof EntityPlayerMP)
|
|
||||||
{
|
|
||||||
var21 = 4;
|
|
||||||
}
|
|
||||||
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
|
|
||||||
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
|
||||||
{
|
|
||||||
if (this.isSteven(par3EntityPlayer))
|
|
||||||
{
|
|
||||||
new Spells(par3EntityPlayer, par1ItemStack.stackSize).cast();
|
|
||||||
//mod_pocketDim.proxy.startCasting(par3EntityPlayer, par1ItemStack.stackSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean didFindThing=false;
|
|
||||||
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
|
|
||||||
if(hit!=null&&!par2World.isRemote)
|
|
||||||
{
|
|
||||||
//if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID)
|
|
||||||
{
|
|
||||||
NewLinkData link = PocketManager.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
|
|
||||||
if(link!=null)
|
|
||||||
{
|
|
||||||
Block var11;
|
|
||||||
if(par1ItemStack.getItem() instanceof itemExitDoor )
|
|
||||||
{
|
|
||||||
var11 = mod_pocketDim.ExitDoor;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(par1ItemStack.getItem() instanceof ItemChaosDoor )
|
|
||||||
{
|
|
||||||
var11 = mod_pocketDim.chaosDoor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var11 = mod_pocketDim.dimDoor;
|
|
||||||
}
|
|
||||||
|
|
||||||
int par4 = hit.blockX;
|
|
||||||
int par5 = hit.blockY-1;
|
|
||||||
int par6 = hit.blockZ;
|
|
||||||
int par7 = 0 ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (par3EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par3EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par2World.isRemote)
|
|
||||||
{
|
|
||||||
int var12 = MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
|
||||||
String cardinal= "default";
|
|
||||||
|
|
||||||
switch(link.linkOrientation)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
cardinal = "East";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
cardinal = "South";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
cardinal = "West";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
cardinal = "North";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
System.out.println("Link orientation is " + link.linkOrientation + " - " + cardinal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return par1ItemStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isSteven(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return (player.username.equalsIgnoreCase("stevenrs11"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewLinkData;
|
import StevenDimDoors.mod_pocketDim.core.IDimLink;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
|
|
||||||
public class itemDimDoor extends ItemDoor
|
public class itemDimDoor extends ItemDoor
|
||||||
@@ -61,23 +61,28 @@ public class itemDimDoor extends ItemDoor
|
|||||||
|
|
||||||
if(par1ItemStack.getItem() instanceof itemExitDoor)
|
if(par1ItemStack.getItem() instanceof itemExitDoor)
|
||||||
{
|
{
|
||||||
var11 = mod_pocketDim.ExitDoor;
|
var11 = mod_pocketDim.exitDoor;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (par1ItemStack.getItem() instanceof ItemChaosDoor)
|
else if (par1ItemStack.getItem() instanceof ItemChaosDoor)
|
||||||
{
|
{
|
||||||
var11 = mod_pocketDim.chaosDoor;
|
var11 = mod_pocketDim.unstableDoor;
|
||||||
|
}
|
||||||
|
else if (par1ItemStack.getItem() instanceof itemDimDoor)
|
||||||
|
{
|
||||||
|
var11 = mod_pocketDim.dimensionalDoor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var11 = mod_pocketDim.dimDoor;
|
//Do nothing
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
if (!canPlace(par3World, par4, par5, par6, var12) || !canPlace(par3World, par4, par5+1, par6, var12))
|
if (!canPlace(par3World, par4, par5, par6) || !canPlace(par3World, par4, par5+1, par6))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -131,78 +136,72 @@ public class itemDimDoor extends ItemDoor
|
|||||||
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
|
return par1World.rayTraceBlocks_do_do(var13, var23, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||||
{
|
{
|
||||||
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
|
if (world.isRemote)
|
||||||
if(hit!=null&&!par2World.isRemote)
|
|
||||||
{
|
{
|
||||||
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(player.worldObj, player, false );
|
||||||
|
if (hit != null)
|
||||||
{
|
{
|
||||||
NewLinkData link = PocketManager.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
|
if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
|
||||||
|
{
|
||||||
|
IDimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId);
|
||||||
if (link != null)
|
if (link != null)
|
||||||
{
|
{
|
||||||
Block var11;
|
Block block;
|
||||||
if(par1ItemStack.getItem() instanceof itemExitDoor )
|
if (stack.getItem() instanceof itemExitDoor)
|
||||||
{
|
{
|
||||||
var11 = mod_pocketDim.ExitDoor;
|
block = mod_pocketDim.exitDoor;
|
||||||
}
|
}
|
||||||
|
else if (stack.getItem() instanceof ItemChaosDoor)
|
||||||
else if(par1ItemStack.getItem() instanceof ItemChaosDoor )
|
|
||||||
{
|
{
|
||||||
var11 = mod_pocketDim.chaosDoor;
|
block = mod_pocketDim.unstableDoor;
|
||||||
|
}
|
||||||
|
else if (stack.getItem() instanceof itemDimDoor)
|
||||||
|
{
|
||||||
|
block = mod_pocketDim.dimensionalDoor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var11 = mod_pocketDim.dimDoor;
|
//Do nothing
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
int par4 = hit.blockX;
|
int x = hit.blockX;
|
||||||
int par5 = hit.blockY;
|
int y = hit.blockY;
|
||||||
int par6 = hit.blockZ;
|
int z = hit.blockZ;
|
||||||
int par7 = 0;
|
int par7 = 0;
|
||||||
|
|
||||||
|
if (player.canPlayerEdit(x, y, z, par7, stack) && player.canPlayerEdit(x, y - 1, z, par7, stack))
|
||||||
|
|
||||||
|
|
||||||
if (par3EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par3EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par2World.isRemote)
|
|
||||||
{
|
{
|
||||||
int var12 = MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
int orientation = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
||||||
|
|
||||||
if (!canPlace(par2World, par4, par5, par6, var12) || !canPlace(par2World, par4, par5-1, par6, var12) ||
|
if (!canPlace(world, x, y, z) || !canPlace(world, x, y - 1, z))
|
||||||
PocketManager.instance.getLinkDataFromCoords(par4, par5, par6, par2World) == null)
|
|
||||||
{
|
{
|
||||||
return par1ItemStack;
|
return stack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
placeDoorBlock(par2World, par4, par5-1, par6, var12, var11);
|
placeDoorBlock(world, x, y - 1, z, orientation, block);
|
||||||
|
if (!player.capabilities.isCreativeMode)
|
||||||
--par1ItemStack.stackSize;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return par1ItemStack;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canPlace(World world,int i, int j, int k, int p)
|
|
||||||
{
|
{
|
||||||
int id = world.getBlockId(i, j, k);
|
stack.stackSize--;
|
||||||
|
}
|
||||||
boolean flag = true;
|
}
|
||||||
if (id==properties.FabricBlockID || id==properties.RiftBlockID || id==properties.PermaFabricBlockID || id == 0)
|
}
|
||||||
{
|
}
|
||||||
return true;
|
}
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != 0 && !Block.blocksList[id].blockMaterial.isReplaceable())
|
private static boolean canPlace(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
flag = false;
|
int id = world.getBlockId(x, y, z);
|
||||||
}
|
|
||||||
return flag;
|
return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,10 +101,10 @@ public class mod_pocketDim
|
|||||||
public static mod_pocketDim instance = new mod_pocketDim();
|
public static mod_pocketDim instance = new mod_pocketDim();
|
||||||
|
|
||||||
public static Block transientDoor;
|
public static Block transientDoor;
|
||||||
public static Block ExitDoor;
|
public static Block exitDoor;
|
||||||
public static Block chaosDoor;
|
public static Block unstableDoor;
|
||||||
public static Block blockLimbo;
|
public static Block blockLimbo;
|
||||||
public static Block dimDoor;
|
public static Block dimensionalDoor;
|
||||||
public static Block blockDimWall;
|
public static Block blockDimWall;
|
||||||
public static Block dimHatch;
|
public static Block dimHatch;
|
||||||
public static Block blockDimWallPerm;
|
public static Block blockDimWallPerm;
|
||||||
@@ -184,11 +184,11 @@ public class mod_pocketDim
|
|||||||
|
|
||||||
blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
|
blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
|
||||||
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
|
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
|
||||||
ExitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
|
exitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
|
||||||
blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift"));
|
blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift"));
|
||||||
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
|
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
|
||||||
chaosDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
|
unstableDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
|
||||||
dimDoor = (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
|
dimensionalDoor = (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
|
||||||
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
|
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
|
||||||
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");
|
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");
|
||||||
|
|
||||||
@@ -206,11 +206,11 @@ public class mod_pocketDim
|
|||||||
|
|
||||||
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
|
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
|
||||||
|
|
||||||
GameRegistry.registerBlock(chaosDoor, "Unstable Door");
|
GameRegistry.registerBlock(unstableDoor, "Unstable Door");
|
||||||
GameRegistry.registerBlock(ExitDoor, "Warp Door");
|
GameRegistry.registerBlock(exitDoor, "Warp Door");
|
||||||
GameRegistry.registerBlock(blockRift, "Rift");
|
GameRegistry.registerBlock(blockRift, "Rift");
|
||||||
GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric");
|
GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric");
|
||||||
GameRegistry.registerBlock(dimDoor, "Dimensional Door");
|
GameRegistry.registerBlock(dimensionalDoor, "Dimensional Door");
|
||||||
GameRegistry.registerBlock(dimHatch,"Transdimensional Trapdoor");
|
GameRegistry.registerBlock(dimHatch,"Transdimensional Trapdoor");
|
||||||
GameRegistry.registerBlock(blockDimWallPerm, "Fabric of RealityPerm");
|
GameRegistry.registerBlock(blockDimWallPerm, "Fabric of RealityPerm");
|
||||||
GameRegistry.registerBlock(transientDoor, "transientDoor");
|
GameRegistry.registerBlock(transientDoor, "transientDoor");
|
||||||
@@ -226,11 +226,11 @@ public class mod_pocketDim
|
|||||||
LanguageRegistry.addName(transientDoor , "transientDoor");
|
LanguageRegistry.addName(transientDoor , "transientDoor");
|
||||||
LanguageRegistry.addName(blockRift , "Rift");
|
LanguageRegistry.addName(blockRift , "Rift");
|
||||||
LanguageRegistry.addName(blockLimbo , "Unraveled Fabric");
|
LanguageRegistry.addName(blockLimbo , "Unraveled Fabric");
|
||||||
LanguageRegistry.addName(ExitDoor , "Warp Door");
|
LanguageRegistry.addName(exitDoor , "Warp Door");
|
||||||
LanguageRegistry.addName(chaosDoor , "Unstable Door");
|
LanguageRegistry.addName(unstableDoor , "Unstable Door");
|
||||||
LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
|
LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
|
||||||
LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric");
|
LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric");
|
||||||
LanguageRegistry.addName(dimDoor, "Dimensional Door");
|
LanguageRegistry.addName(dimensionalDoor, "Dimensional Door");
|
||||||
LanguageRegistry.addName(dimHatch, "Transdimensional Trapdoor");
|
LanguageRegistry.addName(dimHatch, "Transdimensional Trapdoor");
|
||||||
|
|
||||||
LanguageRegistry.addName(itemExitDoor, "Warp Door");
|
LanguageRegistry.addName(itemExitDoor, "Warp Door");
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ public class BlockRotator
|
|||||||
hasOrientations[Block.railActivator.blockID] = true;
|
hasOrientations[Block.railActivator.blockID] = true;
|
||||||
hasOrientations[Block.rail.blockID] = true;
|
hasOrientations[Block.rail.blockID] = true;
|
||||||
|
|
||||||
hasOrientations[mod_pocketDim.dimDoor.blockID] = true;
|
hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true;
|
||||||
hasOrientations[mod_pocketDim.ExitDoor.blockID] = true;
|
hasOrientations[mod_pocketDim.exitDoor.blockID] = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import net.minecraft.util.DamageSource;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.core.NewLinkData;
|
import StevenDimDoors.mod_pocketDim.DDTeleporter;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
|
|
||||||
@@ -94,8 +94,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||||
|
|
||||||
this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png";
|
this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png";
|
||||||
|
|
||||||
|
|
||||||
super.onEntityUpdate();
|
super.onEntityUpdate();
|
||||||
|
|
||||||
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
|
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
|
||||||
@@ -103,9 +101,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 30);
|
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 30);
|
||||||
|
|
||||||
if (entityPlayer != null)
|
if (entityPlayer != null)
|
||||||
@@ -116,26 +111,18 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
this.soundTime=100;
|
this.soundTime=100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.faceEntity(entityPlayer, 1, 1);
|
this.faceEntity(entityPlayer, 1, 1);
|
||||||
|
|
||||||
if (shouldAttackPlayer(entityPlayer))
|
if (shouldAttackPlayer(entityPlayer))
|
||||||
{
|
{
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
if (aggro<470)
|
if (aggro<470)
|
||||||
{
|
{
|
||||||
if (rand.nextInt(11)>this.textureState||this.aggro>=300||rand.nextInt(13)>this.textureState&&this.aggroMax>this.aggro)
|
if (rand.nextInt(11)>this.textureState||this.aggro>=300||rand.nextInt(13)>this.textureState&&this.aggroMax>this.aggro)
|
||||||
{
|
{
|
||||||
aggro++;
|
aggro++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.worldObj.provider instanceof PocketProvider||this.worldObj.getClosestPlayerToEntity(this, 5)!=null)
|
if (this.worldObj.provider instanceof PocketProvider||this.worldObj.getClosestPlayerToEntity(this, 5)!=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
aggro++;
|
aggro++;
|
||||||
aggro++;
|
aggro++;
|
||||||
|
|
||||||
@@ -147,52 +134,34 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
}
|
}
|
||||||
if (aggro>430&&this.soundTime<100)
|
if (aggro>430&&this.soundTime<100)
|
||||||
{
|
{
|
||||||
//this.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.tearing",2, 1);
|
|
||||||
this.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ,"mods.DimDoors.sfx.tearing",2F, 1F);
|
this.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ,"mods.DimDoors.sfx.tearing",2F, 1F);
|
||||||
|
|
||||||
this.soundTime=100;
|
this.soundTime=100;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (aggro>445&&this.soundTime<200)
|
if (aggro>445&&this.soundTime<200)
|
||||||
{
|
{
|
||||||
//this.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.tearing",5, 1);
|
|
||||||
this.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ,"mods.DimDoors.sfx.tearing",5F, 1F);
|
this.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ,"mods.DimDoors.sfx.tearing",5F, 1F);
|
||||||
|
|
||||||
this.soundTime=200;
|
this.soundTime=200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!this.worldObj.isRemote && !entityPlayer.capabilities.isCreativeMode)
|
else if (!this.worldObj.isRemote && !entityPlayer.capabilities.isCreativeMode)
|
||||||
{
|
{
|
||||||
|
Point4D destination = new Point4D(
|
||||||
|
(int) this.posX + MathHelper.getRandomIntegerInRange(rand, -250, 250),
|
||||||
|
(int) this.posY + 500,
|
||||||
|
(int) this.posZ + MathHelper.getRandomIntegerInRange(rand, -250, 250),
|
||||||
|
properties.LimboDimensionID);
|
||||||
NewLinkData link = new NewLinkData(this.worldObj.provider.dimensionId, properties.LimboDimensionID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0);
|
DDTeleporter.teleport(worldObj, destination, entityPlayer);
|
||||||
|
|
||||||
PocketManager.instance.traverseDimDoor(worldObj, link, entityPlayer);
|
|
||||||
this.aggro = 0;
|
this.aggro = 0;
|
||||||
|
|
||||||
entityPlayer.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.crack",13, 1);
|
entityPlayer.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.crack",13, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!(this.worldObj.provider instanceof LimboProvider || this.worldObj.getClosestPlayerToEntity(this, 5) != null) || this.aggro > 300)
|
if (!(this.worldObj.provider instanceof LimboProvider || this.worldObj.getClosestPlayerToEntity(this, 5) != null) || this.aggro > 300)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < -1+this.textureState/2; ++i)
|
for (int i = 0; i < -1+this.textureState/2; ++i)
|
||||||
{
|
{
|
||||||
entityPlayer.worldObj.spawnParticle("portal", entityPlayer.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, entityPlayer.posY + this.rand.nextDouble() * (double)entityPlayer.height - 0.75D, entityPlayer.posZ + (this.rand.nextDouble() - 0.5D) * (double)entityPlayer.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
|
entityPlayer.worldObj.spawnParticle("portal", entityPlayer.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, entityPlayer.posY + this.rand.nextDouble() * (double)entityPlayer.height - 0.75D, entityPlayer.posZ + (this.rand.nextDouble() - 0.5D) * (double)entityPlayer.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -205,12 +174,9 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if(aggro>0)
|
if(aggro>0)
|
||||||
{
|
{
|
||||||
aggro--;
|
aggro--;
|
||||||
@@ -225,40 +191,19 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
{
|
{
|
||||||
soundTime--;
|
soundTime--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.textureState= (byte) (this.aggro/25);
|
this.textureState= (byte) (this.aggro/25);
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState));
|
this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer)
|
private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer)
|
||||||
{
|
{
|
||||||
return par1EntityPlayer.canEntityBeSeen(this);
|
return par1EntityPlayer.canEntityBeSeen(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
|
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
|
||||||
{
|
{
|
||||||
double d4 = (par1 - this.posX) / par7;
|
double d4 = (par1 - this.posX) / par7;
|
||||||
@@ -275,9 +220,9 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
|
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
|
||||||
{
|
{
|
||||||
if(!(par1DamageSource==DamageSource.inWall))
|
if(!(par1DamageSource==DamageSource.inWall))
|
||||||
@@ -286,6 +231,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void faceEntity(Entity par1Entity, float par2, float par3)
|
public void faceEntity(Entity par1Entity, float par2, float par3)
|
||||||
{
|
{
|
||||||
double d0 = par1Entity.posX - this.posX;
|
double d0 = par1Entity.posX - this.posX;
|
||||||
@@ -311,7 +257,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
this.rotationYaw = f2;
|
this.rotationYaw = f2;
|
||||||
this.rotationYawHead=f2;
|
this.rotationYawHead=f2;
|
||||||
this.renderYawOffset=this.rotationYaw;
|
this.renderYawOffset=this.rotationYaw;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private float updateRotation(float par1, float par2, float par3)
|
private float updateRotation(float par1, float par2, float par3)
|
||||||
@@ -336,8 +281,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
return 0.0F;
|
return 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(par1NBTTagCompound);
|
super.writeEntityToNBT(par1NBTTagCompound);
|
||||||
@@ -346,7 +289,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
par1NBTTagCompound.setInteger("aggroMax", this.aggroMax);
|
par1NBTTagCompound.setInteger("aggroMax", this.aggroMax);
|
||||||
par1NBTTagCompound.setByte("textureState", this.textureState);
|
par1NBTTagCompound.setByte("textureState", this.textureState);
|
||||||
par1NBTTagCompound.setFloat("scaleFactor", this.scaleFactor);
|
par1NBTTagCompound.setFloat("scaleFactor", this.scaleFactor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -358,8 +300,8 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
this.aggroMax = par1NBTTagCompound.getInteger("aggroMax");
|
this.aggroMax = par1NBTTagCompound.getInteger("aggroMax");
|
||||||
this.textureState = par1NBTTagCompound.getByte("textureState");
|
this.textureState = par1NBTTagCompound.getByte("textureState");
|
||||||
this.scaleFactor = par1NBTTagCompound.getFloat("scaleFactor");
|
this.scaleFactor = par1NBTTagCompound.getFloat("scaleFactor");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getCanSpawnHere()
|
public boolean getCanSpawnHere()
|
||||||
{
|
{
|
||||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox( this.posX-15, posY-4, this.posZ-15, this.posX+15, this.posY+15, this.posZ+15));
|
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox( this.posX-15, posY-4, this.posZ-15, this.posX+15, this.posY+15, this.posZ+15));
|
||||||
@@ -381,8 +323,4 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
}
|
}
|
||||||
return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox);
|
return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user