This commit is contained in:
Bob 2023-06-25 19:10:29 +02:00
parent 682550616f
commit ff3afbf028
17 changed files with 1380 additions and 33 deletions

View File

@ -1,6 +1,6 @@
mod_version=1.0.27
# Empty build number makes a release type
mod_build_number=4627
mod_build_number=4641
credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\
\ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models,\

View File

@ -2161,7 +2161,7 @@ public class ModBlocks {
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_curve = new RailStandardCurve().setBlockName("rail_large_curve").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 + ":block_steel");
rail_large_buffer = new RailStandardBuffer().setBlockName("rail_large_buffer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rail_standard_buffer");
crate = new BlockCrate(Material.wood).setBlockName("crate").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":crate");
crate_weapon = new BlockCrate(Material.wood).setBlockName("crate_weapon").setStepSound(Block.soundTypeWood).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":crate_weapon");

View File

@ -45,11 +45,13 @@ public interface IRailNTM {
/** A wrapper for additional information like stopping on rails and what type of check we're doing */
public static class MoveContext {
public RailCheckType type;
public double collisionBogieDistance;
public boolean collision = false; //if a buffer stop or similar applies
public double overshoot; //how much of the travel distance was cut shor
public double overshoot; //how much of the travel distance was cut short
public MoveContext(RailCheckType type) {
public MoveContext(RailCheckType type, double collisionBogieDistance) {
this.type = type;
this.collisionBogieDistance = collisionBogieDistance;
}
}

View File

@ -1,12 +1,17 @@
package com.hbm.blocks.rail;
import com.hbm.blocks.BlockDummyable;
import com.hbm.lib.Library;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.material.Material;
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.common.util.ForgeDirection;
public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
@ -19,9 +24,11 @@ public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
return null;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return 0;
return renderID;
}
@Override
@ -38,16 +45,89 @@ public class RailStandardBuffer extends BlockDummyable implements IRailNTM {
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
}
// TBI
@Override
public Vec3 getSnappingPos(World world, int x, int y, int z, double trainX, double trainY, double trainZ) {
return null;
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, 0, 0, 0, 0, new RailContext(), new MoveContext(RailCheckType.OTHER, 0));
}
@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 null;
return snapAndMove(world, x, y, z, trainX, trainY, trainZ, motionX, motionY, motionZ, speed, info, context);
}
/* 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, MoveContext context) {
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(speed == 0) {
//return vec;
}
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 - 2, cX + 3);
vec.yCoord = y + 0.1875;
vec.zCoord = cZ + 0.5 + rot.offsetZ * 0.5;
double nX = (dir == Library.POS_X ? -1 - context.collisionBogieDistance : 2);
double pX = (dir == Library.NEG_X ? 0 - context.collisionBogieDistance : 3);
double buffer = MathHelper.clamp_double(targetX, cX - nX, cX + pX);
if(buffer != vec.xCoord) {
context.collision = true;
context.overshoot = Math.abs(buffer - vec.xCoord);
vec.xCoord = buffer;
return vec;
}
info.dist(Math.abs(targetX - vec.xCoord) * Math.signum(speed));
info.pos(new BlockPos(cX + (motionX * speed > 0 ? 3 : -3), 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 - 2,cZ + 3);
double nZ = (dir == Library.POS_Z ? -1 - context.collisionBogieDistance : 2);
double pZ = (dir == Library.NEG_Z ? 0 - context.collisionBogieDistance : 3);
double buffer = MathHelper.clamp_double(targetZ, cZ - nZ, cZ + pZ);
if(buffer != vec.xCoord) {
context.collision = true;
context.overshoot = Math.abs(buffer - vec.zCoord);
vec.zCoord = buffer;
return vec;
}
info.dist(Math.abs(targetZ - vec.zCoord) * Math.signum(speed));
info.pos(new BlockPos(cX, y, cZ + (motionZ * speed > 0 ? 3 : -3)));
}
return vec;
}
@Override

View File

@ -14,8 +14,7 @@ import com.hbm.blocks.rail.IRailNTM.TrackGauge;
import com.hbm.items.ModItems;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PlayerInformPacket;
import com.hbm.util.ChatBuilder;
import com.hbm.util.Tuple.Pair;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -27,7 +26,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -166,8 +164,8 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
}
BlockPos anchor = this.getCurrentAnchorPos();
Vec3 frontPos = getRelPosAlongRail(anchor, this.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
Vec3 backPos = getRelPosAlongRail(anchor, -this.getLengthSpan(), new MoveContext(RailCheckType.BACK));
Vec3 frontPos = getRelPosAlongRail(anchor, this.getLengthSpan(), new MoveContext(RailCheckType.FRONT, this.getCollisionSpan() - this.getLengthSpan()));
Vec3 backPos = getRelPosAlongRail(anchor, -this.getLengthSpan(), new MoveContext(RailCheckType.BACK, this.getCollisionSpan() - this.getLengthSpan()));
this.lastRenderX = this.renderX;
this.lastRenderY = this.renderY;
@ -325,7 +323,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
EntityRailCarBase train = ltu.trains[0];
BlockPos anchor = new BlockPos(train.posX, train.posY, train.posZ);
Vec3 newPos = train.getRelPosAlongRail(anchor, speed, new MoveContext(RailCheckType.CORE));
Vec3 newPos = train.getRelPosAlongRail(anchor, speed, new MoveContext(RailCheckType.CORE, 0));
if(newPos == null) {
train.derail();
ltu.dissolveTrain();
@ -333,8 +331,8 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
}
train.setPosition(newPos.xCoord, newPos.yCoord, newPos.zCoord);
anchor = train.getCurrentAnchorPos();
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK));
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT, train.getCollisionSpan() - train.getLengthSpan()));
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK, train.getCollisionSpan() - train.getLengthSpan()));
if(frontPos == null || backPos == null) {
train.derail();
@ -634,11 +632,11 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
BlockPos anchor = new BlockPos(moving.posX, moving.posY, moving.posZ);
Vec3 trainPos = Vec3.createVectorHelper(moving.posX, moving.posY, moving.posZ);
float yaw = EntityRailCarBase.generateYaw(prevLoc, nextLoc);
Vec3 newPos = EntityRailCarBase.getRelPosAlongRail(anchor, len, moving.getGauge(), moving.worldObj, trainPos, yaw, new MoveContext(RailCheckType.CORE));
Vec3 newPos = EntityRailCarBase.getRelPosAlongRail(anchor, len, moving.getGauge(), moving.worldObj, trainPos, yaw, new MoveContext(RailCheckType.CORE, 0));
moving.setPosition(newPos.xCoord, newPos.yCoord, newPos.zCoord);
anchor = moving.getCurrentAnchorPos(); //reset origin to new position
Vec3 frontPos = moving.getRelPosAlongRail(anchor, moving.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
Vec3 backPos = moving.getRelPosAlongRail(anchor, -moving.getLengthSpan(), new MoveContext(RailCheckType.BACK));
Vec3 frontPos = moving.getRelPosAlongRail(anchor, moving.getLengthSpan(), new MoveContext(RailCheckType.FRONT, moving.getCollisionSpan() - moving.getLengthSpan()));
Vec3 backPos = moving.getRelPosAlongRail(anchor, -moving.getLengthSpan(), new MoveContext(RailCheckType.BACK, moving.getCollisionSpan() - moving.getLengthSpan()));
if(frontPos == null || backPos == null) {
moving.derail();
@ -679,7 +677,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
for(EntityRailCarBase train : this.trains) {
BlockPos anchor = train.getCurrentAnchorPos();
Vec3 corePos = train.getRelPosAlongRail(anchor, totalSpeed, new MoveContext(RailCheckType.CORE));
Vec3 corePos = train.getRelPosAlongRail(anchor, totalSpeed, new MoveContext(RailCheckType.CORE, 0));
if(corePos == null) {
train.derail();
@ -688,8 +686,8 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
} else {
train.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
anchor = train.getCurrentAnchorPos(); //reset origin to new position
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK));
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT, 0));
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK, 0));
if(frontPos == null || backPos == null) {
train.derail();
@ -763,16 +761,17 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
boolean inReverse = first.getCouplingFrom(null) == current.getCouplingFrom(null);
int sigNum = inReverse ? 1 : -1;
BlockPos anchor = current.getCurrentAnchorPos();
Vec3 corePos = current.getRelPosAlongRail(anchor, speed * sigNum, new MoveContext(RailCheckType.CORE));
if(corePos == null) {
/*Vec3 frontPos = current.getRelPosAlongRail(anchor, current.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
if(frontPos == null) {
current.derail();
this.dissolveTrain();
return;
} else {
current.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
anchor = current.getCurrentAnchorPos(); //reset origin to new position
Vec3 frontPos = current.getRelPosAlongRail(anchor, current.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
Vec3 corePos = current.getRelPosAlongRail(anchor, speed * sigNum, new MoveContext(RailCheckType.CORE));
current.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
Vec3 backPos = current.getRelPosAlongRail(anchor, -current.getLengthSpan(), new MoveContext(RailCheckType.BACK));
if(frontPos == null || backPos == null) {
@ -782,6 +781,33 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
} else {
setRenderPos(current, frontPos, backPos);
}
}*/
Pair<Double, RailCheckType>[] checks;
double dist = speed * sigNum;
if(forward) {
checks = new Pair[] {
new Pair(dist + current.getLengthSpan(), RailCheckType.FRONT),
new Pair(dist, RailCheckType.CORE),
new Pair(dist - current.getLengthSpan(), RailCheckType.BACK)
};
} else {
checks = new Pair[] {
new Pair(dist - current.getLengthSpan(), RailCheckType.BACK),
new Pair(dist, RailCheckType.CORE),
new Pair(dist + current.getLengthSpan(), RailCheckType.FRONT)
};
}
double brake = 0;
for(Pair<Double, RailCheckType> check : checks) {
MoveContext ctx = new MoveContext(check.getValue(), current.getCollisionSpan() - current.getLengthSpan());
current.getRelPosAlongRail(anchor, check.getKey() - (brake * Math.signum(check.getKey())), ctx);
if(ctx.collision) {
brake += ctx.overshoot;
}
}
} else {

View File

@ -866,6 +866,14 @@ public class AssemblerRecipes {
new OreDictStack(OreDictManager.getReflector(), 12),
new ComparableStack(ModItems.circuit_copper, 12)
}, 100);
makeRecipe(new ComparableStack(ModItems.ammo_himars, 1, ItemAmmoHIMARS.SMALL_LAVA), new AStack[] {
new OreDictStack(STEEL.plate(), 24),
new OreDictStack(ANY_HARDPLASTIC.ingot(), 12),
new ComparableStack(ModItems.rocket_fuel, 32),
new ComparableStack(ModItems.ball_tatb, 4),
new OreDictStack(VOLCANIC.gem(), 1),
new ComparableStack(ModItems.circuit_copper, 6)
}, 100);
makeRecipe(new ComparableStack(ModItems.ammo_himars, 1, ItemAmmoHIMARS.LARGE), new AStack[] {
new OreDictStack(STEEL.plate(), 24),
new OreDictStack(ANY_HARDPLASTIC.ingot(), 12),

View File

@ -80,10 +80,10 @@ public class ItemTrain extends ItemEnumMulti {
train.setPosition(x + fx, y + fy, z + fz);
BlockPos anchor = train.getCurrentAnchorPos();
train.rotationYaw = entity.rotationYaw;
Vec3 corePos = train.getRelPosAlongRail(anchor, 0, new MoveContext(RailCheckType.CORE));
Vec3 corePos = train.getRelPosAlongRail(anchor, 0, new MoveContext(RailCheckType.CORE, 0));
train.setPosition(corePos.xCoord, corePos.yCoord, corePos.zCoord);
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT));
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK));
Vec3 frontPos = train.getRelPosAlongRail(anchor, train.getLengthSpan(), new MoveContext(RailCheckType.FRONT, train.getCollisionSpan() - train.getLengthSpan()));
Vec3 backPos = train.getRelPosAlongRail(anchor, -train.getLengthSpan(), new MoveContext(RailCheckType.BACK, train.getCollisionSpan() - train.getLengthSpan()));
train.rotationYaw = train.generateYaw(frontPos, backPos);
world.spawnEntityInWorld(train);
}

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (4627)";
public static final String VERSION = "1.0.27 BETA (4641)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version

View File

@ -801,6 +801,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerBlockHandler(new RenderStandardStraightRail());
RenderingRegistry.registerBlockHandler(new RenderStandardCurveRail());
RenderingRegistry.registerBlockHandler(new RenderStandardRampRail());
RenderingRegistry.registerBlockHandler(new RenderStandardBufferRail());
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_c4.getRenderType(), ResourceManager.charge_c4));

View File

@ -996,6 +996,8 @@ public class CraftingManager {
addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite });
addShapelessAuto(new ItemStack(ModItems.bdcl), new Object[] { ANY_TAR.any(), Fluids.WATER.getDict(1_000), KEY_WHITE });
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleCrafting) {
addShapelessAuto(new ItemStack(ModItems.cordite, 3), new Object[] { ModItems.ballistite, Items.gunpowder, new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) });
addShapelessAuto(new ItemStack(ModItems.ingot_semtex, 3), new Object[] { Items.slime_ball, Blocks.tnt, KNO.dust() });

View File

@ -13,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.effect.EntityNukeTorex;
import com.hbm.entity.mob.EntityHunterChopper;
@ -66,6 +70,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;
@ -259,12 +264,12 @@ public class ModEventHandlerClient {
boolean flip = distanceToCover < 0;
if(it == 1) {
Vec3 snap = next = rail.getTravelLocation(world, x, y, z, next.xCoord, next.yCoord, next.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, 0, info, new MoveContext(RailCheckType.CORE));
Vec3 snap = next = rail.getTravelLocation(world, x, y, z, next.xCoord, next.yCoord, next.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, 0, info, new MoveContext(RailCheckType.CORE, 0));
if(i == 0) world.spawnParticle("reddust", snap.xCoord, snap.yCoord + 0.25, snap.zCoord, 0.1, 1, 0.1);
}
Vec3 prev = next;
next = rail.getTravelLocation(world, x, y, z, prev.xCoord, prev.yCoord, prev.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, distanceToCover, info, new MoveContext(i == 0 ? RailCheckType.FRONT : RailCheckType.BACK));
next = rail.getTravelLocation(world, x, y, z, prev.xCoord, prev.yCoord, prev.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, distanceToCover, info, new MoveContext(i == 0 ? RailCheckType.FRONT : RailCheckType.BACK, 0));
distanceToCover = info.overshoot;
anchor = info.pos;
if(i == 0) world.spawnParticle("reddust", next.xCoord, next.yCoord + 0.25, next.zCoord, 0, distanceToCover != 0 ? 0.5 : 0, 0);

View File

@ -1344,6 +1344,7 @@ public class ResourceManager {
public static final IModelCustom rail_standard_straight = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/rail_standard.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_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 capacitor = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/capacitor.obj"));
public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj"));

View File

@ -0,0 +1,77 @@
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

@ -1000,6 +1000,7 @@ item.ammo_grenade_toxic.name=40mm Granate (Chemisch)
item.ammo_grenade_tracer.name=40mm Übungsgranate
item.ammo_himars_standard.name=227mm gelenkte Artillerierakete
item.ammo_himars_standard_he.name=227mm Artillerielenkrakete (HE)
item.ammo_himars_standard_lava.name=227mm Artillerielenkrakete (Lava)
item.ammo_himars_standard_mini_nuke.name=227mm Artillerielenkrakete (Miniatombombe)
item.ammo_himars_standard_tb.name=227mm Artillerielenkrakete (Thermobarisch)
item.ammo_himars_standard_wp.name=227mm Artillerielenkrakete (WP)

View File

@ -1580,6 +1580,7 @@ item.ammo_grenade_toxic.name=40mm Grenade (Chemical)
item.ammo_grenade_tracer.name=40mm Training Grenade
item.ammo_himars_standard.name=227mm Guided Artillery Rocket Pod
item.ammo_himars_standard_he.name=227mm Guided Artillery Rocket Pod (HE)
item.ammo_himars_standard_lava.name=227mm Guided Artillery Rocket Pod (Lava)
item.ammo_himars_standard_mini_nuke.name=227mm Guided Artillery Rocket Pod (Mini Nuke)
item.ammo_himars_standard_tb.name=227mm Guided Artillery Rocket Pod (Thermobaric)
item.ammo_himars_standard_wp.name=227mm Guided Artillery Rocket Pod (WP)

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B