Merge remote-tracking branch 'upstream/master' into R1.4.0-improvements
This commit is contained in:
commit
df452e930f
28 changed files with 343 additions and 351 deletions
|
@ -1,12 +1,16 @@
|
||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.ITickHandler;
|
import cpw.mods.fml.common.ITickHandler;
|
||||||
|
@ -19,6 +23,11 @@ public class CommonTickHandler implements ITickHandler
|
||||||
public int tickCount=0;
|
public int tickCount=0;
|
||||||
public int tickCount2=0;
|
public int tickCount2=0;
|
||||||
private static DDProperties properties = null;
|
private static DDProperties properties = null;
|
||||||
|
public static ArrayList<int[]> chunksToPopulate= new ArrayList<int[]>();
|
||||||
|
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
|
||||||
|
private static final int MAX_MONOLITH_SPAWN_Y = 245;
|
||||||
|
private static final int CHUNK_SIZE = 16;
|
||||||
|
|
||||||
|
|
||||||
public CommonTickHandler()
|
public CommonTickHandler()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +49,22 @@ public class CommonTickHandler implements ITickHandler
|
||||||
{
|
{
|
||||||
if (type.equals(EnumSet.of(TickType.SERVER)))
|
if (type.equals(EnumSet.of(TickType.SERVER)))
|
||||||
{
|
{
|
||||||
|
if(!CommonTickHandler.chunksToPopulate.isEmpty())
|
||||||
|
{
|
||||||
|
for(int[] chunkData : CommonTickHandler.chunksToPopulate)
|
||||||
|
{
|
||||||
|
if(chunkData[0]==properties.LimboDimensionID)
|
||||||
|
{
|
||||||
|
this.placeMonolithsInLimbo(chunkData[0], chunkData[1], chunkData[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.placeMonolithsInPockets(chunkData[0], chunkData[1], chunkData[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CommonTickHandler.chunksToPopulate.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +78,134 @@ public class CommonTickHandler implements ITickHandler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void placeMonolithsInPockets(int worldID, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
World worldObj = dimHelper.getWorld(worldID);
|
||||||
|
DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId);
|
||||||
|
int sanity = 0;
|
||||||
|
int blockID = 0;
|
||||||
|
boolean didSpawn=false;
|
||||||
|
|
||||||
|
if (dimData == null ||
|
||||||
|
dimData.dungeonGenerator == null ||
|
||||||
|
dimData.dungeonGenerator.isOpen)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//The following initialization code is based on code from ChunkProviderGenerate.
|
||||||
|
//It makes our generation depend on the world seed.
|
||||||
|
Random random = new Random(worldObj.getSeed());
|
||||||
|
long factorA = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
long factorB = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
random.setSeed((long)chunkX * factorA + (long)chunkZ * factorB ^ worldObj.getSeed());
|
||||||
|
|
||||||
|
int x, y, z;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
//Select a random column within the chunk
|
||||||
|
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
y = MAX_MONOLITH_SPAWN_Y;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
while (blockID == 0 &&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
}
|
||||||
|
while(blockID == mod_pocketDim.blockDimWall.blockID&&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
}
|
||||||
|
while (blockID == 0 &&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(y > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int jumpSanity=0;
|
||||||
|
int jumpHeight=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
jumpHeight = y+random.nextInt(10);
|
||||||
|
|
||||||
|
jumpSanity++;
|
||||||
|
}
|
||||||
|
while(!worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Entity mob = new MobObelisk(worldObj);
|
||||||
|
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||||
|
worldObj.spawnEntityInWorld(mob);
|
||||||
|
didSpawn=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sanity++;
|
||||||
|
|
||||||
|
}
|
||||||
|
while (sanity<5&&!didSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void placeMonolithsInLimbo(int worldID, int var2, int var3)
|
||||||
|
{
|
||||||
|
World world = dimHelper.getWorld(worldID);
|
||||||
|
|
||||||
|
if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
|
||||||
|
{
|
||||||
|
int y =0;
|
||||||
|
int x = var2*16 + rand.nextInt(16);
|
||||||
|
int z = var3*16 + rand.nextInt(16);
|
||||||
|
int yTest;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
x = var2*16 + rand.nextInt(16);
|
||||||
|
z = var3*16 + rand.nextInt(16);
|
||||||
|
|
||||||
|
while(world.getBlockId(x, y, z)==0&&y<255)
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
y = yCoordHelper.getFirstUncovered(world,x , y+2, z);
|
||||||
|
|
||||||
|
yTest=yCoordHelper.getFirstUncovered(world,x , y+5, z);
|
||||||
|
if(yTest>245)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int jumpSanity=0;
|
||||||
|
int jumpHeight=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
jumpHeight = y+rand.nextInt(25);
|
||||||
|
|
||||||
|
jumpSanity++;
|
||||||
|
}
|
||||||
|
while(!world.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
||||||
|
|
||||||
|
|
||||||
|
Entity mob = new MobObelisk(world);
|
||||||
|
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
|
world.spawnEntityInWorld(mob);
|
||||||
|
|
||||||
|
}
|
||||||
|
while (yTest > y);
|
||||||
|
}
|
||||||
|
}
|
||||||
//replaces rifts in game that have been destroyed/have blocks placed over them.
|
//replaces rifts in game that have been destroyed/have blocks placed over them.
|
||||||
private void onTickInGame()
|
private void onTickInGame()
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class DDProperties
|
||||||
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
|
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
|
||||||
|
|
||||||
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
||||||
"Sets the chance (out of " + LimboGenerator.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
"Sets the chance (out of " + CommonTickHandler.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
||||||
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
||||||
|
|
||||||
ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3,
|
ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3,
|
||||||
|
|
|
@ -232,7 +232,7 @@ public class DimData implements Serializable
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<LinkData> printAllLinkData()
|
public ArrayList<LinkData> getLinksInDim()
|
||||||
{
|
{
|
||||||
//TODO: We might want to modify this function, but I'm afraid of breaking something right now.
|
//TODO: We might want to modify this function, but I'm afraid of breaking something right now.
|
||||||
//To begin with, the name is wrong. This doesn't print anything! >_o ~SenseiKiwi
|
//To begin with, the name is wrong. This doesn't print anything! >_o ~SenseiKiwi
|
||||||
|
|
|
@ -7,6 +7,11 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.LimboGenerator;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.PocketGenerator;
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -17,6 +22,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.monster.EntityEnderman;
|
import net.minecraft.entity.monster.EntityEnderman;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
@ -27,11 +33,13 @@ import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||||
|
import net.minecraftforge.event.Event.Result;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
|
||||||
public class EventHookContainer
|
public class EventHookContainer
|
||||||
|
@ -46,7 +54,6 @@ public class EventHookContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onSoundLoad(SoundLoadEvent event)
|
public void onSoundLoad(SoundLoadEvent event)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +67,6 @@ public class EventHookContainer
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onWorldLoad(WorldEvent.Load event)
|
public void onWorldLoad(WorldEvent.Load event)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote)
|
if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote)
|
||||||
{
|
{
|
||||||
System.out.println("Registering Pocket Dims");
|
System.out.println("Registering Pocket Dims");
|
||||||
|
@ -69,9 +75,7 @@ public class EventHookContainer
|
||||||
dimHelper.dimList.clear();
|
dimHelper.dimList.clear();
|
||||||
dimHelper.instance.interDimLinkList.clear();
|
dimHelper.instance.interDimLinkList.clear();
|
||||||
dimHelper.instance.initPockets();
|
dimHelper.instance.initPockets();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Integer ids : dimHelper.getIDs())
|
for(Integer ids : dimHelper.getIDs())
|
||||||
{
|
{
|
||||||
World world = dimHelper.getWorld(ids);
|
World world = dimHelper.getWorld(ids);
|
||||||
|
@ -79,8 +83,10 @@ public class EventHookContainer
|
||||||
|
|
||||||
if(dimHelper.dimList.containsKey(world.provider.dimensionId))
|
if(dimHelper.dimList.containsKey(world.provider.dimensionId))
|
||||||
{
|
{
|
||||||
|
//TODO added temporary Try/catch block to prevent a crash here, getLinksInDim needs to be looked at
|
||||||
for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).printAllLinkData())
|
try
|
||||||
|
{
|
||||||
|
for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).getLinksInDim())
|
||||||
{
|
{
|
||||||
if(linkCount>100)
|
if(linkCount>100)
|
||||||
{
|
{
|
||||||
|
@ -92,127 +98,57 @@ public class EventHookContainer
|
||||||
{
|
{
|
||||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
||||||
{
|
{
|
||||||
if(event.entity instanceof EntityPlayer)
|
if(event.entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
// System.out.println(event.entity.worldObj.provider.dimensionId);
|
// System.out.println(event.entity.worldObj.provider.dimensionId);
|
||||||
|
|
||||||
// PacketDispatcher.sendPacketToPlayer(DimUpdatePacket.sendPacket(event.world.provider.dimensionId,1),(Player) event.entity);
|
// PacketDispatcher.sendPacketToPlayer(DimUpdatePacket.sendPacket(event.world.provider.dimensionId,1),(Player) event.entity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerFall(LivingFallEvent event)
|
public void onPlayerFall(LivingFallEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID);
|
event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
public void onPlayerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
|
if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int x = event.x;
|
int x = event.x;
|
||||||
int y = event.y;
|
int y = event.y;
|
||||||
|
|
||||||
int z = event.z;
|
int z = event.z;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(event.entityPlayer.getHeldItem()!=null)
|
if(event.entityPlayer.getHeldItem()!=null)
|
||||||
{
|
{
|
||||||
if(event.entityPlayer.getHeldItem().getItem() instanceof ItemBlock)
|
if(event.entityPlayer.getHeldItem().getItem() instanceof ItemBlock)
|
||||||
{
|
{
|
||||||
// if(event.entityPlayer instanceof EntityPlayerMP)
|
if(event.entityPlayer instanceof EntityPlayerMP)
|
||||||
{
|
{
|
||||||
|
|
||||||
Point3D point = new Point3D(x,y,z);
|
Point3D point = new Point3D(x,y,z);
|
||||||
dimHelper.blocksToDecay.add(point);
|
dimHelper.blocksToDecay.add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @ForgeSubscribe
|
|
||||||
public void onPlayerEvent(PlayerEvent event)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
if(!event.entity.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
ItemStack item = event.entityPlayer.inventory.getCurrentItem();
|
|
||||||
if(item!=null)
|
|
||||||
{
|
|
||||||
if(item.getItem() instanceof ItemRiftBlade)
|
|
||||||
{
|
|
||||||
List<EntityLiving> list = event.entity.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox( event.entityPlayer.posX-7,event.entityPlayer.posY-7, event.entityPlayer.posZ-7, event.entityPlayer.posX+7,event.entityPlayer.posY+7, event.entityPlayer.posZ+7));
|
|
||||||
list.remove(event.entity);
|
|
||||||
|
|
||||||
|
|
||||||
for(EntityLiving ent : list)
|
|
||||||
{
|
|
||||||
|
|
||||||
Vec3 var3 = event.entityPlayer.getLook(1.0F).normalize();
|
|
||||||
Vec3 var4 = event.entityPlayer.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - event.entityPlayer.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( event.entityPlayer.posY + (double) event.entityPlayer.getEyeHeight()), ent.posZ - event.entityPlayer.posZ);
|
|
||||||
double var5 = var4.lengthVector();
|
|
||||||
var4 = var4.normalize();
|
|
||||||
double var7 = var3.dotProduct(var4);
|
|
||||||
if( (var7+.1) > 1.0D - 0.025D / var5 ? event.entityPlayer.canEntityBeSeen(ent) : false)
|
|
||||||
{
|
|
||||||
System.out.println(list.size());
|
|
||||||
ItemRiftBlade.class.cast(item.getItem()).teleportToEntity(item,ent, event.entityPlayer);
|
|
||||||
break;
|
|
||||||
|
|
||||||
//ItemRiftBlade.class.cast(item.getItem()).teleportTo(event.entityPlayer, ent.posX, ent.posY, ent.posZ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
**/
|
|
||||||
}
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerDrops(PlayerDropsEvent event)
|
public void onPlayerDrops(PlayerDropsEvent event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class BlockDimWall extends Block
|
||||||
{
|
{
|
||||||
super(i, Material.ground);
|
super(i, Material.ground);
|
||||||
setTickRandomly(true);
|
setTickRandomly(true);
|
||||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class BlockLimbo extends Block
|
||||||
{
|
{
|
||||||
super(i, Material.ground);
|
super(i, Material.ground);
|
||||||
setTickRandomly(false);
|
setTickRandomly(false);
|
||||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ public class ExitDoor extends dimDoor
|
||||||
{
|
{
|
||||||
|
|
||||||
super(par1, Material.wood);
|
super(par1, Material.wood);
|
||||||
// this.blockIndexInTexture = 19;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class dimHatch extends BlockTrapDoor
|
||||||
public dimHatch(int par1,int par2, Material par2Material)
|
public dimHatch(int par1,int par2, Material par2Material)
|
||||||
{
|
{
|
||||||
super(par1, Material.iron);
|
super(par1, Material.iron);
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
// this.setTextureFile("/PocketBlockTextures.png");
|
// this.setTextureFile("/PocketBlockTextures.png");
|
||||||
// this.blockIndexInTexture = 16;
|
// this.blockIndexInTexture = 16;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,10 @@ public class linkDimDoor extends dimDoor
|
||||||
{
|
{
|
||||||
private Icon blockIconBottom;
|
private Icon blockIconBottom;
|
||||||
public linkDimDoor(int par1, Material material) {
|
public linkDimDoor(int par1, Material material) {
|
||||||
|
|
||||||
super(par1, material);
|
super(par1, material);
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class linkExitDoor extends ExitDoor
|
||||||
//this.blockIndexInTexture = 20;
|
//this.blockIndexInTexture = 20;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
||||||
if(dimHelper.dimList.containsKey(targetDim))
|
if(dimHelper.dimList.containsKey(targetDim))
|
||||||
{
|
{
|
||||||
DimData dim = dimHelper.dimList.get(targetDim);
|
DimData dim = dimHelper.dimList.get(targetDim);
|
||||||
ArrayList<LinkData> linksInDim = dim.printAllLinkData();
|
ArrayList<LinkData> linksInDim = dim.getLinksInDim();
|
||||||
|
|
||||||
for (LinkData link : linksInDim)
|
for (LinkData link : linksInDim)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class CommandDeleteDimensionData extends DDCommandBase
|
||||||
for(DimData dimData :dimHelper.dimList.values())
|
for(DimData dimData :dimHelper.dimList.values())
|
||||||
{
|
{
|
||||||
Collection<LinkData> links= new ArrayList<LinkData>();
|
Collection<LinkData> links= new ArrayList<LinkData>();
|
||||||
links.addAll( dimData.printAllLinkData());
|
links.addAll( dimData.getLinksInDim());
|
||||||
|
|
||||||
for(LinkData link : links)
|
for(LinkData link : links)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class CommandDeleteRifts extends DDCommandBase
|
||||||
if(dimHelper.dimList.containsKey(targetDim))
|
if(dimHelper.dimList.containsKey(targetDim))
|
||||||
{
|
{
|
||||||
DimData dim = dimHelper.dimList.get(targetDim);
|
DimData dim = dimHelper.dimList.get(targetDim);
|
||||||
ArrayList<LinkData> linksInDim = dim.printAllLinkData();
|
ArrayList<LinkData> linksInDim = dim.getLinksInDim();
|
||||||
|
|
||||||
for(LinkData link : linksInDim)
|
for(LinkData link : linksInDim)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class CommandPrintDimensionData extends DDCommandBase
|
||||||
return DDCommandResult.UNREGISTERED_DIMENSION;
|
return DDCommandResult.UNREGISTERED_DIMENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<LinkData> links = dimData.printAllLinkData();
|
ArrayList<LinkData> links = dimData.getLinksInDim();
|
||||||
|
|
||||||
sender.sendChatToPlayer("Dimension ID = " + dimData.dimID);
|
sender.sendChatToPlayer("Dimension ID = " + dimData.dimID);
|
||||||
sender.sendChatToPlayer("Dimension Depth = " + dimData.depth);
|
sender.sendChatToPlayer("Dimension Depth = " + dimData.depth);
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class CommandPruneDimensions extends DDCommandBase
|
||||||
|
|
||||||
for (DimData data : allDims)
|
for (DimData data : allDims)
|
||||||
{
|
{
|
||||||
for (LinkData link : data.printAllLinkData())
|
for (LinkData link : data.getLinksInDim())
|
||||||
{
|
{
|
||||||
linkedDimensions.add(link.destDimID);
|
linkedDimensions.add(link.destDimID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.util.WeightedRandom;
|
import net.minecraft.util.WeightedRandom;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DimData;
|
||||||
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
|
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
|
||||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
@ -531,6 +532,7 @@ public class DungeonHelper
|
||||||
int depth = dimHelper.instance.getDimDepth(incoming.locDimID);
|
int depth = dimHelper.instance.getDimDepth(incoming.locDimID);
|
||||||
int depthWeight = rand.nextInt(depth + 2) + rand.nextInt(depth + 2) - 2;
|
int depthWeight = rand.nextInt(depth + 2) + rand.nextInt(depth + 2) - 2;
|
||||||
|
|
||||||
|
|
||||||
int count = 10;
|
int count = 10;
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
try
|
try
|
||||||
|
@ -648,6 +650,11 @@ public class DungeonHelper
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(getDungeonDataInChain(dimHelper.dimList.get(incoming.locDimID)).contains(dungeon))
|
||||||
|
{
|
||||||
|
flag=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (!flag && count > 0);
|
while (!flag && count > 0);
|
||||||
}
|
}
|
||||||
|
@ -718,4 +725,36 @@ public class DungeonHelper
|
||||||
WeightedContainer<DungeonGenerator> resultContainer = (WeightedContainer<DungeonGenerator>) WeightedRandom.getRandomItem(random, weights);
|
WeightedContainer<DungeonGenerator> resultContainer = (WeightedContainer<DungeonGenerator>) WeightedRandom.getRandomItem(random, weights);
|
||||||
return (resultContainer != null) ? resultContainer.getData() : null;
|
return (resultContainer != null) ? resultContainer.getData() : null;
|
||||||
}
|
}
|
||||||
|
public static ArrayList<DungeonGenerator> getDungeonDataInChain(DimData dimData)
|
||||||
|
{
|
||||||
|
DimData startingDim = dimHelper.dimList.get(dimHelper.instance.getLinkDataFromCoords(dimData.exitDimLink.destXCoord, dimData.exitDimLink.destYCoord, dimData.exitDimLink.destZCoord, dimData.exitDimLink.destDimID).destDimID);
|
||||||
|
|
||||||
|
return getDungeonDataBelow(startingDim);
|
||||||
|
}
|
||||||
|
private static ArrayList<DungeonGenerator> getDungeonDataBelow(DimData dimData)
|
||||||
|
{
|
||||||
|
ArrayList<DungeonGenerator> dungeonData = new ArrayList<DungeonGenerator>();
|
||||||
|
if(dimData.dungeonGenerator!=null)
|
||||||
|
{
|
||||||
|
dungeonData.add(dimData.dungeonGenerator);
|
||||||
|
|
||||||
|
for(LinkData link : dimData.getLinksInDim())
|
||||||
|
{
|
||||||
|
if(dimHelper.dimList.containsKey(link.destDimID))
|
||||||
|
{
|
||||||
|
if(dimHelper.dimList.get(link.destDimID).dungeonGenerator!=null&&dimHelper.instance.getDimDepth(link.destDimID)==dimData.depth+1)
|
||||||
|
{
|
||||||
|
for(DungeonGenerator dungeonGen :getDungeonDataBelow(dimHelper.dimList.get(link.destDimID)) )
|
||||||
|
{
|
||||||
|
if(!dungeonData.contains(dungeonGen))
|
||||||
|
{
|
||||||
|
dungeonData.add(dungeonGen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dungeonData;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -824,7 +824,7 @@ public class dimHelper extends DimensionManager
|
||||||
DeleteFolder.deleteFolder(save);
|
DeleteFolder.deleteFolder(save);
|
||||||
dimData.hasBeenFilled = false;
|
dimData.hasBeenFilled = false;
|
||||||
dimData.hasDoor = false;
|
dimData.hasDoor = false;
|
||||||
for(LinkData link : dimData.printAllLinkData())
|
for(LinkData link : dimData.getLinksInDim())
|
||||||
{
|
{
|
||||||
link.hasGennedDoor = false;
|
link.hasGennedDoor = false;
|
||||||
LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID);
|
LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID);
|
||||||
|
@ -1248,7 +1248,7 @@ public class dimHelper extends DimensionManager
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
linksInDim = dimData.printAllLinkData();
|
linksInDim = dimData.getLinksInDim();
|
||||||
if(!linksInDim.isEmpty())
|
if(!linksInDim.isEmpty())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class ItemChaosDoor extends itemDimDoor
|
||||||
{
|
{
|
||||||
super(par1, par2Material);
|
super(par1, par2Material);
|
||||||
this.doorMaterial = par2Material;
|
this.doorMaterial = par2Material;
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
}
|
}
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class ItemRiftBlade extends itemDimDoor
|
||||||
super(par1, par2Material);
|
super(par1, par2Material);
|
||||||
|
|
||||||
// this.setTextureFile("/PocketBlockTextures.png");
|
// this.setTextureFile("/PocketBlockTextures.png");
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
|
|
||||||
// this.itemIcon=5;
|
// this.itemIcon=5;
|
||||||
|
|
|
@ -27,14 +27,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
{
|
{
|
||||||
super(par);
|
super(par);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
// this.setTextureFile("/PocketBlockTextures.png");
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
|
||||||
|
|
||||||
// this.itemIndex=5;
|
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
this.hasSubtypes=true;
|
this.hasSubtypes=true;
|
||||||
//TODO move to proxy
|
|
||||||
|
|
||||||
if (properties == null)
|
if (properties == null)
|
||||||
properties = DDProperties.instance();
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
|
@ -44,8 +39,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
public boolean hasEffect(ItemStack par1ItemStack)
|
public boolean hasEffect(ItemStack par1ItemStack)
|
||||||
{
|
{
|
||||||
// adds effect if item has a link stored
|
// adds effect if item has a link stored
|
||||||
|
|
||||||
|
|
||||||
if(par1ItemStack.hasTagCompound())
|
if(par1ItemStack.hasTagCompound())
|
||||||
{
|
{
|
||||||
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
|
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
|
||||||
|
@ -56,11 +49,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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.", ""));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,18 +60,8 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
int key;
|
int key;
|
||||||
LinkData linkData;
|
LinkData linkData;
|
||||||
int thisWorldID=par3World.provider.dimensionId;
|
int thisWorldID=par3World.provider.dimensionId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//par1ItemStack= par2EntityPlayer.getCurrentEquippedItem();
|
|
||||||
Integer[] linkCoords =this.readFromNBT(par1ItemStack);
|
Integer[] linkCoords =this.readFromNBT(par1ItemStack);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//System.out.println(key);
|
|
||||||
int offset = 2;
|
int offset = 2;
|
||||||
if(par1ItemStack.getTagCompound()!=null)
|
if(par1ItemStack.getTagCompound()!=null)
|
||||||
{
|
{
|
||||||
|
@ -88,19 +69,14 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
{
|
{
|
||||||
boolean hasEnder = false;
|
boolean hasEnder = false;
|
||||||
// checks to see if the item has a link stored, if so, it creates it
|
// checks to see if the item has a link stored, if so, it creates it
|
||||||
|
|
||||||
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
|
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
|
||||||
{
|
{
|
||||||
if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
|
if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
|
||||||
|
|
||||||
{
|
{
|
||||||
par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID);
|
par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID);
|
||||||
|
|
||||||
}
|
}
|
||||||
hasEnder=true;
|
hasEnder=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
|
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
|
||||||
{
|
{
|
||||||
offset = 1;
|
offset = 1;
|
||||||
|
@ -110,7 +86,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
if(dimHelper.instance.getLinkDataFromCoords(linkCoords[0], linkCoords[1], linkCoords[2], par3World)==null)
|
if(dimHelper.instance.getLinkDataFromCoords(linkCoords[0], linkCoords[1], linkCoords[2], par3World)==null)
|
||||||
{
|
{
|
||||||
dimHelper.instance.createLink(linkCoords[3], par3World.provider.dimensionId, linkCoords[0], linkCoords[1], linkCoords[2],par4, par5+offset, par6);
|
dimHelper.instance.createLink(linkCoords[3], par3World.provider.dimensionId, linkCoords[0], linkCoords[1], linkCoords[2],par4, par5+offset, par6);
|
||||||
|
|
||||||
}
|
}
|
||||||
dimHelper.instance.createLink(par3World.provider.dimensionId, linkCoords[3], par4, par5+offset, par6, linkCoords[0], linkCoords[1], linkCoords[2]);
|
dimHelper.instance.createLink(par3World.provider.dimensionId, linkCoords[3], par4, par5+offset, par6, linkCoords[0], linkCoords[1], linkCoords[2]);
|
||||||
par2EntityPlayer.sendChatToPlayer("Rift Created");
|
par2EntityPlayer.sendChatToPlayer("Rift Created");
|
||||||
|
@ -119,11 +94,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
{
|
{
|
||||||
par2EntityPlayer.sendChatToPlayer("No Ender Pearls!");
|
par2EntityPlayer.sendChatToPlayer("No Ender Pearls!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!par3World.isRemote)
|
else if(!par3World.isRemote)
|
||||||
|
@ -135,21 +105,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
//otherwise, it creates the first half of the link. Next click will complete it.
|
//otherwise, it creates the first half of the link. Next click will complete it.
|
||||||
key= dimHelper.instance.createUniqueInterDimLinkKey();
|
key= dimHelper.instance.createUniqueInterDimLinkKey();
|
||||||
this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId);
|
this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
par2EntityPlayer.sendChatToPlayer("Rift Signature Stored");
|
par2EntityPlayer.sendChatToPlayer("Rift Signature Stored");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//dimHelper.instance.save();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -159,7 +117,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
*/
|
*/
|
||||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(par1ItemStack.hasTagCompound())
|
if(par1ItemStack.hasTagCompound())
|
||||||
{
|
{
|
||||||
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
|
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
|
||||||
|
@ -167,9 +124,7 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
Integer[] coords = this.readFromNBT(par1ItemStack);
|
Integer[] coords = this.readFromNBT(par1ItemStack);
|
||||||
par3List.add(String.valueOf("Leads to dim "+coords[3] +" with depth "+dimHelper.instance.getDimDepth(dimHelper.instance.getDimDepth(coords[3]))));
|
par3List.add(String.valueOf("Leads to dim "+coords[3] +" with depth "+dimHelper.instance.getDimDepth(dimHelper.instance.getDimDepth(coords[3]))));
|
||||||
par3List.add("at x="+coords[0]+" y="+coords[1]+" z="+coords[2]);
|
par3List.add("at x="+coords[0]+" y="+coords[1]+" z="+coords[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -177,8 +132,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
par3List.add ("second click creates two rifts,");
|
par3List.add ("second click creates two rifts,");
|
||||||
par3List.add("that link the first location");
|
par3List.add("that link the first location");
|
||||||
par3List.add("with the second location");
|
par3List.add("with the second location");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,21 +142,17 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
if(itemStack.hasTagCompound())
|
if(itemStack.hasTagCompound())
|
||||||
{
|
{
|
||||||
tag = itemStack.getTagCompound();
|
tag = itemStack.getTagCompound();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tag= new NBTTagCompound();
|
tag= new NBTTagCompound();
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setInteger("linkX", x);
|
tag.setInteger("linkX", x);
|
||||||
tag.setInteger("linkY", y);
|
tag.setInteger("linkY", y);
|
||||||
tag.setInteger("linkZ", z);
|
tag.setInteger("linkZ", z);
|
||||||
tag.setInteger("linkDimID", dimID);
|
tag.setInteger("linkDimID", dimID);
|
||||||
tag.setBoolean("isCreated", true);
|
tag.setBoolean("isCreated", true);
|
||||||
|
|
||||||
itemStack.setTagCompound(tag);
|
itemStack.setTagCompound(tag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -211,7 +160,6 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
*/
|
*/
|
||||||
public Integer[] readFromNBT(ItemStack itemStack)
|
public Integer[] readFromNBT(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
|
|
||||||
NBTTagCompound tag;
|
NBTTagCompound tag;
|
||||||
Integer[] linkCoords = new Integer[5];
|
Integer[] linkCoords = new Integer[5];
|
||||||
if(itemStack.hasTagCompound())
|
if(itemStack.hasTagCompound())
|
||||||
|
@ -226,11 +174,8 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
|
||||||
linkCoords[1]=tag.getInteger("linkY");
|
linkCoords[1]=tag.getInteger("linkY");
|
||||||
linkCoords[2]=tag.getInteger("linkZ");
|
linkCoords[2]=tag.getInteger("linkZ");
|
||||||
linkCoords[3]=tag.getInteger("linkDimID");
|
linkCoords[3]=tag.getInteger("linkDimID");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return linkCoords;
|
return linkCoords;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ItemStableFabric extends Item
|
||||||
{
|
{
|
||||||
super(par1);
|
super(par1);
|
||||||
// this.setitemIcon(Item.doorWood.getIconFromDamage(0));
|
// this.setitemIcon(Item.doorWood.getIconFromDamage(0));
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class itemDimDoor extends ItemDoor
|
||||||
{
|
{
|
||||||
super(par1, par2Material);
|
super(par1, par2Material);
|
||||||
this.setMaxStackSize(64);
|
this.setMaxStackSize(64);
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
if (properties == null)
|
if (properties == null)
|
||||||
properties = DDProperties.instance();
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class itemExitDoor extends itemDimDoor
|
||||||
{
|
{
|
||||||
super(par1, par2Material);
|
super(par1, par2Material);
|
||||||
this.doorMaterial = par2Material;
|
this.doorMaterial = par2Material;
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class itemLinkSignature extends Item
|
||||||
super(par1);
|
super(par1);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
// this.setTextureFile("/PocketBlockTextures.png");
|
// this.setTextureFile("/PocketBlockTextures.png");
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
// this.itemIcon=5;
|
// this.itemIcon=5;
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class itemRiftRemover extends Item
|
||||||
super(par1);
|
super(par1);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
// this.setTextureFile("/PocketBlockTextures.png");
|
// this.setTextureFile("/PocketBlockTextures.png");
|
||||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
|
|
||||||
// this.itemIcon=6;
|
// this.itemIcon=6;
|
||||||
this.setMaxDamage(5);
|
this.setMaxDamage(5);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.HashMap;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityEggInfo;
|
import net.minecraft.entity.EntityEggInfo;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
@ -134,6 +135,23 @@ public class mod_pocketDim
|
||||||
public static long genTime;
|
public static long genTime;
|
||||||
public static int teleTimer = 0;
|
public static int teleTimer = 0;
|
||||||
|
|
||||||
|
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ItemStack getIconItemStack()
|
||||||
|
{
|
||||||
|
return new ItemStack(mod_pocketDim.itemDimDoor, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTranslatedTabLabel()
|
||||||
|
{
|
||||||
|
return "Dimensional Doors";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PreInit
|
@PreInit
|
||||||
public void PreInit(FMLPreInitializationEvent event)
|
public void PreInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
|
@ -218,6 +236,8 @@ public class mod_pocketDim
|
||||||
LanguageRegistry.addName(itemDimDoor, "Dimensional Door");
|
LanguageRegistry.addName(itemDimDoor, "Dimensional Door");
|
||||||
LanguageRegistry.addName(itemRiftBlade , "Rift Blade");
|
LanguageRegistry.addName(itemRiftBlade , "Rift Blade");
|
||||||
|
|
||||||
|
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");
|
||||||
|
|
||||||
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
||||||
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
|
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
|
||||||
|
|
||||||
|
@ -403,13 +423,13 @@ public class mod_pocketDim
|
||||||
CommandPrintDimensionData.instance().register(event);
|
CommandPrintDimensionData.instance().register(event);
|
||||||
CommandPruneDimensions.instance().register(event);
|
CommandPruneDimensions.instance().register(event);
|
||||||
CommandStartDungeonCreation.instance().register(event);
|
CommandStartDungeonCreation.instance().register(event);
|
||||||
|
|
||||||
dimHelper.instance.load();
|
dimHelper.instance.load();
|
||||||
|
|
||||||
if(!dimHelper.dimList.containsKey(properties.LimboDimensionID))
|
if(!dimHelper.dimList.containsKey(properties.LimboDimensionID))
|
||||||
{
|
{
|
||||||
dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData()));
|
dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.world;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
||||||
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.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
@ -33,7 +34,6 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
||||||
|
|
||||||
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
||||||
{
|
{
|
||||||
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
|
|
||||||
private static Random rand;
|
private static Random rand;
|
||||||
|
|
||||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||||
|
@ -158,15 +158,17 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
||||||
this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
|
this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
|
||||||
byte[] var3 = new byte[32768];
|
byte[] var3 = new byte[32768];
|
||||||
this.generateTerrain(par1, par2, var3);
|
this.generateTerrain(par1, par2, var3);
|
||||||
this.caveGenerator.generate(this, this.worldObj, par1, par2, var3);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
|
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
|
||||||
|
|
||||||
|
|
||||||
var4.generateSkylightMap();
|
var4.generateSkylightMap();
|
||||||
|
|
||||||
|
if(!var4.isTerrainPopulated)
|
||||||
|
{
|
||||||
|
var4.isTerrainPopulated=true;
|
||||||
|
CommonTickHandler.chunksToPopulate.add(new int[] {properties.LimboDimensionID,par1,par2});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return var4;
|
return var4;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -177,51 +179,8 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(IChunkProvider var1, int var2, int var3)
|
public void populate(IChunkProvider var1, int var2, int var3)
|
||||||
{
|
|
||||||
if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
|
|
||||||
{
|
|
||||||
int y =0;
|
|
||||||
int x = var2*16 + rand.nextInt(16);
|
|
||||||
int z = var3*16 + rand.nextInt(16);
|
|
||||||
int yTest;
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
|
|
||||||
x = var2*16 + rand.nextInt(16);
|
|
||||||
z = var3*16 + rand.nextInt(16);
|
|
||||||
|
|
||||||
while(this.worldObj.getBlockId(x, y, z)==0&&y<255)
|
|
||||||
{
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
y = yCoordHelper.getFirstUncovered(this.worldObj,x , y+2, z);
|
|
||||||
|
|
||||||
yTest=yCoordHelper.getFirstUncovered(this.worldObj,x , y+5, z);
|
|
||||||
if(yTest>245)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int jumpSanity=0;
|
|
||||||
int jumpHeight=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
jumpHeight = y+rand.nextInt(25);
|
|
||||||
|
|
||||||
jumpSanity++;
|
|
||||||
}
|
|
||||||
while(!this.worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
|
||||||
|
|
||||||
|
|
||||||
Entity mob = new MobObelisk(this.worldObj);
|
|
||||||
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
this.worldObj.spawnEntityInWorld(mob);
|
|
||||||
|
|
||||||
}
|
|
||||||
while (yTest > y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,8 @@ import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||||
|
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.DimData;
|
import StevenDimDoors.mod_pocketDim.DimData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
@ -23,13 +25,17 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
||||||
{
|
{
|
||||||
private World worldObj;
|
private World worldObj;
|
||||||
|
|
||||||
private static final int MAX_MONOLITH_SPAWN_Y = 245;
|
private DDProperties properties = null;
|
||||||
private static final int CHUNK_SIZE = 16;
|
|
||||||
|
|
||||||
|
|
||||||
public PocketGenerator(World par1World, long par2, boolean par4)
|
public PocketGenerator(World par1World, long par2, boolean par4)
|
||||||
{
|
{
|
||||||
super(par1World, par2, par4);
|
super(par1World, par2, par4);
|
||||||
this.worldObj = par1World;
|
this.worldObj = par1World;
|
||||||
|
|
||||||
|
if (properties == null)
|
||||||
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,6 +56,12 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
||||||
|
|
||||||
Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ);
|
Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ);
|
||||||
|
|
||||||
|
if(!chunk.isTerrainPopulated)
|
||||||
|
{
|
||||||
|
chunk.isTerrainPopulated=true;
|
||||||
|
CommonTickHandler.chunksToPopulate.add(new int[] {chunk.worldObj.provider.dimensionId,chunkX,chunkZ});
|
||||||
|
}
|
||||||
|
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,81 +74,7 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
||||||
@Override
|
@Override
|
||||||
public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ)
|
public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ)
|
||||||
{
|
{
|
||||||
//Check whether we want to populate this chunk with Monoliths.
|
|
||||||
DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId);
|
|
||||||
int sanity = 0;
|
|
||||||
int blockID = 0;
|
|
||||||
boolean didSpawn=false;
|
|
||||||
|
|
||||||
if (dimData == null ||
|
|
||||||
dimData.dungeonGenerator == null ||
|
|
||||||
dimData.dungeonGenerator.isOpen)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//The following initialization code is based on code from ChunkProviderGenerate.
|
|
||||||
//It makes our generation depend on the world seed.
|
|
||||||
Random random = new Random(worldObj.getSeed());
|
|
||||||
long factorA = random.nextLong() / 2L * 2L + 1L;
|
|
||||||
long factorB = random.nextLong() / 2L * 2L + 1L;
|
|
||||||
random.setSeed((long)chunkX * factorA + (long)chunkZ * factorB ^ worldObj.getSeed());
|
|
||||||
|
|
||||||
int x, y, z;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
//Select a random column within the chunk
|
|
||||||
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
|
||||||
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
|
||||||
y = MAX_MONOLITH_SPAWN_Y;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
while (blockID == 0 &&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
}
|
|
||||||
while(blockID == mod_pocketDim.blockDimWall.blockID&&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
}
|
|
||||||
while (blockID == 0 &&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(y > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int jumpSanity=0;
|
|
||||||
int jumpHeight=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
jumpHeight = y+random.nextInt(10);
|
|
||||||
|
|
||||||
jumpSanity++;
|
|
||||||
}
|
|
||||||
while(!this.worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Entity mob = new MobObelisk(worldObj);
|
|
||||||
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
|
||||||
worldObj.spawnEntityInWorld(mob);
|
|
||||||
didSpawn=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sanity++;
|
|
||||||
|
|
||||||
}
|
|
||||||
while (sanity<5&&!didSpawn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue