commit
3968255094
11 changed files with 485 additions and 874 deletions
|
@ -58,16 +58,15 @@ public class EventHookContainer
|
||||||
{
|
{
|
||||||
for (LinkData link:dimHelper.instance.getDimData(world.provider.dimensionId).getLinksInDim())
|
for (LinkData link:dimHelper.instance.getDimData(world.provider.dimensionId).getLinksInDim())
|
||||||
{
|
{
|
||||||
if(linkCount>100) //TODO: Wtf? wouldn't this cause some links to not load on servers with several links? Not sure what's going on here. ~SenseiKiwi
|
if (!mod_pocketDim.blockRift.isBlockImmune(world, link.locXCoord, link.locYCoord, link.locZCoord))
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
linkCount++;
|
|
||||||
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
|
|
||||||
if (!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
|
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
linkCount++;
|
||||||
|
if (linkCount >= 100)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
|
|
@ -105,6 +105,6 @@ public class Point3D implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "(" + x + ", " + "y" + ", " + z + ")";
|
return "(" + x + ", " + y + ", " + z + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,17 +1,21 @@
|
||||||
package StevenDimDoors.mod_pocketDim.blocks;
|
package StevenDimDoors.mod_pocketDim.blocks;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Queue;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
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.PacketHandler;
|
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
@ -24,24 +28,47 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockRift extends BlockContainer
|
public class BlockRift extends BlockContainer
|
||||||
{
|
{
|
||||||
private static DDProperties properties = null;
|
private static final float MIN_IMMUNE_HARDNESS = 200.0F;
|
||||||
|
private static final int BLOCK_DESTRUCTION_RANGE = 4;
|
||||||
|
private static final int BLOCK_DESTRUCTION_VOLUME = (int) Math.pow(2 * BLOCK_DESTRUCTION_RANGE + 1, 3);
|
||||||
|
private static final int MAX_BLOCK_SEARCH_CHANCE = 100;
|
||||||
|
private static final int BLOCK_SEARCH_CHANCE = 50;
|
||||||
|
private static final int MAX_BLOCK_DESTRUCTION_CHANCE = 100;
|
||||||
|
private static final int BLOCK_DESTRUCTION_CHANCE = 50;
|
||||||
|
|
||||||
public BlockRift(int i, int j, Material par2Material)
|
private final DDProperties properties;
|
||||||
|
private final ArrayList<Integer> blocksImmuneToRift;
|
||||||
|
|
||||||
|
public BlockRift(int i, int j, Material par2Material, DDProperties properties)
|
||||||
{
|
{
|
||||||
super(i, Material.air);
|
super(i, par2Material);
|
||||||
setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
// this.setCreativeTab(CreativeTabs.tabBlock);
|
|
||||||
this.setLightOpacity(14);
|
this.setLightOpacity(14);
|
||||||
if (properties == null)
|
this.properties = properties;
|
||||||
properties = DDProperties.instance();
|
this.blocksImmuneToRift = new ArrayList<Integer>();
|
||||||
|
this.blocksImmuneToRift.add(properties.FabricBlockID);
|
||||||
|
this.blocksImmuneToRift.add(properties.PermaFabricBlockID);
|
||||||
|
this.blocksImmuneToRift.add(properties.DimensionalDoorID);
|
||||||
|
this.blocksImmuneToRift.add(properties.WarpDoorID);
|
||||||
|
this.blocksImmuneToRift.add(properties.TransTrapdoorID);
|
||||||
|
this.blocksImmuneToRift.add(properties.UnstableDoorID);
|
||||||
|
this.blocksImmuneToRift.add(properties.RiftBlockID);
|
||||||
|
this.blocksImmuneToRift.add(properties.TransientDoorID);
|
||||||
|
this.blocksImmuneToRift.add(Block.blockIron.blockID);
|
||||||
|
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
|
||||||
|
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
|
||||||
|
this.blocksImmuneToRift.add(Block.blockGold.blockID);
|
||||||
|
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
{
|
{
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
||||||
}
|
}
|
||||||
|
|
||||||
//sends a packet informing the client that there is a link present so it renders properly. (when placed)
|
//sends a packet informing the client that there is a link present so it renders properly. (when placed)
|
||||||
|
@Override
|
||||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -53,16 +80,18 @@ public class BlockRift extends BlockContainer
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// this.updateTick(par1World, par2, par3, par4, new Random());
|
// this.updateTick(par1World, par2, par3, par4, new Random());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCollidable()
|
public boolean isCollidable()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,6 +100,7 @@ public class BlockRift extends BlockContainer
|
||||||
/**
|
/**
|
||||||
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
|
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean canCollideCheck(int par1, boolean par2)
|
public boolean canCollideCheck(int par1, boolean par2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -81,11 +111,14 @@ public class BlockRift extends BlockContainer
|
||||||
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
|
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
|
||||||
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
|
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this doesnt do anything yet.
|
//this doesnt do anything yet.
|
||||||
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType()
|
||||||
{
|
{
|
||||||
if(mod_pocketDim.isPlayerWearingGoogles)
|
if(mod_pocketDim.isPlayerWearingGoogles)
|
||||||
|
@ -96,12 +129,12 @@ public class BlockRift extends BlockContainer
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
|
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
|
||||||
* coordinates. Args: blockAccess, x, y, z, side
|
* coordinates. Args: blockAccess, x, y, z, side
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -111,61 +144,89 @@ public class BlockRift extends BlockContainer
|
||||||
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
|
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
|
||||||
* cleared to be reused)
|
* cleared to be reused)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//function that regulates how many blocks it eats/ how fast it eates them.
|
|
||||||
|
//function that regulates how many blocks it eats/ how fast it eats them.
|
||||||
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random)
|
public void updateTick(World world, int x, int y, int z, Random random)
|
||||||
{
|
{
|
||||||
if(!world.isRemote&&dimHelper.instance.getLinkDataFromCoords(x, y, z, world.provider.dimensionId)!=null && properties.RiftGriefingEnabled)
|
if (properties.RiftGriefingEnabled && !world.isRemote &&
|
||||||
|
dimHelper.instance.getLinkDataFromCoords(x, y, z, world.provider.dimensionId) != null)
|
||||||
{
|
{
|
||||||
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z);
|
//Randomly decide whether to search for blocks to destroy. This reduces the frequency of search operations,
|
||||||
if(rift.isNearRift)
|
//moderates performance impact, and controls the apparent speed of block destruction.
|
||||||
|
if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE &&
|
||||||
|
((TileEntityRift) world.getBlockTileEntity(x, y, z)).isNearRift )
|
||||||
{
|
{
|
||||||
|
destroyNearbyBlocks(world, x, y, z, random);
|
||||||
int range=4;
|
|
||||||
|
|
||||||
float distance=range+range/4;
|
|
||||||
int i=-range;
|
|
||||||
int j=-range;
|
|
||||||
int k=-range;
|
|
||||||
boolean flag=true;
|
|
||||||
while (i<range&&flag)
|
|
||||||
{
|
|
||||||
while (j<range&&flag)
|
|
||||||
{
|
|
||||||
while (k<range&&flag)
|
|
||||||
{
|
|
||||||
if(!mod_pocketDim.blocksImmuneToRift.contains(world.getBlockId(x+i, y+j, z+k))&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance&&!world.isAirBlock(x+i, y+j, z+k))
|
|
||||||
{
|
|
||||||
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0&&random.nextInt(2)==0)
|
|
||||||
{
|
|
||||||
world.setBlock(x+i, y+j, z+k,0);
|
|
||||||
flag=random.nextBoolean()||random.nextBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
k++;
|
|
||||||
}
|
|
||||||
k=-range;
|
|
||||||
j++;
|
|
||||||
|
|
||||||
}
|
|
||||||
j=-range;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void destroyNearbyBlocks(World world, int x, int y, int z, Random random)
|
||||||
|
{
|
||||||
|
HashMap<Point3D, Integer> pointDistances = new HashMap<Point3D, Integer>(BLOCK_DESTRUCTION_VOLUME);
|
||||||
|
Queue<Point3D> points = new LinkedList<Point3D>();
|
||||||
|
|
||||||
|
//Perform a breadth-first search outwards from the point at which the rift is located. Record the distances
|
||||||
|
//of the points we visit to stop the search at its maximum range.
|
||||||
|
pointDistances.put(new Point3D(x, y, z), 0);
|
||||||
|
addAdjacentBlocks(x, y, z, 0, pointDistances, points);
|
||||||
|
while (!points.isEmpty())
|
||||||
|
{
|
||||||
|
Point3D current = points.remove();
|
||||||
|
int distance = pointDistances.get(current);
|
||||||
|
|
||||||
|
//If the current block is air, continue searching. Otherwise, try destroying the block.
|
||||||
|
if (world.isAirBlock(current.getX(), current.getY(), current.getZ()))
|
||||||
|
{
|
||||||
|
//Make sure we stay within the search range
|
||||||
|
if (distance < BLOCK_DESTRUCTION_RANGE)
|
||||||
|
{
|
||||||
|
addAdjacentBlocks(current.getX(), current.getY(), current.getZ(), distance, pointDistances, points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Check if the current block is immune to destruction by rifts. If not, randomly decide whether to destroy it.
|
||||||
|
//The randomness makes it so the destroyed area appears "noisy" if the rift is exposed to a large surface.
|
||||||
|
if (!isBlockImmune(world, current.getX(), current.getY(), current.getZ()) &&
|
||||||
|
random.nextInt(MAX_BLOCK_DESTRUCTION_CHANCE) < BLOCK_DESTRUCTION_CHANCE)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(current.getX(), current.getY(), current.getZ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAdjacentBlocks(int x, int y, int z, int distance, HashMap<Point3D, Integer> pointDistances, Queue<Point3D> points)
|
||||||
|
{
|
||||||
|
Point3D[] neighbors = new Point3D[] {
|
||||||
|
new Point3D(x - 1, y, z),
|
||||||
|
new Point3D(x + 1, y, z),
|
||||||
|
new Point3D(x, y - 1, z),
|
||||||
|
new Point3D(x, y + 1, z),
|
||||||
|
new Point3D(x, y, z - 1),
|
||||||
|
new Point3D(x, y, z + 1)
|
||||||
|
};
|
||||||
|
for (int index = 0; index < neighbors.length; index++)
|
||||||
|
{
|
||||||
|
if (!pointDistances.containsKey(neighbors[index]))
|
||||||
|
{
|
||||||
|
pointDistances.put(neighbors[index], distance + 1);
|
||||||
|
points.add(neighbors[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* regulates the render effect, especially when multiple rifts start to link up. Has 3 main parts- Grows toward and away from nearest rft, bends toward it, and a randomization function
|
* regulates the render effect, especially when multiple rifts start to link up. Has 3 main parts- Grows toward and away from nearest rft, bends toward it, and a randomization function
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand)
|
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand)
|
||||||
{
|
{
|
||||||
|
@ -186,8 +247,6 @@ public class BlockRift extends BlockContainer
|
||||||
|
|
||||||
TileEntityRift tile = (TileEntityRift)par1World.getBlockTileEntity(par2, par3, par4);
|
TileEntityRift tile = (TileEntityRift)par1World.getBlockTileEntity(par2, par3, par4);
|
||||||
|
|
||||||
//the noise, ie, how far the rift particles are away from the intended location.
|
|
||||||
float offset=0;
|
|
||||||
float Xoffset=0;
|
float Xoffset=0;
|
||||||
float Yoffset=0;
|
float Yoffset=0;
|
||||||
float Zoffset=0;
|
float Zoffset=0;
|
||||||
|
@ -250,7 +309,6 @@ public class BlockRift extends BlockContainer
|
||||||
yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F);
|
yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F);
|
||||||
zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F);
|
zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F);
|
||||||
|
|
||||||
offset= (float) ((0.2F/(1+Math.abs(xChange)+Math.abs(yChange)+Math.abs(zChange))));
|
|
||||||
Xoffset= (float) ((0.25F/(1+Math.abs(xChange))));
|
Xoffset= (float) ((0.25F/(1+Math.abs(xChange))));
|
||||||
|
|
||||||
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
|
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
|
||||||
|
@ -274,15 +332,27 @@ public class BlockRift extends BlockContainer
|
||||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
|
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBlockImmune(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||||
|
if (block != null)
|
||||||
|
{
|
||||||
|
float hardness = block.getBlockHardness(world, x, y, z);
|
||||||
|
return (hardness < 0 || hardness >= MIN_IMMUNE_HARDNESS || blocksImmuneToRift.contains(block.blockID));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int idPicked(World par1World, int par2, int par3, int par4)
|
public int idPicked(World par1World, int par2, int par3, int par4)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int idDropped(int par1, Random par2Random, int par3)
|
public int idDropped(int par1, Random par2Random, int par3)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -290,12 +360,7 @@ public class BlockRift extends BlockContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World var1)
|
public TileEntity createNewTileEntity(World var1)
|
||||||
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return new TileEntityRift();
|
return new TileEntityRift();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,12 +7,14 @@ import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
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.creativetab.CreativeTabs;
|
||||||
|
@ -67,7 +69,8 @@ public class ExitDoor extends dimDoor
|
||||||
|
|
||||||
|
|
||||||
dimHelper.instance.createLink(locDimID, ExitDimID, par2, par3, par4, par2, yCoord, par4,par1World.getBlockMetadata(par2, par3-1, par4));
|
dimHelper.instance.createLink(locDimID, ExitDimID, par2, par3, par4, par2, yCoord, par4,par1World.getBlockMetadata(par2, par3-1, par4));
|
||||||
dimHelper.instance.createLink(ExitDimID, locDimID, par2, yCoord, par4, par2, par3, par4,dimHelper.instance.flipDoorMetadata(par1World.getBlockMetadata(par2, par3-1, par4)));
|
dimHelper.instance.createLink(ExitDimID, locDimID, par2, yCoord, par4, par2, par3, par4,
|
||||||
|
BlockRotator.transformMetadata(par1World.getBlockMetadata(par2, par3 - 1, par4), 2, Block.doorWood.blockID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
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.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
|
@ -150,7 +151,7 @@ public class dimDoor extends BlockContainer
|
||||||
|
|
||||||
if(par1World.getBlockMetadata(par2, par3-1, par4)==var12)
|
if(par1World.getBlockMetadata(par2, par3-1, par4)==var12)
|
||||||
{
|
{
|
||||||
var12=dimHelper.instance.flipDoorMetadata(var12);
|
var12 = BlockRotator.transformMetadata(var12, 2, Block.doorWood.blockID);
|
||||||
}
|
}
|
||||||
par1World.setBlockMetadataWithNotify(par2, par3-1, par4, var12,2);
|
par1World.setBlockMetadataWithNotify(par2, par3-1, par4, var12,2);
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ public class dimDoor extends BlockContainer
|
||||||
int var12 = (int) (MathHelper.floor_double((double)((par5EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
|
int var12 = (int) (MathHelper.floor_double((double)((par5EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
|
||||||
if(par1World.getBlockMetadata(par2, par3, par4)==var12)
|
if(par1World.getBlockMetadata(par2, par3, par4)==var12)
|
||||||
{
|
{
|
||||||
var12=dimHelper.instance.flipDoorMetadata(var12);
|
var12 = BlockRotator.transformMetadata(var12, 2, Block.doorWood.blockID);
|
||||||
}
|
}
|
||||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, var12,2);
|
par1World.setBlockMetadataWithNotify(par2, par3, par4, var12,2);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
|
|
||||||
public Point3D getEntranceDoorLocation()
|
public Point3D getEntranceDoorLocation()
|
||||||
{
|
{
|
||||||
return entranceDoorLocation;
|
return entranceDoorLocation.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
private DungeonSchematic()
|
private DungeonSchematic()
|
||||||
|
@ -102,7 +102,9 @@ public class DungeonSchematic extends Schematic {
|
||||||
MONOLITH_SPAWN_MARKER_ID, EXIT_DOOR_MARKER_ID);
|
MONOLITH_SPAWN_MARKER_ID, EXIT_DOOR_MARKER_ID);
|
||||||
applyFilter(finder);
|
applyFilter(finder);
|
||||||
|
|
||||||
orientation = (finder.getEntranceOrientation() + 2) & 3; //Flip the entrance's orientation to get the dungeon's orientation
|
//Flip the entrance's orientation to get the dungeon's orientation
|
||||||
|
orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Block.doorWood.blockID);
|
||||||
|
|
||||||
entranceDoorLocation = finder.getEntranceDoorLocation();
|
entranceDoorLocation = finder.getEntranceDoorLocation();
|
||||||
exitDoorLocations = finder.getExitDoorLocations();
|
exitDoorLocations = finder.getExitDoorLocations();
|
||||||
dimensionalDoorLocations = finder.getDimensionalDoorLocations();
|
dimensionalDoorLocations = finder.getDimensionalDoorLocations();
|
||||||
|
@ -195,7 +197,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
pocketPoint.setZ(dz);
|
pocketPoint.setZ(dz);
|
||||||
blockID = blocks[index];
|
blockID = blocks[index];
|
||||||
BlockRotator.transformPoint(pocketPoint, entranceDoorLocation, turnAngle, pocketCenter);
|
BlockRotator.transformPoint(pocketPoint, entranceDoorLocation, turnAngle, pocketCenter);
|
||||||
blockMeta = BlockRotator.transformMetadata(metadata[index], turnAngle + BlockRotator.NORTH_DOOR_METADATA, blockID);
|
blockMeta = BlockRotator.transformMetadata(metadata[index], turnAngle, blockID);
|
||||||
|
|
||||||
//In the future, we might want to make this more efficient by building whole chunks at a time
|
//In the future, we might want to make this more efficient by building whole chunks at a time
|
||||||
setBlockDirectly(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), blockID, blockMeta);
|
setBlockDirectly(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), blockID, blockMeta);
|
||||||
|
@ -353,7 +355,7 @@ public class DungeonSchematic extends Schematic {
|
||||||
sideLink.locXCoord,
|
sideLink.locXCoord,
|
||||||
sideLink.locYCoord,
|
sideLink.locYCoord,
|
||||||
sideLink.locZCoord,
|
sideLink.locZCoord,
|
||||||
dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation));
|
BlockRotator.transformMetadata(sideLink.linkOrientation, 2, Block.doorWood.blockID));
|
||||||
|
|
||||||
if (world.getBlockId(linkDestination.getX(), linkDestination.getY() - 3, linkDestination.getZ()) == properties.FabricBlockID)
|
if (world.getBlockId(linkDestination.getX(), linkDestination.getY() - 3, linkDestination.getZ()) == properties.FabricBlockID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,17 +35,15 @@ public class DungeonHelper
|
||||||
private static final String DEFAULT_DOWN_SCHEMATIC_PATH = "/schematics/core/simpleStairsDown.schematic";
|
private static final String DEFAULT_DOWN_SCHEMATIC_PATH = "/schematics/core/simpleStairsDown.schematic";
|
||||||
private static final String DEFAULT_ERROR_SCHEMATIC_PATH = "/schematics/core/somethingBroke.schematic";
|
private static final String DEFAULT_ERROR_SCHEMATIC_PATH = "/schematics/core/somethingBroke.schematic";
|
||||||
private static final String BUNDLED_DUNGEONS_LIST_PATH = "/schematics/schematics.txt";
|
private static final String BUNDLED_DUNGEONS_LIST_PATH = "/schematics/schematics.txt";
|
||||||
|
private static final String DUNGEON_CREATION_GUIDE_SOURCE_PATH = "/mods/DimDoors/text/How_to_add_dungeons.txt";
|
||||||
|
|
||||||
public static final String SCHEMATIC_FILE_EXTENSION = ".schematic";
|
public static final String SCHEMATIC_FILE_EXTENSION = ".schematic";
|
||||||
private static final int DEFAULT_DUNGEON_WEIGHT = 100;
|
private static final int DEFAULT_DUNGEON_WEIGHT = 100;
|
||||||
public static final int MAX_DUNGEON_WEIGHT = 10000; //Used to prevent overflows and math breaking down
|
public static final int MAX_DUNGEON_WEIGHT = 10000; //Used to prevent overflows and math breaking down
|
||||||
private static final int MAX_EXPORT_RADIUS = 50;
|
private static final int MAX_EXPORT_RADIUS = 50;
|
||||||
public static final short MAX_DUNGEON_WIDTH = 2 * MAX_EXPORT_RADIUS + 1;
|
public static final short MAX_DUNGEON_WIDTH = 2 * MAX_EXPORT_RADIUS + 1;
|
||||||
public static final short MAX_DUNGEON_HEIGHT = 2 * MAX_EXPORT_RADIUS + 1;
|
public static final short MAX_DUNGEON_HEIGHT = MAX_DUNGEON_WIDTH;
|
||||||
public static final short MAX_DUNGEON_LENGTH = 2 * MAX_EXPORT_RADIUS + 1;
|
public static final short MAX_DUNGEON_LENGTH = MAX_DUNGEON_WIDTH;
|
||||||
|
|
||||||
public static final int FABRIC_OF_REALITY_EXPORT_ID = 1973;
|
|
||||||
public static final int PERMAFABRIC_EXPORT_ID = 220;
|
|
||||||
|
|
||||||
private static final String HUB_DUNGEON_TYPE = "Hub";
|
private static final String HUB_DUNGEON_TYPE = "Hub";
|
||||||
private static final String TRAP_DUNGEON_TYPE = "Trap";
|
private static final String TRAP_DUNGEON_TYPE = "Trap";
|
||||||
|
@ -145,7 +143,7 @@ public class DungeonHelper
|
||||||
File file = new File(properties.CustomSchematicDirectory);
|
File file = new File(properties.CustomSchematicDirectory);
|
||||||
if (file.exists() || file.mkdir())
|
if (file.exists() || file.mkdir())
|
||||||
{
|
{
|
||||||
copyfile.copyFile("/mods/DimDoors/text/How_to_add_dungeons.txt", file.getAbsolutePath() + "/How_to_add_dungeons.txt");
|
copyfile.copyFile(DUNGEON_CREATION_GUIDE_SOURCE_PATH, file.getAbsolutePath() + "/How_to_add_dungeons.txt");
|
||||||
}
|
}
|
||||||
registerBundledDungeons();
|
registerBundledDungeons();
|
||||||
importCustomDungeons(properties.CustomSchematicDirectory);
|
importCustomDungeons(properties.CustomSchematicDirectory);
|
||||||
|
|
|
@ -42,7 +42,7 @@ import StevenDimDoors.mod_pocketDim.Point3D;
|
||||||
import StevenDimDoors.mod_pocketDim.SchematicLoader;
|
import StevenDimDoors.mod_pocketDim.SchematicLoader;
|
||||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic;
|
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
@ -92,44 +92,6 @@ public class dimHelper extends DimensionManager
|
||||||
public static final int DEFAULT_POCKET_SIZE = 39;
|
public static final int DEFAULT_POCKET_SIZE = 39;
|
||||||
public static final int DEFAULT_POCKET_WALL_THICKNESS = 5;
|
public static final int DEFAULT_POCKET_WALL_THICKNESS = 5;
|
||||||
public static final int MAX_WORLD_HEIGHT = 254;
|
public static final int MAX_WORLD_HEIGHT = 254;
|
||||||
//Stupid function I use because I don't understand bitwise operations yet. Used in door orientation
|
|
||||||
//TODO get rid of this
|
|
||||||
public int flipDoorMetadata(int data)
|
|
||||||
{
|
|
||||||
if(data==0)
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if(data==1)
|
|
||||||
{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
if(data==2)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if(data==3)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(data==4)
|
|
||||||
{
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
if(data==5)
|
|
||||||
{
|
|
||||||
return 7;
|
|
||||||
}
|
|
||||||
if(data==6)
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
if(data==7)
|
|
||||||
{
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
else return -10;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDimDepth(int DimID)
|
public int getDimDepth(int DimID)
|
||||||
{
|
{
|
||||||
|
@ -309,16 +271,20 @@ public class dimHelper extends DimensionManager
|
||||||
}
|
}
|
||||||
this.generateDoor(world,linkData);
|
this.generateDoor(world,linkData);
|
||||||
|
|
||||||
|
//FIXME: Why are we checking blockList.length? Not necessary. getBlockId() can't return an ID past the end of the block list.
|
||||||
|
//Plus even if the check is necessary, it's still wrong since it should be less than, not less than or equal to.
|
||||||
if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord+1,playerZCoord))
|
if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord+1,playerZCoord))
|
||||||
{
|
{
|
||||||
if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)].isOpaqueCube()&&!mod_pocketDim.blocksImmuneToRift.contains(entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)))
|
if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)].isOpaqueCube() &&
|
||||||
|
!mod_pocketDim.blockRift.isBlockImmune(entity.worldObj, playerXCoord+1,playerYCoord,playerZCoord))
|
||||||
{
|
{
|
||||||
entity.worldObj.setBlock(playerXCoord,playerYCoord+1,playerZCoord,0);
|
entity.worldObj.setBlock(playerXCoord,playerYCoord+1,playerZCoord,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord,playerZCoord))
|
if (Block.blocksList.length >= entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord,playerZCoord))
|
||||||
{
|
{
|
||||||
if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)].isOpaqueCube()&&!mod_pocketDim.blocksImmuneToRift.contains(entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)))
|
if(Block.blocksList[entity.worldObj.getBlockId(playerXCoord,playerYCoord,playerZCoord)].isOpaqueCube() &&
|
||||||
|
!mod_pocketDim.blockRift.isBlockImmune(entity.worldObj, playerXCoord,playerYCoord,playerZCoord))
|
||||||
{
|
{
|
||||||
entity.worldObj.setBlock(playerXCoord,playerYCoord,playerZCoord,0);
|
entity.worldObj.setBlock(playerXCoord,playerYCoord,playerZCoord,0);
|
||||||
}
|
}
|
||||||
|
@ -399,12 +365,12 @@ public class dimHelper extends DimensionManager
|
||||||
link.isLocPocket=locationDimData.isPocket;
|
link.isLocPocket=locationDimData.isPocket;
|
||||||
locationDimData.addLinkToDim(link);
|
locationDimData.addLinkToDim(link);
|
||||||
|
|
||||||
if(dimHelper.getWorld(link.locDimID)!=null)
|
World world = dimHelper.getWorld(link.locDimID);
|
||||||
|
if (world != null)
|
||||||
{
|
{
|
||||||
int blocktoReplace = dimHelper.getWorld(link.locDimID).getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
|
if (!mod_pocketDim.blockRift.isBlockImmune(world, link.locXCoord, link.locYCoord, link.locZCoord))
|
||||||
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
|
|
||||||
{
|
{
|
||||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
world.setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Notifies other players that a link has been created.
|
//Notifies other players that a link has been created.
|
||||||
|
@ -849,7 +815,7 @@ public class dimHelper extends DimensionManager
|
||||||
PacketHandler.onDimCreatedPacket(destDimData);
|
PacketHandler.onDimCreatedPacket(destDimData);
|
||||||
}
|
}
|
||||||
link = this.createLink(DimensionManager.getWorld(link.locDimID).provider.dimensionId,dimensionID,link.locXCoord,link.locYCoord,link.locZCoord, link.destXCoord,constrainPocketY(link.destYCoord),link.destZCoord,link.linkOrientation); //creates and registers the two rifts that link the parent and pocket dim.
|
link = this.createLink(DimensionManager.getWorld(link.locDimID).provider.dimensionId,dimensionID,link.locXCoord,link.locYCoord,link.locZCoord, link.destXCoord,constrainPocketY(link.destYCoord),link.destZCoord,link.linkOrientation); //creates and registers the two rifts that link the parent and pocket dim.
|
||||||
this.createLink(dimensionID,DimensionManager.getWorld(link.locDimID).provider.dimensionId, link.destXCoord,constrainPocketY(link.destYCoord),link.destZCoord, link.locXCoord,link.locYCoord,link.locZCoord, this.flipDoorMetadata(link.linkOrientation));
|
this.createLink(dimensionID,DimensionManager.getWorld(link.locDimID).provider.dimensionId, link.destXCoord,constrainPocketY(link.destYCoord),link.destZCoord, link.locXCoord,link.locYCoord,link.locZCoord, BlockRotator.transformMetadata(link.linkOrientation, 2, Block.doorWood.blockID));
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons;
|
import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandTeleportPlayer;
|
import StevenDimDoors.mod_pocketDim.commands.CommandTeleportPlayer;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.BlockRotationHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall;
|
import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall;
|
||||||
|
@ -104,12 +103,12 @@ public class 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 chaosDoor;
|
||||||
public static Block blockRift;
|
|
||||||
public static Block blockLimbo;
|
public static Block blockLimbo;
|
||||||
public static Block dimDoor;
|
public static Block dimDoor;
|
||||||
public static Block blockDimWall;
|
public static Block blockDimWall;
|
||||||
public static Block dimHatch;
|
public static Block dimHatch;
|
||||||
public static Block blockDimWallPerm;
|
public static Block blockDimWallPerm;
|
||||||
|
public static BlockRift blockRift;
|
||||||
|
|
||||||
public static Item itemRiftBlade;
|
public static Item itemRiftBlade;
|
||||||
public static Item itemDimDoor;
|
public static Item itemDimDoor;
|
||||||
|
@ -126,9 +125,7 @@ public class mod_pocketDim
|
||||||
public static PlayerRespawnTracker tracker;
|
public static PlayerRespawnTracker tracker;
|
||||||
|
|
||||||
public static HashMap<String,ArrayList<EntityItem>> limboSpawnInventory = new HashMap<String,ArrayList<EntityItem>>();
|
public static HashMap<String,ArrayList<EntityItem>> limboSpawnInventory = new HashMap<String,ArrayList<EntityItem>>();
|
||||||
|
|
||||||
public static ArrayList<Integer> blocksImmuneToRift = new ArrayList<Integer>();
|
|
||||||
|
|
||||||
public static boolean hasInitDims = false;
|
public static boolean hasInitDims = false;
|
||||||
public static boolean isPlayerWearingGoogles = false;
|
public static boolean isPlayerWearingGoogles = false;
|
||||||
|
|
||||||
|
@ -191,7 +188,7 @@ 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 = (new BlockRift(properties.RiftBlockID, 0, Material.air).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) );
|
chaosDoor = (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");
|
dimDoor = (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
|
||||||
|
@ -378,22 +375,7 @@ public class mod_pocketDim
|
||||||
" y ", "yxy", " y ", 'x', mod_pocketDim.itemLinkSignature, 'y', mod_pocketDim.itemStableFabric
|
" y ", "yxy", " y ", 'x', mod_pocketDim.itemLinkSignature, 'y', mod_pocketDim.itemStableFabric
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.FabricBlockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.PermaFabricBlockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.DimensionalDoorID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.WarpDoorID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.TransTrapdoorID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.UnstableDoorID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.RiftBlockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(properties.TransientDoorID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(Block.blockIron.blockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(Block.blockDiamond.blockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(Block.blockEmerald.blockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(Block.blockGold.blockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
|
||||||
mod_pocketDim.blocksImmuneToRift.add(Block.bedrock.blockID);
|
|
||||||
|
|
||||||
DungeonHelper.initialize();
|
DungeonHelper.initialize();
|
||||||
|
|
||||||
proxy.loadTextures();
|
proxy.loadTextures();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -43,27 +43,21 @@ public class RiftRegenerator implements IRegularTickReceiver {
|
||||||
//actually gets the random rift based on the size of the list
|
//actually gets the random rift based on the size of the list
|
||||||
link = (LinkData) dimHelper.instance.getRandomLinkData(true);
|
link = (LinkData) dimHelper.instance.getRandomLinkData(true);
|
||||||
|
|
||||||
if(link!=null)
|
if (link != null)
|
||||||
{
|
{
|
||||||
|
World world = dimHelper.getWorld(link.locDimID);
|
||||||
|
|
||||||
if (dimHelper.getWorld(link.locDimID)!=null)
|
if (world != null && !mod_pocketDim.blockRift.isBlockImmune(world, link.locXCoord, link.locYCoord, link.locZCoord))
|
||||||
{
|
{
|
||||||
World world = dimHelper.getWorld(link.locDimID);
|
if (dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID) != null)
|
||||||
|
|
||||||
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
|
|
||||||
|
|
||||||
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesn't replace a door or something
|
|
||||||
{
|
{
|
||||||
if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID) != null)
|
world.setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
||||||
|
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord);
|
||||||
|
if (rift == null)
|
||||||
{
|
{
|
||||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
dimHelper.getWorld(link.locDimID).setBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord, new TileEntityRift());
|
||||||
TileEntityRift rift = TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord));
|
|
||||||
if(rift == null)
|
|
||||||
{
|
|
||||||
dimHelper.getWorld(link.locDimID).setBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord, new TileEntityRift());
|
|
||||||
}
|
|
||||||
rift.hasGrownRifts=true;
|
|
||||||
}
|
}
|
||||||
|
rift.hasGrownRifts = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +65,7 @@ public class RiftRegenerator implements IRegularTickReceiver {
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
System.out.println("An exception occurred in RiftRegenerator.regenerate():");
|
System.err.println("An exception occurred in RiftRegenerator.regenerate():");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue