decimated rail rendering (we're so back)

This commit is contained in:
Bob 2023-12-26 12:04:15 +01:00
parent ca1cd3db17
commit 13debc2cab
22 changed files with 266 additions and 1232 deletions

View File

@ -0,0 +1,13 @@
package com.hbm.blocks.rail;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
public interface IRenderRail {
@SideOnly(Side.CLIENT) public void renderInventory(Tessellator tessellator, Block block, int metadata);
@SideOnly(Side.CLIENT) public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z);
}

View File

@ -1,20 +1,28 @@
package com.hbm.blocks.rail;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RailNarrowCurve extends BlockDummyable implements IRailNTM {
public class RailNarrowCurve extends BlockDummyable implements IRailNTM, IRenderRail {
public RailNarrowCurve() {
super(Material.iron);
@ -25,11 +33,9 @@ public class RailNarrowCurve extends BlockDummyable implements IRailNTM {
return null;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
return RailStandardStraight.renderID;
}
@Override
@ -141,4 +147,27 @@ public class RailNarrowCurve extends BlockDummyable implements IRailNTM {
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
GL11.glScaled(0.2, 0.2, 0.2);
GL11.glTranslated(2.5, -0.0625, -1.5);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_curve, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
}
@Override
@SideOnly(Side.CLIENT)
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
if(meta < 12) return;
float rotation = 0;
if(meta == 12) rotation = 90F / 180F * (float) Math.PI;
if(meta == 14) rotation = 180F / 180F * (float) Math.PI;
if(meta == 13) rotation = 270F / 180F * (float) Math.PI;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_curve, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
}
}

View File

@ -1,20 +1,28 @@
package com.hbm.blocks.rail;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RailNarrowStraight extends BlockDummyable implements IRailNTM {
public class RailNarrowStraight extends BlockDummyable implements IRailNTM, IRenderRail {
public RailNarrowStraight() {
super(Material.iron);
@ -25,11 +33,9 @@ public class RailNarrowStraight extends BlockDummyable implements IRailNTM {
return null;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
return RailStandardStraight.renderID;
}
@Override
@ -112,4 +118,23 @@ public class RailNarrowStraight extends BlockDummyable implements IRailNTM {
public TrackGauge getGauge(World world, int x, int y, int z) {
return TrackGauge.NARROW;
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
GL11.glTranslated(0, -0.0625, 0);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_straight, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
}
@Override
@SideOnly(Side.CLIENT)
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
float rotation = 0;
if(meta == 2 || meta == 3 || meta == 12 || meta == 13) rotation = 90F / 180F * (float) Math.PI;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_straight, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
}
}

View File

@ -1,19 +1,27 @@
package com.hbm.blocks.rail;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
public class RailStandardBuffer extends BlockDummyable implements IRailNTM, IRenderRail {
public RailStandardBuffer() {
super(Material.iron);
@ -24,11 +32,9 @@ public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
return null;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
return RailStandardStraight.renderID;
}
@Override
@ -134,4 +140,36 @@ public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
public TrackGauge getGauge(World world, int x, int y, int z) {
return TrackGauge.STANDARD;
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
GL11.glTranslated(0, -0.0625, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.3, 0.3, 0.3);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_buffer, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
}
@Override
@SideOnly(Side.CLIENT)
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
if(meta < 12) return;
float rotation = 0;
if(meta == 12) rotation = (float) Math.PI;
if(meta == 14) rotation = 270F / 180F * (float) Math.PI;
if(meta == 15) rotation = 90F / 180F * (float) Math.PI;
if(meta == 12) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, -0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, 0.5F);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_buffer, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
if(meta == 12) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, 0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, -0.5F);
}
}

View File

@ -1,20 +1,28 @@
package com.hbm.blocks.rail;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RailStandardCurve extends BlockDummyable implements IRailNTM {
public class RailStandardCurve extends BlockDummyable implements IRailNTM, IRenderRail {
public RailStandardCurve() {
super(Material.iron);
@ -25,11 +33,9 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
return null;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
return RailStandardStraight.renderID;
}
@Override
@ -198,4 +204,28 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
BlockDummyable.safeRem = false;
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
GL11.glScaled(0.2, 0.2, 0.2);
GL11.glTranslated(2.5, -0.0625, -1.5);
GL11.glRotated(90, 0, 1, 0);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_curve, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
}
@Override
@SideOnly(Side.CLIENT)
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
if(meta < 12) return;
float rotation = 0;
if(meta == 15) rotation = 90F / 180F * (float) Math.PI;
if(meta == 12) rotation = 180F / 180F * (float) Math.PI;
if(meta == 14) rotation = 270F / 180F * (float) Math.PI;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_curve, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
}
}

