Overhauled configuration properties
Moved all configuration variables from mod_pocketDim to DDProperties (formerly DimDoorsConfig). Changed property names to be clearer in config file, modified some comments, and generally cleaned up the config file. Fixed some missing properties and variables that were reading from the wrong properties. Modified the order in which mod_pocketDim instantiated some of its static fields so that they would load after properties are read. Almost all classes load after properties are read. Fixed indentation across various files and replaced references to properties in mod_pocketDim with references to DDProperties.
This commit is contained in:
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
@@ -16,83 +17,79 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BlockDimWallPerm extends Block
|
||||
{
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public BlockDimWallPerm(int i, int j, Material par2Material)
|
||||
{
|
||||
super(i, Material.ground);
|
||||
setTickRandomly(true);
|
||||
// this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
super(i, Material.ground);
|
||||
setTickRandomly(true);
|
||||
// this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2().replace("perm", ""));
|
||||
}
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||
|
||||
/**
|
||||
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
|
||||
*/
|
||||
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
|
||||
{
|
||||
if(!par1World.isRemote&&par1World.provider.dimensionId==mod_pocketDim.limboDimID)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
||||
LinkData link=dimHelper.instance.getRandomLinkData(false);
|
||||
if(link==null)
|
||||
{
|
||||
link =new LinkData(0,0,0,0);
|
||||
}
|
||||
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2().replace("perm", ""));
|
||||
}
|
||||
|
||||
if(dimHelper.getWorld(0)==null)
|
||||
{
|
||||
dimHelper.initDimension(0);
|
||||
}
|
||||
|
||||
|
||||
if(dimHelper.getWorld(0)!=null&&par5Entity instanceof EntityPlayer)
|
||||
{
|
||||
|
||||
|
||||
int x = (link.destXCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2);
|
||||
int z = (link.destZCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2);
|
||||
|
||||
x=x+(x>> 4); //make sure I am in the middle of a chunk, andnot on a boundry, so it doesnt load the chunk next to me
|
||||
z=z+(z>> 4);
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||
|
||||
|
||||
|
||||
int y = yCoordHelper.getFirstUncovered(0, x, 63, z);
|
||||
|
||||
//this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk
|
||||
dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0),
|
||||
EntityPlayer.class.cast(par5Entity));
|
||||
/**
|
||||
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
|
||||
*/
|
||||
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
|
||||
{
|
||||
if(!par1World.isRemote&&par1World.provider.dimensionId==properties.LimboDimensionID)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
||||
|
||||
EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z );
|
||||
LinkData link=dimHelper.instance.getRandomLinkData(false);
|
||||
if(link==null)
|
||||
{
|
||||
link =new LinkData(0,0,0,0);
|
||||
}
|
||||
|
||||
//makes sure they can breath when they teleport
|
||||
dimHelper.getWorld(0).setBlock(x, y, z, 0);
|
||||
int i=x;
|
||||
int j=y-1;
|
||||
int k=z;
|
||||
|
||||
|
||||
for(int xc=-3;xc<4;xc++)
|
||||
|
||||
if(dimHelper.getWorld(0)==null)
|
||||
{
|
||||
dimHelper.initDimension(0);
|
||||
}
|
||||
|
||||
|
||||
if(dimHelper.getWorld(0)!=null&&par5Entity instanceof EntityPlayer)
|
||||
{
|
||||
|
||||
|
||||
int x = (link.destXCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2);
|
||||
int z = (link.destZCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2);
|
||||
|
||||
//make sure I am in the middle of a chunk, and not on a boundary, so it doesn't load the chunk next to me
|
||||
x = x + (x >> 4);
|
||||
z = z + (z >> 4);
|
||||
|
||||
int y = yCoordHelper.getFirstUncovered(0, x, 63, z);
|
||||
|
||||
//this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk
|
||||
dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0),
|
||||
EntityPlayer.class.cast(par5Entity));
|
||||
|
||||
|
||||
EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z );
|
||||
|
||||
//makes sure they can breath when they teleport
|
||||
dimHelper.getWorld(0).setBlock(x, y, z, 0);
|
||||
int i=x;
|
||||
int j=y-1;
|
||||
int k=z;
|
||||
|
||||
|
||||
for(int xc=-3;xc<4;xc++)
|
||||
{
|
||||
for(int zc=-3;zc<4;zc++)
|
||||
{
|
||||
@@ -100,15 +97,15 @@ public class BlockDimWallPerm extends Block
|
||||
{
|
||||
if(yc==0)
|
||||
{
|
||||
|
||||
|
||||
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
|
||||
{
|
||||
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, mod_pocketDim.blockLimboID);
|
||||
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, properties.LimboBlockID);
|
||||
}
|
||||
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
|
||||
|
||||
{
|
||||
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, mod_pocketDim.blockLimboID,2,0);
|
||||
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, properties.LimboBlockID,2,0);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -117,15 +114,15 @@ public class BlockDimWallPerm extends Block
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.PacketHandler;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -24,23 +25,23 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockRift extends BlockContainer
|
||||
{
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public BlockRift(int i, int j, Material par2Material)
|
||||
{
|
||||
super(i, Material.air);
|
||||
setTickRandomly(true);
|
||||
// this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
this.setLightOpacity(14);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
super(i, Material.air);
|
||||
setTickRandomly(true);
|
||||
// this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
this.setLightOpacity(14);
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
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)
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
@@ -52,250 +53,250 @@ public class BlockRift extends BlockContainer
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
// this.updateTick(par1World, par2, par3, par4, new Random());
|
||||
|
||||
// this.updateTick(par1World, par2, par3, par4, new Random());
|
||||
|
||||
}
|
||||
public boolean isCollidable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean isCollidable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
|
||||
*/
|
||||
public boolean canCollideCheck(int par1, boolean par2)
|
||||
{
|
||||
|
||||
return par2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//this doesnt do anything yet.
|
||||
public int getRenderType()
|
||||
{
|
||||
if(mod_pocketDim.isPlayerWearingGoogles)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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
|
||||
* coordinates. Args: blockAccess, x, y, z, side
|
||||
*/
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
//function that regulates how many blocks it eats/ how fast it eates them.
|
||||
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&&mod_pocketDim.enableRiftGrief)
|
||||
{
|
||||
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z);
|
||||
if(rift.isNearRift)
|
||||
{
|
||||
|
||||
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++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand)
|
||||
{
|
||||
|
||||
int count;
|
||||
//growth in the direction towards the nearby rift
|
||||
float xGrowth=0;
|
||||
float yGrowth=0;
|
||||
float zGrowth=0;
|
||||
//growth away from the nearby rift
|
||||
float xGrowthn=0;
|
||||
float yGrowthn=0;
|
||||
float zGrowthn=0;
|
||||
//how far the particles are away from original rift. Used to decrease noise the farther they are away.
|
||||
float xChange = 0;
|
||||
float yChange = 0;
|
||||
float zChange = 0;
|
||||
|
||||
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 Yoffset=0;
|
||||
float Zoffset=0;
|
||||
for (count = 0; count < 12 && tile!=null; ++count)
|
||||
{
|
||||
//TODO change to a switch statement for clarity
|
||||
if(tile.xOffset>0)
|
||||
{
|
||||
if(rand.nextInt(tile.xOffset)==0)
|
||||
{
|
||||
xGrowth =xGrowth+.15F*tile.xOffset;
|
||||
|
||||
}
|
||||
}
|
||||
else if(tile.xOffset<0)
|
||||
{
|
||||
if(rand.nextInt(-tile.xOffset)==0)
|
||||
{
|
||||
xGrowthn =xGrowthn-.15F*-tile.xOffset;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(tile.yOffset>0)
|
||||
{
|
||||
if(rand.nextInt(tile.yOffset)==0)
|
||||
{
|
||||
yGrowth =yGrowth+.15F*tile.yOffset;
|
||||
|
||||
}
|
||||
}
|
||||
else if(tile.yOffset<0)
|
||||
{
|
||||
if(rand.nextInt(-tile.yOffset)==0)
|
||||
{
|
||||
yGrowthn =yGrowthn-.15F*-tile.yOffset;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(tile.zOffset>0)
|
||||
{
|
||||
if(rand.nextInt(tile.zOffset)==0)
|
||||
{
|
||||
zGrowth =zGrowth+.15F*tile.zOffset;
|
||||
|
||||
}
|
||||
}
|
||||
else if(tile.zOffset<0)
|
||||
{
|
||||
if(rand.nextInt(-tile.zOffset)==0)
|
||||
{
|
||||
zGrowthn =zGrowthn-.15F*-tile.zOffset;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xChange=(float) ((xGrowth+xGrowthn)+rand.nextGaussian()*.05F);
|
||||
yChange=(float) ((yGrowth+yGrowthn)+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))));
|
||||
|
||||
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
|
||||
Zoffset= (float) ((0.25F/(1+Math.abs(zChange))));
|
||||
|
||||
|
||||
|
||||
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5+xChange+Xoffset*rand.nextGaussian(), par3+.5+yChange+Yoffset*rand.nextGaussian() , par4+.5+zChange+Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5-xChange-Xoffset*rand.nextGaussian(), par3+.5-yChange-Yoffset*rand.nextGaussian() , par4+.5-zChange-Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
||||
|
||||
|
||||
if(rand.nextBoolean())
|
||||
{
|
||||
//renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles.
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
}
|
||||
if(tile.shouldClose)
|
||||
{
|
||||
//renders an opposite color effect if it is being closed by the rift remover
|
||||
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 int idPicked(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
|
||||
*/
|
||||
public boolean canCollideCheck(int par1, boolean par2)
|
||||
{
|
||||
|
||||
return par2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//this doesnt do anything yet.
|
||||
public int getRenderType()
|
||||
{
|
||||
if(mod_pocketDim.isPlayerWearingGoogles)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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
|
||||
* coordinates. Args: blockAccess, x, y, z, side
|
||||
*/
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
//function that regulates how many blocks it eats/ how fast it eates them.
|
||||
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)
|
||||
{
|
||||
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z);
|
||||
if(rift.isNearRift)
|
||||
{
|
||||
|
||||
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++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand)
|
||||
{
|
||||
|
||||
int count;
|
||||
//growth in the direction towards the nearby rift
|
||||
float xGrowth=0;
|
||||
float yGrowth=0;
|
||||
float zGrowth=0;
|
||||
//growth away from the nearby rift
|
||||
float xGrowthn=0;
|
||||
float yGrowthn=0;
|
||||
float zGrowthn=0;
|
||||
//how far the particles are away from original rift. Used to decrease noise the farther they are away.
|
||||
float xChange = 0;
|
||||
float yChange = 0;
|
||||
float zChange = 0;
|
||||
|
||||
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 Yoffset=0;
|
||||
float Zoffset=0;
|
||||
for (count = 0; count < 12 && tile!=null; ++count)
|
||||
{
|
||||
//TODO change to a switch statement for clarity
|
||||
if(tile.xOffset>0)
|
||||
{
|
||||
if(rand.nextInt(tile.xOffset)==0)
|
||||
{
|
||||
xGrowth =xGrowth+.15F*tile.xOffset;
|
||||
|
||||
}
|
||||
}
|
||||
else if(tile.xOffset<0)
|
||||
{
|
||||
if(rand.nextInt(-tile.xOffset)==0)
|
||||
{
|
||||
xGrowthn =xGrowthn-.15F*-tile.xOffset;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(tile.yOffset>0)
|
||||
{
|
||||
if(rand.nextInt(tile.yOffset)==0)
|
||||
{
|
||||
yGrowth =yGrowth+.15F*tile.yOffset;
|
||||
|
||||
}
|
||||
}
|
||||
else if(tile.yOffset<0)
|
||||
{
|
||||
if(rand.nextInt(-tile.yOffset)==0)
|
||||
{
|
||||
yGrowthn =yGrowthn-.15F*-tile.yOffset;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(tile.zOffset>0)
|
||||
{
|
||||
if(rand.nextInt(tile.zOffset)==0)
|
||||
{
|
||||
zGrowth =zGrowth+.15F*tile.zOffset;
|
||||
|
||||
}
|
||||
}
|
||||
else if(tile.zOffset<0)
|
||||
{
|
||||
if(rand.nextInt(-tile.zOffset)==0)
|
||||
{
|
||||
zGrowthn =zGrowthn-.15F*-tile.zOffset;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xChange=(float) ((xGrowth+xGrowthn)+rand.nextGaussian()*.05F);
|
||||
yChange=(float) ((yGrowth+yGrowthn)+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))));
|
||||
|
||||
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
|
||||
Zoffset= (float) ((0.25F/(1+Math.abs(zChange))));
|
||||
|
||||
|
||||
|
||||
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5+xChange+Xoffset*rand.nextGaussian(), par3+.5+yChange+Yoffset*rand.nextGaussian() , par4+.5+zChange+Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5-xChange-Xoffset*rand.nextGaussian(), par3+.5-yChange-Yoffset*rand.nextGaussian() , par4+.5-zChange-Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
|
||||
|
||||
if(rand.nextBoolean())
|
||||
{
|
||||
//renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles.
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
|
||||
}
|
||||
if(tile.shouldClose)
|
||||
{
|
||||
//renders an opposite color effect if it is being closed by the rift remover
|
||||
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 int idPicked(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
|
||||
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return new TileEntityRift();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
@@ -28,12 +29,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class ChaosDoor extends dimDoor
|
||||
{
|
||||
private Icon blockIconBottom;
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public ChaosDoor(int par1, Material material)
|
||||
{
|
||||
super(par1, Material.iron);
|
||||
// this.blockIndexInTexture = 18;
|
||||
|
||||
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
@@ -74,7 +76,7 @@ public class ChaosDoor extends dimDoor
|
||||
|
||||
if(newDim)
|
||||
{
|
||||
LinkData link = new LinkData(par1World.provider.dimensionId, mod_pocketDim.limboDimID, par2, par3, par4, par2, par3+500, par4, false,0);
|
||||
LinkData link = new LinkData(par1World.provider.dimensionId, properties.LimboDimensionID, par2, par3, par4, par2, par3+500, par4, false,0);
|
||||
link.linkOrientation= par1World.getBlockMetadata(par2, par3-1, par4);
|
||||
dimHelper.instance.createLink(link);
|
||||
// System.out.println(link.linkOrientation);
|
||||
@@ -101,9 +103,8 @@ public class ChaosDoor extends dimDoor
|
||||
int var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
|
||||
|
||||
int num = par1World.getBlockMetadata(par2, par3-1, par4);
|
||||
if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.chaosDoorID)
|
||||
if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==properties.UnstableDoorID)
|
||||
{
|
||||
|
||||
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
||||
|
||||
boolean foundRandomDest=false;
|
||||
@@ -122,7 +123,7 @@ public class ChaosDoor extends dimDoor
|
||||
if(link!=null)
|
||||
{
|
||||
|
||||
if(!link.isLocPocket&&link.linkOrientation!=-10&&link.destDimID!=mod_pocketDim.limboDimID)
|
||||
if(!link.isLocPocket&&link.linkOrientation!=-10&&link.destDimID!=properties.LimboDimensionID)
|
||||
{
|
||||
foundRandomDest=true;
|
||||
|
||||
@@ -132,7 +133,7 @@ public class ChaosDoor extends dimDoor
|
||||
{
|
||||
if(dimHelper.getWorld(link.locDimID).isAirBlock(link.locXCoord,link.locYCoord,link.locZCoord))
|
||||
{
|
||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord,link.locYCoord,link.locZCoord, mod_pocketDim.blockRiftID);
|
||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord,link.locYCoord,link.locZCoord, properties.RiftBlockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
@@ -34,9 +35,11 @@ public class dimDoor extends BlockContainer
|
||||
super(par1, Material.iron);
|
||||
// this.blockIndexInTexture = 18;
|
||||
|
||||
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
@@ -56,19 +59,19 @@ public class dimDoor extends BlockContainer
|
||||
if(dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World)!=null)
|
||||
{
|
||||
LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World);
|
||||
par1World.setBlock(par2, par3, par4, mod_pocketDim.blockRiftID);
|
||||
par1World.setBlock(par2, par3, par4, properties.RiftBlockID);
|
||||
|
||||
}
|
||||
if(dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World)!=null)
|
||||
{
|
||||
LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World);
|
||||
par1World.setBlock(par2, par3-1, par4, mod_pocketDim.blockRiftID);
|
||||
par1World.setBlock(par2, par3-1, par4, properties.RiftBlockID);
|
||||
|
||||
}
|
||||
if(dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World)!=null)
|
||||
{
|
||||
LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World);
|
||||
par1World.setBlock(par2, par3+1, par4, mod_pocketDim.blockRiftID);
|
||||
par1World.setBlock(par2, par3+1, par4, properties.RiftBlockID);
|
||||
|
||||
}
|
||||
|
||||
@@ -546,7 +549,7 @@ public class dimDoor extends BlockContainer
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, mod_pocketDim.dimDoorID, 0);
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, properties.DimensionalDoorID, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user