mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-10-26 14:24:40 +00:00
Fixed rendering of Zombie Gen bubbles and fluid plus fixed which pass facades are rendered in.
This commit is contained in:
1 parent
26c8cf6c76
commit
e2b1f6f4ca
7 files changed
+96
-26
No files matched your search
@@ -154,9 +154,11 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
|
||||
} else if(facadeId != null) {
|
||||
bundle.setFacadeRenderAs(FacadeRenderState.FULL);
|
||||
res = !facadeId.isOpaqueCube();
|
||||
boolean isFacadeOpaque = facadeId.isOpaqueCube();
|
||||
res = !isFacadeOpaque;
|
||||
|
||||
if(BlockConduitBundle.theRenderPass == 1) {
|
||||
if((isFacadeOpaque && BlockConduitBundle.theRenderPass == 0) ||
|
||||
(!isFacadeOpaque && BlockConduitBundle.theRenderPass == 1)) {
|
||||
IBlockAccess origBa = rb.blockAccess;
|
||||
rb.blockAccess = new FacadeAccessWrapper(origBa);
|
||||
try {
|
||||
|
||||
@@ -295,6 +295,7 @@ public abstract class AbstractMachineBlock<T extends AbstractMachineEntity> exte
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// If active, randomly throw some smoke around
|
||||
|
||||
+17
-16
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
@@ -121,23 +122,23 @@ public class BlockZombieGenerator extends AbstractMachineBlock<TileZombieGenerat
|
||||
return "enderio:stirlingGenFrontOff";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
if(rand.nextInt(3) == 0) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileZombieGenerator && ((TileZombieGenerator) te).isActive()) {
|
||||
//see RenderGlobal.doSpawnParticle
|
||||
for (int i = 0; i < 2; i++) {
|
||||
float xOffset = 0.5f + (world.rand.nextFloat() * 2.0F - 1.0F) * 0.125f;
|
||||
float xOffset = 0.5f + (world.rand.nextFloat() * 2.0F - 1.0F) * 0.3f;
|
||||
float yOffset = 0.1f;
|
||||
float zOffset = 0.5f + (world.rand.nextFloat() * 2.0F - 1.0F) * 0.125f;
|
||||
|
||||
EntityFX fx = Minecraft.getMinecraft().renderGlobal.doSpawnParticle("bubble", x + xOffset, y + yOffset, z + zOffset, -0.1D, 0.5D, 0.0D);
|
||||
if(fx != null) {
|
||||
fx.setRBGColorF(0.4f, 0.4f, 0.1f);
|
||||
}
|
||||
|
||||
float zOffset = 0.5f + (world.rand.nextFloat() * 2.0F - 1.0F) * 0.3f;
|
||||
|
||||
EntityFX fx = new BubbleFX(world, x + xOffset, y + yOffset, z + zOffset, 0, 0.5, 0);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
|
||||
}
|
||||
|
||||
if(Config.machineSoundsEnabled) {
|
||||
float volume = (Config.machineSoundVolume * 0.045f);
|
||||
world.playSound(x + 0.5, y + 1, z + 0.5, EnderIO.MODID + ":generator.zombie.bubble", volume, world.rand.nextFloat() * 0.75f, false);
|
||||
@@ -145,13 +146,13 @@ public class BlockZombieGenerator extends AbstractMachineBlock<TileZombieGenerat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileZombieGenerator) {
|
||||
tooltip.add(((TileZombieGenerator)te).getFluidStored(ForgeDirection.UNKNOWN) + " mB");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te != null && te instanceof TileZombieGenerator) {
|
||||
tooltip.add(((TileZombieGenerator) te).getFluidStored(ForgeDirection.UNKNOWN) + " mB");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package crazypants.enderio.machine.generator.zombie;
|
||||
|
||||
import net.minecraft.client.particle.EntityBubbleFX;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BubbleFX extends EntityBubbleFX {
|
||||
|
||||
private final double yLimit;
|
||||
|
||||
public BubbleFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||
super(world, x, y, z, motionX, motionY, motionZ);
|
||||
setRBGColorF(0.6f, 0.6f, 0.5f);
|
||||
yLimit = Math.floor(y) + 0.9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
prevPosX = posX;
|
||||
prevPosY = posY;
|
||||
prevPosZ = posZ;
|
||||
motionY += 0.002D;
|
||||
moveEntity(motionX, motionY, motionZ);
|
||||
motionX *= 0.8500000238418579D;
|
||||
motionY *= 0.8500000238418579D;
|
||||
motionZ *= 0.8500000238418579D;
|
||||
|
||||
if(particleMaxAge-- <= 0 || posY > yLimit) {
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,8 @@ public class TileZombieGenerator extends AbstractGeneratorEntity implements IFlu
|
||||
private int ticksRemaingFuel;
|
||||
private boolean inPause;
|
||||
|
||||
int pass = 0;
|
||||
|
||||
public TileZombieGenerator() {
|
||||
super(new SlotDefinition(0, 0, 0));
|
||||
}
|
||||
@@ -227,6 +229,18 @@ public class TileZombieGenerator extends AbstractGeneratorEntity implements IFlu
|
||||
active = nbtRoot.getBoolean("active");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass(int pass) {
|
||||
this.pass = pass;
|
||||
if(pass == 0) {
|
||||
return true;
|
||||
}
|
||||
if(pass == 1) {
|
||||
return fuelTank.getFluidAmount() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCommon(NBTTagCompound nbtRoot) {
|
||||
super.readCommon(nbtRoot);
|
||||
|
||||
+20
-8
@@ -37,12 +37,15 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
int l1 = l % 65536;
|
||||
int l2 = l / 65536;
|
||||
Tessellator.instance.setColorOpaque_F(f, f, f);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) l1, (float) l2);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
renderModel(gen.facing);
|
||||
renderFluid(gen);
|
||||
if(gen.pass == 0) {
|
||||
renderModel(gen.facing);
|
||||
} else if(gen.pass == 1) {
|
||||
renderFluid(gen);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -57,14 +60,22 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
Tessellator tes = Tessellator.instance;
|
||||
tes.startDrawingQuads();
|
||||
|
||||
float fullness = (float) (tank.getFluidAmount()) / (tank.getCapacity());
|
||||
ForgeDirection facingDir = ForgeDirection.values()[gen.facing];
|
||||
double facingOffset = 0.075;
|
||||
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.96, 0.85);
|
||||
bb = bb.scale(1, 0.85 * fullness, 1);
|
||||
float ty = -(0.85f - (bb.maxY - bb.minY)) / 2;
|
||||
float fullness = (float) (tank.getFluidAmount()) / (tank.getCapacity());
|
||||
Vector3d absFac = ForgeDirectionOffsets.absolueOffset(facingDir);
|
||||
|
||||
double scaleX = absFac.x == 0 ? 0.95 : 1 - facingOffset / 2;
|
||||
double scaleY = 0.85 * fullness;
|
||||
double scaleZ = absFac.z == 0 ? 0.95 : 1 - facingOffset / 2;
|
||||
|
||||
bb = bb.scale(scaleX, 0.85 * fullness, scaleZ);
|
||||
|
||||
Vector3d offset = ForgeDirectionOffsets.offsetScaled(ForgeDirection.values()[gen.facing], -0.075);
|
||||
bb = bb.translate((float)offset.x, ty, (float)offset.z);
|
||||
float ty = -(0.85f - (bb.maxY - bb.minY)) / 2;
|
||||
Vector3d transOffset = ForgeDirectionOffsets.offsetScaled(facingDir, -facingOffset);
|
||||
bb = bb.translate((float) transOffset.x, ty, (float) transOffset.z);
|
||||
|
||||
int brightness;
|
||||
if(gen.getWorldObj() == null) {
|
||||
@@ -80,6 +91,7 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDepthMask(false);
|
||||
tes.draw();
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
@@ -27,6 +27,14 @@ public final class ForgeDirectionOffsets {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Vector3d absolueOffset(ForgeDirection dir) {
|
||||
Vector3d res = forDirCopy(dir);
|
||||
res.x = Math.abs(res.x);
|
||||
res.y = Math.abs(res.y);
|
||||
res.z = Math.abs(res.z);
|
||||
return res;
|
||||
}
|
||||
|
||||
public ForgeDirection closest(float x, float y, float z) {
|
||||
float ax = Math.abs(x);
|
||||
float ay = Math.abs(y);
|
||||
|
||||
Reference in new issue
Block a user