View File

@ -1,21 +1,29 @@
package com.hbm.blocks.rail;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RailStandardRamp extends BlockDummyable implements IRailNTM {
public class RailStandardRamp extends BlockDummyable implements IRailNTM, IRenderRail {
public RailStandardRamp() {
super(Material.iron);
@ -31,11 +39,9 @@ public class RailStandardRamp extends BlockDummyable implements IRailNTM {
return null;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
return RailStandardStraight.renderID;
}
@Override
@ -135,4 +141,36 @@ public class RailStandardRamp extends BlockDummyable implements IRailNTM {
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), this, dir);
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, -1, 2, 2, 1, 0}, this, dir);
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
GL11.glTranslated(0, -0.0625, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.3, 0.3, 0.3);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_ramp, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
}
@Override
@SideOnly(Side.CLIENT)
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
if(meta < 12) return;
float rotation = 0;
if(meta == 15) rotation = 90F / 180F * (float) Math.PI;
if(meta == 12) rotation = 180F / 180F * (float) Math.PI;
if(meta == 14) rotation = 270F / 180F * (float) Math.PI;
if(meta == 12) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, -0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, 0.5F);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_ramp, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
if(meta == 12) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, 0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, -0.5F);
}
}

View File

@ -1,20 +1,29 @@
package com.hbm.blocks.rail;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.lib.Library;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.WavefrontObject;
import net.minecraftforge.common.util.ForgeDirection;
public class RailStandardStraight extends BlockDummyable implements IRailNTM {
public class RailStandardStraight extends BlockDummyable implements IRailNTM, IRenderRail {
public RailStandardStraight() {
super(Material.iron);
@ -117,4 +126,34 @@ public class RailStandardStraight extends BlockDummyable implements IRailNTM {
public TrackGauge getGauge(World world, int x, int y, int z) {
return TrackGauge.STANDARD;
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
GL11.glTranslated(0, -0.0625, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.3, 0.3, 0.3);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_straight, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
}
@Override
@SideOnly(Side.CLIENT)
public void renderWorld(Tessellator tessellator, Block block, int meta, IBlockAccess world, int x, int y, int z) {
if(meta < 12) return;
float rotation = 0;
if(meta == 14 || meta == 15) rotation = 90F / 180F * (float) Math.PI;
if(meta == 12) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, -0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, 0.5F);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_straight, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
if(meta == 12) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, 0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, -0.5F);
}
}

View File

@ -1,6 +1,6 @@
package com.hbm.blocks.test;
import com.hbm.entity.logic.EntityNukeExplosionNT;
import com.hbm.entity.logic.EntityNukeExplosionMK5;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.bomb.TileEntityTestBombAdvanced;
@ -133,7 +133,6 @@ public class TestBombAdvanced extends BlockContainer {
}*/
world.setBlock(x, y, z, Blocks.air);
world.spawnEntityInWorld(EntityNukeExplosionNT.statFacMKV(world, x + 0.5, y + 0.5, z + 0.5, 100));
//world.spawnEntityInWorld(EntityNukeExplosionMK4.statFacNoRad(world, 50, x, y, z));
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, 50, x, y, z));
}
}

View File

