Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6f26669d0 | ||
|
|
ae04ae03be | ||
|
|
7ae748d26f | ||
|
|
0d3726cb82 | ||
|
|
0983306d83 |
@@ -2,10 +2,14 @@ package StevenDimDoors.mod_pocketDim;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -39,26 +43,42 @@ public class BlockDimWall extends Block
|
|||||||
{
|
{
|
||||||
if(!par1World.isRemote&&entityPlayer.getCurrentEquippedItem()!=null)
|
if(!par1World.isRemote&&entityPlayer.getCurrentEquippedItem()!=null)
|
||||||
{
|
{
|
||||||
|
Item playerEquip = entityPlayer.getCurrentEquippedItem().getItem();
|
||||||
|
|
||||||
|
if(!(playerEquip instanceof ItemBlock))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Block block= Block.blocksList[playerEquip.itemID];
|
||||||
|
if(!Block.isNormalCube(playerEquip.itemID))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(block instanceof BlockContainer)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock)
|
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if(!entityPlayer.capabilities.isCreativeMode)
|
if(!entityPlayer.capabilities.isCreativeMode)
|
||||||
{
|
{
|
||||||
entityPlayer.getCurrentEquippedItem().stackSize--;
|
entityPlayer.getCurrentEquippedItem().stackSize--;
|
||||||
}
|
}
|
||||||
par1World.setBlockAndMetadataWithNotify(par2, par3, par4, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage());
|
par1World.setBlockAndMetadata(par2, par3, par4, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(par1World.isRemote&&entityPlayer.getCurrentEquippedItem()!=null)
|
else
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class PlayerRespawnTracker implements IPlayerTracker
|
|||||||
for(EntityItem drop : mod_pocketDim.limboSpawnInventory)
|
for(EntityItem drop : mod_pocketDim.limboSpawnInventory)
|
||||||
{
|
{
|
||||||
|
|
||||||
player.inventory.addItemStackToInventory(drop.getEntityItem());
|
player.inventory.addItemStackToInventory(drop.func_92014_d());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class RiftGenerator implements IWorldGenerator
|
|||||||
//Long ntime = System.nanoTime();
|
//Long ntime = System.nanoTime();
|
||||||
shouldGenHere=true;
|
shouldGenHere=true;
|
||||||
|
|
||||||
if(world.provider.getDimensionName()=="PocketDim"||!mod_pocketDim.riftsInWorldGen ||world.isRemote)
|
if(world.provider.getDimensionName()=="PocketDim"||!mod_pocketDim.riftsInWorldGen ||world.isRemote||world.provider.dimensionId==1)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.shouldGenHere=false;
|
this.shouldGenHere=false;
|
||||||
|
|||||||
@@ -863,8 +863,10 @@ public class SchematicLoader
|
|||||||
dimHelper.instance.createLink(sideLink);
|
dimHelper.instance.createLink(sideLink);
|
||||||
dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation));
|
dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation));
|
||||||
|
|
||||||
|
int blockID=Block.stoneBrick.blockID;
|
||||||
|
System.out.println("gennedExit");
|
||||||
|
|
||||||
setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(), Block.stone.blockID,0);
|
setBlockDirectly(world,point.getX(), point.getY()-3, point.getZ(), Block.stone.blockID,0);
|
||||||
// setBlockDirectly(world,point.getX(), point.getY()-1, point.getZ(),mod_pocketDim.ExitDoorID,sideLink.linkOrientation);
|
// setBlockDirectly(world,point.getX(), point.getY()-1, point.getZ(),mod_pocketDim.ExitDoorID,sideLink.linkOrientation);
|
||||||
// setBlockDirectly(world,point.getX(), point.getY(), point.getZ(),mod_pocketDim.ExitDoorID,8);
|
// setBlockDirectly(world,point.getX(), point.getY(), point.getZ(),mod_pocketDim.ExitDoorID,8);
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ public class dimDoor extends BlockContainer
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println(linkData.destDimID);
|
|
||||||
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
|
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
|
||||||
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public class dimHatch extends BlockTrapDoor
|
|||||||
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;
|
||||||
|
exitLink.locDimID=par1World.provider.dimensionId;
|
||||||
|
|
||||||
|
|
||||||
dimHelper.instance.teleportToPocket(par1World, exitLink, par5Entity);
|
dimHelper.instance.teleportToPocket(par1World, exitLink, par5Entity);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
|||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public class dimHelper extends DimensionManager
|
public class dimHelper extends DimensionManager
|
||||||
@@ -120,41 +121,22 @@ public class dimHelper extends DimensionManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the depth of the dimension ID passed in
|
||||||
|
* @param DimID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public int getDimDepth(int DimID)
|
public int getDimDepth(int DimID)
|
||||||
{
|
{
|
||||||
if(this.dimList.containsKey(DimID))
|
if(this.dimList.containsKey(DimID))
|
||||||
{
|
{
|
||||||
return (int)this.dimList.get(DimID).depth;
|
return (int)this.dimList.get(DimID).depth;
|
||||||
}
|
}
|
||||||
else return 1;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void teleportToLimbo(World world,LinkData linkData, EntityPlayer player)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
|
|
||||||
EntityPlayerMP playerMP = (EntityPlayerMP) player;
|
|
||||||
player.fallDistance=-700;
|
|
||||||
|
|
||||||
|
|
||||||
//World worldLimbo= this.getWorld(mod_pocketDim.limboDimID);
|
|
||||||
mod_pocketDim.limbo=this.getWorld(mod_pocketDim.limboDimID);
|
|
||||||
if(mod_pocketDim.limbo==null)
|
|
||||||
{
|
|
||||||
this.initDimension(mod_pocketDim.limboDimID);
|
|
||||||
}
|
|
||||||
else if (mod_pocketDim.limbo.provider==null)
|
|
||||||
{
|
|
||||||
this.initDimension(mod_pocketDim.limboDimID);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//System.out.println(worldLimbo.getHeightValue( MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posZ)));
|
|
||||||
playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, mod_pocketDim.limboDimID, new pocketTeleporter((WorldServer) this.getWorld(mod_pocketDim.limboDimID), linkData));
|
|
||||||
**/
|
|
||||||
}
|
|
||||||
private Entity teleportEntity(World oldWorld, Entity entity, LinkData link) //this beautiful teleport method is based off of xCompWiz's teleport function.
|
private Entity teleportEntity(World oldWorld, Entity entity, LinkData link) //this beautiful teleport method is based off of xCompWiz's teleport function.
|
||||||
{
|
{
|
||||||
Entity cart;
|
Entity cart;
|
||||||
@@ -169,18 +151,18 @@ public class dimHelper extends DimensionManager
|
|||||||
cart = entity.ridingEntity;
|
cart = entity.ridingEntity;
|
||||||
}
|
}
|
||||||
if (entity.ridingEntity != null)
|
if (entity.ridingEntity != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
entity.mountEntity(entity.ridingEntity);
|
entity.mountEntity(entity.ridingEntity);
|
||||||
|
|
||||||
cart = teleportEntity(oldWorld, cart, link);
|
cart = teleportEntity(oldWorld, cart, link);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
World newWorld;
|
WorldServer newWorld;
|
||||||
|
|
||||||
if(this.getWorld(link.destDimID)==null)
|
if(this.getWorld(link.destDimID)==null)
|
||||||
{
|
{
|
||||||
@@ -194,7 +176,7 @@ public class dimHelper extends DimensionManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newWorld=oldWorld;
|
newWorld=(WorldServer)oldWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -202,6 +184,8 @@ public class dimHelper extends DimensionManager
|
|||||||
if ((entity instanceof EntityPlayerMP))
|
if ((entity instanceof EntityPlayerMP))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EntityPlayerMP player = (EntityPlayerMP)entity;
|
EntityPlayerMP player = (EntityPlayerMP)entity;
|
||||||
//player.closeScreen();
|
//player.closeScreen();
|
||||||
|
|
||||||
@@ -211,7 +195,30 @@ public class dimHelper extends DimensionManager
|
|||||||
player.dimension = link.destDimID;
|
player.dimension = link.destDimID;
|
||||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
|
player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
|
||||||
|
|
||||||
WorldServer.class.cast(entity.worldObj).getPlayerManager().removePlayer(player);
|
WorldServer.class.cast(oldWorld).removeEntity(player);
|
||||||
|
player.isDead=false;
|
||||||
|
|
||||||
|
oldWorld.playerEntities.remove(player);
|
||||||
|
WorldServer.class.cast(oldWorld).getPlayerManager().removePlayer(player);
|
||||||
|
newWorld.getPlayerManager().addPlayer(player);
|
||||||
|
player.theItemInWorldManager.setWorld(newWorld);
|
||||||
|
|
||||||
|
player.theItemInWorldManager.setWorld((WorldServer)newWorld);
|
||||||
|
|
||||||
|
player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer)newWorld);
|
||||||
|
player.mcServer.getConfigurationManager().syncPlayerInventory(player);
|
||||||
|
|
||||||
|
for(Object potionEffect : player.getActivePotionEffects())
|
||||||
|
{
|
||||||
|
PotionEffect effect = (PotionEffect)potionEffect;
|
||||||
|
player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,15 +228,7 @@ public class dimHelper extends DimensionManager
|
|||||||
int entX = entity.chunkCoordX;
|
int entX = entity.chunkCoordX;
|
||||||
int entZ = entity.chunkCoordZ;
|
int entZ = entity.chunkCoordZ;
|
||||||
|
|
||||||
if ((entity instanceof EntityPlayer))
|
|
||||||
{
|
|
||||||
EntityPlayer player = (EntityPlayer)entity;
|
|
||||||
|
|
||||||
//player.closeScreen();
|
|
||||||
|
|
||||||
oldWorld.playerEntities.remove(player);
|
|
||||||
//oldWorld.updateAllPlayersSleepingFlag();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists(entX, entZ)))
|
if ((entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists(entX, entZ)))
|
||||||
{
|
{
|
||||||
@@ -241,15 +240,7 @@ public class dimHelper extends DimensionManager
|
|||||||
oldWorld.releaseEntitySkin(entity);
|
oldWorld.releaseEntitySkin(entity);
|
||||||
|
|
||||||
entity.isDead = false;
|
entity.isDead = false;
|
||||||
}
|
|
||||||
|
|
||||||
WorldServer.class.cast(newWorld).theChunkProviderServer.loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (difDest)
|
|
||||||
{
|
|
||||||
if (!(entity instanceof EntityPlayer))
|
if (!(entity instanceof EntityPlayer))
|
||||||
{
|
{
|
||||||
NBTTagCompound entityNBT = new NBTTagCompound();
|
NBTTagCompound entityNBT = new NBTTagCompound();
|
||||||
@@ -275,41 +266,6 @@ public class dimHelper extends DimensionManager
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((entity instanceof EntityPlayerMP))
|
|
||||||
{
|
|
||||||
EntityPlayerMP player = (EntityPlayerMP)entity;
|
|
||||||
|
|
||||||
if (difDest)
|
|
||||||
{
|
|
||||||
player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer)newWorld);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (((entity instanceof EntityPlayerMP)) && (difDest))
|
|
||||||
{
|
|
||||||
EntityPlayerMP player = (EntityPlayerMP)entity;
|
|
||||||
|
|
||||||
player.theItemInWorldManager.setWorld((WorldServer)newWorld);
|
|
||||||
|
|
||||||
player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer)newWorld);
|
|
||||||
player.mcServer.getConfigurationManager().syncPlayerInventory(player);
|
|
||||||
|
|
||||||
for(Object potionEffect : player.getActivePotionEffects())
|
|
||||||
{
|
|
||||||
PotionEffect effect = (PotionEffect)potionEffect;
|
|
||||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel));
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.worldObj.updateEntityWithOptionalForce(entity, false);
|
entity.worldObj.updateEntityWithOptionalForce(entity, false);
|
||||||
|
|
||||||
new pocketTeleporter((WorldServer) newWorld, link).placeInPortal(entity, 0, 0, 0, 0);
|
new pocketTeleporter((WorldServer) newWorld, link).placeInPortal(entity, 0, 0, 0, 0);
|
||||||
@@ -328,7 +284,10 @@ public class dimHelper extends DimensionManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(entity instanceof EntityPlayerMP)
|
||||||
|
{
|
||||||
|
WorldServer.class.cast(newWorld).theChunkProviderServer.loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
||||||
|
}
|
||||||
return entity;
|
return entity;
|
||||||
|
|
||||||
|
|
||||||
@@ -372,7 +331,11 @@ public class dimHelper extends DimensionManager
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.teleportEntity(world, entity, linkData);
|
this.teleportEntity(world, entity, linkData);
|
||||||
|
if(entity instanceof EntityPlayerMP&&world.provider.dimensionId!=linkData.destDimID)
|
||||||
|
{
|
||||||
|
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
|
||||||
|
}
|
||||||
|
|
||||||
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
|
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
|
||||||
|
|
||||||
@@ -904,7 +867,7 @@ public class dimHelper extends DimensionManager
|
|||||||
|
|
||||||
if(link1!=null)
|
if(link1!=null)
|
||||||
{
|
{
|
||||||
locationDimData.exitDimLink=new LinkData(link1.locDimID, link1.locDimID, link1.locXCoord, link1.locYCoord, link1.locZCoord, link1.locXCoord, link1.locYCoord, link1.locZCoord, false);
|
//locationDimData.exitDimLink=new LinkData(link1.locDimID, link1.locDimID, link1.locXCoord, link1.locYCoord, link1.locZCoord, link1.locXCoord, link1.locYCoord, link1.locZCoord, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1186,7 +1149,7 @@ public class dimHelper extends DimensionManager
|
|||||||
ArrayList linksInDim=new ArrayList();
|
ArrayList linksInDim=new ArrayList();
|
||||||
for(size--;size>=0;)
|
for(size--;size>=0;)
|
||||||
{
|
{
|
||||||
dimData = dimHelper.dimList.get(rand.nextInt(dimList.size()));
|
dimData = dimHelper.dimList.get(dimList.keySet().toArray()[rand.nextInt(dimList.keySet().size())]);
|
||||||
if(dimData==null)
|
if(dimData==null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ public class mod_pocketDim
|
|||||||
blockLimboID=config.get("Int", "Block ID for Limbo- must be below 256", 217).getInt();
|
blockLimboID=config.get("Int", "Block ID for Limbo- must be below 256", 217).getInt();
|
||||||
blockDimWallPermID=config.get("Int", "Block ID for blockDimWallPermID- must be below 256", 220).getInt();
|
blockDimWallPermID=config.get("Int", "Block ID for blockDimWallPermID- must be below 256", 220).getInt();
|
||||||
this.limboDimID=config.get("Int", "Limbo Dimension ID", -23).getInt();
|
this.limboDimID=config.get("Int", "Limbo Dimension ID", -23).getInt();
|
||||||
this.limboExitRange=config.get("Int", "The farthest possible distance that limbo can send you upon return to the overworld.", 100000).getInt();
|
this.limboExitRange=config.get("Int", "The farthest possible distance that limbo can send you upon return to the overworld.", 500).getInt();
|
||||||
|
|
||||||
providerID=config.get("Int", "ProviderID", 12).getInt();
|
providerID=config.get("Int", "ProviderID", 12).getInt();
|
||||||
this.limboProviderID=config.get("Int", "Limbo Provider ID", 13).getInt();
|
this.limboProviderID=config.get("Int", "Limbo Provider ID", 13).getInt();
|
||||||
|
|||||||
Reference in New Issue
Block a user