more rails, new gadget model
@ -1171,7 +1171,9 @@ public class ModBlocks {
|
||||
public static Block rail_narrow_straight;
|
||||
public static Block rail_narrow_curve;
|
||||
public static Block rail_large_straight;
|
||||
public static Block rail_large_straight_short;
|
||||
public static Block rail_large_curve;
|
||||
public static Block rail_large_curve_wide;
|
||||
public static Block rail_large_ramp;
|
||||
public static Block rail_large_buffer;
|
||||
public static Block rail_large_switch;
|
||||
@ -2250,7 +2252,9 @@ public class ModBlocks {
|
||||
rail_narrow_straight = new RailNarrowStraight().setBlockName("rail_narrow_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_narrow_neo");
|
||||
rail_narrow_curve = new RailNarrowCurve().setBlockName("rail_narrow_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_narrow_neo");
|
||||
rail_large_straight = new RailStandardStraight().setBlockName("rail_large_straight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_straight_short = new RailStandardStraightShort().setBlockName("rail_large_straight_short").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve = new RailStandardCurve().setBlockName("rail_large_curve").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_curve_wide = new RailStandardCurveWide().setBlockName("rail_large_curve_wide").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_ramp = new RailStandardRamp().setBlockName("rail_large_ramp").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
rail_large_buffer = new RailStandardBuffer().setBlockName("rail_large_buffer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_buffer");
|
||||
rail_large_switch = new RailStandardSwitch().setBlockName("rail_large_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_straight");
|
||||
@ -3552,7 +3556,9 @@ public class ModBlocks {
|
||||
register(rail_narrow_straight);
|
||||
register(rail_narrow_curve);
|
||||
register(rail_large_straight);
|
||||
register(rail_large_straight_short);
|
||||
register(rail_large_curve);
|
||||
register(rail_large_curve_wide);
|
||||
register(rail_large_ramp);
|
||||
register(rail_large_buffer);
|
||||
register(rail_large_switch);
|
||||
|
||||
239
src/main/java/com/hbm/blocks/rail/RailStandardCurveWide.java
Normal file
@ -0,0 +1,239 @@
|
||||
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.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 RailStandardCurveWide extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
|
||||
public RailStandardCurveWide() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
/* Very simple function determining the snapping position and adding the motion value to it, if desired. */
|
||||
public Vec3 snapAndMove(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
int cX = pos[0];
|
||||
int cY = pos[1];
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
double turnRadius = 6D;
|
||||
double axisDist = 6.5D;
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
double axisX = cX + 0.5 + dir.offsetX * 0.5 + rot.offsetX * axisDist;
|
||||
double axisZ = cZ + 0.5 + dir.offsetZ * 0.5 + rot.offsetZ * axisDist;
|
||||
|
||||
Vec3 dist = Vec3.createVectorHelper(vec.xCoord - axisX, 0, vec.zCoord - axisZ);
|
||||
dist = dist.normalize();
|
||||
dist.xCoord *= turnRadius;
|
||||
dist.zCoord *= turnRadius;
|
||||
|
||||
double moveAngle = Math.atan2(motionX, motionZ) * 180D / Math.PI + 90;
|
||||
|
||||
if(speed == 0) {
|
||||
info.dist(0).pos(new BlockPos(x, y, z)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX + dist.xCoord, y, axisZ + dist.zCoord);
|
||||
}
|
||||
|
||||
double angleDeg = Math.atan2(dist.xCoord, dist.zCoord) * 180D / Math.PI + 90;
|
||||
if(dir == Library.NEG_X) angleDeg -= 90;
|
||||
if(dir == Library.POS_X) angleDeg += 90;
|
||||
if(dir == Library.POS_Z) angleDeg += 180;
|
||||
angleDeg = MathHelper.wrapAngleTo180_double(angleDeg);
|
||||
double length90Deg = turnRadius * Math.PI / 2D;
|
||||
double angularChange = speed / length90Deg * 90D;
|
||||
|
||||
ForgeDirection moveDir = ForgeDirection.UNKNOWN;
|
||||
|
||||
if(Math.abs(motionX) > Math.abs(motionZ)) {
|
||||
moveDir = motionX > 0 ? Library.POS_X : Library.NEG_X;
|
||||
} else {
|
||||
moveDir = motionZ > 0 ? Library.POS_Z : Library.NEG_Z;
|
||||
}
|
||||
|
||||
if(moveDir == dir || moveDir == rot.getOpposite()) {
|
||||
angularChange *= -1;
|
||||
}
|
||||
|
||||
double effAngle = angleDeg + angularChange;
|
||||
moveAngle += angularChange;
|
||||
|
||||
if(effAngle > 90) {
|
||||
double angleOvershoot = effAngle - 90D;
|
||||
moveAngle -= angleOvershoot;
|
||||
double lengthOvershoot = angleOvershoot * length90Deg / 90D;
|
||||
info.dist(lengthOvershoot * Math.signum(speed * angularChange)).pos(new BlockPos(cX - dir.offsetX * 6 + rot.offsetX * 7, y, cZ - dir.offsetZ * 6 + rot.offsetZ * 7)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX - dir.offsetX * turnRadius, y + 0.1875, axisZ - dir.offsetZ * turnRadius);
|
||||
}
|
||||
|
||||
if(effAngle < 0) {
|
||||
double angleOvershoot = -effAngle;
|
||||
moveAngle -= angleOvershoot;
|
||||
double lengthOvershoot = angleOvershoot * length90Deg / 90D;
|
||||
info.dist(-lengthOvershoot * Math.signum(speed * angularChange)).pos(new BlockPos(cX + dir.offsetX , y, cZ + dir.offsetZ)).yaw((float) moveAngle);
|
||||
return Vec3.createVectorHelper(axisX - rot.offsetX * turnRadius, y + 0.1875, axisZ -rot.offsetZ * turnRadius);
|
||||
}
|
||||
|
||||
double radianChange = angularChange * Math.PI / 180D;
|
||||
dist.rotateAroundY((float) radianChange);
|
||||
|
||||
return Vec3.createVectorHelper(axisX + dist.xCoord, y + 0.1875, axisZ + dist.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackGauge getGauge(World world, int x, int y, int z) {
|
||||
return TrackGauge.STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 6, 0, 6, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
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
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
dir = dir.getOpposite();
|
||||
|
||||
int dX = dir.offsetX;
|
||||
int dZ = dir.offsetZ;
|
||||
int rX = rot.offsetX;
|
||||
int rZ = rot.offsetZ;
|
||||
|
||||
return world.getBlock(x + dX, y, z + dZ).isReplaceable(world, x + dX, y, z + dZ) &&
|
||||
world.getBlock(x + rX, y, z + rZ).isReplaceable(world, x + rX, y, z + rZ) &&
|
||||
world.getBlock(x + dX + rX, y, z + dZ + rZ).isReplaceable(world, x + dX + rX, y, z + dZ + rZ) &&
|
||||
world.getBlock(x + dX + rX * 2, y, z + dZ + rZ * 2).isReplaceable(world, x + dX + rX * 2, y, z + dZ + rZ * 2) &&
|
||||
world.getBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ).isReplaceable(world, x + dX * 2 + rX, y, z + dZ * 2 + rZ) &&
|
||||
world.getBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2).isReplaceable(world, x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2) &&
|
||||
world.getBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ).isReplaceable(world, x + dX * 3 + rX, y, z + dZ * 3 + rZ) &&
|
||||
world.getBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2).isReplaceable(world, x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2) &&
|
||||
world.getBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3).isReplaceable(world, x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3).isReplaceable(world, x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3).isReplaceable(world, x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4).isReplaceable(world, x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4) &&
|
||||
world.getBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4).isReplaceable(world, x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
BlockDummyable.safeRem = true;
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
dir = dir.getOpposite();
|
||||
|
||||
int dX = dir.offsetX;
|
||||
int dZ = dir.offsetZ;
|
||||
int rX = rot.offsetX;
|
||||
int rZ = rot.offsetZ;
|
||||
|
||||
world.setBlock(x + dX, y, z + dZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2, y, z + dZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + rX, y, z + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX + rX, y, z + dZ + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX, y, z + dZ * 4 + rZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 2, y, z + dZ * 4 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 5 + rX * 2, y, z + dZ * 5 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 5 + rX * 3, y, z + dZ * 5 + rZ * 3, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 5 + rX * 4, y, z + dZ * 5 + rZ * 4, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 6 + rX * 4, y, z + dZ * 6 + rZ * 4, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 5 + rX * 5, y, z + dZ * 5 + rZ * 5, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 5 + rX * 6, y, z + dZ * 5 + rZ * 6, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 6 + rX * 5, y, z + dZ * 6 + rZ * 5, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 6 + rX * 6, y, z + dZ * 6 + rZ * 6, this, rot.ordinal(), 3);
|
||||
|
||||
BlockDummyable.safeRem = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(Tessellator tessellator, Block block, int metadata) {
|
||||
GL11.glScaled(0.12, 0.12, 0.12);
|
||||
GL11.glTranslated(2.5, -0.0625, -3);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_curve_wide, 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_wide, block.getIcon(1, 0), tessellator, rotation, true);
|
||||
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
|
||||
}
|
||||
}
|
||||
152
src/main/java/com/hbm/blocks/rail/RailStandardStraightShort.java
Normal file
@ -0,0 +1,152 @@
|
||||
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.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 RailStandardStraightShort extends BlockDummyable implements IRailNTM, IRenderRail {
|
||||
|
||||
public RailStandardStraightShort() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 0, 0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
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
|
||||
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getTravelLocation(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info, MoveContext context) {
|
||||
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info);
|
||||
}
|
||||
|
||||
/* Very simple function determining the snapping position and adding the motion value to it, if desired. */
|
||||
public Vec3 snapAndMove(World world, int x, int y, int z, double trainX, double trainY, double trainZ, double motionX, double motionY, double motionZ, double speed, RailContext info) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
int cX = pos[0];
|
||||
int cY = pos[1];
|
||||
int cZ = pos[2];
|
||||
int meta = world.getBlockMetadata(cX, cY, cZ) - this.offset;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(trainX, trainY, trainZ);
|
||||
|
||||
if(dir == Library.POS_X || dir == Library.NEG_X) {
|
||||
double targetX = trainX;
|
||||
if(motionX > 0) {
|
||||
targetX += speed;
|
||||
info.yaw(-90F);
|
||||
} else {
|
||||
targetX -= speed;
|
||||
info.yaw(90F);
|
||||
}
|
||||
vec.xCoord = MathHelper.clamp_double(targetX, cX, cX + 1);
|
||||
vec.yCoord = y + 0.1875;
|
||||
vec.zCoord = cZ + 0.5 + rot.offsetZ * 0.5;
|
||||
info.dist(Math.abs(targetX - vec.xCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX + (motionX * speed > 0 ? 1 : -1), y, cZ));
|
||||
} else {
|
||||
double targetZ = trainZ;
|
||||
if(motionZ > 0) {
|
||||
targetZ += speed;
|
||||
info.yaw(0F);
|
||||
} else {
|
||||
targetZ -= speed;
|
||||
info.yaw(180F);
|
||||
}
|
||||
vec.xCoord = cX + 0.5 + rot.offsetX * 0.5;
|
||||
vec.yCoord = y + 0.1875;
|
||||
vec.zCoord = MathHelper.clamp_double(targetZ, cZ,cZ + 1);
|
||||
info.dist(Math.abs(targetZ - vec.zCoord) * Math.signum(speed));
|
||||
info.pos(new BlockPos(cX, y, cZ + (motionZ * speed > 0 ? 1 : -1)));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
@Override
|
||||
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.7, 0.7, 0.7);
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderWithIcon((WavefrontObject) ResourceManager.rail_standard_straight_short, 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_short, 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);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.hbm.blocks.rail;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -128,6 +129,7 @@ public class RailStandardSwitch extends BlockRailWaypointSystem implements IRend
|
||||
|
||||
if(world.isRemote) return true;
|
||||
if(player.isSneaking()) return false;
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.train) return false;
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -125,6 +126,7 @@ public class RailStandardSwitchFlipped extends BlockRailWaypointSystem implement
|
||||
|
||||
if(world.isRemote) return true;
|
||||
if(player.isSneaking()) return false;
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.train) return false;
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom shredder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/shredder.obj"));
|
||||
|
||||
//Bombs
|
||||
public static final IModelCustom bomb_gadget = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/TheGadget3.obj"));
|
||||
public static final IModelCustom bomb_gadget = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/bombs/gadget.obj")).asDisplayList();
|
||||
public static final IModelCustom bomb_boy = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/LilBoy1.obj"));
|
||||
public static final IModelCustom bomb_man = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/FatMan.obj")).asDisplayList();
|
||||
public static final IModelCustom bomb_mike = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/bombs/ivymike.obj"));
|
||||
@ -671,7 +671,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation shredder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/shredder.png");
|
||||
|
||||
//Bombs
|
||||
public static final ResourceLocation bomb_gadget_tex = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_tex.png");
|
||||
public static final ResourceLocation bomb_gadget_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/gadget.png");
|
||||
public static final ResourceLocation bomb_boy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lilboy.png");
|
||||
public static final ResourceLocation bomb_man_tex = new ResourceLocation(RefStrings.MODID, "textures/models/FatMan.png");
|
||||
public static final ResourceLocation bomb_mike_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/ivymike.png");
|
||||
@ -1464,7 +1464,9 @@ public class ResourceManager {
|
||||
public static final IModelCustom rail_narrow_straight = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_narrow.obj"));
|
||||
public static final IModelCustom rail_narrow_curve = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_narrow_bend.obj"));
|
||||
public static final IModelCustom rail_standard_straight = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard.obj"));
|
||||
public static final IModelCustom rail_standard_straight_short = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_short.obj"));
|
||||
public static final IModelCustom rail_standard_curve = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_bend.obj"));
|
||||
public static final IModelCustom rail_standard_curve_wide = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_bend_wide.obj"));
|
||||
public static final IModelCustom rail_standard_ramp = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_ramp.obj"));
|
||||
public static final IModelCustom rail_standard_buffer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_buffer.obj"));
|
||||
public static final IModelCustom rail_standard_switch = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard_switch.obj"));
|
||||
|
||||
@ -411,17 +411,6 @@ public class ItemRenderLibrary {
|
||||
bindTexture(ResourceManager.duchessgambit_tex); ResourceManager.duchessgambit.renderAll();
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.nuke_gadget), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -3, 0);
|
||||
GL11.glScaled(5, 5, 5);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glTranslated(0.25, 0, 0);
|
||||
bindTexture(ResourceManager.bomb_gadget_tex);
|
||||
ResourceManager.bomb_gadget.renderAll();
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.nuke_boy), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glScaled(5, 5, 5);
|
||||
|
||||
@ -2,38 +2,66 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderNukeGadget extends TileEntitySpecialRenderer {
|
||||
public class RenderNukeGadget extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
switch(tileEntity.getBlockMetadata())
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 4:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 3:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 5:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(tileEntity.getBlockMetadata()) {
|
||||
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
bindTexture(ResourceManager.bomb_gadget_tex);
|
||||
ResourceManager.bomb_gadget.renderAll();
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.bomb_gadget_tex);
|
||||
ResourceManager.bomb_gadget.renderPart("Body");
|
||||
|
||||
if(Minecraft.getMinecraft().gameSettings.fancyGraphics)
|
||||
ResourceManager.bomb_gadget.renderPart("Wires");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.nuke_gadget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -3, 0);
|
||||
GL11.glScaled(5, 5, 5);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glRotatef(-90, 0F, 1F, 0F);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.bomb_gadget_tex);
|
||||
ResourceManager.bomb_gadget.renderPart("Body");
|
||||
|
||||
if(Minecraft.getMinecraft().gameSettings.fancyGraphics)
|
||||
ResourceManager.bomb_gadget.renderPart("Wires");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,185 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'rail_standard_straight_short.blend'
|
||||
# www.blender.org
|
||||
o Plane.001
|
||||
v -1.000000 0.000000 0.187500
|
||||
v 1.000000 0.000000 0.187500
|
||||
v -1.000000 0.000000 -0.187500
|
||||
v 1.000000 0.000000 -0.187500
|
||||
v -1.000000 0.062500 -0.187500
|
||||
v -1.000000 0.062500 0.187500
|
||||
v 1.000000 0.062500 0.187500
|
||||
v 1.000000 0.062500 -0.187500
|
||||
v -0.812500 0.062500 0.500000
|
||||
v 0.812500 0.062500 0.500000
|
||||
v -0.812500 0.187500 0.500000
|
||||
v 0.812500 0.187500 0.500000
|
||||
v 0.750000 0.062500 0.500000
|
||||
v 0.750000 0.187500 0.500000
|
||||
v -0.750000 0.062500 0.500000
|
||||
v -0.750000 0.187500 0.500000
|
||||
v 0.625000 0.062500 0.062500
|
||||
v 0.937500 0.062500 0.062500
|
||||
v 0.625000 0.062500 -0.062500
|
||||
v 0.937500 0.062500 -0.062500
|
||||
v 0.625000 0.125000 0.062500
|
||||
v 0.937500 0.125000 0.062500
|
||||
v 0.625000 0.125000 -0.062500
|
||||
v 0.937500 0.125000 -0.062500
|
||||
v -0.937500 0.062500 0.062500
|
||||
v -0.625000 0.062500 0.062500
|
||||
v -0.937500 0.062500 -0.062500
|
||||
v -0.625000 0.062500 -0.062500
|
||||
v -0.937500 0.125000 0.062500
|
||||
v -0.625000 0.125000 0.062500
|
||||
v -0.937500 0.125000 -0.062500
|
||||
v -0.625000 0.125000 -0.062500
|
||||
v -0.812500 0.062500 -0.500000
|
||||
v 0.812500 0.062500 -0.500000
|
||||
v -0.812500 0.187500 -0.500000
|
||||
v 0.812500 0.187500 -0.500000
|
||||
v 0.750000 0.062500 -0.500000
|
||||
v 0.750000 0.187500 -0.500000
|
||||
v -0.750000 0.062500 -0.500000
|
||||
v -0.750000 0.187500 -0.500000
|
||||
vt 0.218750 1.000000
|
||||
vt 0.406250 0.000000
|
||||
vt 0.406250 1.000000
|
||||
vt -0.000000 0.000000
|
||||
vt 0.187500 1.000000
|
||||
vt -0.000000 1.000000
|
||||
vt 0.406250 0.031250
|
||||
vt 0.593750 -0.000000
|
||||
vt 0.593750 0.031250
|
||||
vt 0.218750 1.000000
|
||||
vt 0.187500 -0.000000
|
||||
vt 0.218750 -0.000000
|
||||
vt 0.593750 -0.000000
|
||||
vt 0.406250 0.031250
|
||||
vt 0.187500 0.000000
|
||||
vt 0.218750 0.000000
|
||||
vt 0.500000 0.156250
|
||||
vt 0.437500 0.656250
|
||||
vt 0.437500 0.156250
|
||||
vt 0.593750 0.656250
|
||||
vt 0.531250 0.156250
|
||||
vt 0.593750 0.156250
|
||||
vt 0.531250 0.718750
|
||||
vt 0.500000 0.656250
|
||||
vt 0.531250 0.656250
|
||||
vt 0.406250 0.156250
|
||||
vt 0.531250 0.656250
|
||||
vt 0.500000 0.156250
|
||||
vt 0.531250 0.156250
|
||||
vt 0.500000 0.656250
|
||||
vt 0.531250 0.718750
|
||||
vt 0.500000 0.718750
|
||||
vt 0.437500 0.062500
|
||||
vt 0.406250 0.125000
|
||||
vt 0.406250 0.062500
|
||||
vt 0.437500 0.125000
|
||||
vt 0.593750 0.156250
|
||||
vt 0.437500 0.156250
|
||||
vt 0.593750 0.062500
|
||||
vt 0.437500 0.031250
|
||||
vt 0.593750 0.031250
|
||||
vt 0.593750 0.125000
|
||||
vt 0.625000 0.062500
|
||||
vt 0.625000 0.125000
|
||||
vt 0.437500 0.062500
|
||||
vt 0.406250 0.125000
|
||||
vt 0.406250 0.062500
|
||||
vt 0.437500 0.125000
|
||||
vt 0.593750 0.156250
|
||||
vt 0.437500 0.156250
|
||||
vt 0.593750 0.062500
|
||||
vt 0.437500 0.031250
|
||||
vt 0.593750 0.031250
|
||||
vt 0.593750 0.125000
|
||||
vt 0.625000 0.062500
|
||||
vt 0.625000 0.125000
|
||||
vt 0.406250 0.156250
|
||||
vt 0.437500 0.656250
|
||||
vt 0.406250 0.656250
|
||||
vt 0.437500 0.156250
|
||||
vt 0.500000 0.656250
|
||||
vt 0.531250 0.656250
|
||||
vt 0.500000 0.656250
|
||||
vt 0.593750 0.156250
|
||||
vt 0.593750 0.656250
|
||||
vt 0.531250 0.656250
|
||||
vt 0.500000 0.718750
|
||||
vt 0.500000 0.656250
|
||||
vt 0.531250 0.718750
|
||||
vt 0.500000 0.656250
|
||||
vt 0.531250 0.656250
|
||||
vt 0.406250 -0.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.593750 0.031250
|
||||
vt 0.500000 0.718750
|
||||
vt 0.406250 0.656250
|
||||
vt 0.531250 0.656250
|
||||
vt 0.531250 0.718750
|
||||
vt 0.500000 0.718750
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
s off
|
||||
f 3/1/1 2/2/1 1/3/1
|
||||
f 7/4/2 5/5/2 6/6/2
|
||||
f 1/7/3 5/8/3 3/9/3
|
||||
f 2/10/4 6/11/4 1/12/4
|
||||
f 4/13/5 7/14/5 2/2/5
|
||||
f 3/1/6 8/15/6 4/16/6
|
||||
f 36/17/5 10/18/5 34/19/5
|
||||
f 13/20/3 38/21/3 37/22/3
|
||||
f 12/23/4 13/24/4 10/25/4
|
||||
f 10/18/1 37/26/1 34/19/1
|
||||
f 11/27/2 40/28/2 35/29/2
|
||||
f 9/30/4 16/31/4 11/32/4
|
||||
f 21/33/3 19/34/3 17/35/3
|
||||
f 23/36/6 20/37/6 19/38/6
|
||||
f 22/39/4 17/40/4 18/41/4
|
||||
f 24/42/5 18/43/5 20/44/5
|
||||
f 21/33/2 24/42/2 23/36/2
|
||||
f 29/45/3 27/46/3 25/47/3
|
||||
f 31/48/6 28/49/6 27/50/6
|
||||
f 30/51/4 25/52/4 26/53/4
|
||||
f 32/54/5 26/55/5 28/56/5
|
||||
f 29/45/2 32/54/2 31/48/2
|
||||
f 33/57/1 15/58/1 9/59/1
|
||||
f 39/60/5 16/61/5 15/58/5
|
||||
f 36/17/2 14/62/2 12/63/2
|
||||
f 11/27/3 33/64/3 9/65/3
|
||||
f 33/66/6 40/67/6 39/68/6
|
||||
f 38/69/6 34/70/6 37/71/6
|
||||
f 3/1/1 4/16/1 2/2/1
|
||||
f 7/4/2 8/15/2 5/5/2
|
||||
f 1/7/3 6/72/3 5/8/3
|
||||
f 2/10/4 7/73/4 6/11/4
|
||||
f 4/13/5 8/74/5 7/14/5
|
||||
f 3/1/6 5/5/6 8/15/6
|
||||
f 36/17/5 12/63/5 10/18/5
|
||||
f 13/20/3 14/62/3 38/21/3
|
||||
f 12/23/4 14/75/4 13/24/4
|
||||
f 10/18/1 13/76/1 37/26/1
|
||||
f 11/27/2 16/61/2 40/28/2
|
||||
f 9/30/4 15/77/4 16/31/4
|
||||
f 21/33/3 23/36/3 19/34/3
|
||||
f 23/36/6 24/42/6 20/37/6
|
||||
f 22/39/4 21/33/4 17/40/4
|
||||
f 24/42/5 22/39/5 18/43/5
|
||||
f 21/33/2 22/39/2 24/42/2
|
||||
f 29/45/3 31/48/3 27/46/3
|
||||
f 31/48/6 32/54/6 28/49/6
|
||||
f 30/51/4 29/45/4 25/52/4
|
||||
f 32/54/5 30/51/5 26/55/5
|
||||
f 29/45/2 30/51/2 32/54/2
|
||||
f 33/57/1 39/60/1 15/58/1
|
||||
f 39/60/5 40/28/5 16/61/5
|
||||
f 36/17/2 38/21/2 14/62/2
|
||||
f 11/27/3 35/29/3 33/64/3
|
||||
f 33/66/6 35/78/6 40/67/6
|
||||
f 38/69/6 36/79/6 34/70/6
|
||||
10019
src/main/resources/assets/hbm/models/bombs/gadget.obj
Normal file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 33 KiB |
BIN
src/main/resources/assets/hbm/textures/models/bombs/gadget.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 11 KiB |