@ -193,7 +193,6 @@ public class EntityMappings {
addEntity(EntityBlockSpider.class, "entity_taintcrawler", 1000);
addEntity(EntityRBMKDebris.class, "entity_rbmk_debris", 1000);
addEntity(EntityUFO.class, "entity_ntm_ufo", 1000);
addEntity(EntityNukeExplosionNT.class, "entity_ntm_explosion_nt", 1000);
addEntity(EntityQuasar.class, "entity_digamma_quasar", 250);
addEntity(EntitySpear.class, "entity_digamma_spear", 1000);
addEntity(EntityMissileVolcano.class, "entity_missile_volcano", 1000);

View File

@ -1,52 +0,0 @@
package com.hbm.entity.logic;
import com.hbm.explosion.nt.IExplosionLogic;
import com.hbm.explosion.nt.Mark5Ausf2;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@Deprecated
public class EntityNukeExplosionNT extends Entity {
private IExplosionLogic explosion;
public EntityNukeExplosionNT(World world) {
super(world);
}
public EntityNukeExplosionNT loadLogic(IExplosionLogic explosion) {
this.explosion = explosion;
return this;
}
@Override
public void onUpdate() {
if(!worldObj.isRemote) {
if(this.explosion == null || this.explosion.isDone()) {
this.setDead();
return;
}
this.explosion.updateLogic();
}
}
public static EntityNukeExplosionNT statFacMKV(World world, double x, double y, double z, float power) {
EntityNukeExplosionNT essploshun = new EntityNukeExplosionNT(world);
essploshun.setPositionAndRotation(x, y, z, 0, 0);
essploshun.loadLogic(new Mark5Ausf2(world, power, (float) x, (float) y, (float) z));
return essploshun;
}
@Override
protected void entityInit() { }
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { }
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { }
}

View File

@ -7,18 +7,18 @@ import net.minecraft.world.World;
public abstract class EntityThrowableInterp extends EntityThrowableNT {
private int turnProgress;
private double syncPosX;
private double syncPosY;
private double syncPosZ;
private double syncYaw;
private double syncPitch;
protected int turnProgress;
protected double syncPosX;
protected double syncPosY;
protected double syncPosZ;
protected double syncYaw;
protected double syncPitch;
@SideOnly(Side.CLIENT)
private double velocityX;
protected double velocityX;
@SideOnly(Side.CLIENT)
private double velocityY;
protected double velocityY;
@SideOnly(Side.CLIENT)
private double velocityZ;
protected double velocityZ;
public EntityThrowableInterp(World world) {
super(world);

View File

@ -1,8 +0,0 @@
package com.hbm.explosion.nt;
@Deprecated
public interface IExplosionLogic {
public void updateLogic();
public boolean isDone();
}

View File

@ -1,282 +0,0 @@
package com.hbm.explosion.nt;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@Deprecated
public class Mark5 implements IExplosionLogic {
//holds rays after being calculated up to where the blocks get removed
private List<MVRay> pendingRays = new ArrayList();
//once a ray has been processed, it will be buffered for extension
private List<MVRay> completedRays = new ArrayList();
//buffered blocks marked for deletion
private Set<BlockPos> buffer = new HashSet();
private World world;
private float strength;
float originX;
float originY;
float originZ;
float angularDelta;
//0: calculate blocks to destroy
//1: destroy blocks
//2: generate new rays
int phase = 0;
public Mark5(World world, float strength, float x, float y, float z) {
this.world = world;
this.strength = strength;
this.originX = x;
this.originY = y;
this.originZ = z;
this.initRays();
}
private void initRays() {
float startLen = 0.5F;
//top
pendingRays.add(new MVRay(strength, originX, originY, originZ, 0F, (float) Math.PI * 0.5F, startLen));
//bottom
pendingRays.add(new MVRay(strength, originX, originY, originZ, 0F, -(float) Math.PI * 0.5F, startLen));
float pilet = (float) Math.PI * 0.25F;
for(int i = 0; i < 8; i++) {
pendingRays.add(new MVRay(strength, originX, originY, originZ, pilet * i, 0F, startLen));
{//if(i % 2 == 0) {
pendingRays.add(new MVRay(strength, originX, originY, originZ, pilet * i, -pilet, startLen));
pendingRays.add(new MVRay(strength, originX, originY, originZ, pilet * i, pilet, startLen));
}
}
this.angularDelta = pilet;
}
@Override
public void updateLogic() {
switch(this.phase) {
case 0: processRays(5000); break;
case 1: breakBlocks(10000); break;
case 2: repopulate(20000); break;
}
}
private void processRays(int amount) {
if(this.phase == 0 && this.pendingRays.isEmpty()) {
this.phase = 1;
return;
}
int rem = 0;
for(MVRay ray : this.pendingRays) {
Vec3 vec = Vec3.createVectorHelper(1, 0, 0);
vec.rotateAroundZ(ray.pitch);
vec.rotateAroundY(ray.yaw);
boolean shouldSplit = true;
float lastIndex = 0;
for(float i = 0; i < ray.length; i += 0.5F) {
lastIndex = i;
int x = (int)Math.floor(ray.x + vec.xCoord * i);
int y = (int)Math.floor(ray.y + vec.yCoord * i);
int z = (int)Math.floor(ray.z + vec.zCoord * i);
BlockPos pos = new BlockPos(x, y, z);
if(y > 255 || y < 0) {
shouldSplit = false;
break;
}
Block b = world.getBlock(x, y, z);
float res = (b.getMaterial().isLiquid() ? 0 : b.getExplosionResistance(null)) + Blocks.air.getExplosionResistance(null);
ray.power -= (res * res);
if(ray.power <= 0) {
shouldSplit = false;
break;
}
if(b != Blocks.air)
this.buffer.add(pos);
}
if(shouldSplit) {
ray.x = ray.x + (float)vec.xCoord * lastIndex;
ray.y = ray.y + (float)vec.yCoord * lastIndex;
ray.z = ray.z + (float)vec.zCoord * lastIndex;
this.completedRays.add(ray);
}
rem++;
if(rem == amount)
break;
}
this.pendingRays.subList(0, rem).clear();
if(this.pendingRays.isEmpty()) {
this.phase = 1;
}
}
private void breakBlocks(int amount) {
if(this.phase == 1 && this.buffer.isEmpty()) {
this.angularDelta *= 0.5F;
this.phase = 2;
return;
}
int rem = 0;
List<BlockPos> toRem = new ArrayList();
for(BlockPos pos : this.buffer) {
world.setBlock(pos.x, pos.y, pos.z, Blocks.air, 0, 3);
toRem.add(pos);
rem++;
if(rem == amount)
break;
}
this.buffer.removeAll(toRem);
if(this.buffer.isEmpty()) {
this.angularDelta *= 0.5F;
this.phase = 2;
}
}
private void repopulate(int amount) {
if(this.phase == 2 && this.completedRays.isEmpty()) {
this.phase = 0;
}
int rem = 0;
for(MVRay ray : this.completedRays) {
for(int i = 0; i < 2; i++) {
for(int j = 0; j < 2; j++) {
MVRay child = new MVRay(ray.power, ray.x, ray.y, ray.z, ray.yaw + this.angularDelta * i, ray.pitch + this.angularDelta * j, ray.length * 2);
this.pendingRays.add(child);
}
}
rem++;
if(rem == amount)
break;
}
this.completedRays.subList(0, rem).clear();
}
@Override
public boolean isDone() {
return this.pendingRays.isEmpty() && this.completedRays.isEmpty() && this.buffer.isEmpty();
}
public static class MVRay {
//initiated with starting power, once processed it shows the power left
float power;
//once calculated, this becomes true
boolean collected = false;
float x;
float y;
float z;
float yaw;
float pitch;
float length;
public MVRay(float power, float x, float y, float z, float yaw, float pitch, float length) {
this.power = power;
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
this.length = length;
}
public MVRay(float power, float x, float y, float z, Vec3 dir, float length) {
double len = dir.lengthVector();
float yaw = (float)Math.atan2(dir.zCoord, dir.xCoord);
float pitch = (float)Math.asin(dir.yCoord / len);
this.power = power;
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
this.length = length;
}
}
public static class BlockPos {
int x;
int y;
int z;
public BlockPos(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + x;
result = prime * result + y;
result = prime * result + z;
return result;
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(obj == null) return false;
if(getClass() != obj.getClass()) return false;
BlockPos other = (BlockPos) obj;
if(x != other.x) return false;
if(y != other.y) return false;
if(z != other.z) return false;
return true;
}
}
}

View File

@ -1,447 +0,0 @@
package com.hbm.explosion.nt;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
/*
* Turns out segmenting makes the craters ugly and, for whatever reason, doesn't actually improve performance (??????)
* Ausf3 will use the same approach as MK4 but with some optimizations regarding setBlock redundancy and getBlock operations
* See: docvt7
*/
@Deprecated
public class Mark5Ausf2 implements IExplosionLogic {
//holds rays after being calculated up to where the blocks get removed
private HorizontalSegment[] segments;
private HorizontalSegment[] repopulatedSegments;
//buffered blocks marked for deletion
private Set<BlockPos> buffer = new HashSet();
private World world;
private float strength;
float originX;
float originY;
float originZ;
float length;
//0: calculate blocks to destroy
//1: destroy blocks
//2: generate new rays
int phase = 0;
public Mark5Ausf2(World world, float strength, float x, float y, float z) {
this.world = world;
this.strength = strength;
this.originX = x;
this.originY = y;
this.originZ = z;
this.initRays();
}
private double getResolutionMult() {
return 5D;
}
private void initRays() {
this.length = 5F; //how long the current rays are
double bow = length * Math.PI; //one "bow", the distance between the poles along the circumference ( U/2 )
int bowCount = (int) Math.ceil(bow * getResolutionMult()); //how many segments we want along one bow, usually 1 per block + a resolution multiplier
double bowDelta = (Math.PI / (double) (bowCount - 1)); //the angular difference (pitch) between where each segment is
segments = new HorizontalSegment[bowCount];
for(int i = 0; i < bowCount; i++) {
double currBow = bowDelta * i; //the current angle along the bow (i.e. the pitch of the horizontal ring)
double ringRadius = Math.sin(currBow) * length; //the radius of the current ring
double ringCircumference = 2D * ringRadius * Math.PI; //the circumference for the ring
int ringCount = (int) Math.max(Math.ceil(ringCircumference * getResolutionMult()), 1); //how many rays we want per ring (1 per block plus extra resolution)
double ringDelta = ((Math.PI * 2D) / (double) (ringCount - 1)); //the angular difference (yaw) between rays in a ring
HorizontalSegment seg = new HorizontalSegment(ringCount);
float pitch = (float) currBow;
for(int j = 0; j < ringCount; j++) {
float yaw = (float)(ringDelta * j);
//if(yaw < Math.PI * 0.5 && pitch < Math.PI)
seg.rays[j] = new MVRay(strength, originX, originY, originZ, yaw, pitch, length);
}
segments[i] = seg;
}
/*System.out.println("Initialized with" + segments.length + " segments!");
for(HorizontalSegment seg : segments) {
if(seg == null) {
System.out.println("NULL");
} else {
System.out.println(seg.rays.length);
}
}*/
}
@Override
public void updateLogic() {
switch(this.phase) {
case 0: processRays(50000); break;
case 1: breakBlocks(2000); break;
case 2: repopulate(); break;
}
}
private int processBow = 0;
private int processRing = 0;
private void endPhaseZero() {
this.processBow = 0;
this.processRing = 0;
this.phase = 1;
}
private void processRays(int amount) {
while(true) {
if(amount < 0) {
return;
}
if(this.segments[processBow] == null || this.processRing >= this.segments[processBow].rays.length) {
this.processRing = 0;
this.processBow++;
if(this.processBow >= this.segments.length) {
endPhaseZero();
return;
}
continue;
}
if(this.processBow >= this.segments.length) {
endPhaseZero();
return;
}
MVRay ray = this.segments[processBow].rays[this.processRing];
if(ray != null) {
Vec3 vec = Vec3.createVectorHelper(1, 0, 0);
vec.rotateAroundZ(ray.pitch);
vec.rotateAroundY(ray.yaw);
double finalX = 0;
double finalY = 0;
double finalZ = 0;
for(float i = 0; i < ray.length; i += 0.5F) {
finalX = ray.x + vec.xCoord * i;
finalY = ray.y + vec.yCoord * i;
finalZ = ray.z + vec.zCoord * i;
int x = (int)Math.floor(finalX);
int y = (int)Math.floor(finalY);
int z = (int)Math.floor(finalZ);
//System.out.println(ray.pitch + " " + ray.yaw + " / " + x + " " + y + " " + z);
BlockPos pos = new BlockPos(x, y, z);
if(y > 255 || y < 0) {
break;
}
Block b = world.getBlock(x, y, z);
float res = (b.getMaterial().isLiquid() ? (float)Math.pow(Blocks.air.getExplosionResistance(null), 1.25) : (float)Math.pow(b.getExplosionResistance(null), 1.25));
ray.power -= res;
if(ray.power <= 0) {
break;
}
if(b != Blocks.air)
this.buffer.add(pos);
}
if(ray.power <= 0 || finalY < 0 || finalY > 255 || this.length > this.strength) {
this.segments[processBow].rays[this.processRing] = null;
}
ray.x = (float) finalX;
ray.y = (float) finalY;
ray.z = (float) finalZ;
}
amount--;
this.processRing++;
}
}
private void breakBlocks(int amount) {
if(this.phase == 1 && this.buffer.isEmpty()) {
this.phase = 2;
return;
}
int rem = 0;
List<BlockPos> toRem = new ArrayList();
for(BlockPos pos : this.buffer) {
world.setBlock(pos.x, pos.y, pos.z, Blocks.air, 0, 3);
toRem.add(pos);
rem++;
if(rem == amount)
break;
}
this.buffer.removeAll(toRem);
if(this.buffer.isEmpty()) {
this.phase = 2;
}
}
private void repopulate() {
boolean didYouDoLiterallyAnything = false;
this.length *= 2;
double bow = length * Math.PI;
int bowCount = (int) Math.ceil(bow * getResolutionMult());
double bowDelta = (Math.PI / (double) (bowCount - 1));
repopulatedSegments = new HorizontalSegment[bowCount];
for(int i = 0; i < bowCount; i++) {
double currBow = bowDelta * i;
double ringRadius = Math.sin(currBow) * length;
double ringCircumference = 2D * ringRadius * Math.PI;
int ringCount = (int) Math.max(Math.ceil(ringCircumference * getResolutionMult()), 1);
double ringDelta = ((Math.PI * 2D) / (double) (ringCount - 1));
float pitch = (float) currBow;
HorizontalSegment parentSegment = fromAngle(pitch);
if(parentSegment != null) {
HorizontalSegment seg = new HorizontalSegment(ringCount);
for(int j = 0; j < ringCount; j++) {
float yaw = (float)(ringDelta * j);
MVRay parentRay = parentSegment.fromAngle(yaw);
if(parentRay != null && parentRay.power > 0) {
/*Vec3 newDest = Vec3.createVectorHelper(length, 0D, 0D);
newDest.rotateAroundZ(pitch);
newDest.rotateAroundY(yaw);
Vec3 delta = Vec3.createVectorHelper(newDest.xCoord - parentRay.x, newDest.yCoord - parentRay.y, newDest.zCoord - parentRay.z);
double deltaLen = delta.lengthVector();
float pLen = parentRay.length;
double s_deltaLen = Math.sqrt(delta.xCoord * delta.xCoord + delta.yCoord * delta.yCoord);
double s_alpha0 = parentRay.pitch;
double s_delta = Math.acos((pLen * pLen + s_deltaLen * s_deltaLen - length * length) / (2 * pLen * s_deltaLen));
double newPitch = s_alpha0 + (Math.PI - s_delta);
double r_deltaLen = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
double r_alpha0 = parentRay.yaw;
double r_delta = Math.acos((pLen * pLen + r_deltaLen * r_deltaLen - length * length) / (2 * pLen * r_deltaLen));
double newYaw = r_alpha0 + (Math.PI - r_delta);*/
/*System.out.println("deltaLen: " + deltaLen);
System.out.println("pLen: " + pLen);
System.out.println("s_deltaLen: " + s_deltaLen);
System.out.println("s_alpha0: " + s_alpha0);
System.out.println("s_delta: " + s_delta);
System.out.println("newPitch: " + newPitch);
System.out.println("r_deltaLen: " + r_deltaLen);
System.out.println("r_alpha0: " + r_alpha0);
System.out.println("r_delta: " + r_delta);
System.out.println("newYaw: " + newYaw);*/
/*System.out.println("(pLen * pLen + s_deltaLen * s_deltaLen - length * length) / (2 * pLen * s_deltaLen)");
System.out.println("" + (pLen * pLen + s_deltaLen * s_deltaLen - length * length) / (2 * pLen * s_deltaLen));
System.out.println("(pLen * pLen + r_deltaLen * r_deltaLen - length * length) / (2 * pLen * r_deltaLen)");
System.out.println("" + (pLen * pLen + r_deltaLen * r_deltaLen - length * length) / (2 * pLen * r_deltaLen));*/
Vec3 len = Vec3.createVectorHelper(parentRay.x - originX, parentRay.y - originY, parentRay.z - originZ);
double totalLen = len.lengthVector();
Vec3 normal = Vec3.createVectorHelper(totalLen, 0D, 0D);
normal.rotateAroundZ(pitch);
normal.rotateAroundY(yaw);
//double surface = 4 * Math.PI * this.length * this.length;
//double prevSurface = 4 * Math.PI * totalLen * totalLen;
float newPower = parentRay.power;
MVRay newRay = new MVRay(newPower,
(float)(this.originX - normal.xCoord),
(float)(this.originY - normal.yCoord),
(float)(this.originZ - normal.zCoord),
yaw, pitch, (float) (this.length - totalLen));
seg.rays[j] = newRay;
repopulatedSegments[i] = seg;
didYouDoLiterallyAnything = true;
}
}
}
}
this.segments = this.repopulatedSegments;
this.repopulatedSegments = null;
/*for(HorizontalSegment seg : segments) {
if(seg == null) {
System.out.println("NULL");
} else {
System.out.println(seg.rays.length);
}
}
System.out.println("STOP");*/
this.phase = 0;
if(!didYouDoLiterallyAnything) {
this.isDone = true;
}
}
private HorizontalSegment fromAngle(float pitch) {
int size = this.segments.length;
int index = (int)Math.floor((pitch * size) / Math.PI) % this.segments.length;
if(index >= this.segments.length || index < 0)
return null;
return this.segments[index];
}
private boolean isDone = false;
@Override
public boolean isDone() {
return isDone;
}
public static class HorizontalSegment {
MVRay[] rays;
private HorizontalSegment(int size) {
rays = new MVRay[size];
}
private MVRay fromAngle(float yaw) {
int size = rays.length;
int index = (int)Math.floor((yaw * size) / (Math.PI * 2)) % this.rays.length;
if(index >= this.rays.length || index < 0)
return null;
return rays[index];
}
}
public static class MVRay {
//initiated with starting power, once processed it shows the power left
float power;
//once calculated, this becomes true
boolean collected = false;
float x;
float y;
float z;
float yaw;
float pitch;
float length;
boolean tracked;
public MVRay(float power, float x, float y, float z, float yaw, float pitch, float length) {
this.power = power;
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
this.length = length;
}
public MVRay(float power, float x, float y, float z, Vec3 dir, float length) {
double len = dir.lengthVector();
float yaw = (float)Math.atan2(dir.zCoord, dir.xCoord);
float pitch = (float)Math.asin(dir.yCoord / len);
this.power = power;
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
this.length = length;
}
}
public static class BlockPos {
int x;
int y;
int z;
public BlockPos(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + x;
result = prime * result + y;
result = prime * result + z;
return result;
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(obj == null) return false;
if(getClass() != obj.getClass()) return false;
BlockPos other = (BlockPos) obj;
if(x != other.x) return false;
if(y != other.y) return false;
if(z != other.z) return false;
return true;
}
}
}

View File

@ -834,12 +834,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerBlockHandler(new RenderFoundryTank());
RenderingRegistry.registerBlockHandler(new RenderFoundryOutlet());
RenderingRegistry.registerBlockHandler(new RenderNarrowStraightRail());
RenderingRegistry.registerBlockHandler(new RenderNarrowCurveRail());
RenderingRegistry.registerBlockHandler(new RenderStandardStraightRail());
RenderingRegistry.registerBlockHandler(new RenderStandardCurveRail());
RenderingRegistry.registerBlockHandler(new RenderStandardRampRail());
RenderingRegistry.registerBlockHandler(new RenderStandardBufferRail());
RenderingRegistry.registerBlockHandler(new RenderRail());
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_c4.getRenderType(), ResourceManager.charge_c4));

View File

@ -1,6 +1,7 @@
package com.hbm.main;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
@ -12,6 +13,10 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockAshes;
import com.hbm.blocks.rail.IRailNTM;
import com.hbm.blocks.rail.IRailNTM.MoveContext;
import com.hbm.blocks.rail.IRailNTM.RailCheckType;
import com.hbm.blocks.rail.IRailNTM.RailContext;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
@ -64,6 +69,7 @@ import com.hbm.tileentity.machine.TileEntityNukeFurnace;
import com.hbm.util.I18nUtil;
import com.hbm.util.ItemStackUtil;
import com.hbm.util.LoggingUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.wiaj.GuiWorldInAJar;
import com.hbm.wiaj.cannery.CanneryBase;
import com.hbm.wiaj.cannery.Jars;
@ -235,7 +241,7 @@ public class ModEventHandlerClient {
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
}*/
/*List<String> text = new ArrayList();
List<String> text = new ArrayList();
MovingObjectPosition pos = Library.rayTrace(player, 500, 1, false, true, false);
for(int i = 0; i < 2; i++) if(pos != null && pos.typeOfHit == pos.typeOfHit.BLOCK) {
@ -298,7 +304,7 @@ public class ModEventHandlerClient {
} while(distanceToCover != 0);
ILookOverlay.printGeneric(event, "DEBUG", 0xffff00, 0x4040000, text);
}*/
}
}
/// HANLDE ANIMATION BUSES ///

