rift rendering work
Getting closer- still need to sync client and server
This commit is contained in:
parent
69e32aa1fb
commit
2e833b55c3
2 changed files with 29 additions and 20 deletions
|
@ -7,6 +7,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BlockRift;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||
|
@ -53,9 +54,16 @@ public class TileEntityRift extends TileEntity
|
|||
int x = MathHelper.floor_double(coord[0]+.5);
|
||||
int y = MathHelper.floor_double(coord[1]+.5);
|
||||
int z = MathHelper.floor_double(coord[2]+.5);
|
||||
this.worldObj.setBlockToAir(this.xCoord+x, this.yCoord+y, this.zCoord+z);
|
||||
|
||||
this.worldObj.setBlockToAir(this.xCoord-x, this.yCoord+y, this.zCoord-z);
|
||||
if(!BlockRift.isBlockImmune(worldObj,this.xCoord+x, this.yCoord+y, this.zCoord+z))
|
||||
{
|
||||
this.worldObj.setBlockToAir(this.xCoord+x, this.yCoord+y, this.zCoord+z);
|
||||
}
|
||||
|
||||
if(!BlockRift.isBlockImmune(worldObj,this.xCoord-x, this.yCoord-y, this.zCoord-z))
|
||||
{
|
||||
this.worldObj.setBlockToAir(this.xCoord-x, this.yCoord-y, this.zCoord-z);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +85,9 @@ public class TileEntityRift extends TileEntity
|
|||
{
|
||||
|
||||
|
||||
EntityEnderman enderman = new EntityEnderman(worldObj);
|
||||
enderman.setLocationAndAngles(this.xCoord+.5, this.yCoord-1, this.zCoord+.5, 5, 6);
|
||||
worldObj.spawnEntityInWorld(enderman);
|
||||
EntityEnderman creeper = new EntityEnderman(worldObj);
|
||||
creeper.setLocationAndAngles(this.xCoord+.5, this.yCoord-1, this.zCoord+.5, 5, 6);
|
||||
worldObj.spawnEntityInWorld(creeper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,21 +161,21 @@ public class TileEntityRift extends TileEntity
|
|||
int iteration = MathHelper.floor_double((Math.log(Math.pow(age+1,1.5))));
|
||||
double fl =Math.log(iteration+1)/(iteration);
|
||||
double[] coords= new double[4];
|
||||
double noise = ((rand.nextGaussian())/(10)*(iteration+1));
|
||||
double noise = ((rand.nextGaussian())/(2+iteration/3+1));
|
||||
|
||||
if(!this.renderingCenters.containsKey(iteration-1))
|
||||
{
|
||||
if(rand.nextBoolean())
|
||||
{
|
||||
coords[0] = fl*1.5;
|
||||
coords[1] = rand.nextGaussian()/10;
|
||||
coords[1] = rand.nextGaussian()/5;
|
||||
coords[2] = 0;
|
||||
coords[3] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
coords[0] = 0;
|
||||
coords[1] = rand.nextGaussian()/10;
|
||||
coords[1] = rand.nextGaussian()/5;
|
||||
coords[2] = fl*1.5;
|
||||
coords[3] = 0;
|
||||
|
||||
|
@ -181,7 +189,7 @@ public class TileEntityRift extends TileEntity
|
|||
if(this.renderingCenters.get(iteration-1)[3]==0)
|
||||
{
|
||||
coords[0]=noise/2+this.renderingCenters.get(iteration-1)[0];
|
||||
coords[1]=noise+this.renderingCenters.get(iteration-1)[1];
|
||||
coords[1]=noise/2+this.renderingCenters.get(iteration-1)[1];
|
||||
coords[2]= this.renderingCenters.get(iteration-1)[2]+fl;
|
||||
coords[3] = 0;
|
||||
|
||||
|
@ -189,7 +197,7 @@ public class TileEntityRift extends TileEntity
|
|||
else
|
||||
{
|
||||
coords[0]=this.renderingCenters.get(iteration-1)[0]+fl;
|
||||
coords[1]=noise+this.renderingCenters.get(iteration-1)[1];
|
||||
coords[1]=noise/2+this.renderingCenters.get(iteration-1)[1];
|
||||
coords[2]=noise/2+this.renderingCenters.get(iteration-1)[2];
|
||||
coords[3] = 1;
|
||||
|
||||
|
@ -210,7 +218,7 @@ public class TileEntityRift extends TileEntity
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
int i = nbt.getInteger(("Size"));
|
||||
|
||||
try
|
||||
|
@ -239,13 +247,14 @@ public class TileEntityRift extends TileEntity
|
|||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
super.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
int i = 0;
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
for(Integer key:this.renderingCenters.keySet())
|
||||
{
|
||||
|
@ -260,6 +269,6 @@ public class TileEntityRift extends TileEntity
|
|||
nbt.setFloat("age", this.age);
|
||||
|
||||
nbt.setBoolean("shouldClose", this.shouldClose);
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||
//GL11.glLogicOp(GL11.GL_INVERT);
|
||||
// GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
||||
|
||||
GL11.glColor4f(.3F, .3F, .3F, .2F);
|
||||
GL11.glColor4f(.15F, .15F, .15F, 1F);
|
||||
|
||||
GL11.glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
|
||||
|
@ -67,8 +67,8 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||
{
|
||||
GL11.glBegin(GL11.GL_QUAD_STRIP);
|
||||
|
||||
drawVertex(xWorld+.5, yWorld-Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld+Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld-Math.log(Math.pow(quads.size(),2)+1)/14, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld+Math.log(Math.pow(quads.size(),2)+1)/14, zWorld+.5);
|
||||
for(int i = 0;;i++)
|
||||
{
|
||||
if(!quads.containsKey(i))
|
||||
|
@ -76,7 +76,7 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||
break;
|
||||
}
|
||||
double[] coords = quads.get(i);
|
||||
double width=Math.log(quads.size()-i+1)/8;
|
||||
double width=Math.log(Math.pow(quads.size(),2-i/2)+1)/14;
|
||||
if(coords[3]==0)
|
||||
{
|
||||
|
||||
|
@ -128,8 +128,8 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||
{
|
||||
GL11.glBegin(GL11.GL_QUAD_STRIP);
|
||||
|
||||
drawVertex(xWorld+.5, yWorld+Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld-Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld+Math.log(Math.pow(quads.size(),2)+1)/14, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld-Math.log(Math.pow(quads.size(),2)+1)/14, zWorld+.5);
|
||||
for(int i = 0;;i++)
|
||||
{
|
||||
if(!quads.containsKey(i))
|
||||
|
@ -137,7 +137,7 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||
break;
|
||||
}
|
||||
double[] coords = quads.get(i);
|
||||
double width=Math.log(quads.size()-i+1)/8;
|
||||
double width=Math.log(Math.pow(quads.size(),2-i/2)+1)/14;
|
||||
if(coords[3]==0)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in a new issue