Initial rendering fix for rifts

This commit is contained in:
CannibalVox
2015-03-08 17:46:42 -05:00
parent 22654722b6
commit 4d26a2ec31
5 changed files with 184 additions and 176 deletions

View File

@@ -53,7 +53,7 @@ public class BlockRift extends Block implements ITileEntityProvider
private final ArrayList<Block> blocksImmuneToRift; // List of Vanilla blocks immune to rifts
private final ArrayList<Block> modBlocksImmuneToRift; // List of DD blocks immune to rifts
public BlockRift(int j, Material par2Material, DDProperties properties)
public BlockRift(Material par2Material, DDProperties properties)
{
super(par2Material);
this.setTickRandomly(true);
@@ -131,12 +131,8 @@ public class BlockRift extends Block implements ITileEntityProvider
public int getRenderType()
{
// This doesn't do anything yet
if (mod_pocketDim.isPlayerWearingGoogles)
{
return 0;
}
return 8;
}
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
@@ -320,11 +316,10 @@ public class BlockRift extends Block implements ITileEntityProvider
TileEntityRift tile = (TileEntityRift)world.getTileEntity(x, y, z);
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(world,x+.5, y+.5, z+.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

View File

@@ -140,8 +140,6 @@ public class mod_pocketDim
public static BiomeGenBase limboBiome;
public static BiomeGenBase pocketBiome;
public static boolean isPlayerWearingGoogles = false;
public static DDProperties properties;
public static DDWorldProperties worldProperties;
public static CustomLimboPopulator spawner; //Added this field temporarily. Will be refactored out later.
@@ -206,7 +204,7 @@ public class mod_pocketDim
blockDimWall = new BlockDimWall(0, Material.iron).setLightLevel(1.0F).setHardness(0.1F).setBlockName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(0, Material.iron)).setLightLevel(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setBlockName("blockDimWallPerm");
warpDoor = new WarpDoor(Material.wood, properties).setHardness(1.0F) .setBlockName("dimDoorWarp");
blockRift = (BlockRift) (new BlockRift(0, Material.air, properties).setHardness(1.0F) .setBlockName("rift"));
blockRift = (BlockRift) (new BlockRift(Material.fire, properties).setHardness(1.0F) .setBlockName("rift"));
blockLimbo = new BlockLimbo(15, Material.iron, properties.LimboDimensionID, limboDecay).setHardness(.2F).setBlockName("BlockLimbo").setLightLevel(.0F);
unstableDoor = (new UnstableDoor(Material.iron, properties).setHardness(.2F).setBlockName("chaosDoor").setLightLevel(.0F) );
dimensionalDoor = (DimensionalDoor) (new DimensionalDoor(Material.iron, properties).setHardness(1.0F).setResistance(2000.0F) .setBlockName("dimDoor"));

View File

@@ -289,22 +289,31 @@ public class TileEntityRift extends DDTileEntityBase
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
{
ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj));
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound link = new NBTTagCompound();
linkData.writeToNBT(tag);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
tag.setTag("Link", link);
}
return null;
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, tag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
NBTTagCompound tag = pkt.func_148857_g();
ClientLinkData linkData = ClientLinkData.readFromNBT(tag);
readFromNBT(tag);
if (tag.hasKey("Link")) {
ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link"));
PocketManager.getLinkWatcher().onCreated(linkData);
}
}
@Override
public float[] getRenderColor(Random rand)

View File

@@ -23,8 +23,6 @@ public class ClientProxy extends CommonProxy
//MinecraftForgeClient.preloadTexture(BLOCK_PNG);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDimDoor.class, new RenderDimDoor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTransTrapdoor.class, new RenderTransTrapdoor());
//This code activates the new rift rendering, as well as a bit of code in TileEntityRift
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRift.class, new RenderRift());
//MinecraftForgeClient.preloadTexture(RIFT2_PNG);
RenderingRegistry.registerEntityRenderingHandler(MobMonolith.class, new RenderMobObelisk(.5F));

View File

@@ -29,44 +29,10 @@ public class GoggleRiftFX extends EntityFireworkSparkFX
this.motionY = par10;
this.motionZ = par12;
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.particleScale *= 0.75F;
this.particleMaxAge = 40 + this.rand.nextInt(26);
this.noClip = true;
}
@Override
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float var8 = super.particleTextureIndexX % 16 / 16.0F;
float var9 = var8 + 0.0624375F;
float var10 = this.particleTextureIndexX / 16 / 16.0F;
float var11 = var10 + 0.0624375F;
float var12 = 0.1F * this.particleScale;
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
float var16 = .0F;
if (PocketManager.createDimensionData(worldObj).isPocketDimension())
{
var16 = .7F;
}
par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7);
par1Tessellator.addVertexWithUV(var13 - par3 * var12 - par6 * var12, var14 - par4 * var12, var15 - par5 * var12 - par7 * var12, var9, var11);
par1Tessellator.addVertexWithUV(var13 - par3 * var12 + par6 * var12, var14 + par4 * var12, var15 - par5 * var12 + par7 * var12, var9, var10);
par1Tessellator.addVertexWithUV(var13 + par3 * var12 + par6 * var12, var14 + par4 * var12, var15 + par5 * var12 + par7 * var12, var8, var10);
par1Tessellator.addVertexWithUV(var13 + par3 * var12 - par6 * var12, var14 - par4 * var12, var15 + par5 * var12 - par7 * var12, var8, var11);
}
public void func_92045_e(boolean par1)
{
@@ -113,8 +79,50 @@ public class GoggleRiftFX extends EntityFireworkSparkFX
return false;
}
@Override
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f6 = this.particleTextureIndexX / 16.0F;
float f7 = f6 + 0.0624375F;
float f8 = this.particleTextureIndexY / 16.0F;
float f9 = f8 + 0.0624375F;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ);
float f14 = 0F;
if (PocketManager.createDimensionData(worldObj).isPocketDimension())
{
f14 = 0.7F;
}
par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, (float) .7);
par1Tessellator.addVertexWithUV(f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9);
par1Tessellator.addVertexWithUV(f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8);
par1Tessellator.addVertexWithUV(f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8);
par1Tessellator.addVertexWithUV(f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9);
}
/**
* Called to update the entity's position/logic.
*/