View File

@ -1,69 +0,0 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.rail.RailNarrowCurve;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderNarrowCurveRail implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
GL11.glScaled(0.2, 0.2, 0.2);
GL11.glTranslated(2.5, -0.0625, -1.5);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_curve, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = world.getBlockMetadata(x, y, z);
if(meta < 12) return true;
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
float rotation = 0;
if(meta == 12)
rotation = 90F / 180F * (float) Math.PI;
if(meta == 14)
rotation = 180F / 180F * (float) Math.PI;
if(meta == 13)
rotation = 270F / 180F * (float) Math.PI;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_curve, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return RailNarrowCurve.renderID;
}
}

View File

@ -2,51 +2,34 @@ package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.rail.RailNarrowStraight;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import com.hbm.blocks.rail.IRenderRail;
import com.hbm.blocks.rail.RailStandardStraight;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderNarrowStraightRail implements ISimpleBlockRenderingHandler {
public class RenderRail implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
GL11.glTranslated(0, -0.0625, 0);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_straight, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
IRenderRail rail = (IRenderRail) block;
rail.renderInventory(tessellator, block, metadata);
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
int meta = world.getBlockMetadata(x, y, z);
float rotation = 0;
if(meta == 2 || meta == 3 || meta == 12 || meta == 13)
rotation = 90F / 180F * (float) Math.PI;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_narrow_straight, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
IRenderRail rail = (IRenderRail) block;
rail.renderWorld(tessellator, block, meta, world, x, y, z);
return true;
}
@ -57,6 +40,6 @@ public class RenderNarrowStraightRail implements ISimpleBlockRenderingHandler {
@Override
public int getRenderId() {
return RailNarrowStraight.renderID;
return RailStandardStraight.renderID;
}
}

