Natalie's NEI-breaking bug fix #70
@@ -12,10 +12,15 @@ import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
|||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
|
||||||
|
import net.minecraft.entity.DataWatcher;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.entity.monster.EntityEnderman;
|
import net.minecraft.entity.monster.EntityEnderman;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import net.minecraft.network.packet.Packet130UpdateSign;
|
||||||
|
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||||
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.util.MathHelper;
|
||||||
@@ -36,10 +41,11 @@ public class TileEntityRift extends TileEntity
|
|||||||
|
|
||||||
public HashMap<Integer, double[]> renderingCenters = new HashMap<Integer, double[]>();
|
public HashMap<Integer, double[]> renderingCenters = new HashMap<Integer, double[]>();
|
||||||
public LinkData nearestRiftData;
|
public LinkData nearestRiftData;
|
||||||
Random rand = new Random();
|
Random rand;
|
||||||
|
DataWatcher watcher = new DataWatcher();
|
||||||
|
|
||||||
|
|
||||||
public float age = 0;
|
public int age = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -128,12 +134,19 @@ public class TileEntityRift extends TileEntity
|
|||||||
}
|
}
|
||||||
public void updateEntity()
|
public void updateEntity()
|
||||||
{
|
{
|
||||||
|
if(rand == null)
|
||||||
if(rand.nextInt(10)==0)
|
|
||||||
{
|
{
|
||||||
|
rand = new Random();
|
||||||
|
rand.setSeed(this.xCoord+this.yCoord+this.zCoord);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(rand.nextInt(15) == 1)
|
||||||
|
{
|
||||||
|
|
||||||
age = age + 1;
|
age = age + 1;
|
||||||
this.calculateNextRenderQuad(age, rand);
|
this.calculateNextRenderQuad(age, rand);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.clearBlocksOnRift();
|
this.clearBlocksOnRift();
|
||||||
this.spawnEndermen();
|
this.spawnEndermen();
|
||||||
@@ -158,7 +171,13 @@ public class TileEntityRift extends TileEntity
|
|||||||
}
|
}
|
||||||
public void calculateNextRenderQuad(float age, Random rand)
|
public void calculateNextRenderQuad(float age, Random rand)
|
||||||
{
|
{
|
||||||
int iteration = MathHelper.floor_double((Math.log(Math.pow(age+1,1.5))));
|
int maxSize = MathHelper.floor_double((Math.log(Math.pow(age+1,2))));
|
||||||
|
int iteration=0;
|
||||||
|
while(iteration< maxSize)
|
||||||
|
{
|
||||||
|
iteration++;
|
||||||
|
|
||||||
|
|
||||||
double fl =Math.log(iteration+1)/(iteration);
|
double fl =Math.log(iteration+1)/(iteration);
|
||||||
double[] coords= new double[4];
|
double[] coords= new double[4];
|
||||||
double noise = ((rand.nextGaussian())/(2+iteration/3+1));
|
double noise = ((rand.nextGaussian())/(2+iteration/3+1));
|
||||||
@@ -181,7 +200,7 @@ public class TileEntityRift extends TileEntity
|
|||||||
|
|
||||||
}
|
}
|
||||||
this.renderingCenters.put(iteration-1,coords);
|
this.renderingCenters.put(iteration-1,coords);
|
||||||
|
iteration--;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!this.renderingCenters.containsKey(iteration))
|
else if(!this.renderingCenters.containsKey(iteration))
|
||||||
@@ -207,6 +226,8 @@ public class TileEntityRift extends TileEntity
|
|||||||
this.renderingCenters.put(iteration,coords);
|
this.renderingCenters.put(iteration,coords);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,57 +239,47 @@ public class TileEntityRift extends TileEntity
|
|||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
|
super.readFromNBT(nbt);
|
||||||
int i = nbt.getInteger(("Size"));
|
this.renderingCenters= new HashMap<Integer, double[]>();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.count=nbt.getInteger("count");
|
this.count=nbt.getInteger("count");
|
||||||
this.count2=nbt.getInteger("count2");
|
this.count2=nbt.getInteger("count2");
|
||||||
|
this.age=nbt.getInteger("age");
|
||||||
this.shouldClose=nbt.getBoolean("shouldClose");
|
this.shouldClose=nbt.getBoolean("shouldClose");
|
||||||
this.age=nbt.getFloat("age");
|
|
||||||
for(int key=0; key<=nbt.getInteger("hashMapSize");key++)
|
|
||||||
{
|
|
||||||
double[] coords = new double[4];
|
|
||||||
|
|
||||||
coords[0]= nbt.getDouble(key+"+0");
|
|
||||||
coords[1]= nbt.getDouble(key+"+1");
|
|
||||||
coords[2]= nbt.getDouble(key+"+2");
|
|
||||||
coords[3]= nbt.getDouble(key+"+3");
|
|
||||||
|
|
||||||
this.renderingCenters.put(key, coords);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
super.readFromNBT(nbt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbt)
|
public void writeToNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
int i = 0;
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
|
|
||||||
for(Integer key:this.renderingCenters.keySet())
|
|
||||||
{
|
|
||||||
nbt.setDouble(key+"+0", this.renderingCenters.get(key)[0]);
|
|
||||||
nbt.setDouble(key+"+1", this.renderingCenters.get(key)[1]);
|
|
||||||
nbt.setDouble(key+"+2", this.renderingCenters.get(key)[2]);
|
|
||||||
nbt.setDouble(key+"+3", this.renderingCenters.get(key)[3]);
|
|
||||||
}
|
|
||||||
nbt.setInteger("hashMapSize", this.renderingCenters.size());
|
nbt.setInteger("hashMapSize", this.renderingCenters.size());
|
||||||
|
nbt.setInteger("age", this.age);
|
||||||
nbt.setInteger("count", this.count);
|
nbt.setInteger("count", this.count);
|
||||||
nbt.setInteger("count2", this.count2);
|
nbt.setInteger("count2", this.count2);
|
||||||
nbt.setFloat("age", this.age);
|
|
||||||
|
|
||||||
nbt.setBoolean("shouldClose", this.shouldClose);
|
nbt.setBoolean("shouldClose", this.shouldClose);
|
||||||
super.writeToNBT(nbt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet getDescriptionPacket() {
|
||||||
|
Packet132TileEntityData packet = new Packet132TileEntityData();
|
||||||
|
packet.actionType = 0;
|
||||||
|
packet.xPosition = xCoord;
|
||||||
|
packet.yPosition = yCoord;
|
||||||
|
packet.zPosition = zCoord;
|
||||||
|
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
writeToNBT(nbt);
|
||||||
|
packet.customParam1 = nbt;
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) {
|
||||||
|
readFromNBT(pkt.customParam1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class BlockRift extends BlockContainer
|
|||||||
if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE &&
|
if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE &&
|
||||||
((TileEntityRift) world.getBlockTileEntity(x, y, z)).isNearRift )
|
((TileEntityRift) world.getBlockTileEntity(x, y, z)).isNearRift )
|
||||||
{
|
{
|
||||||
destroyNearbyBlocks(world, x, y, z, random);
|
// destroyNearbyBlocks(world, x, y, z, random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||||||
//GL11.glLogicOp(GL11.GL_INVERT);
|
//GL11.glLogicOp(GL11.GL_INVERT);
|
||||||
// GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
// GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
||||||
|
|
||||||
GL11.glColor4f(.15F, .15F, .15F, 1F);
|
GL11.glColor4f(.3F, .3F, .3F, 1F);
|
||||||
|
|
||||||
GL11.glEnable(GL_BLEND);
|
GL11.glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
|
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
|
||||||
@@ -76,7 +76,7 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
double[] coords = quads.get(i);
|
double[] coords = quads.get(i);
|
||||||
double width=Math.log(Math.pow(quads.size(),2-i/2)+1)/14;
|
double width=Math.log(Math.pow(quads.size(),2-Math.log(i+1))+1)/14;
|
||||||
if(coords[3]==0)
|
if(coords[3]==0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public class RenderRift extends TileEntitySpecialRenderer
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
double[] coords = quads.get(i);
|
double[] coords = quads.get(i);
|
||||||
double width=Math.log(Math.pow(quads.size(),2-i/2)+1)/14;
|
double width=Math.log(Math.pow(quads.size(),2-Math.log(i+1))+1)/14;
|
||||||
if(coords[3]==0)
|
if(coords[3]==0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user