View File

@ -1,77 +0,0 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.rail.RailStandardBuffer;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderStandardBufferRail implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
GL11.glTranslated(0, -0.0625, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.3, 0.3, 0.3);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_buffer, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = world.getBlockMetadata(x, y, z);
if(meta < 12) return true;
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
float rotation = 0;
if(meta == 12) rotation = (float) Math.PI;
if(meta == 14) rotation = 270F / 180F * (float) Math.PI;
if(meta == 15) rotation = 90F / 180F * (float) Math.PI;
if(meta == 12) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, -0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, 0.5F);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_buffer, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
if(meta == 12) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, 0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, -0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return RailStandardBuffer.renderID;
}
}

View File

@ -1,70 +0,0 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.rail.RailStandardCurve;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderStandardCurveRail implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
GL11.glScaled(0.2, 0.2, 0.2);
GL11.glTranslated(2.5, -0.0625, -1.5);
GL11.glRotated(90, 0, 1, 0);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_curve, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = world.getBlockMetadata(x, y, z);
if(meta < 12) return true;
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
float rotation = 0;
if(meta == 15)
rotation = 90F / 180F * (float) Math.PI;
if(meta == 12)
rotation = 180F / 180F * (float) Math.PI;
if(meta == 14)
rotation = 270F / 180F * (float) Math.PI;
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_curve, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return RailStandardCurve.renderID;
}
}

View File

@ -1,80 +0,0 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.rail.RailStandardRamp;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderStandardRampRail implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
GL11.glTranslated(0, -0.0625, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.3, 0.3, 0.3);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_ramp, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = world.getBlockMetadata(x, y, z);
if(meta < 12) return true;
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
float rotation = 0;
if(meta == 15)
rotation = 90F / 180F * (float) Math.PI;
if(meta == 12)
rotation = 180F / 180F * (float) Math.PI;
if(meta == 14)
rotation = 270F / 180F * (float) Math.PI;
if(meta == 12) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, -0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, 0.5F);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_ramp, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
if(meta == 12) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, 0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, -0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return RailStandardRamp.renderID;
}
}

View File

@ -1,75 +0,0 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.rail.RailStandardStraight;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderStandardStraightRail implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
GL11.glTranslated(0, -0.0625, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.3, 0.3, 0.3);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_straight, block.getIcon(1, 0), tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = world.getBlockMetadata(x, y, z);
if(meta < 12) return true;
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
float rotation = 0;
if(meta == 14 || meta == 15) rotation = 90F / 180F * (float) Math.PI;
if(meta == 12) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, -0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, 0.5F);
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_straight, block.getIcon(1, 0), tessellator, rotation, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
if(meta == 12) tessellator.addTranslation(-0.5F, 0F, 0F);
if(meta == 13) tessellator.addTranslation(0.5F, 0F, 0F);
if(meta == 14) tessellator.addTranslation(0F, 0F, 0.5F);
if(meta == 15) tessellator.addTranslation(0F, 0F, -0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return RailStandardStraight.renderID;
}
}