From 0040eb831d382bdac4a3d8afb96d153b768cc965 Mon Sep 17 00:00:00 2001 From: Paul19988 Date: Thu, 23 Nov 2023 21:20:18 +0000 Subject: [PATCH 1/2] most recent clean --- .../client/render/CustomModelRenderer.java | 164 +- .../render/ItemRenderAmericanStopper.java | 2 +- .../train/client/render/ItemRenderBook.java | 139 +- .../client/render/ItemRenderBridgePillar.java | 84 +- .../render/ItemRenderEmbeddedStopper.java | 2 +- .../render/ItemRenderGeneratorDiesel.java | 88 +- .../client/render/ItemRenderLantern.java | 95 +- .../client/render/ItemRenderMFPBWigWag.java | 94 +- .../ItemRenderModelMetroMadridPole.java | 18 +- .../train/client/render/ItemRenderSignal.java | 87 +- .../client/render/ItemRenderStopper.java | 95 +- .../client/render/ItemRenderSwitchStand.java | 91 +- .../client/render/ItemRenderWaterWheel.java | 95 +- .../client/render/ItemRenderWindMill.java | 107 +- .../java/train/client/render/ModelGTNG.java | 2 +- .../client/render/RenderAmericanStopper.java | 2 +- .../java/train/client/render/RenderBogie.java | 43 +- .../client/render/RenderBridgePillar.java | 24 +- .../train/client/render/RenderCoreTC.java | 372 +- .../client/render/RenderEmbeddedStopper.java | 2 +- .../java/train/client/render/RenderEnum.java | 3057 +++++----- .../client/render/RenderGeneratorDiesel.java | 36 +- .../client/render/RenderLasersLines.java | 104 +- .../train/client/render/RenderMFPBWigWag.java | 94 +- .../client/render/RenderMetroMadridPole.java | 2 +- .../client/render/RenderRollingStock.java | 797 ++- .../client/render/RenderRotativeDigger.java | 89 +- .../client/render/RenderRotativeWheel.java | 85 +- .../train/client/render/RenderSignal.java | 34 +- .../train/client/render/RenderStopper.java | 34 +- .../client/render/RenderSwitchStand.java | 105 +- .../train/client/render/RenderTCBook.java | 14 +- .../train/client/render/RenderTCRail.java | 1094 ++-- .../train/client/render/RenderWaterWheel.java | 10 +- .../train/client/render/RenderWindMill.java | 14 +- .../train/client/render/RenderZeppelins.java | 149 +- .../client/render/TileLinesRenderer.java | 28 +- src/main/java/train/common/Traincraft.java | 4 + .../train/common/adminbook/GUIAdminBook.java | 144 +- .../train/common/adminbook/ItemAdminBook.java | 150 +- .../train/common/adminbook/ServerLogger.java | 80 +- .../java/train/common/api/AbstractTrains.java | 1383 ++--- .../train/common/api/EntityRollingStock.java | 5040 ++++++++--------- src/main/java/train/common/api/Freight.java | 391 +- .../java/train/common/api/TrainRecord.java | 56 +- .../java/train/common/core/CommonProxy.java | 403 +- .../common/core/CreativeTabTraincraft.java | 30 +- .../core/CreativeTabTraincraftTrains.java | 30 +- .../java/train/common/core/EntityIds.java | 18 +- .../java/train/common/core/FakePlayer.java | 416 +- .../common/core/HandleMaxAttachedCarts.java | 297 +- .../train/common/core/HandleOverheating.java | 281 +- .../train/common/core/TrainModBlockUtil.java | 16 +- .../java/train/common/core/TrainModCore.java | 69 +- .../common/core/Traincraft_EventSounds.java | 2 +- .../common/core/handlers/RecipeHandler.java | 1058 ++-- .../common/core/handlers/RetrogenHandler.java | 135 +- .../RollingStockStatsEventHandler.java | 102 +- .../common/core/handlers/TrainHandler.java | 41 +- .../core/handlers/TraincraftSaveHandler.java | 194 +- .../core/handlers/TrainsDamageSource.java | 80 +- .../handlers/VillagerTraincraftHandler.java | 144 +- .../common/core/handlers/WorldEvents.java | 132 +- .../train/common/core/interfaces/IPlugin.java | 4 +- .../train/common/core/interfaces/ITier.java | 18 +- .../common/core/managers/TierRecipe.java | 172 +- .../core/managers/TierRecipeManager.java | 120 +- .../core/network/PacketDestination.java | 6 +- .../common/core/network/PacketHandler.java | 107 +- .../common/core/network/PacketKeyPress.java | 125 +- .../common/core/network/PacketLantern.java | 17 +- .../core/network/PacketParkingBrake.java | 42 +- .../network/PacketRollingStockRotation.java | 124 +- .../network/PacketSetJukeboxStreamingUrl.java | 97 +- .../core/network/PacketSetLocoTurnedOn.java | 16 +- .../network/PacketSetTrainLockedToClient.java | 24 +- .../core/network/PacketSlotsFilled.java | 85 +- .../network/PacketTrackBuilderFollow.java | 90 +- .../network/PacketTrackBuilderHeight.java | 16 +- .../core/network/PacketUpdateTrainID.java | 6 +- .../plugins/NEIAssemblyTableRecipePlugin.java | 48 +- .../NEIDistillationTowerRecipePlugin.java | 258 +- .../NEIOpenHearthFurnaceRecipePlugin.java | 278 +- .../core/plugins/NEITraincraftConfig.java | 16 +- .../NEITraincraftWorkbenchRecipePlugin.java | 362 +- .../common/core/plugins/PluginRailcraft.java | 84 +- .../java/train/common/core/util/Energy.java | 114 +- .../train/common/core/util/MP3Player.java | 107 +- .../common/core/util/TraincraftUtil.java | 212 +- .../common/entity/ai/EntityAIFearHorn.java | 74 +- .../train/common/entity/ai/TCPathFinder.java | 87 +- .../entity/digger/EntityRotativeDigger.java | 1470 ++--- .../entity/digger/EntityRotativeWheel.java | 540 +- .../entity/rollingStock/EntityBUnitDD35.java | 473 +- .../entity/rollingStock/EntityBUnitEMDF3.java | 557 +- .../entity/rollingStock/EntityBUnitEMDF7.java | 478 +- .../rollingStock/EntityBoulderWagon.java | 21 +- .../entity/rollingStock/EntityBoxCartPRR.java | 21 +- .../entity/rollingStock/EntityBoxCartUS.java | 189 +- .../rollingStock/EntityBulkheadFlatCart.java | 204 +- .../entity/rollingStock/EntityCaboose.java | 13 +- .../entity/rollingStock/EntityCaboose3.java | 123 +- .../rollingStock/EntityCabooseBRBrakeVan.java | 119 +- .../rollingStock/EntityCabooseBapDRGW.java | 16 +- .../rollingStock/EntityCabooseBapHBC1C.java | 17 +- .../EntityCabooseBapWVcaboose.java | 51 +- .../inventory/TrainCraftingManager.java | 12 +- .../train/common/items/ItemRollingStock.java | 12 +- 108 files changed, 12393 insertions(+), 12680 deletions(-) diff --git a/src/main/java/train/client/render/CustomModelRenderer.java b/src/main/java/train/client/render/CustomModelRenderer.java index 5b5d9299a2..60f694e5cd 100644 --- a/src/main/java/train/client/render/CustomModelRenderer.java +++ b/src/main/java/train/client/render/CustomModelRenderer.java @@ -10,88 +10,90 @@ import java.util.ArrayList; public class CustomModelRenderer extends ModelRendererTurbo { + public CustomModelRenderer(ModelBase m, int i, int j, int w, int h) { + super(m, i, j, w, h); + } + @Override + public ModelRendererTurbo addBox(float f, float f1, float f2, int i, int j, int k) { + addBox(f, f1, f2, i, j, k, 0.0f); + return this; + } - public CustomModelRenderer(ModelBase m, int i, int j, int w, int h) { - super(m,i,j,w,h); - } - - @Override - public ModelRendererTurbo addBox(float f, float f1, float f2, int i, int j, int k) { - addBox(f, f1, f2, i, j, k, 0.0f); - return this; - } - - //for some odd reason the boxes seem inside out normally, so it's likely the values are reversed - @Override - public ModelRendererTurbo addBox(float f, float f1, float f2, int i, int j, int k, float f3) { - faces = new ArrayList(); - float f4 = f + i +f3; - float f5 = f1 + j +f3; - float f6 = f2 + k +f3; - f -= f3; - f1 -= f3; - f2 -= f3; - TexturedVertex TexturedVertex = new TexturedVertex(f, f1, f2, 0.0F, 0.0F); - TexturedVertex TexturedVertex1 = new TexturedVertex(f4, f1, f2, 0.0F, 8F); - TexturedVertex TexturedVertex2 = new TexturedVertex(f4, f5, f2, 8F, 8F); - TexturedVertex TexturedVertex3 = new TexturedVertex(f, f5, f2, 8F, 0.0F); - TexturedVertex TexturedVertex4 = new TexturedVertex(f, f1, f6, 0.0F, 0.0F); - TexturedVertex TexturedVertex5 = new TexturedVertex(f4, f1, f6, 0.0F, 8F); - TexturedVertex TexturedVertex6 = new TexturedVertex(f4, f5, f6, 8F, 8F); - TexturedVertex TexturedVertex7 = new TexturedVertex(f, f5, f6, 8F, 0.0F); - faces.add(generateFaces(new TexturedVertex[] { TexturedVertex5, TexturedVertex1, TexturedVertex2, TexturedVertex6 }, textureOffsetX + k + i, textureOffsetY + k, textureOffsetX + k + i + k, textureOffsetY + k + j, textureWidth, textureHeight)); - faces.add(generateFaces(new TexturedVertex[] { TexturedVertex, TexturedVertex4, TexturedVertex7, TexturedVertex3 }, textureOffsetX, textureOffsetY + k, textureOffsetX + k, textureOffsetY + k + j, textureWidth, textureHeight)); - faces.add(generateFaces(new TexturedVertex[] { TexturedVertex5, TexturedVertex4, TexturedVertex, TexturedVertex1 }, textureOffsetX + k, textureOffsetY, textureOffsetX + k + i, textureOffsetY + k, textureWidth, textureHeight)); - faces.add(generateFaces(new TexturedVertex[] { TexturedVertex2, TexturedVertex3, TexturedVertex7, TexturedVertex6 }, textureOffsetX + k + i, textureOffsetY, textureOffsetX + k + i + i, textureOffsetY + k, textureWidth, textureHeight)); - faces.add(generateFaces(new TexturedVertex[] { TexturedVertex1, TexturedVertex, TexturedVertex3, TexturedVertex2 }, textureOffsetX + k, textureOffsetY + k, textureOffsetX + k + i, textureOffsetY + k + j, textureWidth, textureHeight)); - faces.add(generateFaces(new TexturedVertex[] { TexturedVertex4, TexturedVertex5, TexturedVertex6, TexturedVertex7 }, textureOffsetX + k + i + k, textureOffsetY + k, textureOffsetX + k + i + k + i, textureOffsetY + k + j, textureWidth, textureHeight)); - return this; - } - - private static TexturedPolygon generateFaces(TexturedVertex aPositionTransformVertex[], int i, int j, int k, int l, float textureWidth, float textureHeight) { - aPositionTransformVertex[0] = new TexturedVertex(aPositionTransformVertex[0].vector3F, (float) k / textureWidth - 0.0015625F, (float) j / textureHeight + 0.003125F); - aPositionTransformVertex[1] = new TexturedVertex(aPositionTransformVertex[1].vector3F,(float) i / textureWidth + 0.0015625F, (float) j / textureHeight + 0.003125F); - aPositionTransformVertex[2] = new TexturedVertex(aPositionTransformVertex[2].vector3F,(float) i / textureWidth + 0.0015625F, (float) l / textureHeight - 0.003125F); - aPositionTransformVertex[3] = new TexturedVertex(aPositionTransformVertex[3].vector3F,(float) k / textureWidth - 0.0015625F, (float) l / textureHeight - 0.003125F); - return new TexturedPolygon(aPositionTransformVertex); - } - - private static final float degreesF = (float)(180D/Math.PI); - - //same as super, but old models have inverse Y rotations and I don't even understand the Z rotation - public void render(float worldScale, boolean invertYZ) { - - if(!showModel) { - return; - } - if(!compiled) { - compileDisplayList(worldScale); - return; - } - if (rotateAngleX != 0.0F || rotateAngleY != 0.0F || rotateAngleZ != 0.0F) { - GL11.glPushMatrix(); - GL11.glTranslatef(rotationPointX * worldScale, rotationPointY * worldScale, rotationPointZ *worldScale); - if (rotateAngleZ != 0.0F) { - GL11.glRotatef(rotateAngleZ * degreesF, 0.0F, 0.0F, 1.0F); - } - if (rotateAngleY != 0.0F) { - GL11.glRotatef(rotateAngleY * degreesF, 0.0F, 1.0F, 0.0F); - } - if (rotateAngleX != 0.0F) { - GL11.glRotatef(rotateAngleX * degreesF, 1.0F, 0.0F, 0.0F); - } - callDisplayList(); - GL11.glPopMatrix(); - } - else if (rotationPointX != 0.0F || rotationPointY != 0.0F || rotationPointZ != 0.0F) { - GL11.glTranslatef(rotationPointX * worldScale, rotationPointY * worldScale, rotationPointZ * worldScale); - callDisplayList(); - GL11.glTranslatef(-rotationPointX * worldScale, -rotationPointY * worldScale, -rotationPointZ * worldScale); - } - else { - callDisplayList(); - } - } + // For some odd reason the boxes seem inside out normally, so it's likely the values are reversed + @Override + public ModelRendererTurbo addBox(float f, float f1, float f2, int i, int j, int k, float f3) { + faces = new ArrayList<>(); + float f4 = f + i + f3; + float f5 = f1 + j + f3; + float f6 = f2 + k + f3; + f -= f3; + f1 -= f3; + f2 -= f3; + + TexturedVertex TexturedVertex = new TexturedVertex(f, f1, f2, 0.0F, 0.0F); + TexturedVertex TexturedVertex1 = new TexturedVertex(f4, f1, f2, 0.0F, 8F); + TexturedVertex TexturedVertex2 = new TexturedVertex(f4, f5, f2, 8F, 8F); + TexturedVertex TexturedVertex3 = new TexturedVertex(f, f5, f2, 8F, 0.0F); + TexturedVertex TexturedVertex4 = new TexturedVertex(f, f1, f6, 0.0F, 0.0F); + TexturedVertex TexturedVertex5 = new TexturedVertex(f4, f1, f6, 0.0F, 8F); + TexturedVertex TexturedVertex6 = new TexturedVertex(f4, f5, f6, 8F, 8F); + TexturedVertex TexturedVertex7 = new TexturedVertex(f, f5, f6, 8F, 0.0F); + + faces.add(generateFaces(new TexturedVertex[]{TexturedVertex5, TexturedVertex1, TexturedVertex2, TexturedVertex6}, textureOffsetX + k + i, textureOffsetY + k, textureOffsetX + k + i + k, textureOffsetY + k + j, textureWidth, textureHeight)); + faces.add(generateFaces(new TexturedVertex[]{TexturedVertex, TexturedVertex4, TexturedVertex7, TexturedVertex3}, textureOffsetX, textureOffsetY + k, textureOffsetX + k, textureOffsetY + k + j, textureWidth, textureHeight)); + faces.add(generateFaces(new TexturedVertex[]{TexturedVertex5, TexturedVertex4, TexturedVertex, TexturedVertex1}, textureOffsetX + k, textureOffsetY, textureOffsetX + k + i, textureOffsetY + k, textureWidth, textureHeight)); + faces.add(generateFaces(new TexturedVertex[]{TexturedVertex2, TexturedVertex3, TexturedVertex7, TexturedVertex6}, textureOffsetX + k + i, textureOffsetY, textureOffsetX + k + i + i, textureOffsetY + k, textureWidth, textureHeight)); + faces.add(generateFaces(new TexturedVertex[]{TexturedVertex1, TexturedVertex, TexturedVertex3, TexturedVertex2}, textureOffsetX + k, textureOffsetY + k, textureOffsetX + k + i, textureOffsetY + k + j, textureWidth, textureHeight)); + faces.add(generateFaces(new TexturedVertex[]{TexturedVertex4, TexturedVertex5, TexturedVertex6, TexturedVertex7}, textureOffsetX + k + i + k, textureOffsetY + k, textureOffsetX + k + i + k + i, textureOffsetY + k + j, textureWidth, textureHeight)); + return this; + } + + private static TexturedPolygon generateFaces(TexturedVertex aPositionTransformVertex[], int i, int j, int k, int l, float textureWidth, float textureHeight) { + aPositionTransformVertex[0] = new TexturedVertex(aPositionTransformVertex[0].vector3F, (float) k / textureWidth - 0.0015625F, (float) j / textureHeight + 0.003125F); + aPositionTransformVertex[1] = new TexturedVertex(aPositionTransformVertex[1].vector3F, (float) i / textureWidth + 0.0015625F, (float) j / textureHeight + 0.003125F); + aPositionTransformVertex[2] = new TexturedVertex(aPositionTransformVertex[2].vector3F, (float) i / textureWidth + 0.0015625F, (float) l / textureHeight - 0.003125F); + aPositionTransformVertex[3] = new TexturedVertex(aPositionTransformVertex[3].vector3F, (float) k / textureWidth - 0.0015625F, (float) l / textureHeight - 0.003125F); + return new TexturedPolygon(aPositionTransformVertex); + } + + private static final float degreesF = (float) (180D / Math.PI); + + // Same as super, but old models have inverse Y rotations and I don't even understand the Z rotation + public void render(float worldScale, boolean invertYZ) { + if (!showModel) { + return; + } + + if (!compiled) { + compileDisplayList(worldScale); + return; + } + + if (rotateAngleX != 0.0F || rotateAngleY != 0.0F || rotateAngleZ != 0.0F) { + GL11.glPushMatrix(); + GL11.glTranslatef(rotationPointX * worldScale, rotationPointY * worldScale, rotationPointZ * worldScale); + if (rotateAngleZ != 0.0F) { + GL11.glRotatef(rotateAngleZ * degreesF, 0.0F, 0.0F, 1.0F); + } + + if (rotateAngleY != 0.0F) { + GL11.glRotatef(rotateAngleY * degreesF, 0.0F, 1.0F, 0.0F); + } + + if (rotateAngleX != 0.0F) { + GL11.glRotatef(rotateAngleX * degreesF, 1.0F, 0.0F, 0.0F); + } + + callDisplayList(); + GL11.glPopMatrix(); + } else if (rotationPointX != 0.0F || rotationPointY != 0.0F || rotationPointZ != 0.0F) { + GL11.glTranslatef(rotationPointX * worldScale, rotationPointY * worldScale, rotationPointZ * worldScale); + callDisplayList(); + GL11.glTranslatef(-rotationPointX * worldScale, -rotationPointY * worldScale, -rotationPointZ * worldScale); + } else { + callDisplayList(); + } + } } diff --git a/src/main/java/train/client/render/ItemRenderAmericanStopper.java b/src/main/java/train/client/render/ItemRenderAmericanStopper.java index 772f4ec877..32964aff2a 100644 --- a/src/main/java/train/client/render/ItemRenderAmericanStopper.java +++ b/src/main/java/train/client/render/ItemRenderAmericanStopper.java @@ -15,7 +15,7 @@ import train.common.library.Info; public class ItemRenderAmericanStopper implements IItemRenderer { - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "buffer.png"); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "buffer.png"); private static final ModelAmericanStopper americanStopper = new ModelAmericanStopper(1F); public ItemRenderAmericanStopper() { diff --git a/src/main/java/train/client/render/ItemRenderBook.java b/src/main/java/train/client/render/ItemRenderBook.java index 66aa3a511c..8dcb3d97d4 100644 --- a/src/main/java/train/client/render/ItemRenderBook.java +++ b/src/main/java/train/client/render/ItemRenderBook.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2013 Mrbrutal. All rights reserved. - * + * * @name Traincraft * @author Mrbrutal ******************************************************************************/ @@ -17,68 +17,67 @@ import train.common.library.Info; public class ItemRenderBook implements IItemRenderer { - - ModelTCBook book1; - ModelTCBook book2; - - public static boolean open = false; - - public ItemRenderBook() { - book1 = new ModelTCBook(); - book2 = new ModelTCBook(); - } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + ModelTCBook book1; + ModelTCBook book2; - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + public static boolean open = false; - @Override - public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { - switch (type) { - case ENTITY: { - renderBook(0.0F, 1.0F, 0.0F, 0.0F, 0.0f, 0.0f, 0.0f, 1.5F); - break; - } - case EQUIPPED: { - renderBook(0.3F, 0.6F, 0.7F, 70.0F, 0.0f, 1.0f, 0.0f, 1.0F); - break; - } - case EQUIPPED_FIRST_PERSON: { - if(open) { - rotateBook(-0.7F, 1.8F, -0.277F, -45.0F, 0.0f, 1.0f, 0.0f, 1.0f+Minecraft.getMinecraft().currentScreen.height*0.003f); - } - else { - renderBook(0F, 0.8F, 0F, 0.0F, 0.0f, 1.0f, 0.0f, 1.0F); - } - return; - } - case INVENTORY: { - renderBook(0.5F, 0.4F, 0.5F, 180.0F, 0.0f, 1.0f, 0.0f, 1.2F); - break; - } - default: - break; - } - } + public ItemRenderBook() { + book1 = new ModelTCBook(); + book2 = new ModelTCBook(); + } - private void renderBook(float left, float up, float right, float rotation, float x, float y, float z, float scale) { - Tessellator tesselator = Tessellator.instance; - tmt.Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "book2.png")); - GL11.glPushMatrix(); - GL11.glTranslatef(left, up, right); - GL11.glRotatef(rotation, x, y, z); - GL11.glScalef(scale, scale, scale); - book1.render(20); - GL11.glPopMatrix(); - } - - private void rotateBook(float left, float up, float right, float rotation, float x, float y, float z, float scale) { + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { + switch (type) { + case ENTITY: { + renderBook(0.0F, 1.0F, 0.0F, 0.0F, 0.0f, 0.0f, 0.0f, 1.5F); + break; + } + case EQUIPPED: { + renderBook(0.3F, 0.6F, 0.7F, 70.0F, 0.0f, 1.0f, 0.0f, 1.0F); + break; + } + case EQUIPPED_FIRST_PERSON: { + if (open) { + rotateBook(-0.7F, 1.8F, -0.277F, -45.0F, 0.0f, 1.0f, 0.0f, 1.0f + Minecraft.getMinecraft().currentScreen.height * 0.003f); + } else { + renderBook(0F, 0.8F, 0F, 0.0F, 0.0f, 1.0f, 0.0f, 1.0F); + } + return; + } + case INVENTORY: { + renderBook(0.5F, 0.4F, 0.5F, 180.0F, 0.0f, 1.0f, 0.0f, 1.2F); + break; + } + default: + break; + } + } + + private void renderBook(float left, float up, float right, float rotation, float x, float y, float z, float scale) { + Tessellator tesselator = Tessellator.instance; + tmt.Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "book2.png")); + GL11.glPushMatrix(); + GL11.glTranslatef(left, up, right); + GL11.glRotatef(rotation, x, y, z); + GL11.glScalef(scale, scale, scale); + book1.render(20); + GL11.glPopMatrix(); + } + + private void rotateBook(float left, float up, float right, float rotation, float x, float y, float z, float scale) { // if(upp) { // w++; // } @@ -93,16 +92,16 @@ private void rotateBook(float left, float up, float right, float rotation, float // upp = true; // down = false; // } - //System.out.println(w/10); - tmt.Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "book2.png")); - GL11.glPushMatrix(); - GL11.glTranslatef(left, up, right); - GL11.glTranslatef(0.5f, 1.f, -0.5f); - GL11.glRotatef(rotation, x, y, z); - GL11.glRotatef(-25.0f, 1.0f, 0.0f, 0.0f); - GL11.glScalef(scale, scale, scale); - book1.rotate(10/*+(int)((Math.sin(w)*10)-(Math.sin(w))%10)*/); - GL11.glPopMatrix(); - } + //System.out.println(w/10); + tmt.Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "book2.png")); + GL11.glPushMatrix(); + GL11.glTranslatef(left, up, right); + GL11.glTranslatef(0.5f, 1.f, -0.5f); + GL11.glRotatef(rotation, x, y, z); + GL11.glRotatef(-25.0f, 1.0f, 0.0f, 0.0f); + GL11.glScalef(scale, scale, scale); + book1.rotate(10/*+(int)((Math.sin(w)*10)-(Math.sin(w))%10)*/); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderBridgePillar.java b/src/main/java/train/client/render/ItemRenderBridgePillar.java index 026f1a5b49..83fa173640 100644 --- a/src/main/java/train/client/render/ItemRenderBridgePillar.java +++ b/src/main/java/train/client/render/ItemRenderBridgePillar.java @@ -11,49 +11,43 @@ public class ItemRenderBridgePillar implements IItemRenderer { - public ItemRenderBridgePillar() { - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderBridgePillar(0f, 0f, 0f); - return; - } - case EQUIPPED: { - renderBridgePillar(0.2f, 1f, 1f); - return; - } - case EQUIPPED_FIRST_PERSON: { - renderBridgePillar(0.2f, 1f, 1f); - return; - } - case INVENTORY: { - renderBridgePillar(0f, 0f, 0f); - return; - } - default: - break; - } - } - - private void renderBridgePillar(float x, float y, float z) { - Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "bridgePillar.png")); - GL11.glPushMatrix(); - GL11.glTranslatef(x, y-0.5f, z); - GL11.glRotatef(180f,0f,0f, 1f); - modelBridgePillar.render(); - GL11.glPopMatrix(); - } + public ItemRenderBridgePillar() { + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: + case INVENTORY: { + renderBridgePillar(0f, 0f, 0f); + return; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderBridgePillar(0.2f, 1f, 1f); + return; + } + default: + break; + } + } + + private void renderBridgePillar(float x, float y, float z) { + Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "bridgePillar.png")); + GL11.glPushMatrix(); + GL11.glTranslatef(x, y - 0.5f, z); + GL11.glRotatef(180f, 0f, 0f, 1f); + modelBridgePillar.render(); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderEmbeddedStopper.java b/src/main/java/train/client/render/ItemRenderEmbeddedStopper.java index bbae0b182f..3f7281f411 100644 --- a/src/main/java/train/client/render/ItemRenderEmbeddedStopper.java +++ b/src/main/java/train/client/render/ItemRenderEmbeddedStopper.java @@ -15,7 +15,7 @@ import train.common.library.Info; public class ItemRenderEmbeddedStopper implements IItemRenderer { - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "embedded_buffer.png"); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "embedded_buffer.png"); private static final ModelEmbeddedStopper embeddedStopper = new ModelEmbeddedStopper(1F); public ItemRenderEmbeddedStopper() { diff --git a/src/main/java/train/client/render/ItemRenderGeneratorDiesel.java b/src/main/java/train/client/render/ItemRenderGeneratorDiesel.java index 06742b1595..2297714aca 100644 --- a/src/main/java/train/client/render/ItemRenderGeneratorDiesel.java +++ b/src/main/java/train/client/render/ItemRenderGeneratorDiesel.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2013 Spitfire4466. All rights reserved. - * + * * @name TrainCraft * @author Spitfire4466 ******************************************************************************/ @@ -16,53 +16,53 @@ public class ItemRenderGeneratorDiesel implements IItemRenderer { - private static final ModelGeneratorDiesel generator = new ModelGeneratorDiesel(1F); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "generator_diesel.png"); + private static final ModelGeneratorDiesel generator = new ModelGeneratorDiesel(1F); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "generator_diesel.png"); - public ItemRenderGeneratorDiesel() { + public ItemRenderGeneratorDiesel() { - } + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderGenerator(0.0F, 0F, 0.0F); - break; - } - case EQUIPPED: { - renderGenerator(0F, 0.1F, 0F); - break; - } - case EQUIPPED_FIRST_PERSON: { - renderGenerator(0F, 0.1F, 0F); - return; - } - case INVENTORY: { - renderGenerator(0.5F, -0.1F, 0.5F); - break; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderGenerator(0.0F, 0F, 0.0F); + break; + } + case EQUIPPED: { + renderGenerator(0F, 0.1F, 0F); + break; + } + case EQUIPPED_FIRST_PERSON: { + renderGenerator(0F, 0.1F, 0F); + return; + } + case INVENTORY: { + renderGenerator(0.5F, -0.1F, 0.5F); + break; + } + default: + break; + } + } - private void renderGenerator(float f, float g, float h) { - tmt.Tessellator.bindTexture(texture); - GL11.glPushMatrix(); - GL11.glTranslatef(f, g, h); - GL11.glScalef(0.7F, 0.7F, 0.7F); - generator.render2(0.0625F); - GL11.glPopMatrix(); - } + private void renderGenerator(float f, float g, float h) { + tmt.Tessellator.bindTexture(texture); + GL11.glPushMatrix(); + GL11.glTranslatef(f, g, h); + GL11.glScalef(0.7F, 0.7F, 0.7F); + generator.render2(0.0625F); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderLantern.java b/src/main/java/train/client/render/ItemRenderLantern.java index b87886f2ef..e8ab573853 100644 --- a/src/main/java/train/client/render/ItemRenderLantern.java +++ b/src/main/java/train/client/render/ItemRenderLantern.java @@ -8,62 +8,59 @@ import train.common.library.Info; public class ItemRenderLantern implements IItemRenderer { - private static final ModelLantern modelLantern= new ModelLantern(); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "lantern_uv_draw_2.png"); + private static final ModelLantern modelLantern = new ModelLantern(); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "lantern_uv_draw_2.png"); - public ItemRenderLantern() { - } + public ItemRenderLantern() { + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderLantern(0f, 0f, 0f, 1f); - return; - } - case EQUIPPED: { - renderLantern(0.2f, 1f, 1f, 1f); - return; - } - case EQUIPPED_FIRST_PERSON: { - renderLantern(0.2f, 1f, 1f, 1f); - return; - } - case INVENTORY: { - renderLantern(0f, 0f, 0f, 0.7f); - return; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderLantern(0f, 0f, 0f, 1f); + return; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderLantern(0.2f, 1f, 1f, 1f); + return; + } + case INVENTORY: { + renderLantern(0f, 0f, 0f, 0.7f); + return; + } + default: + break; + } + } - private void renderLantern(float x, float y, float z, float scale) { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); + private void renderLantern(float x, float y, float z, float scale) { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); - GL11.glTranslatef(x, y, z); - GL11.glScalef(scale, scale, scale); + GL11.glTranslatef(x, y, z); + GL11.glScalef(scale, scale, scale); - tmt.Tessellator.bindTexture(texture); - float f2 = (float) (0x4f4e4a >> 16 & 255) / 255.0F; - float f3 = (float) (0x4f4e4a >> 8 & 255) / 255.0F; - float f4 = (float) (0x4f4e4a & 255) / 255.0F; - GL11.glColor3f(f2, f3, f4); + tmt.Tessellator.bindTexture(texture); + float f2 = (float) (0x4f4e4a >> 16 & 255) / 255.0F; + float f3 = (float) (0x4f4e4a >> 8 & 255) / 255.0F; + float f4 = (float) (0x4f4e4a & 255) / 255.0F; + GL11.glColor3f(f2, f3, f4); - modelLantern.render(); + modelLantern.render(); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderMFPBWigWag.java b/src/main/java/train/client/render/ItemRenderMFPBWigWag.java index a559937b60..ba10f5e990 100644 --- a/src/main/java/train/client/render/ItemRenderMFPBWigWag.java +++ b/src/main/java/train/client/render/ItemRenderMFPBWigWag.java @@ -9,60 +9,60 @@ import train.common.library.Info; public class ItemRenderMFPBWigWag implements IItemRenderer { - private static final ModelMFPBWigWag modeSwitch = new ModelMFPBWigWag(); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "MFPBWigWagOn.png"); + private static final ModelMFPBWigWag modeSwitch = new ModelMFPBWigWag(); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "MFPBWigWagOn.png"); - public ItemRenderMFPBWigWag() { - } + public ItemRenderMFPBWigWag() { + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderSwitch(0f, 0f, 0f, 1f); - return; - } - case EQUIPPED: { - renderSwitch(0.6f, 0.25f, 1f, 1f); - return; - } - case EQUIPPED_FIRST_PERSON: { - renderSwitch(0.2f, 0.25f, 1f, 0.7f); - return; - } - case INVENTORY: { - renderSwitch(0f, -0.7f, 0f, 0.5f); - return; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderSwitch(0f, 0f, 0f, 1f); + return; + } + case EQUIPPED: { + renderSwitch(0.6f, 0.25f, 1f, 1f); + return; + } + case EQUIPPED_FIRST_PERSON: { + renderSwitch(0.2f, 0.25f, 1f, 0.7f); + return; + } + case INVENTORY: { + renderSwitch(0f, -0.7f, 0f, 0.5f); + return; + } + default: + break; + } + } - private void renderSwitch(float x, float y, float z, float scale) { - Tessellator.bindTexture(texture); - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); + private void renderSwitch(float x, float y, float z, float scale) { + Tessellator.bindTexture(texture); + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); - GL11.glTranslatef(x, y, z); - GL11.glScalef(scale, scale, scale); - GL11.glRotated(180,0,0,1); - GL11.glRotated(180,0,1,0); + GL11.glTranslatef(x, y, z); + GL11.glScalef(scale, scale, scale); + GL11.glRotated(180, 0, 0, 1); + GL11.glRotated(180, 0, 1, 0); - modeSwitch.render(null,0,0,0,0,0,0.0625f); + modeSwitch.render(null, 0, 0, 0, 0, 0, 0.0625f); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderModelMetroMadridPole.java b/src/main/java/train/client/render/ItemRenderModelMetroMadridPole.java index 54e286dec2..4de6c6f243 100644 --- a/src/main/java/train/client/render/ItemRenderModelMetroMadridPole.java +++ b/src/main/java/train/client/render/ItemRenderModelMetroMadridPole.java @@ -10,7 +10,7 @@ public class ItemRenderModelMetroMadridPole implements IItemRenderer { - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "MetroMadridPole.png"); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "MetroMadridPole.png"); private static final ModelMetroMadridOHW modelMetroMadridPole = new ModelMetroMadridOHW(); public ItemRenderModelMetroMadridPole() { @@ -29,22 +29,16 @@ public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRe @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch (type) { - case ENTITY: { + case ENTITY: + case INVENTORY: { renderMetroMadridPole(0f, 0f, 0f); return; } - case EQUIPPED: { - renderMetroMadridPole(0.2f, 1f, 1f); - return; - } + case EQUIPPED: case EQUIPPED_FIRST_PERSON: { renderMetroMadridPole(0.2f, 1f, 1f); return; } - case INVENTORY: { - renderMetroMadridPole(0f, 0f, 0f); - return; - } default: break; } @@ -53,8 +47,8 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { private void renderMetroMadridPole(float x, float y, float z) { Tessellator.bindTexture(texture); GL11.glPushMatrix(); - GL11.glTranslatef(x, y+0.125f, z); - GL11.glRotatef(180f,0f,0f, 1f); + GL11.glTranslatef(x, y + 0.125f, z); + GL11.glRotatef(180f, 0f, 0f, 1f); modelMetroMadridPole.render(); GL11.glPopMatrix(); } diff --git a/src/main/java/train/client/render/ItemRenderSignal.java b/src/main/java/train/client/render/ItemRenderSignal.java index 9fabe5dbfc..4cb157545b 100644 --- a/src/main/java/train/client/render/ItemRenderSignal.java +++ b/src/main/java/train/client/render/ItemRenderSignal.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -16,53 +16,50 @@ public class ItemRenderSignal implements IItemRenderer { - private static final ModelBlockSignal signal = new ModelBlockSignal(1F); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.trainsPrefix + "signal_suisse_green.png"); + private static final ModelBlockSignal signal = new ModelBlockSignal(1F); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.trainsPrefix + "signal_suisse_green.png"); - public ItemRenderSignal() { - } + public ItemRenderSignal() { + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderSignal(0.0F, 0F, 0.0F, 0.0F, 1F); - break; - } - case EQUIPPED: { - renderSignal(0F, 0.05F, 0F, 180.0F, 0.7F); - break; - } - case EQUIPPED_FIRST_PERSON: { - renderSignal(0F, 0.05F, 0F, 180.0F, 0.7F); - return; - } - case INVENTORY: { - renderSignal(0F, -0.8F, 0F, 180.0F, 0.65F); - break; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderSignal(0.0F, 0F, 0.0F, 0.0F, 1F); + break; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderSignal(0F, 0.05F, 0F, 180.0F, 0.7F); + return; + } + case INVENTORY: { + renderSignal(0F, -0.8F, 0F, 180.0F, 0.65F); + break; + } + default: + break; + } + } - private void renderSignal(float f, float g, float h, float rotation, float scale) { - tmt.Tessellator.bindTexture(texture); - GL11.glPushMatrix(); //start - GL11.glTranslatef(f, g, h); //size - GL11.glRotatef(rotation, f, g, h); - GL11.glScalef(scale, scale, scale); - signal.render2(0.0625F); - GL11.glPopMatrix(); //end - } + private void renderSignal(float f, float g, float h, float rotation, float scale) { + tmt.Tessellator.bindTexture(texture); + GL11.glPushMatrix(); //start + GL11.glTranslatef(f, g, h); //size + GL11.glRotatef(rotation, f, g, h); + GL11.glScalef(scale, scale, scale); + signal.render2(0.0625F); + GL11.glPopMatrix(); //end + } } diff --git a/src/main/java/train/client/render/ItemRenderStopper.java b/src/main/java/train/client/render/ItemRenderStopper.java index 5d212ee95f..2ef506ba54 100644 --- a/src/main/java/train/client/render/ItemRenderStopper.java +++ b/src/main/java/train/client/render/ItemRenderStopper.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -15,52 +15,49 @@ import train.common.library.Info; public class ItemRenderStopper implements IItemRenderer { - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "buffer.png"); - private static final ModelStopper stopper = new ModelStopper(1F); - - public ItemRenderStopper() { - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderStopper(0.0F, 0F, 0.0F, 0.0F); - break; - } - case EQUIPPED: { - renderStopper(0F, 0.4F, 0F, 180.0F); - break; - } - case EQUIPPED_FIRST_PERSON: { - renderStopper(0F, 0.4F, 0F, 180.0F); - return; - } - case INVENTORY: { - renderStopper(1F, 0.65F, 1F, 0.0F); - break; - } - default: - break; - } - } - - private void renderStopper(float f, float g, float h, float rotation) { - tmt.Tessellator.bindTexture(texture); - GL11.glPushMatrix(); //start - GL11.glTranslatef(f, g, h); //size - GL11.glRotatef(rotation, f, g, h); - stopper.render2(0.0625F); - GL11.glPopMatrix(); //end - } + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "buffer.png"); + private static final ModelStopper stopper = new ModelStopper(1F); + + public ItemRenderStopper() { + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderStopper(0.0F, 0F, 0.0F, 0.0F); + break; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderStopper(0F, 0.4F, 0F, 180.0F); + return; + } + case INVENTORY: { + renderStopper(1F, 0.65F, 1F, 0.0F); + break; + } + default: + break; + } + } + + private void renderStopper(float f, float g, float h, float rotation) { + tmt.Tessellator.bindTexture(texture); + GL11.glPushMatrix(); //start + GL11.glTranslatef(f, g, h); //size + GL11.glRotatef(rotation, f, g, h); + stopper.render2(0.0625F); + GL11.glPopMatrix(); //end + } } diff --git a/src/main/java/train/client/render/ItemRenderSwitchStand.java b/src/main/java/train/client/render/ItemRenderSwitchStand.java index 688a78e07b..644e00db41 100644 --- a/src/main/java/train/client/render/ItemRenderSwitchStand.java +++ b/src/main/java/train/client/render/ItemRenderSwitchStand.java @@ -9,60 +9,57 @@ import train.common.library.Info; public class ItemRenderSwitchStand implements IItemRenderer { - private static final ModelSwitchStandOn modeSwitch = new ModelSwitchStandOn(); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "switchStand_uv_draw_1.png"); + private static final ModelSwitchStandOn modeSwitch = new ModelSwitchStandOn(); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "switchStand_uv_draw_1.png"); - public ItemRenderSwitchStand() { - } + public ItemRenderSwitchStand() { + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderSwitch(0f, 0f, 0f, 1f); - return; - } - case EQUIPPED: { - renderSwitch(0.2f, 1f, 1f, 1f); - return; - } - case EQUIPPED_FIRST_PERSON: { - renderSwitch(0.2f, 1f, 1f, 1f); - return; - } - case INVENTORY: { - renderSwitch(0f, 0f, 0f, 0.7f); - return; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderSwitch(0f, 0f, 0f, 1f); + return; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderSwitch(0.2f, 1f, 1f, 1f); + return; + } + case INVENTORY: { + renderSwitch(0f, 0f, 0f, 0.7f); + return; + } + default: + break; + } + } - private void renderSwitch(float x, float y, float z, float scale) { - Tessellator.bindTexture(texture); - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); + private void renderSwitch(float x, float y, float z, float scale) { + Tessellator.bindTexture(texture); + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); - GL11.glTranslatef(x, y, z); - GL11.glScalef(scale, scale, scale); - GL11.glRotated(180,0,0,1); - GL11.glRotated(180,0,1,0); + GL11.glTranslatef(x, y, z); + GL11.glScalef(scale, scale, scale); + GL11.glRotated(180, 0, 0, 1); + GL11.glRotated(180, 0, 1, 0); - modeSwitch.render(null,0,0,0,0,0,0.0625f); + modeSwitch.render(null, 0, 0, 0, 0, 0, 0.0625f); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderWaterWheel.java b/src/main/java/train/client/render/ItemRenderWaterWheel.java index 9f1cef2fbf..d0e256f768 100644 --- a/src/main/java/train/client/render/ItemRenderWaterWheel.java +++ b/src/main/java/train/client/render/ItemRenderWaterWheel.java @@ -8,62 +8,59 @@ import train.common.library.Info; public class ItemRenderWaterWheel implements IItemRenderer { - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "water_wheel_uv.png"); - private static final ModelWaterWheel modelWaterWheel = new ModelWaterWheel(); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "water_wheel_uv.png"); + private static final ModelWaterWheel modelWaterWheel = new ModelWaterWheel(); - public ItemRenderWaterWheel() { - } + public ItemRenderWaterWheel() { + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderWaterWheel(0f, 0f, 0f, 0.8f); - return; - } - case EQUIPPED: { - renderWaterWheel(0f, 0.5f, 0.5f, 0.8f); - return; - } - case EQUIPPED_FIRST_PERSON: { - renderWaterWheel(0f, 0.5f, 0.5f, 0.8f); - return; - } - case INVENTORY: { - renderWaterWheel(0f, 0f, 0f, 0.5f); - return; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderWaterWheel(0f, 0f, 0f, 0.8f); + return; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderWaterWheel(0f, 0.5f, 0.5f, 0.8f); + return; + } + case INVENTORY: { + renderWaterWheel(0f, 0f, 0f, 0.5f); + return; + } + default: + break; + } + } - private void renderWaterWheel(float x, float y, float z, float scale) { - GL11.glPushMatrix(); + private void renderWaterWheel(float x, float y, float z, float scale) { + GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - GL11.glScalef(scale, scale, scale); - GL11.glScalef(0.36F, 0.36F, 1F); - GL11.glRotatef(180f, 0f, 1f, 0f); + GL11.glTranslatef(x, y, z); + GL11.glScalef(scale, scale, scale); + GL11.glScalef(0.36F, 0.36F, 1F); + GL11.glRotatef(180f, 0f, 1f, 0f); - tmt.Tessellator.bindTexture(texture); - float f2 = (float) (0x331D14 >> 16 & 255) / 255.0F; - float f3 = (float) (0x331D14 >> 8 & 255) / 255.0F; - float f4 = (float) (0x331D14 & 255) / 255.0F; - GL11.glColor3f(f2, f3, f4); + tmt.Tessellator.bindTexture(texture); + float f2 = (float) (0x331D14 >> 16 & 255) / 255.0F; + float f3 = (float) (0x331D14 >> 8 & 255) / 255.0F; + float f4 = (float) (0x331D14 & 255) / 255.0F; + GL11.glColor3f(f2, f3, f4); - modelWaterWheel.render(); + modelWaterWheel.render(); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ItemRenderWindMill.java b/src/main/java/train/client/render/ItemRenderWindMill.java index 9e26ac0033..5b275fa051 100644 --- a/src/main/java/train/client/render/ItemRenderWindMill.java +++ b/src/main/java/train/client/render/ItemRenderWindMill.java @@ -9,68 +9,65 @@ import train.common.library.Info; public class ItemRenderWindMill implements IItemRenderer { - private ModelWindMill modelWindMill; - private ModelWindMillWheel modelWindMillWheel; + private final ModelWindMill modelWindMill; + private final ModelWindMillWheel modelWindMillWheel; - public ItemRenderWindMill() { - modelWindMill = new ModelWindMill(); - modelWindMillWheel = new ModelWindMillWheel(); - } + public ItemRenderWindMill() { + modelWindMill = new ModelWindMill(); + modelWindMillWheel = new ModelWindMillWheel(); + } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: { - renderWindMill(0f, 0f, 0f, 0.5f); - return; - } - case EQUIPPED: { - renderWindMill(0f, 0.5f, 0.5f, 0.4f); - return; - } - case EQUIPPED_FIRST_PERSON: { - renderWindMill(0f, 0.5f, 0.5f, 0.4f); - return; - } - case INVENTORY: { - renderWindMill(0f, -0.34f, 0f, 0.4f); - return; - } - default: - break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch (type) { + case ENTITY: { + renderWindMill(0f, 0f, 0f, 0.5f); + return; + } + case EQUIPPED: + case EQUIPPED_FIRST_PERSON: { + renderWindMill(0f, 0.5f, 0.5f, 0.4f); + return; + } + case INVENTORY: { + renderWindMill(0f, -0.34f, 0f, 0.4f); + return; + } + default: + break; + } + } - private void renderWindMill(float x, float y, float z, float scale) { - GL11.glPushMatrix(); + private void renderWindMill(float x, float y, float z, float scale) { + GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - GL11.glScalef(scale, scale, scale); + GL11.glTranslatef(x, y, z); + GL11.glScalef(scale, scale, scale); - tmt.Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "water_wheel_uv.png")); - float f2 = (float) (0x331D14 >> 16 & 255) / 255.0F; - float f3 = (float) (0x331D14 >> 8 & 255) / 255.0F; - float f4 = (float) (0x331D14 & 255) / 255.0F; - GL11.glColor3f(f2,f3,f4); + tmt.Tessellator.bindTexture(new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "water_wheel_uv.png")); + float f2 = (float) (0x331D14 >> 16 & 255) / 255.0F; + float f3 = (float) (0x331D14 >> 8 & 255) / 255.0F; + float f4 = (float) (0x331D14 & 255) / 255.0F; + GL11.glColor3f(f2, f3, f4); - modelWindMill.render(); - f2 = (float) (0x7A7674 >> 16 & 255) / 255.0F; - f3 = (float) (0x7A7674 >> 8 & 255) / 255.0F; - f4 = (float) (0x7A7674 & 255) / 255.0F; - GL11.glColor3f(f2,f3,f4); - GL11.glTranslatef(0, 2F, 0); - modelWindMillWheel.render(); + modelWindMill.render(); + f2 = (float) (0x7A7674 >> 16 & 255) / 255.0F; + f3 = (float) (0x7A7674 >> 8 & 255) / 255.0F; + f4 = (float) (0x7A7674 & 255) / 255.0F; + GL11.glColor3f(f2, f3, f4); + GL11.glTranslatef(0, 2F, 0); + modelWindMillWheel.render(); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/ModelGTNG.java b/src/main/java/train/client/render/ModelGTNG.java index e475502483..e28ac9ccb6 100644 --- a/src/main/java/train/client/render/ModelGTNG.java +++ b/src/main/java/train/client/render/ModelGTNG.java @@ -453,5 +453,5 @@ public void render(Entity entity, float f, float f1, float f2, float f3, float f public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { } - public ModelRendererTurbo gtngModel[]; + public ModelRendererTurbo[] gtngModel; } \ No newline at end of file diff --git a/src/main/java/train/client/render/RenderAmericanStopper.java b/src/main/java/train/client/render/RenderAmericanStopper.java index 4e7db63cd6..4df71e4757 100644 --- a/src/main/java/train/client/render/RenderAmericanStopper.java +++ b/src/main/java/train/client/render/RenderAmericanStopper.java @@ -18,7 +18,7 @@ public class RenderAmericanStopper extends TileEntitySpecialRenderer { private static final ModelAmericanStopper modelAmericanStopper = new ModelAmericanStopper(1.0F / 16.0F); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "buffer.png"); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "buffer.png"); public RenderAmericanStopper() { } diff --git a/src/main/java/train/client/render/RenderBogie.java b/src/main/java/train/client/render/RenderBogie.java index 3046ab49c5..cdbbab7d64 100644 --- a/src/main/java/train/client/render/RenderBogie.java +++ b/src/main/java/train/client/render/RenderBogie.java @@ -9,32 +9,33 @@ public class RenderBogie extends Render { - protected ModelBase model = new ModelBase() {}; - private static final ResourceLocation TEXTURE = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "robot.png"); - - public RenderBogie() { - } - - - @Override - public void doRender(Entity entity, double x, double y, double z, float f, float f1) { - GL11.glPushMatrix(); - GL11.glTranslated(x, y, z); + protected ModelBase model = new ModelBase() { + }; + private static final ResourceLocation TEXTURE = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "robot.png"); + + public RenderBogie() { + } + + + @Override + public void doRender(Entity entity, double x, double y, double z, float f, float f1) { + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); /*renderManager.renderEngine.bindTexture(TEXTURE); float factor = (float) (1.0 / 16.0); GL11.glScalef(2, 2, 2); box.render(factor);*/ - - - GL11.glPopMatrix(); - } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) { - return TEXTURE; - } - + + + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TEXTURE; + } + } diff --git a/src/main/java/train/client/render/RenderBridgePillar.java b/src/main/java/train/client/render/RenderBridgePillar.java index 1e60a567ca..d3314c4e39 100644 --- a/src/main/java/train/client/render/RenderBridgePillar.java +++ b/src/main/java/train/client/render/RenderBridgePillar.java @@ -9,16 +9,16 @@ import train.common.library.Info; public class RenderBridgePillar extends TileEntitySpecialRenderer { - static final ModelBridgePillar modelBridgePillar = new ModelBridgePillar(); - static final ResourceLocation texture = new ResourceLocation(Info.modID,Info.modelTexPrefix + "bridgePillar.png"); - static Integer GLID = null; + static final ModelBridgePillar modelBridgePillar = new ModelBridgePillar(); + static final ResourceLocation texture = new ResourceLocation(Info.modID, Info.modelTexPrefix + "bridgePillar.png"); + static Integer GLID = null; - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { - Tessellator.bindTexture(texture); - GL11.glPushMatrix(); - GL11.glTranslated(x+0.5,y,z+0.5); - GL11.glRotatef(180f,180f,1f,0f); + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { + Tessellator.bindTexture(texture); + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5, y, z + 0.5); + GL11.glRotatef(180f, 180f, 1f, 0f); /* if(GLID==null || !GL11.glIsList(GLID)) { GLID = GLAllocation.generateDisplayLists(1); @@ -31,7 +31,7 @@ public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double */ - modelBridgePillar.render(); - GL11.glPopMatrix(); - } + modelBridgePillar.render(); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/RenderCoreTC.java b/src/main/java/train/client/render/RenderCoreTC.java index 6cc915849f..b5ee8a8924 100644 --- a/src/main/java/train/client/render/RenderCoreTC.java +++ b/src/main/java/train/client/render/RenderCoreTC.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -12,189 +12,189 @@ import net.minecraft.world.World; public class RenderCoreTC { - public static void renderBlockFalling(Block block, int meta, World world, int i, int j, int k) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.setBrightness(block.getMixedBrightnessForBlock(world, i, j, k)); - tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F); - tessellator.draw(); - } - - public static void renderBottomFace(Block block, double d, double d1, double d2, int i) { - double blockMinX = block.getBlockBoundsMinX(); - double blockMaxX = block.getBlockBoundsMaxX(); - double blockMinY = block.getBlockBoundsMinY(); - double blockMinZ = block.getBlockBoundsMinZ(); - double blockMaxZ = block.getBlockBoundsMaxZ(); - Tessellator tessellator = Tessellator.instance; - - int j = (i & 0xf) << 4; - int k = i & 0xf0; - double d3 = ((double) j + blockMinX * 16D) / 256D; - double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; - double d5 = ((double) k + blockMinZ * 16D) / 256D; - double d6 = (((double) k + blockMaxZ * 16D) - 0.01D) / 256D; - if (blockMinX < 0.0D || blockMaxX > 1.0D) { - d3 = ((float) j + 0.0F) / 256F; - d4 = ((float) j + 15.99F) / 256F; - } - if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { - d5 = ((float) k + 0.0F) / 256F; - d6 = ((float) k + 15.99F) / 256F; - } - - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMaxZ, d3, d6); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMinZ, d3, d5); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMinZ, d4, d5); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMaxZ, d4, d6); - } - - public static void renderTopFace(Block block, double d, double d1, double d2, int i) { - double blockMinX = block.getBlockBoundsMinX(); - double blockMaxX = block.getBlockBoundsMaxX(); - double blockMaxY = block.getBlockBoundsMaxY(); - double blockMinZ = block.getBlockBoundsMinZ(); - double blockMaxZ = block.getBlockBoundsMaxZ(); - Tessellator tessellator = Tessellator.instance; - - int j = (i & 0xf) << 4; - int k = i & 0xf0; - double d3 = ((double) j + blockMinX * 16D) / 256D; - double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; - double d5 = ((double) k + blockMinZ * 16D) / 256D; - double d6 = (((double) k + blockMaxZ * 16D) - 0.01D) / 256D; - if (blockMinX < 0.0D || blockMaxX > 1.0D) { - d3 = ((float) j + 0.0F) / 256F; - d4 = ((float) j + 15.99F) / 256F; - } - if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { - d5 = ((float) k + 0.0F) / 256F; - d6 = ((float) k + 15.99F) / 256F; - } - - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMaxZ, d4, d6); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMinZ, d4, d5); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMinZ, d3, d5); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMaxZ, d3, d6); - } - - public static void renderEastFace(Block block, double d, double d1, double d2, int i) { - double blockMinX = block.getBlockBoundsMinX(); - double blockMaxX = block.getBlockBoundsMaxX(); - double blockMinY = block.getBlockBoundsMinY(); - double blockMaxY = block.getBlockBoundsMaxY(); - double blockMinZ = block.getBlockBoundsMinZ(); - Tessellator tessellator = Tessellator.instance; - - int j = (i & 0xf) << 4; - int k = i & 0xf0; - double d3 = ((double) j + blockMinX * 16D) / 256D; - double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; - double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; - double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; - - if (blockMinX < 0.0D || blockMaxX > 1.0D) { - d3 = ((float) j + 0.0F) / 256F; - d4 = ((float) j + 15.99F) / 256F; - } - if (blockMinY < 0.0D || blockMaxY > 1.0D) { - d5 = ((float) k + 0.0F) / 256F; - d6 = ((float) k + 15.99F) / 256F; - } - - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMinZ, d4, d5); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMinZ, d3, d5); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMinZ, d3, d6); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMinZ, d4, d6); - } - - public static void renderWestFace(Block block, double d, double d1, double d2, int i) { - double blockMinX = block.getBlockBoundsMinX(); - double blockMaxX = block.getBlockBoundsMaxX(); - double blockMinY = block.getBlockBoundsMinY(); - double blockMaxY = block.getBlockBoundsMaxY(); - double blockMaxZ = block.getBlockBoundsMaxZ(); - Tessellator tessellator = Tessellator.instance; - - int j = (i & 0xf) << 4; - int k = i & 0xf0; - double d3 = ((double) j + blockMinX * 16D) / 256D; - double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; - double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; - double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; - - if (blockMinX < 0.0D || blockMaxX > 1.0D) { - d3 = ((float) j + 0.0F) / 256F; - d4 = ((float) j + 15.99F) / 256F; - } - if (blockMinY < 0.0D || blockMaxY > 1.0D) { - d5 = ((float) k + 0.0F) / 256F; - d6 = ((float) k + 15.99F) / 256F; - } - - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMaxZ, d3, d5); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMaxZ, d3, d6); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMaxZ, d4, d6); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMaxZ, d4, d5); - } - - public static void renderNorthFace(Block block, double d, double d1, double d2, int i) { - double blockMinX = block.getBlockBoundsMinX(); - double blockMinY = block.getBlockBoundsMinY(); - double blockMaxY = block.getBlockBoundsMaxY(); - double blockMinZ = block.getBlockBoundsMinZ(); - double blockMaxZ = block.getBlockBoundsMaxZ(); - Tessellator tessellator = Tessellator.instance; - - int j = (i & 0xf) << 4; - int k = i & 0xf0; - double d3 = ((double) j + blockMinZ * 16D) / 256D; - double d4 = (((double) j + blockMaxZ * 16D) - 0.01D) / 256D; - double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; - double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; - - if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { - d3 = ((float) j + 0.0F) / 256F; - d4 = ((float) j + 15.99F) / 256F; - } - if (blockMinY < 0.0D || blockMaxY > 1.0D) { - d5 = ((float) k + 0.0F) / 256F; - d6 = ((float) k + 15.99F) / 256F; - } - - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMaxZ, d4, d5); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMinZ, d3, d5); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMinZ, d3, d6); - tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMaxZ, d4, d6); - } - - public static void renderSouthFace(Block block, double d, double d1, double d2, int i) { - double blockMaxX = block.getBlockBoundsMaxX(); - double blockMinY = block.getBlockBoundsMinY(); - double blockMaxY = block.getBlockBoundsMaxY(); - double blockMinZ = block.getBlockBoundsMinZ(); - double blockMaxZ = block.getBlockBoundsMaxZ(); - Tessellator tessellator = Tessellator.instance; - - int j = (i & 0xf) << 4; - int k = i & 0xf0; - double d3 = ((double) j + blockMinZ * 16D) / 256D; - double d4 = (((double) j + blockMaxZ * 16D) - 0.01D) / 256D; - double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; - double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; - - if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { - d3 = ((float) j + 0.0F) / 256F; - d4 = ((float) j + 15.99F) / 256F; - } - if (blockMinY < 0.0D || blockMaxY > 1.0D) { - d5 = ((float) k + 0.0F) / 256F; - d6 = ((float) k + 15.99F) / 256F; - } - - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMaxZ, d3, d6); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMinZ, d4, d6); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMinZ, d4, d5); - tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMaxZ, d3, d5); - } + public static void renderBlockFalling(Block block, int meta, World world, int i, int j, int k) { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, i, j, k)); + tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F); + tessellator.draw(); + } + + public static void renderBottomFace(Block block, double d, double d1, double d2, int i) { + double blockMinX = block.getBlockBoundsMinX(); + double blockMaxX = block.getBlockBoundsMaxX(); + double blockMinY = block.getBlockBoundsMinY(); + double blockMinZ = block.getBlockBoundsMinZ(); + double blockMaxZ = block.getBlockBoundsMaxZ(); + Tessellator tessellator = Tessellator.instance; + + int j = (i & 0xf) << 4; + int k = i & 0xf0; + double d3 = ((double) j + blockMinX * 16D) / 256D; + double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; + double d5 = ((double) k + blockMinZ * 16D) / 256D; + double d6 = (((double) k + blockMaxZ * 16D) - 0.01D) / 256D; + if (blockMinX < 0.0D || blockMaxX > 1.0D) { + d3 = ((float) j + 0.0F) / 256F; + d4 = ((float) j + 15.99F) / 256F; + } + if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { + d5 = ((float) k + 0.0F) / 256F; + d6 = ((float) k + 15.99F) / 256F; + } + + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMaxZ, d3, d6); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMinZ, d3, d5); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMinZ, d4, d5); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMaxZ, d4, d6); + } + + public static void renderTopFace(Block block, double d, double d1, double d2, int i) { + double blockMinX = block.getBlockBoundsMinX(); + double blockMaxX = block.getBlockBoundsMaxX(); + double blockMaxY = block.getBlockBoundsMaxY(); + double blockMinZ = block.getBlockBoundsMinZ(); + double blockMaxZ = block.getBlockBoundsMaxZ(); + Tessellator tessellator = Tessellator.instance; + + int j = (i & 0xf) << 4; + int k = i & 0xf0; + double d3 = ((double) j + blockMinX * 16D) / 256D; + double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; + double d5 = ((double) k + blockMinZ * 16D) / 256D; + double d6 = (((double) k + blockMaxZ * 16D) - 0.01D) / 256D; + if (blockMinX < 0.0D || blockMaxX > 1.0D) { + d3 = ((float) j + 0.0F) / 256F; + d4 = ((float) j + 15.99F) / 256F; + } + if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { + d5 = ((float) k + 0.0F) / 256F; + d6 = ((float) k + 15.99F) / 256F; + } + + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMaxZ, d4, d6); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMinZ, d4, d5); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMinZ, d3, d5); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMaxZ, d3, d6); + } + + public static void renderEastFace(Block block, double d, double d1, double d2, int i) { + double blockMinX = block.getBlockBoundsMinX(); + double blockMaxX = block.getBlockBoundsMaxX(); + double blockMinY = block.getBlockBoundsMinY(); + double blockMaxY = block.getBlockBoundsMaxY(); + double blockMinZ = block.getBlockBoundsMinZ(); + Tessellator tessellator = Tessellator.instance; + + int j = (i & 0xf) << 4; + int k = i & 0xf0; + double d3 = ((double) j + blockMinX * 16D) / 256D; + double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; + double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; + double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; + + if (blockMinX < 0.0D || blockMaxX > 1.0D) { + d3 = ((float) j + 0.0F) / 256F; + d4 = ((float) j + 15.99F) / 256F; + } + if (blockMinY < 0.0D || blockMaxY > 1.0D) { + d5 = ((float) k + 0.0F) / 256F; + d6 = ((float) k + 15.99F) / 256F; + } + + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMinZ, d4, d5); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMinZ, d3, d5); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMinZ, d3, d6); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMinZ, d4, d6); + } + + public static void renderWestFace(Block block, double d, double d1, double d2, int i) { + double blockMinX = block.getBlockBoundsMinX(); + double blockMaxX = block.getBlockBoundsMaxX(); + double blockMinY = block.getBlockBoundsMinY(); + double blockMaxY = block.getBlockBoundsMaxY(); + double blockMaxZ = block.getBlockBoundsMaxZ(); + Tessellator tessellator = Tessellator.instance; + + int j = (i & 0xf) << 4; + int k = i & 0xf0; + double d3 = ((double) j + blockMinX * 16D) / 256D; + double d4 = (((double) j + blockMaxX * 16D) - 0.01D) / 256D; + double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; + double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; + + if (blockMinX < 0.0D || blockMaxX > 1.0D) { + d3 = ((float) j + 0.0F) / 256F; + d4 = ((float) j + 15.99F) / 256F; + } + if (blockMinY < 0.0D || blockMaxY > 1.0D) { + d5 = ((float) k + 0.0F) / 256F; + d6 = ((float) k + 15.99F) / 256F; + } + + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMaxZ, d3, d5); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMaxZ, d3, d6); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMaxZ, d4, d6); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMaxZ, d4, d5); + } + + public static void renderNorthFace(Block block, double d, double d1, double d2, int i) { + double blockMinX = block.getBlockBoundsMinX(); + double blockMinY = block.getBlockBoundsMinY(); + double blockMaxY = block.getBlockBoundsMaxY(); + double blockMinZ = block.getBlockBoundsMinZ(); + double blockMaxZ = block.getBlockBoundsMaxZ(); + Tessellator tessellator = Tessellator.instance; + + int j = (i & 0xf) << 4; + int k = i & 0xf0; + double d3 = ((double) j + blockMinZ * 16D) / 256D; + double d4 = (((double) j + blockMaxZ * 16D) - 0.01D) / 256D; + double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; + double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; + + if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { + d3 = ((float) j + 0.0F) / 256F; + d4 = ((float) j + 15.99F) / 256F; + } + if (blockMinY < 0.0D || blockMaxY > 1.0D) { + d5 = ((float) k + 0.0F) / 256F; + d6 = ((float) k + 15.99F) / 256F; + } + + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMaxZ, d4, d5); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMaxY, d2 + blockMinZ, d3, d5); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMinZ, d3, d6); + tessellator.addVertexWithUV(d + blockMinX, d1 + blockMinY, d2 + blockMaxZ, d4, d6); + } + + public static void renderSouthFace(Block block, double d, double d1, double d2, int i) { + double blockMaxX = block.getBlockBoundsMaxX(); + double blockMinY = block.getBlockBoundsMinY(); + double blockMaxY = block.getBlockBoundsMaxY(); + double blockMinZ = block.getBlockBoundsMinZ(); + double blockMaxZ = block.getBlockBoundsMaxZ(); + Tessellator tessellator = Tessellator.instance; + + int j = (i & 0xf) << 4; + int k = i & 0xf0; + double d3 = ((double) j + blockMinZ * 16D) / 256D; + double d4 = (((double) j + blockMaxZ * 16D) - 0.01D) / 256D; + double d5 = ((double) (k + 16) - blockMaxY * 16D) / 256D; + double d6 = ((double) (k + 16) - blockMinY * 16D - 0.01D) / 256D; + + if (blockMinZ < 0.0D || blockMaxZ > 1.0D) { + d3 = ((float) j + 0.0F) / 256F; + d4 = ((float) j + 15.99F) / 256F; + } + if (blockMinY < 0.0D || blockMaxY > 1.0D) { + d5 = ((float) k + 0.0F) / 256F; + d6 = ((float) k + 15.99F) / 256F; + } + + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMaxZ, d3, d6); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMinY, d2 + blockMinZ, d4, d6); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMinZ, d4, d5); + tessellator.addVertexWithUV(d + blockMaxX, d1 + blockMaxY, d2 + blockMaxZ, d3, d5); + } } diff --git a/src/main/java/train/client/render/RenderEmbeddedStopper.java b/src/main/java/train/client/render/RenderEmbeddedStopper.java index 63fcca326a..d2f63f6861 100644 --- a/src/main/java/train/client/render/RenderEmbeddedStopper.java +++ b/src/main/java/train/client/render/RenderEmbeddedStopper.java @@ -18,7 +18,7 @@ public class RenderEmbeddedStopper extends TileEntitySpecialRenderer { private static final ModelEmbeddedStopper modelEmbeddedStopper = new ModelEmbeddedStopper(1.0F / 16.0F); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "buffer.png"); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "buffer.png"); public RenderEmbeddedStopper() { } diff --git a/src/main/java/train/client/render/RenderEnum.java b/src/main/java/train/client/render/RenderEnum.java index e3657b8ed8..33b0b4e928 100644 --- a/src/main/java/train/client/render/RenderEnum.java +++ b/src/main/java/train/client/render/RenderEnum.java @@ -7,6 +7,7 @@ import train.common.entity.rollingStock.*; import java.util.ArrayList; + import train.common.api.TrainRenderRecord; import train.common.library.Info; import net.minecraft.util.ResourceLocation; @@ -15,1502 +16,1566 @@ public enum RenderEnum implements TrainRenderRecord { - /** Passengers */ - passengerCartBlue(EntityPassengerBlue.class, new ModelPassenger6(), "passenger_", true, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passengerCartBlackSmall(EntityPassenger2.class, new ModelPassenger2(), "passenger3", false, new float[] { 0.0F, -0.32F, -0.1F }, null, null, "", 0, null, "", null, 0, false), - passengerLongGreen(EntityPassenger5.class, new ModelPassenger5(), "passenger5_", true, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passengerShortGreen(EntityPassenger7.class, new ModelPassenger7(), "passenger7", false, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - passenger_1class_DB(EntityPassenger_1class_DB.class, new ModelPassenger_1class_DB(), "passenger_1class_DB", false, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passenger_2class_DB(EntityPassenger_2class_DB.class, new ModelPassenger_2class_DB(), "passenger_2class_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passengerHighSpeedZeroED(EntityPassengerHighSpeedCarZeroED.class, new ModelPassengerHighSpeedCarZeroED(), "passengerHighSpeedCarZeroED", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passengerTramNY(EntityPassengerTramNY.class, new ModelTramNY(), "locoTramNY", false, new float[] { 0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passengerAdler(EntityPassengerAdler.class, new ModelPassengerAdler(), "passengerAdler", false, new float[] { 0F, 1.04F, 0.0F }, new float[] { 180F, -90F, 0F }, null, "", 0, null, "", null, 0, false), - passenger_DB_oriental(EntityPassengerDBOriental.class, new ModelPassenger_DB_oriental(), "passenger_DB_oriental_", true, new float[] { 0F, -0.42F, 0.0F }, new float[] { 180F, 0F, 0F }, new float[] { -1F, -1F, 1F }, "", 0, null, "", null, 0,false), - passengerCE1Class1(EntityPassengerICE_1class.class, new ModelICE1Passenger(), "ICE1_1st_class_", true, - new float[] { 0.0F, 0.18F, 0F }, new float[] { 0F, 180F, 180F }, new float[] { 0.8f, 1f, 0.8f }, "", 0, null, - "", null, 0, false), - passengerCE1Class2(EntityPassengerICE_2class.class, new ModelICE1Passenger(), "ICE1_2nd_class_", true, - new float[] { 0.0F, 0.18F, 0F }, new float[] { 0F, 180F, 180F }, new float[] { 0.8f, 1f, 0.8f }, "", 0, null, - "", null, 0, false), - passengerCE1Restaurant(EntityPassengerICE_Restaurant.class, new ModelICE1Restaurant(), "ICE1_Restaurant_", true, new float[] { 0.0F, 0.18F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.8f,1f,0.8f}, "", 0, null, "", null, 0, false), - passengerGS4(EntityPassengerGS4.class, new ModelGS4Passenger(), "GS4_Passenger_", true, new float[] { 0.0F, 0.03F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.8f,1f,0.8f}, "", 0, null, "", null, 0, false), - passengerGS4_Tail(EntityPassengerGS4_Tail.class, new ModelGS4Tail(), "GS4_Tail_", true, new float[] { -0.2F, 0.025F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.8f,1f,0.8f}, "", 0, null, "", null, 0, false), - passengerGS4_Observatory(EntityPassengerGS4_Observatory.class, new ModelGS4Tavern(), "GS4_Tavern_", true, new float[] { 0.0F, 0.025F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.8f,1f,0.8f}, "", 0, null, "", null, 0, false), - passengerRheingold(EntityPassengerRheingold.class, new ModelRheingoldPassenger(), "Rheingold_passenger_", true, new float[] { 1.55F, 0.15F, -0.6F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - passengerRheingoldDining1(EntityPassengerRheingoldDining1.class, new ModelRheingoldPassenger_Dining1(), "Rheingold_passenger_dining1_", true, new float[] { 1.7F, 0.15F, -0.6F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - passengerRheingoldDining2(EntityPassengerRheingoldDining2.class, new ModelRheingoldPassenger_Dining2(), "Rheingold_passenger_dining2_", true, new float[] { 0.05F, 0.15F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - passengerRheingoldPanorama(EntityPassengerRheingoldPanorama.class, new ModelRheingoldPassenger_Panorama(), "Rheingold_passenger_panorama_", true, new float[] { -0.1F, 0.15F, 0.1F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - drgPasenger(EntityPassengerDenverRioGrande.class, new ModelDRGPassenger(), "drg_passenger_", true, new float[] { 0.0F, 0.14F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - drgPasengerCombo(EntityPassengerDenverRioGrandeCombo.class, new ModelDRGCombo(), "drg_combo_", true, new float[] { 0.0F, 0.14F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - MILWPasenger(EntityPassengerMILW.class, new ModelMILWPassenger(), "milw_passenger", false, new float[] { 0.2F, 0F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,0.9f,0.9f}, "", 0, null, "", null, 0, false), - MILWPasengerTail(EntityPassengerMILWTail.class, new ModelMILWTail(), "milw_passenger_tail", false, new float[] { 0.1F, 0.1F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,0.9f,0.9f}, "", 0, null, "", null, 0, false), - //MILWPasengerDiner(EntityPassengerMILWDiner.class, new ModelMILW1935Passenger(), "milw_passenger_diner", false, new float[] { 0.0F, -0.14F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - - PasengerBamboo(EntityPassengerBamboo.class, new ModelBambooTrainPassenger(), "passenger_bamboo_", true, new float[] { 0.1F, 0F, 0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - - /** Caboose */ - cabooseRed(EntityCaboose3.class, new ModelCaboose3(), "caboose3", false, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - cabooseBlack(EntityCaboose.class, new ModelCaboose(), "caboose", false, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - cabooseLogging(EntityCabooseLogging.class, new ModelCabooseLogging(), "cabLogging_", true, new float[] { 0.0F, -0.45F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - cabooseLoggingPRR(EntityCabooseLoggingPRR.class, new ModelPRRCaboose(), "PRRCaboose_", true, new float[] { 0.0F, -0.38F, 0.0F },new float[]{0,180,180}, null, "", 0, null, "", null, 0, false), - GWRBrakeVan(EntityGWRBrakeVan.class, new ModelGWRBrakeVan(), "GWRBrakeVan", false, new float[] { 0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - - /** Specials **/ - stockCar(EntityStockCar.class, new ModelStockCar(), "stockcar_", true, new float[] { -.0F, -0.32F, 0.0F }, new float[]{0,0,0}, null, "", 0, null, "", null, 0, false), - drwgStockCar(EntityStockCarDRWG.class, new ModelDRWGStockCar(), "drwgstockcar", false, new float[] { 1.0F, -0.4F, 0.0F }, new float[]{0,0,180}, null, "", 0, null, "", null, 0, false), - workCart(EntityWorkCart.class, new ModelWorkCart(), "workcart", false, new float[] { 0.0F, -0.42F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCart(EntityFlatCart.class, new ModelFlatCar(), "flatcart", false, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - workCaboose(EntityCabooseWorkCart.class, new ModelWorkCaboose(), "workcaboose", false, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - jukeBoxCart(EntityJukeBoxCart.class, new ModelJukeBox(), "jukebox", false, new float[] { 0.0F, -0.42F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCartSU(EntityFlatCartSU.class, new ModelFlatCarSU(), "flatcarsu", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCartUS(EntityFlatCartUS.class, new ModelFlatCarUS(), "flatCartUS", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tracksBuilder(EntityTracksBuilder.class, new ModelBuilder(), "builder2", false, new float[] { 0.0F, -0.42F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { -1.3D, 2.1D, 0.0D }); - } - }, "", null, 0, true), - - /** Freight */ - freightCartRed(EntityFreightCart2.class, new ModelFreightCart2(), "freightcart2", false, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightCartYellow(EntityFreightCart.class, new ModelFreightCart2(), "freightcart", false, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightWood(EntityFreightWood.class, new ModelWood(), "wood_Full", false, new float[] { 0.0F, -0.42F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightHopper(EntityFreightGrain.class, new ModelGrain(), "hopper", false, new float[] { 0.0F, -0.42F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightOpenWagon(EntityFreightOpenWagon.class, new ModelOpenWagon(), "openwagon", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - //passenger4(EntityPassenger4.class, new ModelPassenger4(), "passenger4",false,new float[] {0.0F, -0.32F, 0.0F},null,null,"",0,null,"",null,0),//apparently has been removed - freightHopperUS(EntityFreightHopperUS.class, new ModelFreightHopper(), "freightHopperUS_", true, - new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCartWoodUS(EntityFlatCartWoodUS.class, new ModelFlatCarWoodUS(), "flatCartWoodUS", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightCartUS(EntityFreightCartUS.class, new ModelFreightCartUS(), "freightCartUS_", true, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightBoxCartUS(EntityBoxCartUS.class, new ModelBoxCartUS(), "boxCartUS_", true, new float[] { 0.0F, -0.45F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightBoxCartPRR(EntityBoxCartPRR.class, new ModelPRRX31Wagon(), "PRR_X31a", false, new float[] { 0.0F, -0.38F, 0.0F }, new float[]{0,180,180}, null, "", 0, null, "", null, 0, false), - freightTGNG(EntityFreightGTNG.class, new ModelGTNG(), "GTNGOreWagon", false, new float[] { 0.0F, 0.2F, 0.0F }, new float[]{0,0,180}, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - freightCartSmall(EntityFreightCartSmall.class, new ModelSmallFreightCart(), "freightCartSmall", false, new float[] { 0.0F, -0.20F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightMinetrain(EntityFreightMinetrain.class, new ModelMinetrain(), "minetrain", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCartWoodLogs(EntityFreightWood2.class, new ModelFreightWood(), "flatCartWood2", false, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - freightClosedRedBrown(EntityFreightClosed.class, new ModelFreightClosed(), "freightClosed", false, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - freightOpenRedBrown(EntityFreightOpen2.class, new ModelFreightOpen2(), "freightOpen2", false, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - mailWagen_DB(EntityMailWagen_DB.class, new ModelMailWagen(), "mailWagen_DB", false, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightWagen_DB(EntityFreightWagenDB.class, new ModelFreightWagenDB(), "freightWagen_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCarRails_DB(EntityFlatCarRails_DB.class, new ModelFlatCarRails_DB(), "flatCarRails_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCar_DB(EntityFlatCar_DB.class, new ModelFlatCar_DB(), "flatCar_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - flatCarLogs_DB(EntityFlatCarLogs_DB.class, new ModelFlatCarLogs_DB(), "flatCarLogs_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightGondola_DB(EntityFreightGondola_DB.class, new ModelFreightGondola_DB(), "freightGondola_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - freightCenterBeam_Empty(EntityFreightCenterbeam_Empty.class, new ModelFreightCenterBeam_Empty(), "freight_centerbeam_empty_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - freightCenterBeam_Wood1(EntityFreightCenterbeam_Wood_1.class, new ModelFreightCenterBeam_Wood_1(), "freight_centerbeam_wood_1_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - freightCenterBeam_Wood2(EntityFreightCenterbeam_Wood_2.class, new ModelFreightCenterBeam_Wood_2(), "freight_centerbeam_wood_2_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - //freightWellcar(EntityFreightWellcar.class, new ModelFreightWellcar(), "freightWellcar_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - freightWellcar(EntityFreightWellcar.class, new ModelWellcar(), "wellcar_", true, new float[] { 0.0F, 0.0F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightTrailer(EntityFreightTrailer.class, new ModelFreightTrailer(), "freightTrailer_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - freightGS4(EntityFreightGS4_Baggage.class, new ModelGS4Baggage(), "GS4_baggage_", true, new float[] { 0.0F, 0.025F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.8f,1f,0.8f}, "", 0, null, "", null, 0, false), - freightSlateWagon(EntityFreightSlateWagon.class, new ModelSlateWagon(), "freightslatewagon", false, new float[] { 0.0F, 0.2F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - freightIceeWagon(EntityFreightIceWagon.class, new ModelIceWagon(), "icewagon", false, new float[] { 0.0F, 0.2F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - freight100TonHopper(EntityFreight100TonHopper.class, new Model100TonHopper(), "freight_100tonhopper_", true, new float[] { -0.1F, 0.0F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - freightBulkheadFlatCar(EntityBulkheadFlatCart.class, new ModelBulkheadFlat(), "BulkheadFlat_", true, new float[] { 0.0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - drgBaggage(EntityFreightDenverRioGrande.class, new ModelDRGBaggage(), "drg_baggage_", true, new float[] { 0.0F, 0.14F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - MILW1935Baggage(EntityFreightBaggageMILW.class, new ModelMILWBaggage(), "milw_baggage", false, new float[] { 0.1F, 0.1F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,0.9f,0.9f}, "", 0, null, "", null, 0, false), - HeavyweightMailcar(EntityFreightHeavyweight.class, new ModelHeavyweight(), "heavyweight_mailcar", false, new float[] { 0.1F, 0.18F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - BambooFreightcar(EntityFreightBamboo.class, new ModelBambooTrainCargo(), "bamboo_freight_", true, new float[] { 0.1F, 0F, 0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightGermanPost(EntityFreightGermanPost.class, new ModelGermanPost(), "german_post_", true, new float[] { -1F, 0.15F, -0.075F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - freightDepressedFlatbed(EntityFreightDepressedFlatbed.class, new ModelDepressedFlatbed(), "depressed_flatbed_", true, new float[] { -0.1F, 0.15F, -0.075F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightCartL(EntityFreightCartL.class, new ModelFreightCarL(), "freightCarL_", true, new float[] { 0F, 0.2F, 0.825F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightKclassrailBox(EntityFreightKClassRailBox.class, new ModelKClassRailBox(), "KClassRailBox_", true, new float[] { -1.5F, 0.1F, 0.125F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightShortCoveredHopper(EntityFreightShortCoveredHopper.class, new ModelShortCoveredHopper(), "ShortCoveredHopper_", true, new float[] { -2.2F, -0.25F, 0.7F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightLongCoveredHopper(EntityFreightLongCoveredHopper.class, new ModelLongCoveredHopper(), "LongCoveredHopper_", true, new float[] { -1F, -0.25F, 0.65F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightHeavyweightBoxcar(EntityFreightHeavyweightBaggage.class, new ModelHeavyweightBaggage(), "heavyweightBoxcar_", true, new float[] { 0F, 0.1F, -0.05F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightASTFAutorack(EntityFreightASTFAutorack.class, new ModelASTFAutorack(), "astf_autorack", false, new float[] { -1F, 0.2F, 0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - BoulderWagon(EntityBoulderWagon.class, new ModelBoulderWagon(),"BoulderWagon_",true, new float[]{0F,0.2F,0F}, new float[] { 0F, 180F, 180F },null, "",0,null, "",null, 0,false), + /** + * Passengers + */ + passengerCartBlue(EntityPassengerBlue.class, new ModelPassenger6(), "passenger_", true, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passengerCartBlackSmall(EntityPassenger2.class, new ModelPassenger2(), "passenger3", false, new float[]{0.0F, -0.32F, -0.1F}, null, null, "", 0, null, "", null, 0, false), + passengerLongGreen(EntityPassenger5.class, new ModelPassenger5(), "passenger5_", true, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passengerShortGreen(EntityPassenger7.class, new ModelPassenger7(), "passenger7", false, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + passenger_1class_DB(EntityPassenger_1class_DB.class, new ModelPassenger_1class_DB(), "passenger_1class_DB", false, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passenger_2class_DB(EntityPassenger_2class_DB.class, new ModelPassenger_2class_DB(), "passenger_2class_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passengerHighSpeedZeroED(EntityPassengerHighSpeedCarZeroED.class, new ModelPassengerHighSpeedCarZeroED(), "passengerHighSpeedCarZeroED", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passengerTramNY(EntityPassengerTramNY.class, new ModelTramNY(), "locoTramNY", false, new float[]{0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passengerAdler(EntityPassengerAdler.class, new ModelPassengerAdler(), "passengerAdler", false, new float[]{0F, 1.04F, 0.0F}, new float[]{180F, -90F, 0F}, null, "", 0, null, "", null, 0, false), + passenger_DB_oriental(EntityPassengerDBOriental.class, new ModelPassenger_DB_oriental(), "passenger_DB_oriental_", true, new float[]{0F, -0.42F, 0.0F}, new float[]{180F, 0F, 0F}, new float[]{-1F, -1F, 1F}, "", 0, null, "", null, 0, false), + passengerCE1Class1(EntityPassengerICE_1class.class, new ModelICE1Passenger(), "ICE1_1st_class_", true, + new float[]{0.0F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, + "", null, 0, false), + passengerCE1Class2(EntityPassengerICE_2class.class, new ModelICE1Passenger(), "ICE1_2nd_class_", true, + new float[]{0.0F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, + "", null, 0, false), + passengerCE1Restaurant(EntityPassengerICE_Restaurant.class, new ModelICE1Restaurant(), "ICE1_Restaurant_", true, new float[]{0.0F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + passengerGS4(EntityPassengerGS4.class, new ModelGS4Passenger(), "GS4_Passenger_", true, new float[]{0.0F, 0.03F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + passengerGS4_Tail(EntityPassengerGS4_Tail.class, new ModelGS4Tail(), "GS4_Tail_", true, new float[]{-0.2F, 0.025F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + passengerGS4_Observatory(EntityPassengerGS4_Observatory.class, new ModelGS4Tavern(), "GS4_Tavern_", true, new float[]{0.0F, 0.025F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + passengerRheingold(EntityPassengerRheingold.class, new ModelRheingoldPassenger(), "Rheingold_passenger_", true, new float[]{1.55F, 0.15F, -0.6F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + passengerRheingoldDining1(EntityPassengerRheingoldDining1.class, new ModelRheingoldPassenger_Dining1(), "Rheingold_passenger_dining1_", true, new float[]{1.7F, 0.15F, -0.6F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + passengerRheingoldDining2(EntityPassengerRheingoldDining2.class, new ModelRheingoldPassenger_Dining2(), "Rheingold_passenger_dining2_", true, new float[]{0.05F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + passengerRheingoldPanorama(EntityPassengerRheingoldPanorama.class, new ModelRheingoldPassenger_Panorama(), "Rheingold_passenger_panorama_", true, new float[]{-0.1F, 0.15F, 0.1F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + drgPasenger(EntityPassengerDenverRioGrande.class, new ModelDRGPassenger(), "drg_passenger_", true, new float[]{0.0F, 0.14F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + drgPasengerCombo(EntityPassengerDenverRioGrandeCombo.class, new ModelDRGCombo(), "drg_combo_", true, new float[]{0.0F, 0.14F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + MILWPasenger(EntityPassengerMILW.class, new ModelMILWPassenger(), "milw_passenger", false, new float[]{0.2F, 0F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "", 0, null, "", null, 0, false), + MILWPasengerTail(EntityPassengerMILWTail.class, new ModelMILWTail(), "milw_passenger_tail", false, new float[]{0.1F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "", 0, null, "", null, 0, false), + //MILWPasengerDiner(EntityPassengerMILWDiner.class, new ModelMILW1935Passenger(), "milw_passenger_diner", false, new float[] { 0.0F, -0.14F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), + + PasengerBamboo(EntityPassengerBamboo.class, new ModelBambooTrainPassenger(), "passenger_bamboo_", true, new float[]{0.1F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + + /** + * Caboose + */ + cabooseRed(EntityCaboose3.class, new ModelCaboose3(), "caboose3", false, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + cabooseBlack(EntityCaboose.class, new ModelCaboose(), "caboose", false, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + cabooseLogging(EntityCabooseLogging.class, new ModelCabooseLogging(), "cabLogging_", true, new float[]{0.0F, -0.45F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + cabooseLoggingPRR(EntityCabooseLoggingPRR.class, new ModelPRRCaboose(), "PRRCaboose_", true, new float[]{0.0F, -0.38F, 0.0F}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + GWRBrakeVan(EntityGWRBrakeVan.class, new ModelGWRBrakeVan(), "GWRBrakeVan", false, new float[]{0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + + /** + * Specials + **/ + stockCar(EntityStockCar.class, new ModelStockCar(), "stockcar_", true, new float[]{-.0F, -0.32F, 0.0F}, new float[]{0, 0, 0}, null, "", 0, null, "", null, 0, false), + drwgStockCar(EntityStockCarDRWG.class, new ModelDRWGStockCar(), "drwgstockcar", false, new float[]{1.0F, -0.4F, 0.0F}, new float[]{0, 0, 180}, null, "", 0, null, "", null, 0, false), + workCart(EntityWorkCart.class, new ModelWorkCart(), "workcart", false, new float[]{0.0F, -0.42F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCart(EntityFlatCart.class, new ModelFlatCar(), "flatcart", false, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + workCaboose(EntityCabooseWorkCart.class, new ModelWorkCaboose(), "workcaboose", false, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + jukeBoxCart(EntityJukeBoxCart.class, new ModelJukeBox(), "jukebox", false, new float[]{0.0F, -0.42F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCartSU(EntityFlatCartSU.class, new ModelFlatCarSU(), "flatcarsu", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCartUS(EntityFlatCartUS.class, new ModelFlatCarUS(), "flatCartUS", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tracksBuilder(EntityTracksBuilder.class, new ModelBuilder(), "builder2", false, new float[]{0.0F, -0.42F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{-1.3D, 2.1D, 0.0D}); + } + }, "", null, 0, true), + + /** + * Freight + */ + freightCartRed(EntityFreightCart2.class, new ModelFreightCart2(), "freightcart2", false, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightCartYellow(EntityFreightCart.class, new ModelFreightCart2(), "freightcart", false, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightWood(EntityFreightWood.class, new ModelWood(), "wood_Full", false, new float[]{0.0F, -0.42F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightHopper(EntityFreightGrain.class, new ModelGrain(), "hopper", false, new float[]{0.0F, -0.42F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightOpenWagon(EntityFreightOpenWagon.class, new ModelOpenWagon(), "openwagon", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + //passenger4(EntityPassenger4.class, new ModelPassenger4(), "passenger4",false,new float[] {0.0F, -0.32F, 0.0F},null,null,"",0,null,"",null,0),//apparently has been removed + freightHopperUS(EntityFreightHopperUS.class, new ModelFreightHopper(), "freightHopperUS_", true, + new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCartWoodUS(EntityFlatCartWoodUS.class, new ModelFlatCarWoodUS(), "flatCartWoodUS", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightCartUS(EntityFreightCartUS.class, new ModelFreightCartUS(), "freightCartUS_", true, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightBoxCartUS(EntityBoxCartUS.class, new ModelBoxCartUS(), "boxCartUS_", true, new float[]{0.0F, -0.45F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightBoxCartPRR(EntityBoxCartPRR.class, new ModelPRRX31Wagon(), "PRR_X31a", false, new float[]{0.0F, -0.38F, 0.0F}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + freightTGNG(EntityFreightGTNG.class, new ModelGTNG(), "GTNGOreWagon", false, new float[]{0.0F, 0.2F, 0.0F}, new float[]{0, 0, 180}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + freightCartSmall(EntityFreightCartSmall.class, new ModelSmallFreightCart(), "freightCartSmall", false, new float[]{0.0F, -0.20F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightMinetrain(EntityFreightMinetrain.class, new ModelMinetrain(), "minetrain", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCartWoodLogs(EntityFreightWood2.class, new ModelFreightWood(), "flatCartWood2", false, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + freightClosedRedBrown(EntityFreightClosed.class, new ModelFreightClosed(), "freightClosed", false, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + freightOpenRedBrown(EntityFreightOpen2.class, new ModelFreightOpen2(), "freightOpen2", false, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + mailWagen_DB(EntityMailWagen_DB.class, new ModelMailWagen(), "mailWagen_DB", false, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightWagen_DB(EntityFreightWagenDB.class, new ModelFreightWagenDB(), "freightWagen_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCarRails_DB(EntityFlatCarRails_DB.class, new ModelFlatCarRails_DB(), "flatCarRails_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCar_DB(EntityFlatCar_DB.class, new ModelFlatCar_DB(), "flatCar_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + flatCarLogs_DB(EntityFlatCarLogs_DB.class, new ModelFlatCarLogs_DB(), "flatCarLogs_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightGondola_DB(EntityFreightGondola_DB.class, new ModelFreightGondola_DB(), "freightGondola_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + freightCenterBeam_Empty(EntityFreightCenterbeam_Empty.class, new ModelFreightCenterBeam_Empty(), "freight_centerbeam_empty_", true, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + freightCenterBeam_Wood1(EntityFreightCenterbeam_Wood_1.class, new ModelFreightCenterBeam_Wood_1(), "freight_centerbeam_wood_1_", true, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + freightCenterBeam_Wood2(EntityFreightCenterbeam_Wood_2.class, new ModelFreightCenterBeam_Wood_2(), "freight_centerbeam_wood_2_", true, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + //freightWellcar(EntityFreightWellcar.class, new ModelFreightWellcar(), "freightWellcar_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), + freightWellcar(EntityFreightWellcar.class, new ModelWellcar(), "wellcar_", true, new float[]{0.0F, 0.0F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightTrailer(EntityFreightTrailer.class, new ModelFreightTrailer(), "freightTrailer_", true, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + freightGS4(EntityFreightGS4_Baggage.class, new ModelGS4Baggage(), "GS4_baggage_", true, new float[]{0.0F, 0.025F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + freightSlateWagon(EntityFreightSlateWagon.class, new ModelSlateWagon(), "freightslatewagon", false, new float[]{0.0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + freightIceeWagon(EntityFreightIceWagon.class, new ModelIceWagon(), "icewagon", false, new float[]{0.0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + freight100TonHopper(EntityFreight100TonHopper.class, new Model100TonHopper(), "freight_100tonhopper_", true, new float[]{-0.1F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + freightBulkheadFlatCar(EntityBulkheadFlatCart.class, new ModelBulkheadFlat(), "BulkheadFlat_", true, new float[]{0.0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + drgBaggage(EntityFreightDenverRioGrande.class, new ModelDRGBaggage(), "drg_baggage_", true, new float[]{0.0F, 0.14F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + MILW1935Baggage(EntityFreightBaggageMILW.class, new ModelMILWBaggage(), "milw_baggage", false, new float[]{0.1F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "", 0, null, "", null, 0, false), + HeavyweightMailcar(EntityFreightHeavyweight.class, new ModelHeavyweight(), "heavyweight_mailcar", false, new float[]{0.1F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + BambooFreightcar(EntityFreightBamboo.class, new ModelBambooTrainCargo(), "bamboo_freight_", true, new float[]{0.1F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightGermanPost(EntityFreightGermanPost.class, new ModelGermanPost(), "german_post_", true, new float[]{-1F, 0.15F, -0.075F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + freightDepressedFlatbed(EntityFreightDepressedFlatbed.class, new ModelDepressedFlatbed(), "depressed_flatbed_", true, new float[]{-0.1F, 0.15F, -0.075F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightCartL(EntityFreightCartL.class, new ModelFreightCarL(), "freightCarL_", true, new float[]{0F, 0.2F, 0.825F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightKclassrailBox(EntityFreightKClassRailBox.class, new ModelKClassRailBox(), "KClassRailBox_", true, new float[]{-1.5F, 0.1F, 0.125F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightShortCoveredHopper(EntityFreightShortCoveredHopper.class, new ModelShortCoveredHopper(), "ShortCoveredHopper_", true, new float[]{-2.2F, -0.25F, 0.7F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightLongCoveredHopper(EntityFreightLongCoveredHopper.class, new ModelLongCoveredHopper(), "LongCoveredHopper_", true, new float[]{-1F, -0.25F, 0.65F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightHeavyweightBoxcar(EntityFreightHeavyweightBaggage.class, new ModelHeavyweightBaggage(), "heavyweightBoxcar_", true, new float[]{0F, 0.1F, -0.05F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightASTFAutorack(EntityFreightASTFAutorack.class, new ModelASTFAutorack(), "astf_autorack", false, new float[]{-1F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BoulderWagon(EntityBoulderWagon.class, new ModelBoulderWagon(), "BoulderWagon_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), // freight7Plank(EntityFreight7Plank.class, new ModelFreight7Plank(), "7_plank_", true, new float[]{0F,0.2F,0F}, new float[] {0F, 180F, 180F }, null, "",0,null,"",null, 0, false), - /** Tanks **/ - tankWagon_DB(EntityTankWagon_DB.class, new ModelTankWagon_DB(), "tankWagon_DB_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tankWagonUS(EntityTankWagonUS.class, new ModelTankWagonUS(), "tankWagonUS_", true, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tankWagonGrey(EntityTankWagon2.class, new ModelTankWagon2(), "tankwagon2", false, new float[] { 0.0F, -0.32F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tankCartLava(EntityTankLava.class, new ModelWatertransp(), "lavacar_", true, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tankWagonYellow(EntityTankWagon.class, new ModelTankWagon(), "tankwagon", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tankWagonThreeDome(EntityTankWagonThreeDome.class, new ModelTankWagonThreeDome(), "tanker_three_dome_", true, new float[] { 0.0F, 0.17F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - - /** Tenders */ - tenderSmall(EntityTenderSmall.class, new ModelTender(), "tender2_", true, new float[] { 0.0F, -0.5F, 0.0F }, new float[] { 0F, 90F, 0F }, new float[] { 0.75F, 0.75F, 0.75F }, "", 0, null, "", null, 0, false), - tenderHeavy(EntityTenderHeavy.class, new ModelTenderHeavy(), "heavytender_", true, new float[] { 0.0F, -0.4F, 0.0F }, new float[] { 0F, 180F, 0F }, null, "", 0, null, "", null, 0, false), - tender4_4_0(EntityTender4_4_0.class, new ModelNormalSteamTender(), "4-4-0-loco_tender_", true, new float[] { 0.0F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "", 0, null, "", null, 0, false), - tenderBR01(EntityTenderBR01_DB.class, new ModelTenderBR01_DB(), "tenderBR01_DB", false, new float[] { 0.0F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tenderEr_Ussr(EntityTenderEr_Ussr.class, new ModelTenderEr_Ussr(), "tenderEr_Ussr", false, new float[] { 0.06F, -0.44F, 0.0F }, new float[] { 0F, 180F, 0F }, null, "", 0, null, "", null, 0, false), - tenderC62Class(EntityTenderC62Class.class, new ModelC62Tender(), "c62_tender_", true, - new float[] { 0.0F, -0.42F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - tenderD51(EntityTenderD51.class, new ModelD51Tender(), "d51_tender", false, - new float[] { -3.0F, 0.35F, 0.0F }, new float[]{0,180f,180f}, null, "", 0, null, "", null, 0, false), - tenderAdler(EntityTenderAdler.class, new ModelTenderAdler(), "tender_adler", false, new float[] { 0.0F, 1.05F, 0.0F }, new float[] { 180F, -90F, 0F }, null, "", 0, null, "", null, 0, false), - tenderGS4(EntityTenderGS4.class, new ModelGS4Tender(), "GS4_tender_", true, new float[] { 0.0F, 0.15F, -0.05F }, - new float[] { 0F, 180F, 180F }, new float[] { 0.8f, 1f, 0.8f }, "", 0, null, "", null, 0, false), - Model4000GallonTender(EntityTender4000.class, new Model4000GallonTender(), "GWR_Tender_", true, new float[] { -4.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - ModelFowler4FTender(EntityTenderFowler4F.class, new ModelFowler4FTender(), "Fowler_4F_Tender", false, new float[] { -5.25F, -0.51585F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - tenderCoranationClass(EntityTenderCoranationClass.class, new ModelCoranationClassTender(), "CoranationClassTender", false, new float[] { 0.0F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - tenderBerk1225(EntityTenderBerk1225.class, new Model1225Tender(), "Berkshire_tender_", true, new float[] { 2.75F, -0.65F, 0.0625F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - tenderC41(EntityTender_C41.class, new ModelTenderC41(), "C41Tender", false, new float[] { 0.1F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - tenderSouthern1102(EntityTender_Southern1102.class, new ModelSouthern1102Tender(), "Southern1102Tender", false, new float[] { -5.25F, -0.5F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - tenderMILW(EntityTenderMILW.class, new ModelMILWTender(), "milw_tender", false, new float[] {0.15F, 0.055F, 0.025F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,0.9f,0.9f}, "", 0, null, "", null, 0, false), - - /** Diesel */ - locoKOF(EntityLocoDieselKof_DB.class, new ModelKof(), "locoKof_DB_", true, new float[] { -1.0F, -0.44F, 0.0F }, null, null, "smoke", 2, new ArrayList() { - { - add(new double[] { 0.9D, 1.1D, 0.0D }); - } - }, "", null, 0, true), - locoGP40(EntityLocoDieselCD742.class, new ModelGP40(), "cd742_", true, new float[] { -0.8F, 0.75F, 0.0F }, new float[] { 180F, 180F, 0F }, new float[] { 0.8F, 0.8F, 0.8F }, "smoke", 5, new ArrayList() { - { - add(new double[] { 1.25D, 1.15D, 0.0D }); - } - }, "", null, 0, false), - locoCD754(EntityLocoDieselCD754.class, new ModelCD754(), "cd754_", true, new float[] { -2.5F, 0.2F, 0.0F }, new float[] { 180F, 0F, 0F }, new float[] { 1F, 1F, 1F }, "smoke", 5, new ArrayList() { - { - add(new double[] { 1.25D, 1.15D, 0.0D }); - } - }, "", null, 0, false), - locoChME3(EntityLocoDieselChME3.class, new ModelChME3(), "chme3", false, new float[] { -0.5F, -0.47F, 0.0F }, null, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 0.6D, 1.55D, 0.0D }); - } - }, "", null, 0, false), - - Class143Front(EntityLocoDieselClass143.class, new ModelClass143(), "Class143_", true, new float[] {-1f, 0.15f, 0f}, new float[] {0f, 180f, 180f}, null, "smoke", 1, new ArrayList() { - { - add(new double[] { -0.8D, 1.25D, 0.4D }); - } - }, "", null, 0, false), - - - locoGP7Red(EntityLocoDieselGP7Red.class, new ModelGP7(), "gp7_", true, new float[] { -0.8F, -0.47F, 0.0F }, new float[] { 0F, 180F, 0F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { -0.2D, 1.3D, 0.0D }); - add(new double[] { 0.45D, 1.3D, 0.0D }); - } - }, "", null, 0, false), - loco44tonner(EntityLocoDiesel44TonSwitcher.class, new ModelLoco44TonSwitcher(), "loco_44tonswitcher_", true, new float[] { -2.75F, -0.425F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 0.6D, 1.55D, 0.0D }); - add(new double[] { 2D, 1.55D, 0.0D }); - } - }, "", null, 0, false), - locoSD40(EntityLocoDieselSD40.class, new ModelSD40(), "locoSD40_", true, new float[] { -1.2F, -0.47F, 0.0F }, new float[] { 180F, 90F, 0F }, new float[] { -1F, -1F, 1F }, "smoke", 5, new ArrayList() { - { - add(new double[] { 1.45D, 1.45D, 0.0D }); - } - }, "", null, 0, false), - locoSD70(EntityLocoDieselSD70.class, new ModelSD70(), "locoSD70_", true, new float[] { -1.2F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "smoke", 5, new ArrayList() { - { - add(new double[] { 0.4D, 1.3D, 0.0D }); - } - }, "", null, 0, false), - - locoShunter(EntityLocoDieselShunter.class, new ModelShunter(), "shunter_", true, new float[] { -1.2F, -0.451F, 0.0F }, null, null, "smoke", 5, new ArrayList() { - { - add(new double[] { 2.4D, 1.5D, -0.1D }); - add(new double[] { 2.4D, 1.5D, 0.1D }); - } - }, "", null, 0, true), - locoWLs40(EntityLocoDieselWLs40.class, new ModelWLs40(), "wls40", false, new float[] { 0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[] { 3.0D, 1.4D, 0.0D }); - } - }, "", null, 0, true), - locoV60_DB(EntityLocoDieselV60_DB.class, new ModelV60(), "locoV60_DB_", true, new float[] { -0.75F, -0.44F, 0.0F }, null, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 0.75D, 1.7D, 0.0D }); - } - }, "", null, 0, false), - locoMILW_H1044(EntityLocoDieselMILW_H1044.class, new ModelMILW_H1044(), "MILW_H1044_", true, new float[]{0,0.06f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "largesmoke", 4, new ArrayList() { - { - add(new double[] { 3.7D, 1.7D, 0D }); - } - }, "", null, 0, false), - locoEMDF7(EntityLocoDieselEMDF7.class, new ModelEMDF7(), "emdf7_", true, new float[]{-2.2f,0.1f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 4, new ArrayList() { - { - add(new double[] { -0.15D, 1.6D, 0.0D }); - add(new double[] { 0.5D, 1.6D, 0.0D }); - } - }, "", null, 0, false), - locoEMDF3(EntityLocoDieselEMDF3.class, new ModelEMDF3(), "emdf3_", true, new float[]{-2.2f,0.1f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 4, new ArrayList() { - { - add(new double[] { -0.15D, 1.6D, 0.0D }); - add(new double[] { 0.55D, 1.6D, 0.0D }); - } - }, "", null, 0, false), - locoEMDF7b(EntityBUnitEMDF7.class, new ModelEMDF7B(), "emdf7b_", true, new float[]{0,0.1f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 4, null, "", null, 0, false), - locoEMDF3b(EntityBUnitEMDF3.class, new ModelEMDF3B(), "emdf3b_", true, new float[]{0,0.1f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 4, null, "", null, 0, false), - DD35b(EntityBUnitDD35.class, new ModelDD35B(), "dd35b_", true, new float[]{0,0.18f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "", 0, null, "", null, 0, false), - locoDieselDD35A(EntityLocoDieselDD35A.class, new ModelDD35A(), "dd35a_", true, new float[]{-5,0.18f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 4, new ArrayList() { - { - add(new double[] { 3.9D, 1.6D, 0.0D }); - - add(new double[] { -0.4D, 1.6D, 0.0D }); - } - }, "", null, 0, false), - locoBamboo(EntityLocoDieselBamboo.class, new ModelBambooTrainEngine(), "loco_bamboo_", true, new float[] { -1.0F, 0F, 0.0F }, new float[]{180,180,0}, null, "smoke", 2, new ArrayList() { - { - add(new double[] { -0.05D, -0.05D, 0.0D }); - } - }, "", null, 0, true), - /** Electric */ - locoE10DB(EntityLocoElectricE10_DB.class, new ModelE10DB(), "locoe10_db_", true, new float[] { -1.7F, 0.05F, 0.0F }, new float[] { 0F, 0F, 180F }, new float[]{0.9f,0.9f,0.9f}, "",0,null, "", null, 0, false), - locoCD151(EntityLocoElectricCD151.class, new ModelLocoCD151(), "CD151_", true, new float[]{-2,0.18f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "",0,null, "", null, 0, false), - locoE103(EntityLocoElectricE103.class, new ModelE103(), "E103_", true, new float[]{-2,0.05f,0}, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "",0,null, "", null, 0, false), - locoVL10(EntityLocoElectricVL10.class, new ModelVL10(), "vl10", false, new float[] { -1.2F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoBR_E69(EntityLocoElectricBR_E69.class, new ModelBR_E69(), "locoBR_E69_", true, new float[] { 0.0F, -0.42F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoMineTrain(EntityLocoElectricMinetrain.class, new ModelLocoMinetrain(), "locoMinetrain", false, new float[] { -0.8F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoSpeedZeroED(EntityLocoElectricHighSpeedZeroED.class, new ModelLocoHighSpeedZeroED(), "locoHighSpeedZeroED", false, new float[] { -1.7F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoICE1(EntityLocoElectricICE1.class, new ModelICE1(), "ICE1_Engine_", true, new float[] { 0.0F, 0.18F, 0.1F }, new float[] { 0F, 180F, 180F }, new float[]{0.8f,1f,0.8f}, "", 0, null, "", null, 0, false), - //locoSpeedGrey(EntityNewHighSpeedLoco.class, new ModelNewHighSpeedLoco(), "newhighspeedloco", false, new float[] { -0.05F, -0.5F, 0.0F }, new float[] { 0F, 90F, 0F }, new float[] { 0.8F, 0.8F, 0.8F }, "", 0, null, "", null, 0), - locoTramYellow(EntityLocoElectricTramWood.class, new ModelTram(), "tram", false, new float[] { -0.8F, -0.44F, 0F }, new float[] { 0F, 180F, 0F }, null, "", 0, null, "", null, 0, false), - locoTramNY(EntityLocoElectricTramNY.class, new ModelTramNY(), "locoTramNY", false, new float[] { -1.5F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - - passengerC4FG(PassengerIC4_DSB_FG.class, new ModelLocoDieselIC4_DSB_FG(), "IC4_DSB_FG", false, new float[] { -0.8F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - passengerC4FH(PassengerIC4_DSB_FH.class, new ModelLocoDieselIC4_DSB_FH(), "IC4_DSB_FH", false, new float[] { -0.8F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoIC4MG(EntityLocoDieselIC4_DSB_MG.class, new ModelLocoDieselIC4_DSB_MG(), "IC4_DSB_MG_", true, new float[] { -0.8F, -0.44F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoBR185(EntityLocoElectricBR185.class, new BR185_EngineModel(), "BR185_Engine_", true, new float[] { -2.0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - locoClass85(EntityLocoElectricClass85.class, new ModelClass85(), "Class85_", true, new float[] { -3.0F, 0.65F, 0.0F }, new float[] { 0F, 90F, 180F }, null, "", 0, null, "", null, 0, false), - locoBP4(EntityLocoElectricBP4.class, new ModelBP4(), "bp4_", true, new float[] { -2.2F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerBNLRV_B(EntityPassengerBNLRV_B.class, new ModelBNLRV_B(), "bnlrv_", true, new float[] {0.0f, 0.10f, 0.0f}, new float[] {0F, 0F, 180F}, null, "", 0, null, "", null, 0, false ), - locoBNLRV_A(EntityLocoElectricBNLRV_A.class, new ModelBNLRV_A(), "bnlrv_", true, new float[] {-2f, 0.10f, 0.0f}, new float[] {0F, 180F, 180F}, null, "", 0, null, "", null, 0, false ), - - locoDeltic(EntityLocoDieselDeltic.class, new ModelDeltic(), "Deltic", false, new float[] { -2.25F, 0.8F, 0.0F }, new float[] { 0F, 90F, 180F }, null, "largesmoke", 1, new ArrayList() { - { - add(new double[]{2.3D, 1.6D, 0D}); - } - }, "", null, 0, false), - locoEWSClass66(EntityLocoDieselClass66.class, new ModelEWSClass66(), "Class66_", true, new float[] { -3.0F, 0.65F, 0.0F }, new float[] { 0F, 90F, 180F }, null, "largesmoke", 2, new ArrayList() { - { - add(new double[]{0.9D, 1.4D, 0.0D}); - } - }, "", null, 0, false), - locoFOL_M1(EntityLocoDieselFOLM1.class, new ModelFOL_M1(), "FOL_M1_", true, new float[] { -2.8F, 0.05F, 0.9F }, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{1.3D, 1.45D, 0.0D}); - } - }, "", null, 0, false), - FOLM1B(EntityLocoDieselFOLM1B.class, new ModelFOLM1B(), "FOL_M1b_", true, new float[] { -2.2F, 0.05F, 0.F }, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{1.6D, 1.45D, 0.0D}); - } - }, "", null, 0, false), - /** Steam */ - locoCherepanov(EntityLocoSteamCherepanov.class, new ModelLocoCherepanov(), "locoCherepanov", false, new float[] { -0.875F, -0.47F, 0.0F }, new float[] { 0, 180, 0 }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 1.5D, 2.1D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 0.875D, 0.2D, 0.2D }); - } - }, 2, true), - locoPannier(EntityLocoSteamPannier.class, new ModelLocoPannier(), "locoPannier", false, new float[] { 0.15F, 0.2F, 0.0F }, new float[] { 0, 180, 180 }, new float[]{0.9f,0.9f,0.9f}, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.4D, 1.8D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.575D, 0.05D, 0.65D }); - } - }, 2, true), - locoC41(EntityLocoSteamC41.class, new ModelLocoC41(), "locoC41", false, new float[] { -3.5F, -0.5F, 0.0F }, new float[] { 0, 180, 180 }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.55D, 1.65D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - - locoBR_Black_5(EntityLocoSteamBR_Black_5.class, new ModelBR_Black_5(), "BR_Black_5_", true, new float[] {-1.75f, 0f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.1D, 1.35D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 3.25D, 0D, 0.65D }); - } - }, 2, true), - - locoRW_Type_3(EntityLocoSteamRWType3.class, new ModelRW_Type_3(), "RW_Type_3_", true, new float[] {-1.25f, 0.17f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.4D, 1.55D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - - locoRW_Type_2(EntityLocoSteamRWType2.class, new ModelRW_Type_2(), "Type_2_", true, new float[] {-1.25f, 0.17f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.2D, 1.55D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.6D, 0.05D, 0.65D }); - } - }, 2, true), - - - locoGWR_101_Class(EntityLocoSteamGWR101Class.class, new ModelGWR101Class(), "Gwr_101_", true, new float[] {-1.25f, 0.17f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.6D, 1.55D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 3D, 0.05D, 0.65D }); - } - }, 2, true), - - - locoGWR_42xx(EntityLocoSteamGWR42xx.class, new ModelGWR42xx(), "2-8-0_", true, new float[] {-2.1f, 0.17f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 4.1D, 1.6D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.3D, 0.05D, 0.65D }); - } - }, 2, true), - - locoGWR_72xx(EntityLocoSteamGWR72xx.class, new ModelGWR72xx(), "72xx_", true, new float[] {-2.5f, 0.17f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 4.8D, 1.6D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 5.0D, 0.05D, 0.65D }); - } - }, 2, true), - - locoWWCP_Class_062T(EntityLocoSteamWWCPClass062T.class, new ModelWWCPClass062T(), "WWCP_Standard_0-6-2T_", true, new float[] {-2.5f, 0.17f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 4.3D, 1.6D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.6D, 0.05D, 0.65D }); - } - }, 2, true), - - locoBR_Britannia_Class(EntityLocoSteamBR_Britannia_Class.class, new ModelBR_Britannia_Class(), "BR_Britannia_", true, new float[] {-2.3f, -0.05f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.78D, 1.4D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.1D, 0.05D, 0.65D }); - } - }, 2, true), - - locoJ50(EntityLocoSteamJ50.class, new ModelJ50(), "J50_", true, new float[] {-1.25f, 0.15f, 0 }, new float[] {0,180,180}, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.7D, 1.5D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.8D, 0.05D, 0.65D }); - } - }, 2, true), - - locoSentinelY3(EntityLocoSteamSentinelY3.class, new ModelSentinelY3(), "Sentinel_Y3_", true, new float[] {-0.5f, 0.15f, 0}, new float[] {0, 180, 180}, null, "largesmoke", 2, new ArrayList() { - { - add(new double[] { -0.5D, 1.5D, 0D }); - } - }, "explode", new ArrayList() { - { - - } - }, 2, true), - - locoJacknail(EntitylocoSteamJacknail.class,new ModelMWClass88BTE(), "0-8-0_box_tank_", true, new float[] {-1.25f, 0.15f, 0 }, new float[] {0, 180, 180}, null, "largesmoke", 2, new ArrayList() { - { - add(new double[] { 2.5D, 1.5D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.5D, 0.05D, 0.65D }); - } - }, 2, true), - - locoC41_080(EntityLocoSteamC41_080.class, new ModelC41_080(), "locoC41_080", false, new float[] { -3.5F, -0.5F, 0.0F }, new float[] { 0, 180, 180 }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.55D, 1.65D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - locoAlcoSC4(EntityLocoSteamAlcoSC4.class, new ModelAlcoSC4(), "AlcoSC4", false, new float[] { -3.5F, -0.5F, 0.0F }, new float[] { 0, 180, 180 }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.55D, 1.65D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - locoC41T(EntityLocoSteamC41T.class, new ModelLocoC41T(), "locoC41t", false, new float[] { -3.5F, -0.5F, 0.0F }, new float[] { 0, 180, 180 }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.55D, 1.65D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - locoSouthern1102(EntityLocoSteamSouthern1102.class, new ModelSouthern1102(), "Southern1102", false, new float[] { -3.5F, -0.5F, 0.0F }, new float[] { 0, 180, 180 }, new float[]{1f,1f,1f}, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.55D, 1.65D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - locoUSATCUS(EntityLocoSteamUSATCUS.class, new ModelUSATCUS(), "USATCUS", false, new float[] { -2.0F, -0.2F, 0.8375F }, new float[] { 0, 180, 180 }, new float[]{1f,1f,1f}, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.5D, 1.2D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.5D, -0.5D, 0.65D }); - } - }, 2, true), - locoUSATCUK(EntityLocoSteamUSATCUK.class, new ModelUSATCUK(), "USATCUK", false, new float[] { -2.0F, -0.2F, 0.8375F }, new float[] { 0, 180, 180 }, new float[]{1f,1f,1f}, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.5D, 1.2D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.5D, -0.5D, 0.65D }); - } - }, 2, true), - locoCoranationClass(EntityLocoSteamCoranationClass.class, new ModelCoranationClass(), "CoranationClass", false, new float[] { -3.8F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 5.45D, 1.9D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] {4.8D, 0.15D, 0.5D }); - } - }, 2, true), - locoBR80(EntityLocoSteamBR80_DB.class, new ModelLocoBR80_DB(), "locoBR80_DB_", true, new float[] { -0.75F, -0.44F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 1.8D, 1.75D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.6D, -0.4D, 0.8D }); - } - }, 4, true), - loco4_4_0(EntityLocoSteam4_4_0.class, new ModelLoco(), "4-4-0-loco_", true, new float[] { -0.66F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 1.6D, 2.05D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.56D, -0.2D, 0.8D }); - } - }, 4, true), - locoSteamSmall(EntityLocoSteamSmall.class, new ModelLoco3(), "loco3_", true, new float[] { -0.99F, -0.5F, 0.0F }, new float[] { 0F, -90F, 0F }, new float[] { 0.8F, 0.8F, 0.8F }, "smoke", 20, new ArrayList() { - { - add(new double[] { 1.69D, 1.1D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.6D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamLSSP7(EntityLocoSteamLSSP7.class, new ModelLSSP7(), "LSSP7", false, new float[] { -1F, -0.2F, 0.8F }, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1F, 1F }, "smoke", 20, new ArrayList() { - { - add(new double[] { 0.1D, 1.15D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 0.7D, -0.4D, 0.5D }); - add(new double[] { 0.7D, -0.4D, -0.5D }); - } - }, 2, true), - locoHeavySteam(EntityLocoSteamHeavy.class, new ModelHeavySteamLoco(), "heavysteam_", true, new float[] { 0F, -0.42F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.1D, 2D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 3D, -0.2D, 0.8D }); - } - }, 2, true), - locoSteamC62Class(EntityLocoSteamC62Class.class, new ModelC62Locomotive(), "c62_engine_", true, - new float[] { 0F, -0.44F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 5.0D, 1.75D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 5.2D, -0.2D, 0.8D }); - } - }, 2, false), - locoSteamD51Short(EntityLocoSteamD51.class, new ModelD51ShortStreamlining(), "d51_short_", true, - new float[] { 0F, -0.5F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 4.85D, 1.85D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.6D, -0.2D, 0.8D }); - } - }, 2, false), - locoSteamD51Long(EntityLocoSteamD51Long.class, new ModelD51LongStreamlining(), "d51_long_", true, - new float[] { 0F, -0.5F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 4.85D, 1.85D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.6D, -0.2D, 0.8D }); - } - }, 2, false), - locoSteamBR01_DB(EntityLocoSteamBR01_DB.class, new ModelLocoBR01_DB(), "locoBR01_DB_", true, new float[] { -1.0F, -0.44F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.45D, 1.8D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 3.4D, -0.2D, 0.8D }); - } - }, 2, false), - locoSteamGS4(EntityLocoSteamGS4.class, new ModelGS4Loco(), "GS4_engine_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, new float[]{0.95f,0.95f,0.95f}, "largesmoke", 5, new ArrayList() { - { - add(new double[] { 5.8D, 1.7D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 5.2D, -0.2D, 0.8D }); - } - }, 2, false), - locoSteamEr_USSR(EntityLocoSteamEr_Ussr.class, new ModelLocoEr_Ussr(), "locoEr_Ussr", false, new float[] { -0.75F, -0.44F, 0.0F }, null, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.45D, 1.9D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 3.4D, -0.2D, 0.8D }); - } - }, 2, false), - locoSteamForney(EntityLocoSteamForneyRed.class, new ModelLocoForney(), "locoForney_", true, new float[] { -1.3F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 2.2D, 1.9D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.2D, -0.2D, 0.8D }); - } - }, 2, true), - locoSteamMogul(EntityLocoSteamMogulBlue.class, new ModelLocoMogul(), "locoMogul_", true, new float[] { -0.6F, -0.44F, 0.0F }, new float[] { 0F, 90F, 0F }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 1.55D, 1.95D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.45D, -0.2D, 0.8D }); - } - }, 2, true), - locoSteamShay(EntityLocoSteamShay.class, new ModelLocoSteamShay(), "locoShay", false, new float[] { -0.4F, -0.45F, -0.0F }, new float[] { 0F, 180F, 0F }, null, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 1.8D, 1.7D, 0.2D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.6D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamVBShay(EntityLocoSteamVBShay.class, new ModelVBShay(), "vbshay", false, new float[] { 0F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 0.55D, 2.2D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.6D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamClimax(EntityLocoSteamClimax.class, new ModelLocoClimax(), "loco_climax", false, new float[] { 0F, 0.18F, 0.0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 2.05D, 1.9D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.6D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamAdler(EntityLocoSteamAdler.class, new ModelLocoSteamAdler(), "locoAdler", false, new float[] { -0.8F, 1.05F, 0F }, new float[] { 180F, -90F, 0F }, new float[]{0.9f,1f,0.9f}, "smoke", 20, new ArrayList() { - { - add(new double[] { 1.6D, 1.3D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.5D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamAlice(EntityLocoSteamAlice0_4_0.class, new ModelLocoAlice040(), "0-4-0-loco-alice", false, new float[] { 0F, 0.15F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 20, new ArrayList() { - { - add(new double[] { 2.2D, 1.6D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.8D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteam040VB(EntityLocoSteam040VB.class, new ModelVB040(), "loco040VB", false, new float[] { 0F, 0.15F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 20, new ArrayList() { - { - add(new double[] { 0.6D, 1.75D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.8D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamGLYN(EntityLocoSteamGLYN042T.class, new Model042TGLYN(), "0-4-2-loco-glyn", false, new float[] { 0F, 0.15F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 20, new ArrayList() { - { - add(new double[] { 2.15D, 1.75D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.8D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteam626T(EntityLocoSteam262T.class, new ModelT262(), "262t", false, new float[] { 0F, 0.15F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 20, new ArrayList() { - { - add(new double[] { 2.65D, 1.7D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.8D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamA4Mallard(EntityLocoSteamMallardA4.class, new ModelA4Locomotive(), "locoA4_UK_", true, new float[] {-3.0F, 0.2F, 0F },new float[] { 0F, 180F, 180F }, new float[]{0.975f,0.975f,0.975f}, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 4.8D, 1.95D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.9D, -0.4D, 0.8D }); - } - }, 2, true), - LocoSteamHallClass(EntityLocoSteamHallClass.class, new ModelHallClass(), "Hall_Class_Locomotive_", true, new float[] {-0.65F, 0.15F, -0.25F },/*position*/ new float[] { 0F, 180F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - add(new double[] { 4.25D, 1.55D, 0D });//smoke - } - }, "explode", new ArrayList() { - { - add(new double[] { 4D, -0.4D, 0.8D });//steam - } - }, 2, true), - LocoSteamKingClass(EntityLocoSteamKingClass.class, new ModelKingClass(), "King_Class_Locomotive_", true, new float[] {-1.75F, 0.15F, 0.0F },/*position*/ new float[] { 0F, 180F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - add(new double[] { 4.8D, 1.6D, 0.0D });//smoke - } - }, "explode", new ArrayList() { - { - add(new double[] { 3.6D, -0.4D, 0.8D });//steam - } - }, 2, true), - LocoSteamBerk1225(EntityLocoSteamBerk1225.class, new Model1225(), "Berk1225_Locomotive", false, new float[] {-2.0F, -0.65F, 0.0625F },/*position*/ new float[] { 0F, 0F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - add(new double[] { 4.65D, 1.7D, 0.0D });//smoke - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.2D, -0.4D, 0.8D });//steam - } - }, 2, true), - LocoSteamBerk765(EntityLocoSteamBerk765.class, new Model765(), "Berk765_Locomotive", false, new float[] {-2.0F, -0.65F, 0.0625F },/*position*/ new float[] { 0F, 0F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - add(new double[] { 4.65D, 1.7D, 0.0D });//smoke - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.2D, -0.4D, 0.8D });//steam - } - }, 2, true), - locoSteamMILWClassA(EntityLocoSteamMILWClassA.class, new ModelMILWClassA(), "locoMILW_ClassA", false, new float[] {0.0F, 0.1F, 0F }, new float[] { 0F, 180F, 180F }, new float[]{0.9f,0.9f,0.9f}, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 4.4D, 1.35D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 4.2D, -0.4D, 0.8D }); - } - }, 2, true), - locoSteamFowler(EntityLocoSteamFowler.class, new ModelFowler(), "loco_Fowler", false, new float[] { -3F, -0.51585F, 0.0F }, new float[] { 0F, 180F, 180F }, new float[]{1f,1f,1f}, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 3.2D, 1.6D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2D, -0.4D, 0D }); - } - }, 2, true), - locoMRcompound(EntitylocoSteamMRCompound.class, new ModelMidlandcompound(), "LMS_4p_", true, new float[] {-1.95f, 0.1f, 0 }, new float[] {0, 180, 180}, null, "largesmoke", 2, new ArrayList() { - { - add(new double[] { 3.5D, 1.5D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 3.5D, 0.05D, 0.65D }); - } - }, 2, true), - - locoSteamA4Tender(EntityTenderA4.class, new ModelTenderA4(), "tenderA4_UK_", true, new float[] { -0.2F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - LocoMRcompoundTender(EntityTenderMRCompound.class, new ModelMRCompoundTender(), "LMS_4p_", true, new float[] {0f, 0.15f, 0 }, new float[] {0, 180, 180}, null, "", 0, null, "", null, 0, false), - LocoBR_Black_5_Tender(EntityTenderBR_Black_5.class, new ModelBR_Black_5_Tender(), "BR_Black_5_Tender_", true, new float[] {-0.05f, 0f, 0f,}, new float[] {0F, 180f, 180F}, null, "", 0, null, "", null, 0, false), - LocoBR1_Tender(EntityTenderBR1.class, new ModelBR1_Tender(), "BR1_Tender_", true, new float[] {0f, -0.01f, 0f,}, new float[] {0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), - LocoRW_Type_2_Tender(EntityTenderRWType2.class, new ModelRW_Type_2_Tender(), "Type_2_", true, new float[] {0f, 0.16f, 0f,}, new float[] {0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), - PropagandaUS(EntityPropagandaUS.class, new ModelPropagandaCar(), "propaganda_US_", true, new float[] { 1.1F, 0.2F, -0.1F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PropagandaJapan(EntityPropagandaJapan.class, new ModelPropagandaCar(), "propaganda_Japan_", true, new float[] { 1.1F, 0.2F, -0.1F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PropagandaUSSR(EntityPropagandaUSSR.class, new ModelPropagandaCar(), "propaganda_USSR_", true, new float[] { 1.1F, 0.2F, -0.1F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PropagandaBritain(EntityPropagandaBritain.class, new ModelPropagandaCar(), "propaganda_Britain_", true, new float[] { 1.1F, 0.2F, -0.1F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - SnowPlow(EntityLocoSteamSnowPlow.class, new ModelSnowPlow(), "train_snowplow", false, new float[] { -2F, 0.12F, 0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 3.15D, 1.6D, 0.0D }); - } - }, "", null, 0, false), - - - locoDieselCF7(EntityLocoDieselCF7.class, new ModelCF7(), "CF7_", true,new float[] {-1.5F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() { - { - add(new double[]{0.6D, 1.4D, 0.0D}); - add(new double[]{1.1D, 1.4D, 0.0D}); - } - }, "", null, 0, false), - locoDieselGP15(EntityLocoDieselGP15.class, new ModelGP15(),"gp15_", true,new float[] {-1.3F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{1.33D, 1.45D, 0.0D}); - add(new double[]{0.75D, 1.45D, 0.0D}); - } - }, "", null, 0, false), - LocoDieselSW8( EntityLocoDieselSW8.class, new ModelSW8(), "sw8_", true,new float[] {-1.0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{1.3D, 1.3D, 0.0D}); - } - }, "", null, 0, false), - locoElectricRenfe446Motor(EntityLocoElectricRenfe446Motor.class, new Modelrenfe446end(), "446_", true, new float[] { -1.9F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerRenfe446Coach(EntityPassengerRenfe446Coach.class, new Modelrenfe446middle(), "446_", true, new float[] { -0.3F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - cabooseRenfe446Tail(EntityCabooseRenfe446Tail.class, new Modelrenfe446end(), "446_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - pch120(EntityLocoElectricPCH120.class, new ModelPCH120Commute(), "pch120commute_", true,new float[] {-1.3F, 0.01F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - pch120Coach(EntityPassengerPCH120Coach.class, new ModelPCH120Car(), "pch120car_", true,new float[] {0F, 0.01F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class345(EntityElectricClass345.class, new ModelClass345(), "Class345_", true,new float[] {-1.5F, 0.17F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class345Coach( EntityClass345Coach.class, new ModelClass345Coach(),"Class345_Passenger_", true, new float[] {0F, 0.05F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - LUengine(EntityElectricLUengine.class, new ModelLUengine(), "lu_engine", false,new float[] {-1.0F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - LUpassenger(EntityLUpassenger.class, new ModelLUpassenger(), "lu_passenger",false,new float[] {0F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DstockEngine(EntityElectricDstockEngine.class, new ModelDstockEngine(), "D_stock_engine_", true,new float[] {-1.0F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DstockCar(EntityDstockPassenger.class, new ModelDstockPassenger(), "D_stock_passenger_",true,new float[] {0F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPS52SeatCoach(EntityPassengerPS52SeatCoach.class, new ModelPS52SeatCoach(), "PS_lightweight_52seat_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPSCombine(EntityPassengerPSCombine.class, new ModelPSCombine(), "PS_lightweight_baggage-coach_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPScenterDiner(EntityPassengerPScenterDiner.class, new ModelPScenterDiner(), "PS_lightweight_center_diner_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPSAnotherDiner(EntityPassengerPSAnotherDiner.class, new ModelPSscrewyoutoomanydiners(), "PS_lightweight_center_diner_2_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - locoElectricMetro2000(EntityElectricMetro2000Motor.class, new ModelMetroMadrid2000Loco(),"metro_2000_",true, new float[] { -1.5F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F },null,"",0,null,"",null,0,false), - passengerMetro2000(EntityPassengerMetro2000.class, new ModelMetro2000Tail(), "metro_2000_", true, new float[] {0F,0.2F,0.0F}, new float[] {0F, 0F, 180F}, null, "", 0, null, "", null , 0, false), - locoElectricRenfe450Motor(EntityLocoElectricRenfe450Motor.class, new Modelrenfe450endA(), "450_loco_", true, new float[] { -1.9F, 0.1F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - passengerRenfe450Coach(EntityPassengerRenfe450Coach.class, new Modelrenfe450middle(), "450_passenger_", true, new float[] { -0.0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - cabooseRenfe450Tail(EntityCabooseRenfe450Tail.class, new Modelrenfe450endB(), "450_passenger_", true, new float[] { 0.0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerCD014(EntityPassengerCD014.class, new ModelCD014(), "cd014_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerCD914(EntityPassengerCD914.class, new ModelCD914(), "cd914_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerCD010(EntityPassengerCD010.class, new ModelCD010(), "cd010_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - locoCD814(EntityLocoDieselCD814.class, new ModelCD814(), "cd814_", true, new float[] { -0.8F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - locoCD810(EntityLocoDieselCD810.class, new ModelCD810(), "cd810_", true, new float[] { -0.8F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - VBShay(EntityLocoSteamVBShay2.class, new ModelVertiBoi2(), "vbshay2", false, new float[] { -0.4F, -1.15F, -0.0F }, new float[] { 0F, 0F, 0F }, null, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 0.6D, 1.9D, -0.1D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 0.6D, -0.4D, 0.8D }); - add(new double[] { 0.3D, 2.3D, 0.0D }); - } - }, 2, true), - locoSteamClimax2(EntityLocoSteamClimaxNew.class, new ModelClimaxNew(), "climax_Grey", false, new float[] { -0.4F, -1.15F, -0.0F }, new float[] { 0F, 180F, 0F }, null, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 1.55D, 1.6D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.0D, -0.0D, 0.8D }); - } - }, 2, true), - freightRoundHopper(EntityFreightRoundHopper.class, new ModelRoundHopper(), "roundedhopper_", true, new float[] { -0F,0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightRibbedHopper(EntityFreightRibbedHopper.class, new ModelRibbedHopper(), "ribbed_hopper_", true, new float[] { -0F,0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - locoSM42(EntityLocoDieselSM42.class, new SM42(), "SM42_", true, new float[] { -2.0F, 0.05F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 0.9D, 1.35D, 0.0D }); - } - }, "", null, 0, false), - locoDieselWWCPGP7(EntityLocoDieselWWCPGP7.class, new ModelWWCPGP7(), "GP7_Highood_", true, new float[]{-2f,0.15f,0}, new float[] { 0F, 0F, 180F }, new float[]{0.9f,1f,0.9f}, "smoke", 4, new ArrayList() { - { - add(new double[] { 1.7D, 1.3D, 0.0D }); - - add(new double[] { 0.85D, 1.3D, 0.0D }); - } - }, "", null, 0, false), - locoC11(EntityLocoSteamC11.class, new ModellocoC11(), "locoC11", false, new float[] { -1.5F, 0.2F, 0.0F }, new float[] { 0, 180, 180 }, null, "largesmoke", 5, new ArrayList() { - { - add(new double[] { 3.05D, 1.25D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.00D, 0.75D }); - } - }, 3, true), - LocoDieselGE44Ton( EntityLocoDieselGE44Ton.class, new ModelGE44Ton(), "44_ton_", true,new float[] {-1.0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{0.6D, 1.1D, 0.0D}); - add(new double[]{1.4D, 1.1D, 0.0D}); - } - }, "", null, 0, false), - amfleet(EntityPassengerAmfleet.class, new ModelAmfleet(),"amfleet_", true, new float[]{0F, -0.4F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - amfleet2(EntityPassengerAmfleet2.class, new ModelAmfleet2(),"amfleet2_", true, new float[]{0F, -0.4F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - bawx40highcube(EntityFreightBap40highcube.class, new Model40highcube(),"40highcube_", true, new float[]{0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - WoodchipHopper(EntityFreightBapWoodchipHopper.class, new ModelWoodchipHopper(),"woodchiphopper_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - OreJenny(EntityFreightBapOreJenny.class, new ModelOreJenny(),"orejenny_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - MillGondola(EntityFreightBapMillGondola.class, new ModelMillGondola(),"MillGondola_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - MILW40boxcar(EntityFreightBapMILW40boxcar.class, new ModelMILW40boxcar(),"milw40_", true, new float[]{0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Freight60centerbeam(EntityFreightBap60centerbeam.class, new Model60centerbeam(),"60ftcb_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Freight66centerbeam(EntityFreightBap66centerbeam.class, new Model66centerbeam(),"66ftcb_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Freight73centerbeam(EntityFreightBap73centerbeam.class, new Model73centerbeam(),"73ftcb_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PS140(EntityFreightBapPS140.class, new ModelPS140(),"ps140_", true, new float[]{0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PS150(EntityFreightBapPS150.class, new ModelPS150(),"ps150_", true, new float[]{0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PS160(EntityFreightBapPS160.class, new ModelPS160(),"ps160_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - WVcaboose(EntityCabooseBapWVcaboose.class, new ModelWVcaboose(),"wvcaboose_", true, new float[]{0F, 0.1675F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - //OWO60Verticube(EntityFreightBapOWO60Verticube.class, new ModelOWO60Verticube(),"owo60verticube_", true, new float[]{0F, 0.1875F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PEcoach(EntityPassengerBapPEcoach.class, new ModelPEcoach(),"PECoach_", true, new float[]{0F, 0.105F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PEobserve(EntityPassengerBapPEobserve.class, new ModelPEobserve(),"PEObserve_", true, new float[]{0F, 0.105F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - VersaLongi(EntityFreightBapVersaLongi.class, new ModelVersaLongi(),"versa_longi_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - VersaTrans(EntityFreightBapVersaTrans.class, new ModelVersaTrans(),"versa_trans_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DOT11111000(EntityFreightBapDOT11111000.class, new Model11000DOT111(),"dot11K_", true, new float[]{0F, 0.00F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DOT11120600(EntityFreightBapDOT11120600.class, new Model20600DOT111(),"dot206K_", true, new float[]{0F, 0.00F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DOT11129080(EntityFreightBapDOT11129080.class, new Model29080DOT111(),"dot290K_", true, new float[]{0F, 0.00F /*was 0.20F for height*/, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - F7A( EntityLocoDieselBapF7A.class, new ModelF7A(), "F7A_", true,new float[] {-1.375F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - { - add(new double[]{0.9375D, 1.3D, 0.0D}); - add(new double[]{0.25D, 1.3D, 0.0D}); - - } - }, "", null, 0, false), - F7B( EntityLocoDieselBapF7B.class, new ModelF7B(), "F7B_", true,new float[] {-1.25F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - { - add(new double[]{1.35D, 1.3D, 0.0D}); - add(new double[]{0.55D, 1.3D, 0.0D}); - - } - }, "", null, 0, false), - H1044( EntityLocoDieselBapH1044.class, new ModelH1044(), "FM_H10-44_", true,new float[] {-1.1F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[]{1.9D, 1.45D, -0.16D}); - add(new double[]{1.9D, 1.45D, 0.16D}); - } - }, "", null, 0, false), - locoSteamStarClass(EntityLocoSteamStarClass.class, new ModelStarClass(), "StarLoco", false, new float[] { -0.8F, 0.15F, 0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 20, new ArrayList() { - { - add(new double[] { 1.65D, 1.3D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.5D, -0.4D, 0.8D }); - } - }, 2, true), - tenderStarClass(EntityTenderStarClass.class, new ModelStarClassTender(), "StarTender", false, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerStarCarFat(EntityPassengerStarCarFat.class, new ModelStarCarFat(), "GWRClosed", false, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerStarCarNotFat(EntityPassengerStarCarNotFat.class, new ModelStarCarNotFat(), "GWROpen", false, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - LightCrane(EntityLightCrane.class, new ModelLightCrane(),"lightcrane2_", true, new float[]{0F,0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - BR155(EntityLocoElectricBR155.class, new ModelBR155(), "BR155_", true, new float[] { -1.7F, 0.05F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "",0,null, "", null, 0, false), - Onion(EntityLocoOnion.class, new ModelOnion(), "Onion_", true, new float[] { -0.7F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 0.6D, 1.5D, 0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 1.2D, -0.4D, 0.8D }); - } - }, 2, true), - OnionTender(EntityTenderOnion.class, new ModelOnionTender(), "Onion_Tender_", true, new float[] { 0.0F, 0.1F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - loco440RFront(EntityLocoElectric440RFront.class, new Model440R_Front(), "440R_", true, new float[] { -1.9F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passenger440RMid(EntityPassenger440RMid.class, new Model440R_Mid(), "440R_", true, new float[] { -0.0F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passenger440RRear(EntityPassenger440RRear.class, new Model440R_Back(), "440R_", true, new float[] { 0.0F, 0.1F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - passengerBW305(EntityPassengerBW305.class, new ModelBW305(), "tw_", true, new float[]{ 0.0F, 0.18F, 0.0F}, new float[]{ 0.0F, 180F, 180F} , null, "", 0, null, "", null, 0 , false ), - LocoElectricTW305(EntityLocoElectricTW305.class, new ModelTW305(), "tw_", true, new float[]{ -1.0F, 0.18F, 0.0F}, new float[]{ 0.0F, 180F, 180F} , null, "", 0, null, "", null, 0 , false ), - LocoElectricInterurbanSeries100(EntityElectricInterurbanSeries100.class, new ModelInterurbanSeries100(), "Interurban_tram_", true, new float[]{ -1.5F, 0.18F, 0.0F}, new float[]{ 0.0F, 180F, 180F} , null, "", 0, null, "", null, 0 , false ), - GP13(EntityLocoDieselGP13.class, new ModelGP13(), "gp13_", true, new float[] { -0.8F, -0.47F, 0.0F }, new float[] { 0F, 180F, 0F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { -0.2D, 1.2D, 0.0D }); - add(new double[] { 0.45D, 1.2D, 0.0D }); - } - }, "", null, 0, false), - DB143(EntityLocoElectricDB143.class, new ModelDB143(), "DB143", false, new float[] { -1.7F, 0.2F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "",0,null, "", null, 0, false), - tenderPETender(EntityTenderPETender.class, new ModelPE_Tender(), "PETender", false, new float[] { 0.1F, 0.15F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - locoSteamPELoco(EntityLocoSteamPELoco.class, new ModelPE_Loco(), "PELoco", false, new float[] { -1.5F, 0.15F, 0.0F }, new float[] { 0, 180, 180 }, null, "largesmoke", 3, new ArrayList() { - { - add(new double[] { 3.1D, 1.4D, 0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 2.9D, 0.05D, 0.65D }); - } - }, 2, true), - BapB23( EntityLocoDieselBapB23.class, new ModelB23(), "b23_", true,new float[] {-1.7F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { } - }, "", null, 0, false), - C424( EntityLocoDieselBapC424.class, new ModelC424(), "c424_", true,new float[] {-1.6F, 0.1F, 0F}, new float[] { 0F, 180F, 180F }, null, "largesmoke", 2, new ArrayList() { - { - add(new double[]{1D, 1.65D, 0.0D}); - } - }, "", null, 0, false), - C425( EntityLocoDieselBapC425.class, new ModelC425(), "c425_", true,new float[] {-1.6F, 0.1F, 0F}, new float[] { 0F, 180F, 180F }, null, "largesmoke", 2, new ArrayList() { - { - add(new double[]{1D, 1.65D, 0.0D}); - } - }, "", null, 0, false), - GP9( EntityLocoDieselBapGP9.class, new ModelGP9(), "gp9_", true,new float[] {-1.5F, -0.05F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{0.45D, 1.35D, 0.0D}); - add(new double[]{1.25D, 1.35D, 0.0D}); - } - }, "", null, 0, false), - GP7b( EntityLocoDieselBapGP7b.class, new ModelGP7b(), "bettergp7b_", true,new float[] {-1.5F, -0.05F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{0.45D, 1.35D, 0.0D}); - add(new double[]{1.25D, 1.35D, 0.0D}); - } - }, "", null, 0, false), - GP7u( EntityLocoDieselBapGP7u.class, new ModelGP7u(), "gp7u_", true,new float[] {-1.5F, -0.05F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{0.45D, 1.35D, 0.0D}); - add(new double[]{1.25D, 1.35D, 0.0D}); - - } - }, "", null, 0, false), - GP7( EntityLocoDieselBapGP7.class, new ModelGP7BAP(), "bettergp7_", true,new float[] {-1.5F, -0.05F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{0.45D, 1.35D, 0.0D}); - add(new double[]{1.25D, 1.35D, 0.0D}); - } - }, "", null, 0, false), - GP30( EntityLocoDieselBapGP30.class, new ModelGP30(), "gp30_", true,new float[] {-1.5F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - //add(new double[]{1.9D, 1.4D, 0.0D}); - } - }, "", null, 0, false), - GP38dash2( EntityLocoDieselBapGP38dash2.class, new ModelGP38dash2(), "gp38dash2_", true,new float[] {-1.5F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{0.75D, 1.4D, 0.0D}); - add(new double[]{1.55D, 1.4D, 0.0D}); - } - }, "", null, 0, false), - KOF_III(EntityLocoDieselKof_III.class, new ModelKOF_III(), "KofIII_", true, new float[] { -0.8F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 0.5D, 1.0D, 0.0D }); - } - }, "", null, 0, false), - KOF_III_M(EntityLocoDieselKof_III_M.class, new ModelKOF_III_M(), "KofIIIM_", true, new float[] { -0.8F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[] { 0.5D, 1.0D, 0.0D }); - } - }, "", null, 0, false), - U36C( EntityLocoDieselBapU36C.class, new ModelU36C(), "u36c_", true,new float[] {-2.3125F, -0.15F/* -0.13F*/, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1F, 1F }, "smoke", 3, new ArrayList() { - { - //add(new double[]{0.75D, 1.75D, 0.0D}); - - } - }, "", null, 0, false), - GP49( EntityLocoDieselBapGP49.class, new ModelGP49(), "gp49_arr_2807", false,new float[] {-1.5F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { } - }, "", null, 0, false), - GP15( EntityLocoDieselBapGP15.class, new ModelBapGP15(), "gp15_bap_", true,new float[] {-1.3F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { } - }, "", null, 0, false), - spookyGarrattFront(EntityLocoSteamGarrattFront.class, new ModelGarrattFront(), "GarrattTexture", false, new float[] {3.5F, 0.155F, 0.0F },/*position*/ new float[] { 0F, 180F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - //add(new double[] { 4.65D, 1.7D, 0.0D });//smoke - } - }, "explode", new ArrayList() { - { - //add(new double[] { 4.2D, -0.4D, 0.8D });//steam - } - }, 2, true), - spookyGarrattRear(EntityLocoSteamGarrattRear.class, new ModelGarrattBack(), "GarrattTexture", false, new float[] {3.25F, 0.155F, 0.0F },/*position*/ new float[] { 0F, 0F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - //add(new double[] { 4.65D, 1.7D, 0.0D });//smoke - } - }, "explode", new ArrayList() { - { - //add(new double[] { 4.2D, -0.4D, 0.8D });//steam - } - }, 2, true), - spookyGarrattMid(EntityLocoSteamGarrattMid.class, new ModelGarrattMid(), "GarrattTexture", false, new float[] {-2.25F, 0.155F, 0.0F },/*position*/ new float[] { 0F, 0F, 180F }, new float[]{1f,1f,1f},/*scale*/ "largesmoke", 20, new ArrayList() { - { - //add(new double[] { 4.65D, 1.7D, 0.0D });//smoke - } - }, "explode", new ArrayList() { - { - //add(new double[] { 4.2D, -0.4D, 0.8D });//steam - } - }, 2, true), - Skook(EntityLocoSteamSkook.class, new ModelSkookum(), "skookum", false, new float[] { -0.0F, -0.0F, -0.0F }, new float[] { 0F, 180F, 180F }, null, "largesmoke", 20, new ArrayList() { - { - add(new double[] { 2.4D, 1.5D, -0.0D }); - } - }, "explode", new ArrayList() { - { - add(new double[] { 0.9D, -0.4D, 0.8D }); - add(new double[] { 2.5D, -0.4D, 0.8D }); - add(new double[] { -0.5D, 1.5D, 0.0D }); - } - }, 2, true), - SkookTender(EntityTenderSkookTender.class, new ModelSkookumTender(), "skookumtender", false, new float[] {-0.00F, 0.0F, 0F}, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - EF1(EntityLocoElectricBapEF1.class, new ModelEF1(), "ef1_", true,new float[] {-1.60F, 0.1875F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - EF1B(EntityLocoElectricBapEF1B.class, new ModelEF1B(), "ef1b_", true,new float[] {-1.15635F, 0.1875F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - EP1A(EntityLocoElectricBapEP1A.class, new ModelEP1A(), "ep1a_", true,new float[] {-1.60F, 0.1875F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - SD9(EntityLocoDieselBapSD9.class, new ModelSD9(), "SD9_", true,new float[] {-1.6F,0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - //add(new double[]{0.8D, 1.4D, 0.0D}); - //add(new double[]{1.6D, 1.4D, 0.0D}); - } - }, "", null, 0, false), - SD40dash2(EntityLocoDieselBapSD40dash2.class, new ModelSD40dash2(), "sd40_", true,new float[] {-1.9F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() { - { - //add(new double[]{2.3D, 1.5D, 0.0D}); - } - }, "", null, 0, false), - WWCP40FootBox(EntityFreightWWCP40FootBox.class, new ModelWWCP40FootBox(),"40ft_Boxcar_", true, new float[]{0F, 0.1875F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - //HuskyStackWellcar(EntityFreightBapHuskyStack.class, new ModelHuskyStack(), "huskystack_", true, new float[]{0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - U23B( EntityLocoDieselBapU23B.class, new ModelU23B(), "U23B_", true,new float[] {-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { - { }}, "", null, 0, false), - U18B( EntityLocoDieselBapU18B.class, new ModelU18B(), "U18B_", true,new float[] {-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { - { }}, "", null, 0, false), - hicube60foot(EntityFreightBaphicube60foot.class, new Modelhicube60foot(),"hicube60_", true, new float[]{0F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - freightBNSFGon(EntityFreightBNSFGon.class, new ModelBNSFGon(), "BNSFMillGon_", true, new float[] { 0.0F, 0.0F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - locoILMA(EntityLocoElectricILMA.class, new ModelILMA(), "ILMA_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - locoILMB(EntityLocoElectricILMB.class, new ModelILMB(), "ILMB_", true, new float[] { 0.0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Feve3300Front(EntityLocoElectricFeve3300.class, new Modelfeve3300front(), "feve3300_", true, new float[] { -1.8F, 0.18F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Feve3300Rear(EntityPassengerFeve3300.class, new Modelfeve3300rear(), "feve3300_", true, new float[] { -0.0F, 0.18F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - HH660( EntityLocoDieselBapHH660.class, new ModelHH660(), "hh600_", true,new float[] {-1F, -0.1F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[]{2.0D, 1.35D, 0D}); - } - }, "", null, 0, false), - Krautt(EntityLocoDieselBapKrautt.class, new ModelKrautt(), "KM_ML4000_", true,new float[] {0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() { - { }}, "", null, 0, false), - BoxMotor(EntityLocoElectricBoxMotor.class, new boxmotor(), "BoxMotorTexture", false, new float[] { -1.8F, 0.1F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Hopper5201(EntityFreightBapHopper5201.class, new ModelHopper5201(), "5201_", true, new float[] { -0F,0.0F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Hopper6260(EntityFreightBapHopper6260.class, new ModelHopper6260(), "6260_", true, new float[] { -0F,0.0F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Skeleton(EntityFreightBapSkeletonLogCar.class, new ModelSkeletonLogCar(), "SkeletonLogCar_", true, new float[] { 0.0F, -0.0F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Shay3Truck(EntityLocoSteamShay3Truck.class, new ModelShay3Truck(), "3truckShay_", true,new float[] {0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "largesmoke", 4, new ArrayList() { - { - add(new double[] { 2.15D, 1.3D, -0.17D });//1.1D - } - }, "explode", new ArrayList() { - { - add(new double[] { 0.9D, -0.4D, 0.6D }); - //add(new double[] { 0.6D, 1.1D, 0.0D }); - } - }, 2, true), - Shay3TruckTender(EntityTenderShay3Truck.class, new ModelShay3TruckTender(), "3truckShay_", true, new float[] { 0.0F, 0.0F, 0.0F }, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - Dash840B( EntityLocoDieselBapDash840B.class, new ModelDash840B(), "dash8_40b_", true,new float[] {-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { - { }}, "", null, 0, false), - Class44(EntityLocoDieselClass44.class, new ModelClass44(), "Class44_", true, new float[] { 0F, 0.0F, 0.0F }, new float[] { 0F, 90F, 180F }, null, "largesmoke", 1, new ArrayList() { - { - add(new double[]{2.3D, 1.6D, 0D}); - } - }, "", null, 0, false), - EU07(EntityLocoElectricEU07.class, new EU07Modernised(), "EU07_", true, new float[] { -0F, 0.00F, 0.0F }, new float[] { 0F, 0F, 180F }, new float[]{0.9f,0.9f,0.9f}, "",0,null, "", null, 0, false), - SW1( EntityLocoDieselBapSW1.class, new ModelSW1(), "sw1_", true,new float[] {-0.0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() {{ }}, "", null, 0, false), - SW1500( EntityLocoDieselBapSW1500.class, new ModelSW1500(), "sw1500_", true,new float[] {-0.0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() {{ }}, "", null, 0, false), - GM6C(EntityLocoElectricBapGM6C.class, new ModelGM6C(), "GM6C_demo", false,new float[] {-0.0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Dash840C( EntityLocoDieselBapDash840C.class, new ModelDash840C(), "dash8_40c_", true,new float[] {-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { - { }}, "", null, 0, false), - SW1200( EntityLocoDieselBapSW1200.class, new ModelSW1200(), "sw1200_", true,new float[] {-0.0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() {{ }}, "", null, 0, false), - RSD15( EntityLocoDieselBapRSD15.class, new ModelRSD15(), "RSD15_", true,new float[] {-0.0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() {{ }}, "", null, 0, false), - PSBaggage(EntityFreightPS73Baggage.class, new ModelPS73Baggage(), "PS_Baggage_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - ES44( EntityLocoDieselBapES44.class, new ModelES44(), "es44_", true,new float[] {-2.2F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{1.0D, 1.4D, 0.0D}); - - } - }, "", null, 0, false), - Dash9_44CW( EntityLocoDieselBapDash9_44CW.class, new ModelDash9_44CW(), "d9-44cw_", true,new float[] {-2.2F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - - } - }, "", null, 0, false), - SD70Mac( EntityLocoDieselBapSD70Mac.class, new ModelSD70Mac(), "sd70mac_", true,new float[] {-2.1F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - - { - add(new double[]{2.35D, 1.5D, 0.0D}); - } - }, "", null, 0, false), - Dash840BB( EntityLocoDieselBapDash840BB.class, new ModelDash840BB(), "dash8_40b_b_", true,new float[] {-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { - { }}, "", null, 0, false), - Dash840BW( EntityLocoDieselBapDash840BW.class, new ModelDash840BW(), "dash8_40bw_", true,new float[] {-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { - { }}, "", null, 0, false), - PSBaggage85(EntityFreightPS85Baggage.class, new ModelPS85Baggage(), "PS_lightweight_85_baggage_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Reefer64(EntityFreightBapReefer64Foot.class, new ModelReefer64Foot(),"reefer_64_", true, new float[]{0F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DH643( EntityLocoDieselBapDH643.class, new ModelDH643(), "alco_dh423_not_dumb", false,new float[] {-0.0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() {{ }}, "", null, 0, false), - CF7( EntityLocoDieselBapCF7.class, new ModelCF7Angle(), "CF7_Angle_", true,new float[] {-0F, -0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() { - { } - }, "", null, 0, false), - CF7round( EntityLocoDieselBapCF7round.class, new ModelCF7round(), "CF7_Round_", true,new float[] {-0F, -0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 6, new ArrayList() { - { } - }, "", null, 0, false), - alcoS2( EntityLocoDieselBapAlcoS2.class, new ModelAlcoS2(), "alcos2_", true,new float[] {0f, 0f, 0f}, new float[] { 0F, 180F, 180F }, null, "smoke", 5, new ArrayList() { - { - add(new double[]{0.7D, 1.3D, -0.18D}); - } - }, "", null, 0, false), - NRE3gs21b( EntityLocoDieselBapNRE3gs21b.class, new ModelNRE3gs21b(), "3gs21b_", true,new float[] {-1.5F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{0.15D, 1.3D, 0.0D}); //farthest from cab - add(new double[]{1.05D, 1.3D, 0.0D}); //middle - add(new double[]{2.0D, 1.3D, 0.0D}); // closest to cab - } - }, "", null, 0, false), - Beep( EntityLocoDieselBapBeep.class, new ModelBeep(), "atsfbeep", false,new float[] {-0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[]{1.45D, 1.25D, 0.0D}); - add(new double[]{1.65D, 1.25D, 0.0D}); - add(new double[]{1.05D, 1.25D, 0.0D}); - add(new double[]{1.25D, 1.25D, 0.0D}); - } - }, "", null, 0, false), - GP38dash9W( EntityLocoDieselBapGP38dash9W.class, new ModelGP38dash9W(), "GP38dash9W_Green", false,new float[] {-1.5F, 0.155F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { } - }, "", null, 0, false), - class158motor(EntityLocoDieselClass158.class, new ModelClass158(), "Class_158_", true, new float[] { -1.85F, -0.45F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "smoke", 2, new ArrayList() { - { } - }, "", null, 0, false), - class158car(EntityClass158Coach.class, new ModelClass158Middle(), "Class_158_", true, new float[] { 0.5F, -0.45F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - //HBC1C(EntityCabooseBapHBC1C.class, new ModelHBC1C(),"HBC1C_", true, null, null, null, "", 0, null, "", null, 0, false), - DRGWCaboose(EntityCabooseBapDRGW.class, new ModelDRGW01400Caboose(),"BAP_DRGW_01400_", true, null, null, null, "", 0, null, "", null, 0, false), - passengerPSSleeper565(EntityPassengerPSSleeper565.class, new ModelPSSleeper565(), "PS_lightweight_5-6-5_sleeper_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPSSleeper565DRGW(EntityPassengerPSSleeper565DRGW.class, new ModelPSSleeper565DRGW(), "PS_DRGW_lightweight_5-6-5_sleeper", false, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - AlcoPA1( EntityLocoDieselAlcoPA1.class, new ModelAlcoPA(), "AlcoPA1_", true,new float[] {-1.6F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - AlcoPB1( EntityLocoDieselAlcoPB1.class, new ModelAlcoPB(), "AlcoPB1_", true,new float[] {-1.55F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - EMDE8A( EntityLocoDieselEMDE8A.class, new ModelEMDE8A(), "EMDE8A_", true,new float[] {-1.85F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - - //tcce4 new stuff - SNCB_M6( EntityPassengerSNCB_M6.class, new ModelSNCB_M6(),"SNCB_M6_", true, new float[] {-2.0f, .095F, 0F}, new float[] { 0f, 180F, 180F },null, "", 0, null, "", null, 0, false), - SNCB_M6_TAIL( EntityPassengerSNCB_M6_TAIL.class, new ModelSNCB_M6_TAIL(),"SNCB_M6_Tail_", true, new float[] {-2.30F, 0.04f, 0F}, new float[] { 0F, 0, 180F },null, "", 0, null, "", null, 0, false), - - Class153Engine( EntityLocoDieselClass153.class, new ModelClass153(), "class_153_", true, new float[] {-2.1F, 0.18F, 0F}, new float[] {0F, 180F, 180F }, null, "smoke", 3, new ArrayList() {{}}, "", null, 0, false), - Class153Coach( EntityPassengerClass153.class, new ModelClass153(), "class_153_", true, new float[] {0F, 0.18F, 0F}, new float[] {0F, 180F, 180F }, null, "",0 , null, "", null, 0, false), - Class156Engine( EntityLocoDieselClass156.class, new ModelClass156(), "Class_156_", true, new float[] {-1.3F, -0.57F, 0F}, new float[] {0F, 180F, 180F}, null, "smoke",3, new ArrayList() {{}}, "", null, 0, false ), - Class47(EntityLocoDieselClass47.class, new ModelClass47(), "Class_47_", true, new float[] {-4f, 0f, 0f}, new float[] {0f, 180f, 180f}, null, "smoke", 3, new ArrayList() {{}}, "", null, 0, false), - Class319Engine(EntityElectricClass319.class, new ModelClass319Engine(), "Br_319_", true,new float[] {-1.65F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList(), "", null, 0, false), - Class319Middle( EntityPassengerClass319Middle.class, new ModelClass319Middle(),"Br_319_", true, new float[] {0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class319Panto( EntityPassengerClass319Panto.class, new ModelClass319Panto(),"Br_319_", true, new float[] {0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class319Tail( EntityPassengerClass319Tail.class, new ModelClass319Engine(), "Br_319_", true, new float[] {0F, 0.15F, 0F}, new float[] { 0F, 0F, 180F },null, "", 0, null, "", null, 0, false), - PSRPOPM(EntityFreightPSRPOPM.class, new ModelPSRPOPM(), "PSRPOPM_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - PSRPO(EntityFreightPSRPO.class, new ModelPSRPO(), "PSRPO_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - KVB_2300(EntityElectricKVB_2300.class, new ModelKVB_2300(), "kvb_2300_", true,new float[] {-1.25F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - KVB_2300_B( EntityPassengerKVB_2300_B.class, new ModelKVB_2300_B(),"kvb_2300_", true, new float[] {-1.25F, 0.15F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - //tcce5 new stuff (its mixed around in the file tbh) - BR_MK2F_Coach( EntityPassengerBR_MK2F_Coach.class, new ModelBR_MK2F_Coach(), "BR_Mk2f_", true, new float[] {0.485F,0F,0F}, new float[] {0F, 180F, 180F}, null, "",0,null, "", null, 0, false), - BR_MK2F_BSO(EntityPassengerBR_MK2F_BSO.class, new ModelBR_MK2F_BSO(), "BR_Mk2f_BSO_", true, new float[] {0.485F,0F,0F}, new float[] {0F, 180F, 180F}, null, "", 0 , null, "", null, 0, false), - BR_MK2F_DBSO(EntityElectricBR_MK2F_DBSO.class, new ModelBR_MK2F_DBSO(), "BR_Mk2f_DBSO_", true, new float[] {-1.5F, 0F, 0F},new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - BR_MK3_Buffet( EntityPassengerBR_MK3_Buffet.class, new ModelBR_MK3_Buffet(),"BR_Mk3_Buffet_", true, new float[] {0.15F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - BR_MK3_Coach( EntityPassengerBR_MK3_Coach.class, new ModelBR_MK3_Coach(),"BR_Mk3_Coach_", true, new float[] {0.15F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - BR_MK3a_Coach( EntityPassengerBR_MK3a_Coach.class, new ModelBR_Mk3a_Coach(),"BR_Mk3a_", true, new float[] {0.15F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - BR_MK3_Pantograph( EntityPassengerBR_MK3_Pantograph.class, new ModelBR_MK3_Pantograph(),"BR_Mk3_Pantograph_", true, new float[] {0.15F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - BR_MK3_DVT(EntityElectricBR_MK3_DVT.class, new ModelBR_MK3_DVT(), "BR_Mk3_DVT_", true, new float[] {-1.5F, 0F, 0F},new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - BR_MK4_DVT( EntityElectricBR_MK4_DVT.class, new ModelBR_MK4_DVT(),"BR_Mk4_DVT_", true, new float[] {-1.9F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - BR_MK4_Coach( EntityPassengerBR_MK4_Coach.class, new ModelBR_MK4_Coach(),"BR_Mk4_", true, new float[] {0.2F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - BR_MK4_Buffet( EntityPassengerBR_MK4_Buffet.class, new ModelBR_MK4_Buffet(),"BR_Mk4_Buffet_", true, new float[] {0.22F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class43( EntityLocoDieselClass43.class, new ModelClass43(),"Class_43_", true, new float[] {-0.65F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class90( EntityElectricClass90.class, new ModelClass90(),"Class_90_", true, new float[] {-0.55F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class91( EntityElectricClass91.class, new ModelClass91(),"Class_91_", true, new float[] {-1.2F, 0.05F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class321( EntityElectricClass321.class, new ModelClass321(),"Class_321_", true, new float[] {-1.2F, -0.455F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class321Panto( EntityPassengerClass321Panto.class, new ModelClass321_Panto(),"Class_321_Panto_Car_", true, new float[] {0.6F, -0.455F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class321Coach( EntityPassengerClass321Coach.class, new ModelClass321Coach(),"Class_321_Trailer_Car_", true, new float[] {0.6F, -0.455F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - passengerMinetrain(EntityPassengerMinetrain.class, new ModelPassengerMinetrain(), "minetrain", false, new float[] { 0.0F, -0.47F, 0.0F }, null, null, "", 0, null, "", null, 0, false), - asteri(EntityLocoSteamasteri.class, new Modelasteri(), "asteri", false, new float[] {-1.0F, 0.16F, 0F}, new float[] { 5F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - //TCCE6 - C415H( EntityLocoDieselC415H.class, new ModelC415H(), "C415h_", true,new float[] {0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { } - }, "", null, 0, false), - C415S( EntityLocoDieselC415S.class, new ModelC415S(), "C415s_", true,new float[] {0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { } - }, "", null, 0, false), - C415L( EntityLocoDieselC415L.class, new ModelC415L(), "C415l_", true,new float[] {-1.2F, 0.105F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - add(new double[]{1.85D, 1.55D, 0.0D}); - } - }, "", null, 0, false), - GE25Ton( EntityLocoDieselGE25Ton.class, new ModelGE25Ton(), "25ton_", true,new float[] {0.0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - { - add(new double[]{0.6D, 1.1D, 0.0D}); - } - }, "", null, 0, false), - GSI60FootBulkhead(EntityFreightGSI60FootBulkhead.class, new ModelGSI60FootBulkheadFlat(),"gsi_60bulk_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - GSC60FootFlat(EntityFreightGSC60FootFlat.class, new ModelGSI60FootBulkheadFlat(),"gsc_60flat_", true, new float[]{0F, 0.0F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - FMH24_66( EntityLocoDieselFMH24_66.class, new ModelFMH24_66(), "FM_H24-66_", true,new float[] {-1.9F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - //add(new double[]{1.85D, 1.55D, 0.0D}); - } - }, "", null, 0, false), - FMH24_66L( EntityLocoDieselFMH24_66L.class, new ModelFMH24_66L(), "FM_H24-66_L_", true,new float[] {-1.9F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - EMDE8B( EntityLocoDieselEMDE8B.class, new ModelEMDE8B(), "EMDE8B_", true,new float[] {-1.75F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - passengerPSLunchCounter_Lounge(EntityPassengerPSLunchCounter_Lounge.class, new ModelPSLunchCounter_Lounge(), "PS_lightweight_LunchCounter_Lounge_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPS30SeatParlor(EntityPassengerPS30SeatParlor.class, new ModelPS30SeatParlor(), "PS_lightweight_30SeatParlor_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPS54SeatCoach_Lounge(EntityPassengerPS54SeatCoach_Lounge.class, new ModelPS54SeatCoach_Lounge(), "PS_lightweight_54SeatCoach_Lounge_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPS58SeatCoach_Observation(EntityPassengerPS58SeatCoach_Observation.class, new ModelPS58SeatCoach_Observation(), "PS_lightweight_58SeatCoach_Observation_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPSBM56SeatCoach(EntityPassengerPSBM56SeatCoach.class, new ModelPSBM56SeatCoach(), "PS_lightweight_BM56SeatCoach_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPSBMCombine(EntityPassengerPSBMCombine.class, new ModelPSBMCombine(), "PS_lightweight_BMCombine_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - passengerPSBMDiner_Lounge(EntityPassengerPSBMDiner_Lounge.class, new ModelPSBMDiner_Lounge(), "PS_lightweight_BMDiner_Lounge_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - EMDE7A( EntityLocoDieselEMDE7A.class, new ModelEMDE7A(), "EMDE7A_", true,new float[] {-1.85F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - EMDE7B( EntityLocoDieselEMDE7B.class, new ModelEMDE7B(), "EMDE7B_", true,new float[] {-1.75F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, new float[] { 1F, 1.0F, 1F }, "smoke", 3, new ArrayList() { - {} - }, "", null, 0, false), - freight5Plank(EntityFreight5Plank.class, new Model5Plank(), "5_plank_", true, new float[] {0f, 0.15f, 0f}, new float[] {0f, 180f, 180f}, null, "", 0, null, "", null, 0, false ), - NMBS_HLE_18( EntityLocoElectricNMBS_HLE_18.class, new ModelNMBS_HLE_18(), "hle19_", true, new float[]{-1.5F,0.05F,0}, new float[] {0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), - BR_Mk_1_BSO(EntityPassengerBR_Mk1_BSO.class, new ModelBR_Mk1_BSO(),"BR_Mk1_BSO_", true, new float[]{0,0,0,}, new float[] {0,180,180}, null, "", 0, null, "", null, 0, false), - BR_Mk_1_TSO(EntityPassengerBR_Mk1_TSO.class, new ModelBR_Mk1_TSO(),"BR_Mk1_TSO_", true, new float[]{0,0,0,}, new float[] {0,180,180}, null, "", 0, null, "", null, 0, false), - BR_Mk_1_Buffet(EntityPassengerBR_Mk1_Buffet.class, new ModelBR_Mk1_Buffet(),"BR_Mk1_Buffet_", true, new float[]{0,0,0,}, new float[] {0,180,180}, null, "", 0, null, "", null, 0, false), - BR_Mk_1_TPO_Stowage(EntityFreightBR_Mk1_TPO_Stowage.class, new ModelBR_Mk1_TPO_Stowage(), "BR_Mk1_TPO_", true, new float[] {0F,0F,0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - BR_Mk_1_BG(EntityPassengerBR_Mk1_BG.class, new ModelBR_Mk1_BG(),"BR_Mk1_BG_", true, new float[]{0,0,0}, new float[] {0, 180, 180}, null, "", 0, null, "", null, 0, false), - Class175(EntityLocoDieselClass175.class, new ModelClass175(), "Class_175_", true, new float[]{-2.25f,-0.127f,0}, new float[] {0, 180, 180}, null , "smoke", 1, new ArrayList() {{}}, "", null, 0, false), - Class175Coach(EntityPassengerClass175Coach.class, new ModelClass175Coach(), "Class_175_Middle_Car_", true, new float[]{0, -0.127f, 0}, new float[] {0, 180F, 180F}, null, "", 0, null, "", null,0, false), - FMH16_66( EntityLocoDieselFMH16_66.class, new ModelFMH16_66(), "FM_H16-66_", true,new float[] {-1.7F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "smoke", 4, new ArrayList() { - { - //add(new double[]{1.85D, 1.55D, 0.0D}); - } - }, "", null, 0, false), - ACFGNRPO_30(EntityPassengerACFGNRPO_30.class, new ModelACFGNRPO_30(), "AC&F_lightweight_GNRPO30_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - ACFGN60SeatCoach(EntityPassengerACFGN60SeatCoach.class, new ModelACFGN60SeatCoach(), "AC&F_lightweight_GN60SeatCoach_", true, new float[] { 0F, 0.15F, 0.0F }, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - FGV4300Motor(EntityLocoElectricFGV4300.class, new ModelFGV4300Motor(), "4300_motorcar", false, new float[] {-1.3F, -0.03F, 0F}, new float[]{0F,180F,180F}, null, "", 0, null, "", null, 0, false), - FGV4300Coach(EntityPassengerFGV4300Coach.class, new ModelFGV4300Coach(), "4300_middle", false, new float[] {0F, -0.03F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false ), - FGV4300Tail(EntityPassengerFGV4300Tail.class, new ModelFGV4300Tail(), "4300_motorcar", false, new float[] {0F, -0.03F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false ), - MetroMadrid3000Loco(EntityElectricMetro3000Motor.class, new ModelMetroMadrid3000Loco(), "MM3000_", true, new float[] {-1.5F, 0.2F, 0F}, new float[]{0F,180F,180F}, null, "", 0, null, "", null, 0, false), - PassengerMetro3000(EntityPassengerMetro3000.class, new ModelMetroMadrid3000Passenger(), "MM3000_", true, new float[] {0F, 0.2F, 0F}, new float[] {0F,180F,180F}, null, "", 0, null, "", null , 0, false), - PassengerMetro3000Tail(EntityPassengerMetro3000Tail.class, new ModelMetroMadrid3000Loco(), "MM3000_", true, new float[] {0F, 0.2F, 0F}, new float[] {0F,0F,180F}, null, "", 0, null, "", null , 0, false), - CQ310(EntityElectricCQ310Loco.class, new Modelcq310loco(), "CQ_310_", true, new float[] {-1.5F, 0.2F, 0F}, new float[] {0F,180F,180F}, null, "", 0, null, "", null , 0, false), - CQ310Passenger(EntityPassengerCQ310Passenger.class, new Modelcq310loco(), "CQ_310_", true, new float[] {0F, 0.2F, 0F}, new float[] {0F,0F,180F}, null, "", 0, null, "", null , 0, false), - Class162Engine( EntityElectricClass162.class, new ModelClass162Engine(),"Class_162_engine_", true, new float[] {-2F, 0.155F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class162CoachB( EntityPassengerClass162CoachB.class, new ModelClass162CoachB(),"Class_162_Coach_B_", true, new float[] {0F, 0.155F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class162CoachA( EntityPassengerClass162CoachA.class, new ModelClass162CoachA(),"Class_162_Coach_A_", true, new float[] {0F, 0.155F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class162Tail(EntityPassengerClass162Tail.class, new ModelClass162Engine(), "Class_162_engine_", true, new float[] {0F, 0.155F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class34(EntityLocoDieselClass34.class, new ModelClass34(), "class_34_", true, new float[] {-2.75F, 0.17F, 0F}, new float[] {0F,180F,180F}, null, "smoke", 3, new ArrayList() {{}}, "", null, 0, false), - tankerUK(EntityTankerUK.class, new ModelTankerUK(), "Tanker_UK_", true, new float[] {0F,0.155F,0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - MetalTram(EntityLocoElectricMetalTram.class, new ModelMetalTram(), "Metal_Tram_", true, new float[]{ -1F, 0.18F, 0.0F}, new float[]{ 0.0F, 180F, 180F} , null, "", 0, null, "", null, 0 , false ), - MetalTramCoach(EntityPassengerMetalTramCoach.class, new ModelMetalTramCoach(), "Metal_Tram_", true, new float[]{ 0.0F, 0.18F, 0.0F}, new float[]{ 0.0F, 180F, 180F} , null, "", 0, null, "", null, 0 , false ), - HopperUK(EntityFreightHopperUK.class, new ModelHopper_UK(), "Hopper_UK_", true, new float[] {0F,0.1F,0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - B80C_A(EntityElectricB80C_A.class, new ModelB80C_A(), "B80C_", true,new float[] {-1.25F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - B80C_B( EntityPassengerB80C_B.class, new ModelB80C_B(),"B80C_", true, new float[] {-1.25F, 0.15F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - WoodenTramCoach(EntityPassengerWoodenTramCoach.class, new ModelWoodenTramCoach(), "Wooden_Tram_Coach_", true, new float[]{ 0.0F, 0.18F, 0.0F}, new float[]{ 0.0F, 180F, 180F} , null, "", 0, null, "", null, 0 , false ), - MA100_Loco(EntityElectricMA100_Loco.class, new ModelMA100_Loco(), "MA100_", true,new float[] {-0.95F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - MA100_Tail(EntityPassengerMA100_Tail.class, new ModelMA100_Tail(), "MA100_",true,new float[] {0F, 0.16F, 0F}, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - ExpressFreightVan(EntityFreightExpressFreightVan.class, new ModelExpressFreightVan(), "Express_Freight_Van_", true, new float[] {0F,0.1F,0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class390Front( EntityElectricClass390.class, new ModelClass390Front(),"Class_390_Front_", true, new float[] {-2.3F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class390Coach( EntityPassengerClass390Coach.class, new ModelClass390Coach(),"Class_390_Coach_", true, new float[] {0F, 0.F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class390Panto( EntityPassengerClass390Panto.class, new ModelClass390Panto(),"Class_390_Panto_", true, new float[] {0F, 0.F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class121Bubblecar( EntityLocoDieselClass121.class, new ModelClass121(), "bubble_car_", true, new float[] {-2.1F, 0.17F, 0F}, new float[] {0F, 180F, 180F }, null, "smoke", 3, new ArrayList() {{}}, "", null, 0, false), - Class121Trailer( EntityPassengerClass121Trailer.class, new ModelClass121Trailer(),"bubble_car_", true, new float[] {0F, 0.17F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class117( EntityLocoDieselClass117.class, new ModelClass117(), "bubble_car_", true, new float[] {-2.1F, 0.17F, 0F}, new float[] {0F, 180F, 180F }, null, "smoke", 3, new ArrayList() {{}}, "", null, 0, false), - Class117Middle( EntityPassengerClass117Middle.class, new ModelClass117Middle(),"bubble_car_", true, new float[] {0F, 0.17F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - TipperUK(EntityFreightTipperUK.class, new ModelTipperUK(), "tipper_", true, new float[] {0F,0.1F,0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - ShuntingTenderUK(EntityTenderShuntingTenderUK.class, new ModelShuntingTenderUK(), "shunting_tender_", true, new float[] {0f, 0.15f, 0f}, new float[] {0f, 180f, 180f}, null, "", 0, null, "", null, 0, false ), - BRBrakeVan(EntityCabooseBRBrakeVan.class, new ModelBRBrakeVan(), "br_brake_van_", true, new float[] {0F,0.1F,0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - - //TCCE7 - DuewagT4ER(EntityElectricDuewagT4ER.class, new ModelDuewagT4ER(), "Duewag_T4_", true,new float[] {-1.25F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DuewagGT6ZRLoco(EntityElectricDuewagGT6ZRLoco.class, new ModelDuewagGT6ZRLoco(), "Duewag_GT6_", true,new float[] {-0.85F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DuewagGT6ZTail(EntityPassengerDuewagGT6ZRTail.class, new ModelDuewagGT6ZRTail(), "Duewag_GT6_", true,new float[] {-0.85F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - M8CLoco(EntityElectricM8CLoco.class, new ModelM8CLoco(), "M8C_", true,new float[] {-1F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - M8CTail(EntityPassengerM8CTail.class, new ModelM8CTail(), "M8C_", true,new float[] {-1F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class416Loco(EntityElectricClass416Loco.class, new ModelClass416Engine(), "Class_205_", true, new float[] {-2F, 0.15F, 0F}, new float[] {0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), - Class416Tail(EntityPassengerClass416Tail.class, new ModelClass416Tail(), "Class_205_", true, new float[] {0f, 0.15f, 0f}, new float[] {0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), - DB420Loco(EntityElectricDB420Loco.class, new ModelDB420End(), "db420_", true,new float[] {-1.5F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DB420Middle(EntityPassengerDB420Middle.class, new ModelDB420Middle(), "db420_",true,new float[] {0F, 0.16F, 0F}, new float[] { 0F, 0F, 180F }, null, "", 0, null, "", null, 0, false), - DB420Tail(EntityPassengerDB420Tail.class, new ModelDB420End(), "db420_",true,new float[] {-1.5F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - CattleVan(EntityCattleVan.class, new ModelCattleVan(), "cattle_van", false, new float[] { 0F, 0.15F, 0.0F }, new float[]{0F,0F,180F}, null, "", 0, null, "", null, 0, false), - Class401Loco(EntityLocoElectricClass401.class, new ModelClass401Engine(), "2-bil_", true, new float[] {-1.7F, 0.17F, 0F}, new float[] {0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), - Class401Tail(EntityPassengerClass401Tail.class, new ModelClass401tail(), "2-bil_", true, new float[] {0.02F, 0.17F, 0.03F}, new float[] {0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), - passenger10tonBrakeVan(EntityPassenger10tonBrakeVan.class, new Model10tonBrakeVan(), "10ton_brakevan_", true, new float[] { 0F, 0.15F, 0.0F }, new float[]{0F,0F,180F}, null, "", 0, null, "", null, 0, false), - BR_MK2C_Coach( EntityPassengerBR_MK2C_Coach.class, new ModelBR_MK2C_Coach(), "BR_Mk2c_", true, new float[] {0.485F,0F,0F}, new float[] {0F, 180F, 180F}, null, "",0,null, "", null, 0, false), - BR_MK2C_BSO(EntityPassengerBR_MK2C_BSO.class, new ModelBR_MK2C_BSO(), "BR_Mk2c_BSO_", true, new float[] {0.485F,0F,0F}, new float[] {0F, 180F, 180F}, null, "", 0 , null, "", null, 0, false), - Class230Engine(EntityElectricClass230.class, new ModelClass230(), "Class_230_", true,new float[] {-1.3F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class230Middle(EntityClass230Middle.class, new ModelClass230Middle(), "Class_230_",true,new float[] {0F, 0.16F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DuewagGT6ERLoco(EntityElectricDuewagGT6ERLoco.class, new ModelDuewagGT6ERLoco(), "Duewag_GT6ER_", true,new float[] {-0.85F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - DuewagGT6ERTail(EntityPassengerDuewagGT6ERTail.class, new ModelDuewagGT6ERTail(), "Duewag_GT6ER_", true,new float[] {-0.85F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Mineralwagon(EntityFreightMineralwagon.class, new ModelMineralwagon(), "Mineral_wagon_", true, new float[] {0f, 0.15f, 0f}, new float[] {0f, 180f, 180f}, null, "", 0, null, "", null, 0, false ), - VentilatedVan(EntityFreightVentilatedVan.class, new ModelVentilatedVan(), "Ventilated_van_", true, new float[] {0f, 0.15f, 0f}, new float[] {0f, 180f, 180f}, null, "", 0, null, "", null, 0, false ), - Class143Rear(EntityPassengerClass143.class, new ModelClass143(), "Class143_",true,new float[] {0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class143Middle(EntityPassengerClass143M.class, new ModelClass144(), "Class143_",true,new float[] {0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - Class374Front( EntityElectricClass374.class, new ModelClass374Front(),"Class_374_Front_", true, new float[] {-2.6F, 0.162F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class374PremierPanto( EntityPassengerClass374PremierPanto.class, new ModelClass374PremierPanto(),"Class_374_Premier_Panto_", true, new float[] {0F, 0.162F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class374StandardPanto( EntityPassengerClass374StandardPanto.class, new ModelClass374StandardPanto(),"Class_374_Standard_Panto_", true, new float[] {0F, 0.162F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class374Buffet( EntityPassengerClass374Buffet.class, new ModelClass374Buffet(),"Class_374_Buffet_", true, new float[] {0F, 0.162F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class387Front( EntityElectricClass387Front.class, new ModelClass387Front(),"Class_387_", true, new float[] {-2F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class387Coach( EntityPassengerClass387Coach.class, new ModelClass387Coach(),"Class_387_Middle_", true, new float[] {0F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class387Panto( EntityPassengerClass387Panto.class, new ModelClass387Panto(),"Class_387_Middle_", true, new float[] {0F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class387Tail( EntityPassengerClass387Tail.class, new ModelClass387Front(),"Class_387_", true, new float[] {0F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class378Front( EntityElectricClass378Front.class, new ModelClass378Front(),"Class_378_", true, new float[] {-1.9F, 0.2F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class378Middle( EntityPassengerClass378Middle.class, new ModelClass378Middle(),"Class_378_Middle_", true, new float[] {0F, 0.2F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class378Tail( EntityPassengerClass378Tail.class, new ModelClass378Front(),"Class_378_", true, new float[] {0F, 0.2F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class142Front( EntityLocoDieselClass142.class, new ModelClass142(),"Class_142_", true, new float[] {-1.8F, 0.2F, 0F}, new float[] { 0F, 180F, 180F },null, "smoke", 2, new ArrayList() {{}}, "", null, 0, false), - Class142Tail( EntityPassengerClass142Tail.class, new ModelClass142(),"Class_142_", true, new float[] {-0.53F, 0.2F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Bagnall( EntityLocoDieselBagnall.class, new ModelBagnall(),"Bagnall_Shunter_0-4-0_", true, new float[] {-0.85F, 0.18F, 0F}, new float[] { 0F, 180F, 180F },null, "smoke", 2, new ArrayList() {{}}, "", null, 0, false), - Class389Front( EntityElectricClass389Front.class, new ModelClass389Front(),"Class_389_", true, new float[] {-2.4F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class389Middle( EntityPassengerClass389Middle.class, new ModelClass389Middle(),"Class_389_Middle_", true, new float[] {-0.31F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class389Tail( EntityPassengerClass389Tail.class, new ModelClass389Front(),"Class_389_", true, new float[] {-0.31F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class442DTS( EntityElectricClass442DTS.class, new ModelClass442DTS(),"class_442_DTS_", true, new float[] {-2F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class442TS( EntityPassengerClass442TS.class, new ModelClass442TS(),"class_442_TS_", true, new float[] {0.15F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class442MBLS( EntityPassengerClass442MBLS.class, new ModelClass442MBLS(),"class_442_MBLS_", true, new float[] {0.15F, 0F, 0F}, new float[] { 0F, 180F, 180F },null, "", 0, null, "", null, 0, false), - Class205loco( EntityLocoDieselClass205loco.class, new ModelClass205(), "Class_205_", true, new float[] {-2F, 0.15F, 0F}, new float[] {0F, 180F, 180F}, null, "smoke", 3, new ArrayList() {{}}, "", null, 0, false), - Class205tso( EntityPassengerClass205tso.class, new ModelClass205tso(), "Class_205_", true, new float[] {0f, 0.15f, 0f}, new float[] {0F, 180F, 180F}, null, "", 0,null, "", null, 0, false), - Class205tail( EntityPassengerClass205tail.class, new ModelClass205tail(), "Class_205_", true, new float[] {0f, 0.15f, 0f}, new float[] {0F, 180F, 180F}, null, "", 0,null, "", null, 0, false), - M8DNF1Loco(EntityElectricM8DNF1Loco.class, new ModelM8DNF1End(), "m8d_nf1_", true,new float[] {-0.65F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - M8DNF1Middlelong(EntityPassengerM8DNF1MiddleLong.class, new ModelM8DNF1Middle1(), "m8d_nf1_", true,new float[] {0F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - M8DNF1Middleshort(EntityPassengerM8DNF1MiddleShort.class, new ModelM8DNF1Middle2(), "m8d_nf1_", true,new float[] {0F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - M8DNF1Tail(EntityPassengerM8DNF1Tail.class, new ModelM8DNF1End(), "m8d_nf1_", true,new float[] {-0.65F, 0.2F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), - ; - - private Class entityClass; - private ModelBase model; - private String texture; - private boolean multiTexture; - private float[] trans; - private float[] rotate; - private float[] scale; - private String smokeType; - private ArrayList smokeFX; - private String explosionType; - private ArrayList explosionFX; - private int smokeIterations; - private int explosionFXIterations; - private boolean hasSmokeOnSlopes; - - /** - * Defines the render @param for a RollingStock - * - * @param model ModelBase - * @param texture String - * @param multiTexture boolean - * @param trans float[] - * @param rotate float[] - * @param scale float[] - * @param smokeType String - * @param smokeFX ArrayList - * @param explosionType String - * @param explosionFX ArrayList - * @see RenderRollingStock - */ - RenderEnum(Class entityClass, ModelBase model, String texture, boolean multiTexture, float[] trans, float[] rotate, float[] scale, String smokeType, int smokeIterations, ArrayList smokeFX, String explosionType, ArrayList explosionFX, int explosionFXIterations, boolean hasSmokeOnSlopes) { - this.entityClass = entityClass; - this.model = model; - this.texture = texture; - this.multiTexture = multiTexture; - this.trans = trans; - this.rotate = rotate; - this.scale = scale; - this.smokeType = smokeType; - this.smokeFX = smokeFX; - this.explosionType = explosionType; - this.explosionFX = explosionFX; - this.smokeIterations = smokeIterations; - this.explosionFXIterations = explosionFXIterations; - this.hasSmokeOnSlopes = hasSmokeOnSlopes; - } - @Override - public Class getEntityClass() { - return entityClass; - } - - @Override - public ModelBase getModel() { - return model; - } - - public boolean getIsMultiTextured() { - return multiTexture; - } - - @Override - public boolean hasSmoke() { - return smokeType.length() > 0; - } - - @Override - public boolean hasSmokeOnSlopes() { - return hasSmokeOnSlopes; - } - - @Override - public String getSmokeType() { - return smokeType; - } - - @Override - public ArrayList getSmokeFX() { - return smokeFX; - } - - @Override - public String getExplosionType() { - return explosionType; - } - - @Override - public boolean hasExplosion() { - return explosionType.length() > 0; - } - - @Override - public ArrayList getExplosionFX() { - return explosionFX; - } - - @Override - public float[] getTrans() { - return trans; - } - - @Override - public float[] getRotate() { - return rotate; - } - - @Override - public float[] getScale() { - return scale; - } - - @Override - public ResourceLocation getTextureFile(String colorString) { - if (multiTexture) { - return new ResourceLocation(Info.resourceLocation, Info.trainsPrefix + texture + colorString + ".png"); - } else { - return new ResourceLocation(Info.resourceLocation, Info.trainsPrefix + texture + ".png"); - } - } - - @Override - public int getSmokeIterations() { - return smokeIterations; - } - - @Override - public int getExplosionFXIterations() { - return explosionFXIterations; - } + /** + * Tanks + **/ + tankWagon_DB(EntityTankWagon_DB.class, new ModelTankWagon_DB(), "tankWagon_DB_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tankWagonUS(EntityTankWagonUS.class, new ModelTankWagonUS(), "tankWagonUS_", true, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tankWagonGrey(EntityTankWagon2.class, new ModelTankWagon2(), "tankwagon2", false, new float[]{0.0F, -0.32F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tankCartLava(EntityTankLava.class, new ModelWatertransp(), "lavacar_", true, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tankWagonYellow(EntityTankWagon.class, new ModelTankWagon(), "tankwagon", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tankWagonThreeDome(EntityTankWagonThreeDome.class, new ModelTankWagonThreeDome(), "tanker_three_dome_", true, new float[]{0.0F, 0.17F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + + /** + * Tenders + */ + tenderSmall(EntityTenderSmall.class, new ModelTender(), "tender2_", true, new float[]{0.0F, -0.5F, 0.0F}, new float[]{0F, 90F, 0F}, new float[]{0.75F, 0.75F, 0.75F}, "", 0, null, "", null, 0, false), + tenderHeavy(EntityTenderHeavy.class, new ModelTenderHeavy(), "heavytender_", true, new float[]{0.0F, -0.4F, 0.0F}, new float[]{0F, 180F, 0F}, null, "", 0, null, "", null, 0, false), + tender4_4_0(EntityTender4_4_0.class, new ModelNormalSteamTender(), "4-4-0-loco_tender_", true, new float[]{0.0F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "", 0, null, "", null, 0, false), + tenderBR01(EntityTenderBR01_DB.class, new ModelTenderBR01_DB(), "tenderBR01_DB", false, new float[]{0.0F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tenderEr_Ussr(EntityTenderEr_Ussr.class, new ModelTenderEr_Ussr(), "tenderEr_Ussr", false, new float[]{0.06F, -0.44F, 0.0F}, new float[]{0F, 180F, 0F}, null, "", 0, null, "", null, 0, false), + tenderC62Class(EntityTenderC62Class.class, new ModelC62Tender(), "c62_tender_", true, + new float[]{0.0F, -0.42F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + tenderD51(EntityTenderD51.class, new ModelD51Tender(), "d51_tender", false, + new float[]{-3.0F, 0.35F, 0.0F}, new float[]{0, 180f, 180f}, null, "", 0, null, "", null, 0, false), + tenderAdler(EntityTenderAdler.class, new ModelTenderAdler(), "tender_adler", false, new float[]{0.0F, 1.05F, 0.0F}, new float[]{180F, -90F, 0F}, null, "", 0, null, "", null, 0, false), + tenderGS4(EntityTenderGS4.class, new ModelGS4Tender(), "GS4_tender_", true, new float[]{0.0F, 0.15F, -0.05F}, + new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + Model4000GallonTender(EntityTender4000.class, new Model4000GallonTender(), "GWR_Tender_", true, new float[]{-4.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + ModelFowler4FTender(EntityTenderFowler4F.class, new ModelFowler4FTender(), "Fowler_4F_Tender", false, new float[]{-5.25F, -0.51585F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + tenderCoranationClass(EntityTenderCoranationClass.class, new ModelCoranationClassTender(), "CoranationClassTender", false, new float[]{0.0F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + tenderBerk1225(EntityTenderBerk1225.class, new Model1225Tender(), "Berkshire_tender_", true, new float[]{2.75F, -0.65F, 0.0625F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + tenderC41(EntityTender_C41.class, new ModelTenderC41(), "C41Tender", false, new float[]{0.1F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + tenderSouthern1102(EntityTender_Southern1102.class, new ModelSouthern1102Tender(), "Southern1102Tender", false, new float[]{-5.25F, -0.5F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + tenderMILW(EntityTenderMILW.class, new ModelMILWTender(), "milw_tender", false, new float[]{0.15F, 0.055F, 0.025F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "", 0, null, "", null, 0, false), + + /** + * Diesel + */ + locoKOF(EntityLocoDieselKof_DB.class, new ModelKof(), "locoKof_DB_", true, new float[]{-1.0F, -0.44F, 0.0F}, null, null, "smoke", 2, new ArrayList() { + { + add(new double[]{0.9D, 1.1D, 0.0D}); + } + }, "", null, 0, true), + locoGP40(EntityLocoDieselCD742.class, new ModelGP40(), "cd742_", true, new float[]{-0.8F, 0.75F, 0.0F}, new float[]{180F, 180F, 0F}, new float[]{0.8F, 0.8F, 0.8F}, "smoke", 5, new ArrayList() { + { + add(new double[]{1.25D, 1.15D, 0.0D}); + } + }, "", null, 0, false), + locoCD754(EntityLocoDieselCD754.class, new ModelCD754(), "cd754_", true, new float[]{-2.5F, 0.2F, 0.0F}, new float[]{180F, 0F, 0F}, new float[]{1F, 1F, 1F}, "smoke", 5, new ArrayList() { + { + add(new double[]{1.25D, 1.15D, 0.0D}); + } + }, "", null, 0, false), + locoChME3(EntityLocoDieselChME3.class, new ModelChME3(), "chme3", false, new float[]{-0.5F, -0.47F, 0.0F}, null, null, "smoke", 4, new ArrayList() { + { + add(new double[]{0.6D, 1.55D, 0.0D}); + } + }, "", null, 0, false), + + Class143Front(EntityLocoDieselClass143.class, new ModelClass143(), "Class143_", true, new float[]{-1f, 0.15f, 0f}, new float[]{0f, 180f, 180f}, null, "smoke", 1, new ArrayList() { + { + add(new double[]{-0.8D, 1.25D, 0.4D}); + } + }, "", null, 0, false), + + + locoGP7Red(EntityLocoDieselGP7Red.class, new ModelGP7(), "gp7_", true, new float[]{-0.8F, -0.47F, 0.0F}, new float[]{0F, 180F, 0F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{-0.2D, 1.3D, 0.0D}); + add(new double[]{0.45D, 1.3D, 0.0D}); + } + }, "", null, 0, false), + loco44tonner(EntityLocoDiesel44TonSwitcher.class, new ModelLoco44TonSwitcher(), "loco_44tonswitcher_", true, new float[]{-2.75F, -0.425F, 0.0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{0.6D, 1.55D, 0.0D}); + add(new double[]{2D, 1.55D, 0.0D}); + } + }, "", null, 0, false), + locoSD40(EntityLocoDieselSD40.class, new ModelSD40(), "locoSD40_", true, new float[]{-1.2F, -0.47F, 0.0F}, new float[]{180F, 90F, 0F}, new float[]{-1F, -1F, 1F}, "smoke", 5, new ArrayList() { + { + add(new double[]{1.45D, 1.45D, 0.0D}); + } + }, "", null, 0, false), + locoSD70(EntityLocoDieselSD70.class, new ModelSD70(), "locoSD70_", true, new float[]{-1.2F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{0.4D, 1.3D, 0.0D}); + } + }, "", null, 0, false), + + locoShunter(EntityLocoDieselShunter.class, new ModelShunter(), "shunter_", true, new float[]{-1.2F, -0.451F, 0.0F}, null, null, "smoke", 5, new ArrayList() { + { + add(new double[]{2.4D, 1.5D, -0.1D}); + add(new double[]{2.4D, 1.5D, 0.1D}); + } + }, "", null, 0, true), + locoWLs40(EntityLocoDieselWLs40.class, new ModelWLs40(), "wls40", false, new float[]{0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{3.0D, 1.4D, 0.0D}); + } + }, "", null, 0, true), + locoV60_DB(EntityLocoDieselV60_DB.class, new ModelV60(), "locoV60_DB_", true, new float[]{-0.75F, -0.44F, 0.0F}, null, null, "smoke", 4, new ArrayList() { + { + add(new double[]{0.75D, 1.7D, 0.0D}); + } + }, "", null, 0, false), + locoMILW_H1044(EntityLocoDieselMILW_H1044.class, new ModelMILW_H1044(), "MILW_H1044_", true, new float[]{0, 0.06f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "largesmoke", 4, new ArrayList() { + { + add(new double[]{3.7D, 1.7D, 0D}); + } + }, "", null, 0, false), + locoEMDF7(EntityLocoDieselEMDF7.class, new ModelEMDF7(), "emdf7_", true, new float[]{-2.2f, 0.1f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 4, new ArrayList() { + { + add(new double[]{-0.15D, 1.6D, 0.0D}); + add(new double[]{0.5D, 1.6D, 0.0D}); + } + }, "", null, 0, false), + locoEMDF3(EntityLocoDieselEMDF3.class, new ModelEMDF3(), "emdf3_", true, new float[]{-2.2f, 0.1f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 4, new ArrayList() { + { + add(new double[]{-0.15D, 1.6D, 0.0D}); + add(new double[]{0.55D, 1.6D, 0.0D}); + } + }, "", null, 0, false), + locoEMDF7b(EntityBUnitEMDF7.class, new ModelEMDF7B(), "emdf7b_", true, new float[]{0, 0.1f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 4, null, "", null, 0, false), + locoEMDF3b(EntityBUnitEMDF3.class, new ModelEMDF3B(), "emdf3b_", true, new float[]{0, 0.1f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 4, null, "", null, 0, false), + DD35b(EntityBUnitDD35.class, new ModelDD35B(), "dd35b_", true, new float[]{0, 0.18f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + locoDieselDD35A(EntityLocoDieselDD35A.class, new ModelDD35A(), "dd35a_", true, new float[]{-5, 0.18f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 4, new ArrayList() { + { + add(new double[]{3.9D, 1.6D, 0.0D}); + + add(new double[]{-0.4D, 1.6D, 0.0D}); + } + }, "", null, 0, false), + locoBamboo(EntityLocoDieselBamboo.class, new ModelBambooTrainEngine(), "loco_bamboo_", true, new float[]{-1.0F, 0F, 0.0F}, new float[]{180, 180, 0}, null, "smoke", 2, new ArrayList() { + { + add(new double[]{-0.05D, -0.05D, 0.0D}); + } + }, "", null, 0, true), + /** + * Electric + */ + locoE10DB(EntityLocoElectricE10_DB.class, new ModelE10DB(), "locoe10_db_", true, new float[]{-1.7F, 0.05F, 0.0F}, new float[]{0F, 0F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "", 0, null, "", null, 0, false), + locoCD151(EntityLocoElectricCD151.class, new ModelLocoCD151(), "CD151_", true, new float[]{-2, 0.18f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + locoE103(EntityLocoElectricE103.class, new ModelE103(), "E103_", true, new float[]{-2, 0.05f, 0}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "", 0, null, "", null, 0, false), + locoVL10(EntityLocoElectricVL10.class, new ModelVL10(), "vl10", false, new float[]{-1.2F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoBR_E69(EntityLocoElectricBR_E69.class, new ModelBR_E69(), "locoBR_E69_", true, new float[]{0.0F, -0.42F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoMineTrain(EntityLocoElectricMinetrain.class, new ModelLocoMinetrain(), "locoMinetrain", false, new float[]{-0.8F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoSpeedZeroED(EntityLocoElectricHighSpeedZeroED.class, new ModelLocoHighSpeedZeroED(), "locoHighSpeedZeroED", false, new float[]{-1.7F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoICE1(EntityLocoElectricICE1.class, new ModelICE1(), "ICE1_Engine_", true, new float[]{0.0F, 0.18F, 0.1F}, new float[]{0F, 180F, 180F}, new float[]{0.8f, 1f, 0.8f}, "", 0, null, "", null, 0, false), + //locoSpeedGrey(EntityNewHighSpeedLoco.class, new ModelNewHighSpeedLoco(), "newhighspeedloco", false, new float[] { -0.05F, -0.5F, 0.0F }, new float[] { 0F, 90F, 0F }, new float[] { 0.8F, 0.8F, 0.8F }, "", 0, null, "", null, 0), + locoTramYellow(EntityLocoElectricTramWood.class, new ModelTram(), "tram", false, new float[]{-0.8F, -0.44F, 0F}, new float[]{0F, 180F, 0F}, null, "", 0, null, "", null, 0, false), + locoTramNY(EntityLocoElectricTramNY.class, new ModelTramNY(), "locoTramNY", false, new float[]{-1.5F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + + passengerC4FG(PassengerIC4_DSB_FG.class, new ModelLocoDieselIC4_DSB_FG(), "IC4_DSB_FG", false, new float[]{-0.8F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + passengerC4FH(PassengerIC4_DSB_FH.class, new ModelLocoDieselIC4_DSB_FH(), "IC4_DSB_FH", false, new float[]{-0.8F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoIC4MG(EntityLocoDieselIC4_DSB_MG.class, new ModelLocoDieselIC4_DSB_MG(), "IC4_DSB_MG_", true, new float[]{-0.8F, -0.44F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoBR185(EntityLocoElectricBR185.class, new BR185_EngineModel(), "BR185_Engine_", true, new float[]{-2.0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + locoClass85(EntityLocoElectricClass85.class, new ModelClass85(), "Class85_", true, new float[]{-3.0F, 0.65F, 0.0F}, new float[]{0F, 90F, 180F}, null, "", 0, null, "", null, 0, false), + locoBP4(EntityLocoElectricBP4.class, new ModelBP4(), "bp4_", true, new float[]{-2.2F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerBNLRV_B(EntityPassengerBNLRV_B.class, new ModelBNLRV_B(), "bnlrv_", true, new float[]{0.0f, 0.10f, 0.0f}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + locoBNLRV_A(EntityLocoElectricBNLRV_A.class, new ModelBNLRV_A(), "bnlrv_", true, new float[]{-2f, 0.10f, 0.0f}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + + locoDeltic(EntityLocoDieselDeltic.class, new ModelDeltic(), "Deltic", false, new float[]{-2.25F, 0.8F, 0.0F}, new float[]{0F, 90F, 180F}, null, "largesmoke", 1, new ArrayList() { + { + add(new double[]{2.3D, 1.6D, 0D}); + } + }, "", null, 0, false), + locoEWSClass66(EntityLocoDieselClass66.class, new ModelEWSClass66(), "Class66_", true, new float[]{-3.0F, 0.65F, 0.0F}, new float[]{0F, 90F, 180F}, null, "largesmoke", 2, new ArrayList() { + { + add(new double[]{0.9D, 1.4D, 0.0D}); + } + }, "", null, 0, false), + locoFOL_M1(EntityLocoDieselFOLM1.class, new ModelFOL_M1(), "FOL_M1_", true, new float[]{-2.8F, 0.05F, 0.9F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{1.3D, 1.45D, 0.0D}); + } + }, "", null, 0, false), + FOLM1B(EntityLocoDieselFOLM1B.class, new ModelFOLM1B(), "FOL_M1b_", true, new float[]{-2.2F, 0.05F, 0.F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{1.6D, 1.45D, 0.0D}); + } + }, "", null, 0, false), + /** + * Steam + */ + locoCherepanov(EntityLocoSteamCherepanov.class, new ModelLocoCherepanov(), "locoCherepanov", false, new float[]{-0.875F, -0.47F, 0.0F}, new float[]{0, 180, 0}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{1.5D, 2.1D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{0.875D, 0.2D, 0.2D}); + } + }, 2, true), + locoPannier(EntityLocoSteamPannier.class, new ModelLocoPannier(), "locoPannier", false, new float[]{0.15F, 0.2F, 0.0F}, new float[]{0, 180, 180}, new float[]{0.9f, 0.9f, 0.9f}, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.4D, 1.8D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.575D, 0.05D, 0.65D}); + } + }, 2, true), + locoC41(EntityLocoSteamC41.class, new ModelLocoC41(), "locoC41", false, new float[]{-3.5F, -0.5F, 0.0F}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.55D, 1.65D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + + locoBR_Black_5(EntityLocoSteamBR_Black_5.class, new ModelBR_Black_5(), "BR_Black_5_", true, new float[]{-1.75f, 0f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.1D, 1.35D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{3.25D, 0D, 0.65D}); + } + }, 2, true), + + locoRW_Type_3(EntityLocoSteamRWType3.class, new ModelRW_Type_3(), "RW_Type_3_", true, new float[]{-1.25f, 0.17f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.4D, 1.55D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + + locoRW_Type_2(EntityLocoSteamRWType2.class, new ModelRW_Type_2(), "Type_2_", true, new float[]{-1.25f, 0.17f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.2D, 1.55D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.6D, 0.05D, 0.65D}); + } + }, 2, true), + + + locoGWR_101_Class(EntityLocoSteamGWR101Class.class, new ModelGWR101Class(), "Gwr_101_", true, new float[]{-1.25f, 0.17f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.6D, 1.55D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{3D, 0.05D, 0.65D}); + } + }, 2, true), + + + locoGWR_42xx(EntityLocoSteamGWR42xx.class, new ModelGWR42xx(), "2-8-0_", true, new float[]{-2.1f, 0.17f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{4.1D, 1.6D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.3D, 0.05D, 0.65D}); + } + }, 2, true), + + locoGWR_72xx(EntityLocoSteamGWR72xx.class, new ModelGWR72xx(), "72xx_", true, new float[]{-2.5f, 0.17f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{4.8D, 1.6D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{5.0D, 0.05D, 0.65D}); + } + }, 2, true), + + locoWWCP_Class_062T(EntityLocoSteamWWCPClass062T.class, new ModelWWCPClass062T(), "WWCP_Standard_0-6-2T_", true, new float[]{-2.5f, 0.17f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{4.3D, 1.6D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.6D, 0.05D, 0.65D}); + } + }, 2, true), + + locoBR_Britannia_Class(EntityLocoSteamBR_Britannia_Class.class, new ModelBR_Britannia_Class(), "BR_Britannia_", true, new float[]{-2.3f, -0.05f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.78D, 1.4D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.1D, 0.05D, 0.65D}); + } + }, 2, true), + + locoJ50(EntityLocoSteamJ50.class, new ModelJ50(), "J50_", true, new float[]{-1.25f, 0.15f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.7D, 1.5D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.8D, 0.05D, 0.65D}); + } + }, 2, true), + + locoSentinelY3(EntityLocoSteamSentinelY3.class, new ModelSentinelY3(), "Sentinel_Y3_", true, new float[]{-0.5f, 0.15f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 2, new ArrayList() { + { + add(new double[]{-0.5D, 1.5D, 0D}); + } + }, "explode", new ArrayList() { + { + + } + }, 2, true), + + locoJacknail(EntitylocoSteamJacknail.class, new ModelMWClass88BTE(), "0-8-0_box_tank_", true, new float[]{-1.25f, 0.15f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 2, new ArrayList() { + { + add(new double[]{2.5D, 1.5D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.5D, 0.05D, 0.65D}); + } + }, 2, true), + + locoC41_080(EntityLocoSteamC41_080.class, new ModelC41_080(), "locoC41_080", false, new float[]{-3.5F, -0.5F, 0.0F}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.55D, 1.65D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + locoAlcoSC4(EntityLocoSteamAlcoSC4.class, new ModelAlcoSC4(), "AlcoSC4", false, new float[]{-3.5F, -0.5F, 0.0F}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.55D, 1.65D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + locoC41T(EntityLocoSteamC41T.class, new ModelLocoC41T(), "locoC41t", false, new float[]{-3.5F, -0.5F, 0.0F}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.55D, 1.65D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + locoSouthern1102(EntityLocoSteamSouthern1102.class, new ModelSouthern1102(), "Southern1102", false, new float[]{-3.5F, -0.5F, 0.0F}, new float[]{0, 180, 180}, new float[]{1f, 1f, 1f}, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.55D, 1.65D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + locoUSATCUS(EntityLocoSteamUSATCUS.class, new ModelUSATCUS(), "USATCUS", false, new float[]{-2.0F, -0.2F, 0.8375F}, new float[]{0, 180, 180}, new float[]{1f, 1f, 1f}, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.5D, 1.2D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.5D, -0.5D, 0.65D}); + } + }, 2, true), + locoUSATCUK(EntityLocoSteamUSATCUK.class, new ModelUSATCUK(), "USATCUK", false, new float[]{-2.0F, -0.2F, 0.8375F}, new float[]{0, 180, 180}, new float[]{1f, 1f, 1f}, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.5D, 1.2D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.5D, -0.5D, 0.65D}); + } + }, 2, true), + locoCoranationClass(EntityLocoSteamCoranationClass.class, new ModelCoranationClass(), "CoranationClass", false, new float[]{-3.8F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{5.45D, 1.9D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.8D, 0.15D, 0.5D}); + } + }, 2, true), + locoBR80(EntityLocoSteamBR80_DB.class, new ModelLocoBR80_DB(), "locoBR80_DB_", true, new float[]{-0.75F, -0.44F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{1.8D, 1.75D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.6D, -0.4D, 0.8D}); + } + }, 4, true), + loco4_4_0(EntityLocoSteam4_4_0.class, new ModelLoco(), "4-4-0-loco_", true, new float[]{-0.66F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{1.6D, 2.05D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.56D, -0.2D, 0.8D}); + } + }, 4, true), + locoSteamSmall(EntityLocoSteamSmall.class, new ModelLoco3(), "loco3_", true, new float[]{-0.99F, -0.5F, 0.0F}, new float[]{0F, -90F, 0F}, new float[]{0.8F, 0.8F, 0.8F}, "smoke", 20, new ArrayList() { + { + add(new double[]{1.69D, 1.1D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.6D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamLSSP7(EntityLocoSteamLSSP7.class, new ModelLSSP7(), "LSSP7", false, new float[]{-1F, -0.2F, 0.8F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1F, 1F}, "smoke", 20, new ArrayList() { + { + add(new double[]{0.1D, 1.15D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{0.7D, -0.4D, 0.5D}); + add(new double[]{0.7D, -0.4D, -0.5D}); + } + }, 2, true), + locoHeavySteam(EntityLocoSteamHeavy.class, new ModelHeavySteamLoco(), "heavysteam_", true, new float[]{0F, -0.42F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.1D, 2D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{3D, -0.2D, 0.8D}); + } + }, 2, true), + locoSteamC62Class(EntityLocoSteamC62Class.class, new ModelC62Locomotive(), "c62_engine_", true, + new float[]{0F, -0.44F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{5.0D, 1.75D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{5.2D, -0.2D, 0.8D}); + } + }, 2, false), + locoSteamD51Short(EntityLocoSteamD51.class, new ModelD51ShortStreamlining(), "d51_short_", true, + new float[]{0F, -0.5F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{4.85D, 1.85D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.6D, -0.2D, 0.8D}); + } + }, 2, false), + locoSteamD51Long(EntityLocoSteamD51Long.class, new ModelD51LongStreamlining(), "d51_long_", true, + new float[]{0F, -0.5F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{4.85D, 1.85D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.6D, -0.2D, 0.8D}); + } + }, 2, false), + locoSteamBR01_DB(EntityLocoSteamBR01_DB.class, new ModelLocoBR01_DB(), "locoBR01_DB_", true, new float[]{-1.0F, -0.44F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.45D, 1.8D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{3.4D, -0.2D, 0.8D}); + } + }, 2, false), + locoSteamGS4(EntityLocoSteamGS4.class, new ModelGS4Loco(), "GS4_engine_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, new float[]{0.95f, 0.95f, 0.95f}, "largesmoke", 5, new ArrayList() { + { + add(new double[]{5.8D, 1.7D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{5.2D, -0.2D, 0.8D}); + } + }, 2, false), + locoSteamEr_USSR(EntityLocoSteamEr_Ussr.class, new ModelLocoEr_Ussr(), "locoEr_Ussr", false, new float[]{-0.75F, -0.44F, 0.0F}, null, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.45D, 1.9D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{3.4D, -0.2D, 0.8D}); + } + }, 2, false), + locoSteamForney(EntityLocoSteamForneyRed.class, new ModelLocoForney(), "locoForney_", true, new float[]{-1.3F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{2.2D, 1.9D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.2D, -0.2D, 0.8D}); + } + }, 2, true), + locoSteamMogul(EntityLocoSteamMogulBlue.class, new ModelLocoMogul(), "locoMogul_", true, new float[]{-0.6F, -0.44F, 0.0F}, new float[]{0F, 90F, 0F}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{1.55D, 1.95D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.45D, -0.2D, 0.8D}); + } + }, 2, true), + locoSteamShay(EntityLocoSteamShay.class, new ModelLocoSteamShay(), "locoShay", false, new float[]{-0.4F, -0.45F, -0.0F}, new float[]{0F, 180F, 0F}, null, "largesmoke", 20, new ArrayList() { + { + add(new double[]{1.8D, 1.7D, 0.2D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.6D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamVBShay(EntityLocoSteamVBShay.class, new ModelVBShay(), "vbshay", false, new float[]{0F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "largesmoke", 20, new ArrayList() { + { + add(new double[]{0.55D, 2.2D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.6D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamClimax(EntityLocoSteamClimax.class, new ModelLocoClimax(), "loco_climax", false, new float[]{0F, 0.18F, 0.0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "largesmoke", 20, new ArrayList() { + { + add(new double[]{2.05D, 1.9D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.6D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamAdler(EntityLocoSteamAdler.class, new ModelLocoSteamAdler(), "locoAdler", false, new float[]{-0.8F, 1.05F, 0F}, new float[]{180F, -90F, 0F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 20, new ArrayList() { + { + add(new double[]{1.6D, 1.3D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.5D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamAlice(EntityLocoSteamAlice0_4_0.class, new ModelLocoAlice040(), "0-4-0-loco-alice", false, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 20, new ArrayList() { + { + add(new double[]{2.2D, 1.6D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.8D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteam040VB(EntityLocoSteam040VB.class, new ModelVB040(), "loco040VB", false, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 20, new ArrayList() { + { + add(new double[]{0.6D, 1.75D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.8D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamGLYN(EntityLocoSteamGLYN042T.class, new Model042TGLYN(), "0-4-2-loco-glyn", false, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 20, new ArrayList() { + { + add(new double[]{2.15D, 1.75D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.8D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteam626T(EntityLocoSteam262T.class, new ModelT262(), "262t", false, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 20, new ArrayList() { + { + add(new double[]{2.65D, 1.7D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.8D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamA4Mallard(EntityLocoSteamMallardA4.class, new ModelA4Locomotive(), "locoA4_UK_", true, new float[]{-3.0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.975f, 0.975f, 0.975f}, "largesmoke", 20, new ArrayList() { + { + add(new double[]{4.8D, 1.95D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.9D, -0.4D, 0.8D}); + } + }, 2, true), + LocoSteamHallClass(EntityLocoSteamHallClass.class, new ModelHallClass(), "Hall_Class_Locomotive_", true, new float[]{-0.65F, 0.15F, -0.25F},/*position*/ new float[]{0F, 180F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + add(new double[]{4.25D, 1.55D, 0D});//smoke + } + }, "explode", new ArrayList() { + { + add(new double[]{4D, -0.4D, 0.8D});//steam + } + }, 2, true), + LocoSteamKingClass(EntityLocoSteamKingClass.class, new ModelKingClass(), "King_Class_Locomotive_", true, new float[]{-1.75F, 0.15F, 0.0F},/*position*/ new float[]{0F, 180F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + add(new double[]{4.8D, 1.6D, 0.0D});//smoke + } + }, "explode", new ArrayList() { + { + add(new double[]{3.6D, -0.4D, 0.8D});//steam + } + }, 2, true), + LocoSteamBerk1225(EntityLocoSteamBerk1225.class, new Model1225(), "Berk1225_Locomotive", false, new float[]{-2.0F, -0.65F, 0.0625F},/*position*/ new float[]{0F, 0F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + add(new double[]{4.65D, 1.7D, 0.0D});//smoke + } + }, "explode", new ArrayList() { + { + add(new double[]{4.2D, -0.4D, 0.8D});//steam + } + }, 2, true), + LocoSteamBerk765(EntityLocoSteamBerk765.class, new Model765(), "Berk765_Locomotive", false, new float[]{-2.0F, -0.65F, 0.0625F},/*position*/ new float[]{0F, 0F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + add(new double[]{4.65D, 1.7D, 0.0D});//smoke + } + }, "explode", new ArrayList() { + { + add(new double[]{4.2D, -0.4D, 0.8D});//steam + } + }, 2, true), + locoSteamMILWClassA(EntityLocoSteamMILWClassA.class, new ModelMILWClassA(), "locoMILW_ClassA", false, new float[]{0.0F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "largesmoke", 20, new ArrayList() { + { + add(new double[]{4.4D, 1.35D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{4.2D, -0.4D, 0.8D}); + } + }, 2, true), + locoSteamFowler(EntityLocoSteamFowler.class, new ModelFowler(), "loco_Fowler", false, new float[]{-3F, -0.51585F, 0.0F}, new float[]{0F, 180F, 180F}, new float[]{1f, 1f, 1f}, "largesmoke", 20, new ArrayList() { + { + add(new double[]{3.2D, 1.6D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2D, -0.4D, 0D}); + } + }, 2, true), + locoMRcompound(EntitylocoSteamMRCompound.class, new ModelMidlandcompound(), "LMS_4p_", true, new float[]{-1.95f, 0.1f, 0}, new float[]{0, 180, 180}, null, "largesmoke", 2, new ArrayList() { + { + add(new double[]{3.5D, 1.5D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{3.5D, 0.05D, 0.65D}); + } + }, 2, true), + + locoSteamA4Tender(EntityTenderA4.class, new ModelTenderA4(), "tenderA4_UK_", true, new float[]{-0.2F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LocoMRcompoundTender(EntityTenderMRCompound.class, new ModelMRCompoundTender(), "LMS_4p_", true, new float[]{0f, 0.15f, 0}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + LocoBR_Black_5_Tender(EntityTenderBR_Black_5.class, new ModelBR_Black_5_Tender(), "BR_Black_5_Tender_", true, new float[]{-0.05f, 0f, 0f,}, new float[]{0F, 180f, 180F}, null, "", 0, null, "", null, 0, false), + LocoBR1_Tender(EntityTenderBR1.class, new ModelBR1_Tender(), "BR1_Tender_", true, new float[]{0f, -0.01f, 0f,}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LocoRW_Type_2_Tender(EntityTenderRWType2.class, new ModelRW_Type_2_Tender(), "Type_2_", true, new float[]{0f, 0.16f, 0f,}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PropagandaUS(EntityPropagandaUS.class, new ModelPropagandaCar(), "propaganda_US_", true, new float[]{1.1F, 0.2F, -0.1F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PropagandaJapan(EntityPropagandaJapan.class, new ModelPropagandaCar(), "propaganda_Japan_", true, new float[]{1.1F, 0.2F, -0.1F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PropagandaUSSR(EntityPropagandaUSSR.class, new ModelPropagandaCar(), "propaganda_USSR_", true, new float[]{1.1F, 0.2F, -0.1F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PropagandaBritain(EntityPropagandaBritain.class, new ModelPropagandaCar(), "propaganda_Britain_", true, new float[]{1.1F, 0.2F, -0.1F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + SnowPlow(EntityLocoSteamSnowPlow.class, new ModelSnowPlow(), "train_snowplow", false, new float[]{-2F, 0.12F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{3.15D, 1.6D, 0.0D}); + } + }, "", null, 0, false), + + + locoDieselCF7(EntityLocoDieselCF7.class, new ModelCF7(), "CF7_", true, new float[]{-1.5F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + { + add(new double[]{0.6D, 1.4D, 0.0D}); + add(new double[]{1.1D, 1.4D, 0.0D}); + } + }, "", null, 0, false), + locoDieselGP15(EntityLocoDieselGP15.class, new ModelGP15(), "gp15_", true, new float[]{-1.3F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{1.33D, 1.45D, 0.0D}); + add(new double[]{0.75D, 1.45D, 0.0D}); + } + }, "", null, 0, false), + LocoDieselSW8(EntityLocoDieselSW8.class, new ModelSW8(), "sw8_", true, new float[]{-1.0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{1.3D, 1.3D, 0.0D}); + } + }, "", null, 0, false), + locoElectricRenfe446Motor(EntityLocoElectricRenfe446Motor.class, new Modelrenfe446end(), "446_", true, new float[]{-1.9F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerRenfe446Coach(EntityPassengerRenfe446Coach.class, new Modelrenfe446middle(), "446_", true, new float[]{-0.3F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + cabooseRenfe446Tail(EntityCabooseRenfe446Tail.class, new Modelrenfe446end(), "446_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + pch120(EntityLocoElectricPCH120.class, new ModelPCH120Commute(), "pch120commute_", true, new float[]{-1.3F, 0.01F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + pch120Coach(EntityPassengerPCH120Coach.class, new ModelPCH120Car(), "pch120car_", true, new float[]{0F, 0.01F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class345(EntityElectricClass345.class, new ModelClass345(), "Class345_", true, new float[]{-1.5F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class345Coach(EntityClass345Coach.class, new ModelClass345Coach(), "Class345_Passenger_", true, new float[]{0F, 0.05F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LUengine(EntityElectricLUengine.class, new ModelLUengine(), "lu_engine", false, new float[]{-1.0F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LUpassenger(EntityLUpassenger.class, new ModelLUpassenger(), "lu_passenger", false, new float[]{0F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DstockEngine(EntityElectricDstockEngine.class, new ModelDstockEngine(), "D_stock_engine_", true, new float[]{-1.0F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DstockCar(EntityDstockPassenger.class, new ModelDstockPassenger(), "D_stock_passenger_", true, new float[]{0F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPS52SeatCoach(EntityPassengerPS52SeatCoach.class, new ModelPS52SeatCoach(), "PS_lightweight_52seat_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPSCombine(EntityPassengerPSCombine.class, new ModelPSCombine(), "PS_lightweight_baggage-coach_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPScenterDiner(EntityPassengerPScenterDiner.class, new ModelPScenterDiner(), "PS_lightweight_center_diner_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPSAnotherDiner(EntityPassengerPSAnotherDiner.class, new ModelPSscrewyoutoomanydiners(), "PS_lightweight_center_diner_2_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + locoElectricMetro2000(EntityElectricMetro2000Motor.class, new ModelMetroMadrid2000Loco(), "metro_2000_", true, new float[]{-1.5F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerMetro2000(EntityPassengerMetro2000.class, new ModelMetro2000Tail(), "metro_2000_", true, new float[]{0F, 0.2F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + locoElectricRenfe450Motor(EntityLocoElectricRenfe450Motor.class, new Modelrenfe450endA(), "450_loco_", true, new float[]{-1.9F, 0.1F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + passengerRenfe450Coach(EntityPassengerRenfe450Coach.class, new Modelrenfe450middle(), "450_passenger_", true, new float[]{-0.0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + cabooseRenfe450Tail(EntityCabooseRenfe450Tail.class, new Modelrenfe450endB(), "450_passenger_", true, new float[]{0.0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerCD014(EntityPassengerCD014.class, new ModelCD014(), "cd014_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerCD914(EntityPassengerCD914.class, new ModelCD914(), "cd914_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerCD010(EntityPassengerCD010.class, new ModelCD010(), "cd010_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + locoCD814(EntityLocoDieselCD814.class, new ModelCD814(), "cd814_", true, new float[]{-0.8F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + locoCD810(EntityLocoDieselCD810.class, new ModelCD810(), "cd810_", true, new float[]{-0.8F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + VBShay(EntityLocoSteamVBShay2.class, new ModelVertiBoi2(), "vbshay2", false, new float[]{-0.4F, -1.15F, -0.0F}, new float[]{0F, 0F, 0F}, null, "largesmoke", 20, new ArrayList() { + { + add(new double[]{0.6D, 1.9D, -0.1D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{0.6D, -0.4D, 0.8D}); + add(new double[]{0.3D, 2.3D, 0.0D}); + } + }, 2, true), + locoSteamClimax2(EntityLocoSteamClimaxNew.class, new ModelClimaxNew(), "climax_Grey", false, new float[]{-0.4F, -1.15F, -0.0F}, new float[]{0F, 180F, 0F}, null, "largesmoke", 20, new ArrayList() { + { + add(new double[]{1.55D, 1.6D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.0D, -0.0D, 0.8D}); + } + }, 2, true), + freightRoundHopper(EntityFreightRoundHopper.class, new ModelRoundHopper(), "roundedhopper_", true, new float[]{-0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightRibbedHopper(EntityFreightRibbedHopper.class, new ModelRibbedHopper(), "ribbed_hopper_", true, new float[]{-0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + locoSM42(EntityLocoDieselSM42.class, new SM42(), "SM42_", true, new float[]{-2.0F, 0.05F, 0.0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{0.9D, 1.35D, 0.0D}); + } + }, "", null, 0, false), + locoDieselWWCPGP7(EntityLocoDieselWWCPGP7.class, new ModelWWCPGP7(), "GP7_Highood_", true, new float[]{-2f, 0.15f, 0}, new float[]{0F, 0F, 180F}, new float[]{0.9f, 1f, 0.9f}, "smoke", 4, new ArrayList() { + { + add(new double[]{1.7D, 1.3D, 0.0D}); + + add(new double[]{0.85D, 1.3D, 0.0D}); + } + }, "", null, 0, false), + locoC11(EntityLocoSteamC11.class, new ModellocoC11(), "locoC11", false, new float[]{-1.5F, 0.2F, 0.0F}, new float[]{0, 180, 180}, null, "largesmoke", 5, new ArrayList() { + { + add(new double[]{3.05D, 1.25D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.00D, 0.75D}); + } + }, 3, true), + LocoDieselGE44Ton(EntityLocoDieselGE44Ton.class, new ModelGE44Ton(), "44_ton_", true, new float[]{-1.0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{0.6D, 1.1D, 0.0D}); + add(new double[]{1.4D, 1.1D, 0.0D}); + } + }, "", null, 0, false), + amfleet(EntityPassengerAmfleet.class, new ModelAmfleet(), "amfleet_", true, new float[]{0F, -0.4F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + amfleet2(EntityPassengerAmfleet2.class, new ModelAmfleet2(), "amfleet2_", true, new float[]{0F, -0.4F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + bawx40highcube(EntityFreightBap40highcube.class, new Model40highcube(), "40highcube_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + WoodchipHopper(EntityFreightBapWoodchipHopper.class, new ModelWoodchipHopper(), "woodchiphopper_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + OreJenny(EntityFreightBapOreJenny.class, new ModelOreJenny(), "orejenny_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + MillGondola(EntityFreightBapMillGondola.class, new ModelMillGondola(), "MillGondola_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + MILW40boxcar(EntityFreightBapMILW40boxcar.class, new ModelMILW40boxcar(), "milw40_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Freight60centerbeam(EntityFreightBap60centerbeam.class, new Model60centerbeam(), "60ftcb_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Freight66centerbeam(EntityFreightBap66centerbeam.class, new Model66centerbeam(), "66ftcb_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Freight73centerbeam(EntityFreightBap73centerbeam.class, new Model73centerbeam(), "73ftcb_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PS140(EntityFreightBapPS140.class, new ModelPS140(), "ps140_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PS150(EntityFreightBapPS150.class, new ModelPS150(), "ps150_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PS160(EntityFreightBapPS160.class, new ModelPS160(), "ps160_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + WVcaboose(EntityCabooseBapWVcaboose.class, new ModelWVcaboose(), "wvcaboose_", true, new float[]{0F, 0.1675F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + //OWO60Verticube(EntityFreightBapOWO60Verticube.class, new ModelOWO60Verticube(),"owo60verticube_", true, new float[]{0F, 0.1875F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), + PEcoach(EntityPassengerBapPEcoach.class, new ModelPEcoach(), "PECoach_", true, new float[]{0F, 0.105F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PEobserve(EntityPassengerBapPEobserve.class, new ModelPEobserve(), "PEObserve_", true, new float[]{0F, 0.105F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + VersaLongi(EntityFreightBapVersaLongi.class, new ModelVersaLongi(), "versa_longi_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + VersaTrans(EntityFreightBapVersaTrans.class, new ModelVersaTrans(), "versa_trans_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DOT11111000(EntityFreightBapDOT11111000.class, new Model11000DOT111(), "dot11K_", true, new float[]{0F, 0.00F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DOT11120600(EntityFreightBapDOT11120600.class, new Model20600DOT111(), "dot206K_", true, new float[]{0F, 0.00F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DOT11129080(EntityFreightBapDOT11129080.class, new Model29080DOT111(), "dot290K_", true, new float[]{0F, 0.00F /*was 0.20F for height*/, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + F7A(EntityLocoDieselBapF7A.class, new ModelF7A(), "F7A_", true, new float[]{-1.375F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + add(new double[]{0.9375D, 1.3D, 0.0D}); + add(new double[]{0.25D, 1.3D, 0.0D}); + + } + }, "", null, 0, false), + F7B(EntityLocoDieselBapF7B.class, new ModelF7B(), "F7B_", true, new float[]{-1.25F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + add(new double[]{1.35D, 1.3D, 0.0D}); + add(new double[]{0.55D, 1.3D, 0.0D}); + + } + }, "", null, 0, false), + H1044(EntityLocoDieselBapH1044.class, new ModelH1044(), "FM_H10-44_", true, new float[]{-1.1F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{1.9D, 1.45D, -0.16D}); + add(new double[]{1.9D, 1.45D, 0.16D}); + } + }, "", null, 0, false), + locoSteamStarClass(EntityLocoSteamStarClass.class, new ModelStarClass(), "StarLoco", false, new float[]{-0.8F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 20, new ArrayList() { + { + add(new double[]{1.65D, 1.3D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.5D, -0.4D, 0.8D}); + } + }, 2, true), + tenderStarClass(EntityTenderStarClass.class, new ModelStarClassTender(), "StarTender", false, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerStarCarFat(EntityPassengerStarCarFat.class, new ModelStarCarFat(), "GWRClosed", false, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerStarCarNotFat(EntityPassengerStarCarNotFat.class, new ModelStarCarNotFat(), "GWROpen", false, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LightCrane(EntityLightCrane.class, new ModelLightCrane(), "lightcrane2_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR155(EntityLocoElectricBR155.class, new ModelBR155(), "BR155_", true, new float[]{-1.7F, 0.05F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Onion(EntityLocoOnion.class, new ModelOnion(), "Onion_", true, new float[]{-0.7F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "largesmoke", 20, new ArrayList() { + { + add(new double[]{0.6D, 1.5D, 0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{1.2D, -0.4D, 0.8D}); + } + }, 2, true), + OnionTender(EntityTenderOnion.class, new ModelOnionTender(), "Onion_Tender_", true, new float[]{0.0F, 0.1F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + loco440RFront(EntityLocoElectric440RFront.class, new Model440R_Front(), "440R_", true, new float[]{-1.9F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passenger440RMid(EntityPassenger440RMid.class, new Model440R_Mid(), "440R_", true, new float[]{-0.0F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passenger440RRear(EntityPassenger440RRear.class, new Model440R_Back(), "440R_", true, new float[]{0.0F, 0.1F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + passengerBW305(EntityPassengerBW305.class, new ModelBW305(), "tw_", true, new float[]{0.0F, 0.18F, 0.0F}, new float[]{0.0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LocoElectricTW305(EntityLocoElectricTW305.class, new ModelTW305(), "tw_", true, new float[]{-1.0F, 0.18F, 0.0F}, new float[]{0.0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + LocoElectricInterurbanSeries100(EntityElectricInterurbanSeries100.class, new ModelInterurbanSeries100(), "Interurban_tram_", true, new float[]{-1.5F, 0.18F, 0.0F}, new float[]{0.0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + GP13(EntityLocoDieselGP13.class, new ModelGP13(), "gp13_", true, new float[]{-0.8F, -0.47F, 0.0F}, new float[]{0F, 180F, 0F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{-0.2D, 1.2D, 0.0D}); + add(new double[]{0.45D, 1.2D, 0.0D}); + } + }, "", null, 0, false), + DB143(EntityLocoElectricDB143.class, new ModelDB143(), "DB143", false, new float[]{-1.7F, 0.2F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + tenderPETender(EntityTenderPETender.class, new ModelPE_Tender(), "PETender", false, new float[]{0.1F, 0.15F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + locoSteamPELoco(EntityLocoSteamPELoco.class, new ModelPE_Loco(), "PELoco", false, new float[]{-1.5F, 0.15F, 0.0F}, new float[]{0, 180, 180}, null, "largesmoke", 3, new ArrayList() { + { + add(new double[]{3.1D, 1.4D, 0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{2.9D, 0.05D, 0.65D}); + } + }, 2, true), + BapB23(EntityLocoDieselBapB23.class, new ModelB23(), "b23_", true, new float[]{-1.7F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + C424(EntityLocoDieselBapC424.class, new ModelC424(), "c424_", true, new float[]{-1.6F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "largesmoke", 2, new ArrayList() { + { + add(new double[]{1D, 1.65D, 0.0D}); + } + }, "", null, 0, false), + C425(EntityLocoDieselBapC425.class, new ModelC425(), "c425_", true, new float[]{-1.6F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "largesmoke", 2, new ArrayList() { + { + add(new double[]{1D, 1.65D, 0.0D}); + } + }, "", null, 0, false), + GP9(EntityLocoDieselBapGP9.class, new ModelGP9(), "gp9_", true, new float[]{-1.5F, -0.05F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{0.45D, 1.35D, 0.0D}); + add(new double[]{1.25D, 1.35D, 0.0D}); + } + }, "", null, 0, false), + GP7b(EntityLocoDieselBapGP7b.class, new ModelGP7b(), "bettergp7b_", true, new float[]{-1.5F, -0.05F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{0.45D, 1.35D, 0.0D}); + add(new double[]{1.25D, 1.35D, 0.0D}); + } + }, "", null, 0, false), + GP7u(EntityLocoDieselBapGP7u.class, new ModelGP7u(), "gp7u_", true, new float[]{-1.5F, -0.05F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{0.45D, 1.35D, 0.0D}); + add(new double[]{1.25D, 1.35D, 0.0D}); + + } + }, "", null, 0, false), + GP7(EntityLocoDieselBapGP7.class, new ModelGP7BAP(), "bettergp7_", true, new float[]{-1.5F, -0.05F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{0.45D, 1.35D, 0.0D}); + add(new double[]{1.25D, 1.35D, 0.0D}); + } + }, "", null, 0, false), + GP30(EntityLocoDieselBapGP30.class, new ModelGP30(), "gp30_", true, new float[]{-1.5F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + //add(new double[]{1.9D, 1.4D, 0.0D}); + } + }, "", null, 0, false), + GP38dash2(EntityLocoDieselBapGP38dash2.class, new ModelGP38dash2(), "gp38dash2_", true, new float[]{-1.5F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{0.75D, 1.4D, 0.0D}); + add(new double[]{1.55D, 1.4D, 0.0D}); + } + }, "", null, 0, false), + KOF_III(EntityLocoDieselKof_III.class, new ModelKOF_III(), "KofIII_", true, new float[]{-0.8F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{0.5D, 1.0D, 0.0D}); + } + }, "", null, 0, false), + KOF_III_M(EntityLocoDieselKof_III_M.class, new ModelKOF_III_M(), "KofIIIM_", true, new float[]{-0.8F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{0.5D, 1.0D, 0.0D}); + } + }, "", null, 0, false), + U36C(EntityLocoDieselBapU36C.class, new ModelU36C(), "u36c_", true, new float[]{-2.3125F, -0.15F/* -0.13F*/, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1F, 1F}, "smoke", 3, new ArrayList() { + { + //add(new double[]{0.75D, 1.75D, 0.0D}); + + } + }, "", null, 0, false), + GP49(EntityLocoDieselBapGP49.class, new ModelGP49(), "gp49_arr_2807", false, new float[]{-1.5F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + GP15(EntityLocoDieselBapGP15.class, new ModelBapGP15(), "gp15_bap_", true, new float[]{-1.3F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + } + }, "", null, 0, false), + spookyGarrattFront(EntityLocoSteamGarrattFront.class, new ModelGarrattFront(), "GarrattTexture", false, new float[]{3.5F, 0.155F, 0.0F},/*position*/ new float[]{0F, 180F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + //add(new double[] { 4.65D, 1.7D, 0.0D });//smoke + } + }, "explode", new ArrayList() { + { + //add(new double[] { 4.2D, -0.4D, 0.8D });//steam + } + }, 2, true), + spookyGarrattRear(EntityLocoSteamGarrattRear.class, new ModelGarrattBack(), "GarrattTexture", false, new float[]{3.25F, 0.155F, 0.0F},/*position*/ new float[]{0F, 0F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + //add(new double[] { 4.65D, 1.7D, 0.0D });//smoke + } + }, "explode", new ArrayList() { + { + //add(new double[] { 4.2D, -0.4D, 0.8D });//steam + } + }, 2, true), + spookyGarrattMid(EntityLocoSteamGarrattMid.class, new ModelGarrattMid(), "GarrattTexture", false, new float[]{-2.25F, 0.155F, 0.0F},/*position*/ new float[]{0F, 0F, 180F}, new float[]{1f, 1f, 1f},/*scale*/ "largesmoke", 20, new ArrayList() { + { + //add(new double[] { 4.65D, 1.7D, 0.0D });//smoke + } + }, "explode", new ArrayList() { + { + //add(new double[] { 4.2D, -0.4D, 0.8D });//steam + } + }, 2, true), + Skook(EntityLocoSteamSkook.class, new ModelSkookum(), "skookum", false, new float[]{-0.0F, -0.0F, -0.0F}, new float[]{0F, 180F, 180F}, null, "largesmoke", 20, new ArrayList() { + { + add(new double[]{2.4D, 1.5D, -0.0D}); + } + }, "explode", new ArrayList() { + { + add(new double[]{0.9D, -0.4D, 0.8D}); + add(new double[]{2.5D, -0.4D, 0.8D}); + add(new double[]{-0.5D, 1.5D, 0.0D}); + } + }, 2, true), + SkookTender(EntityTenderSkookTender.class, new ModelSkookumTender(), "skookumtender", false, new float[]{-0.00F, 0.0F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + EF1(EntityLocoElectricBapEF1.class, new ModelEF1(), "ef1_", true, new float[]{-1.60F, 0.1875F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + EF1B(EntityLocoElectricBapEF1B.class, new ModelEF1B(), "ef1b_", true, new float[]{-1.15635F, 0.1875F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + EP1A(EntityLocoElectricBapEP1A.class, new ModelEP1A(), "ep1a_", true, new float[]{-1.60F, 0.1875F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + SD9(EntityLocoDieselBapSD9.class, new ModelSD9(), "SD9_", true, new float[]{-1.6F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + //add(new double[]{0.8D, 1.4D, 0.0D}); + //add(new double[]{1.6D, 1.4D, 0.0D}); + } + }, "", null, 0, false), + SD40dash2(EntityLocoDieselBapSD40dash2.class, new ModelSD40dash2(), "sd40_", true, new float[]{-1.9F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + { + //add(new double[]{2.3D, 1.5D, 0.0D}); + } + }, "", null, 0, false), + WWCP40FootBox(EntityFreightWWCP40FootBox.class, new ModelWWCP40FootBox(), "40ft_Boxcar_", true, new float[]{0F, 0.1875F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + //HuskyStackWellcar(EntityFreightBapHuskyStack.class, new ModelHuskyStack(), "huskystack_", true, new float[]{0F, 0.15F, 0F}, new float[] { 0F, 180F, 180F }, null, "", 0, null, "", null, 0, false), + U23B(EntityLocoDieselBapU23B.class, new ModelU23B(), "U23B_", true, new float[]{-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + U18B(EntityLocoDieselBapU18B.class, new ModelU18B(), "U18B_", true, new float[]{-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + hicube60foot(EntityFreightBaphicube60foot.class, new Modelhicube60foot(), "hicube60_", true, new float[]{0F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + freightBNSFGon(EntityFreightBNSFGon.class, new ModelBNSFGon(), "BNSFMillGon_", true, new float[]{0.0F, 0.0F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + locoILMA(EntityLocoElectricILMA.class, new ModelILMA(), "ILMA_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + locoILMB(EntityLocoElectricILMB.class, new ModelILMB(), "ILMB_", true, new float[]{0.0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Feve3300Front(EntityLocoElectricFeve3300.class, new Modelfeve3300front(), "feve3300_", true, new float[]{-1.8F, 0.18F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Feve3300Rear(EntityPassengerFeve3300.class, new Modelfeve3300rear(), "feve3300_", true, new float[]{-0.0F, 0.18F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + HH660(EntityLocoDieselBapHH660.class, new ModelHH660(), "hh600_", true, new float[]{-1F, -0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{2.0D, 1.35D, 0D}); + } + }, "", null, 0, false), + Krautt(EntityLocoDieselBapKrautt.class, new ModelKrautt(), "KM_ML4000_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + { + } + }, "", null, 0, false), + BoxMotor(EntityLocoElectricBoxMotor.class, new boxmotor(), "BoxMotorTexture", false, new float[]{-1.8F, 0.1F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Hopper5201(EntityFreightBapHopper5201.class, new ModelHopper5201(), "5201_", true, new float[]{-0F, 0.0F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Hopper6260(EntityFreightBapHopper6260.class, new ModelHopper6260(), "6260_", true, new float[]{-0F, 0.0F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Skeleton(EntityFreightBapSkeletonLogCar.class, new ModelSkeletonLogCar(), "SkeletonLogCar_", true, new float[]{0.0F, -0.0F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Shay3Truck(EntityLocoSteamShay3Truck.class, new ModelShay3Truck(), "3truckShay_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "largesmoke", 4, new ArrayList() { + { + add(new double[]{2.15D, 1.3D, -0.17D});//1.1D + } + }, "explode", new ArrayList() { + { + add(new double[]{0.9D, -0.4D, 0.6D}); + //add(new double[] { 0.6D, 1.1D, 0.0D }); + } + }, 2, true), + Shay3TruckTender(EntityTenderShay3Truck.class, new ModelShay3TruckTender(), "3truckShay_", true, new float[]{0.0F, 0.0F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + Dash840B(EntityLocoDieselBapDash840B.class, new ModelDash840B(), "dash8_40b_", true, new float[]{-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + Class44(EntityLocoDieselClass44.class, new ModelClass44(), "Class44_", true, new float[]{0F, 0.0F, 0.0F}, new float[]{0F, 90F, 180F}, null, "largesmoke", 1, new ArrayList() { + { + add(new double[]{2.3D, 1.6D, 0D}); + } + }, "", null, 0, false), + EU07(EntityLocoElectricEU07.class, new EU07Modernised(), "EU07_", true, new float[]{-0F, 0.00F, 0.0F}, new float[]{0F, 0F, 180F}, new float[]{0.9f, 0.9f, 0.9f}, "", 0, null, "", null, 0, false), + SW1(EntityLocoDieselBapSW1.class, new ModelSW1(), "sw1_", true, new float[]{-0.0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + SW1500(EntityLocoDieselBapSW1500.class, new ModelSW1500(), "sw1500_", true, new float[]{-0.0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + GM6C(EntityLocoElectricBapGM6C.class, new ModelGM6C(), "GM6C_demo", false, new float[]{-0.0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Dash840C(EntityLocoDieselBapDash840C.class, new ModelDash840C(), "dash8_40c_", true, new float[]{-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + SW1200(EntityLocoDieselBapSW1200.class, new ModelSW1200(), "sw1200_", true, new float[]{-0.0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + RSD15(EntityLocoDieselBapRSD15.class, new ModelRSD15(), "RSD15_", true, new float[]{-0.0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + }, "", null, 0, false), + PSBaggage(EntityFreightPS73Baggage.class, new ModelPS73Baggage(), "PS_Baggage_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + ES44(EntityLocoDieselBapES44.class, new ModelES44(), "es44_", true, new float[]{-2.2F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{1.0D, 1.4D, 0.0D}); + + } + }, "", null, 0, false), + Dash9_44CW(EntityLocoDieselBapDash9_44CW.class, new ModelDash9_44CW(), "d9-44cw_", true, new float[]{-2.2F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + + } + }, "", null, 0, false), + SD70Mac(EntityLocoDieselBapSD70Mac.class, new ModelSD70Mac(), "sd70mac_", true, new float[]{-2.1F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + + { + add(new double[]{2.35D, 1.5D, 0.0D}); + } + }, "", null, 0, false), + Dash840BB(EntityLocoDieselBapDash840BB.class, new ModelDash840BB(), "dash8_40b_b_", true, new float[]{-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + Dash840BW(EntityLocoDieselBapDash840BW.class, new ModelDash840BW(), "dash8_40bw_", true, new float[]{-0F, -0.0F, 0F}, null, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + PSBaggage85(EntityFreightPS85Baggage.class, new ModelPS85Baggage(), "PS_lightweight_85_baggage_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Reefer64(EntityFreightBapReefer64Foot.class, new ModelReefer64Foot(), "reefer_64_", true, new float[]{0F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DH643(EntityLocoDieselBapDH643.class, new ModelDH643(), "alco_dh423_not_dumb", false, new float[]{-0.0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + }, "", null, 0, false), + CF7(EntityLocoDieselBapCF7.class, new ModelCF7Angle(), "CF7_Angle_", true, new float[]{-0F, -0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + { + } + }, "", null, 0, false), + CF7round(EntityLocoDieselBapCF7round.class, new ModelCF7round(), "CF7_Round_", true, new float[]{-0F, -0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 6, new ArrayList() { + { + } + }, "", null, 0, false), + alcoS2(EntityLocoDieselBapAlcoS2.class, new ModelAlcoS2(), "alcos2_", true, new float[]{0f, 0f, 0f}, new float[]{0F, 180F, 180F}, null, "smoke", 5, new ArrayList() { + { + add(new double[]{0.7D, 1.3D, -0.18D}); + } + }, "", null, 0, false), + NRE3gs21b(EntityLocoDieselBapNRE3gs21b.class, new ModelNRE3gs21b(), "3gs21b_", true, new float[]{-1.5F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{0.15D, 1.3D, 0.0D}); //farthest from cab + add(new double[]{1.05D, 1.3D, 0.0D}); //middle + add(new double[]{2.0D, 1.3D, 0.0D}); // closest to cab + } + }, "", null, 0, false), + Beep(EntityLocoDieselBapBeep.class, new ModelBeep(), "atsfbeep", false, new float[]{-0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{1.45D, 1.25D, 0.0D}); + add(new double[]{1.65D, 1.25D, 0.0D}); + add(new double[]{1.05D, 1.25D, 0.0D}); + add(new double[]{1.25D, 1.25D, 0.0D}); + } + }, "", null, 0, false), + GP38dash9W(EntityLocoDieselBapGP38dash9W.class, new ModelGP38dash9W(), "GP38dash9W_Green", false, new float[]{-1.5F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + class158motor(EntityLocoDieselClass158.class, new ModelClass158(), "Class_158_", true, new float[]{-1.85F, -0.45F, 0.0F}, new float[]{0F, 180F, 180F}, null, "smoke", 2, new ArrayList() { + { + } + }, "", null, 0, false), + class158car(EntityClass158Coach.class, new ModelClass158Middle(), "Class_158_", true, new float[]{0.5F, -0.45F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + //HBC1C(EntityCabooseBapHBC1C.class, new ModelHBC1C(),"HBC1C_", true, null, null, null, "", 0, null, "", null, 0, false), + DRGWCaboose(EntityCabooseBapDRGW.class, new ModelDRGW01400Caboose(), "BAP_DRGW_01400_", true, null, null, null, "", 0, null, "", null, 0, false), + passengerPSSleeper565(EntityPassengerPSSleeper565.class, new ModelPSSleeper565(), "PS_lightweight_5-6-5_sleeper_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPSSleeper565DRGW(EntityPassengerPSSleeper565DRGW.class, new ModelPSSleeper565DRGW(), "PS_DRGW_lightweight_5-6-5_sleeper", false, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + AlcoPA1(EntityLocoDieselAlcoPA1.class, new ModelAlcoPA(), "AlcoPA1_", true, new float[]{-1.6F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + AlcoPB1(EntityLocoDieselAlcoPB1.class, new ModelAlcoPB(), "AlcoPB1_", true, new float[]{-1.55F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + EMDE8A(EntityLocoDieselEMDE8A.class, new ModelEMDE8A(), "EMDE8A_", true, new float[]{-1.85F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + + //tcce4 new stuff + SNCB_M6(EntityPassengerSNCB_M6.class, new ModelSNCB_M6(), "SNCB_M6_", true, new float[]{-2.0f, .095F, 0F}, new float[]{0f, 180F, 180F}, null, "", 0, null, "", null, 0, false), + SNCB_M6_TAIL(EntityPassengerSNCB_M6_TAIL.class, new ModelSNCB_M6_TAIL(), "SNCB_M6_Tail_", true, new float[]{-2.30F, 0.04f, 0F}, new float[]{0F, 0, 180F}, null, "", 0, null, "", null, 0, false), + + Class153Engine(EntityLocoDieselClass153.class, new ModelClass153(), "class_153_", true, new float[]{-2.1F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + Class153Coach(EntityPassengerClass153.class, new ModelClass153(), "class_153_", true, new float[]{0F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class156Engine(EntityLocoDieselClass156.class, new ModelClass156(), "Class_156_", true, new float[]{-1.3F, -0.57F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + Class47(EntityLocoDieselClass47.class, new ModelClass47(), "Class_47_", true, new float[]{-4f, 0f, 0f}, new float[]{0f, 180f, 180f}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + Class319Engine(EntityElectricClass319.class, new ModelClass319Engine(), "Br_319_", true, new float[]{-1.65F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList(), "", null, 0, false), + Class319Middle(EntityPassengerClass319Middle.class, new ModelClass319Middle(), "Br_319_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class319Panto(EntityPassengerClass319Panto.class, new ModelClass319Panto(), "Br_319_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class319Tail(EntityPassengerClass319Tail.class, new ModelClass319Engine(), "Br_319_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + PSRPOPM(EntityFreightPSRPOPM.class, new ModelPSRPOPM(), "PSRPOPM_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PSRPO(EntityFreightPSRPO.class, new ModelPSRPO(), "PSRPO_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + KVB_2300(EntityElectricKVB_2300.class, new ModelKVB_2300(), "kvb_2300_", true, new float[]{-1.25F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + KVB_2300_B(EntityPassengerKVB_2300_B.class, new ModelKVB_2300_B(), "kvb_2300_", true, new float[]{-1.25F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + //tcce5 new stuff (its mixed around in the file tbh) + BR_MK2F_Coach(EntityPassengerBR_MK2F_Coach.class, new ModelBR_MK2F_Coach(), "BR_Mk2f_", true, new float[]{0.485F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK2F_BSO(EntityPassengerBR_MK2F_BSO.class, new ModelBR_MK2F_BSO(), "BR_Mk2f_BSO_", true, new float[]{0.485F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK2F_DBSO(EntityElectricBR_MK2F_DBSO.class, new ModelBR_MK2F_DBSO(), "BR_Mk2f_DBSO_", true, new float[]{-1.5F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK3_Buffet(EntityPassengerBR_MK3_Buffet.class, new ModelBR_MK3_Buffet(), "BR_Mk3_Buffet_", true, new float[]{0.15F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK3_Coach(EntityPassengerBR_MK3_Coach.class, new ModelBR_MK3_Coach(), "BR_Mk3_Coach_", true, new float[]{0.15F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK3a_Coach(EntityPassengerBR_MK3a_Coach.class, new ModelBR_Mk3a_Coach(), "BR_Mk3a_", true, new float[]{0.15F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK3_Pantograph(EntityPassengerBR_MK3_Pantograph.class, new ModelBR_MK3_Pantograph(), "BR_Mk3_Pantograph_", true, new float[]{0.15F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK3_DVT(EntityElectricBR_MK3_DVT.class, new ModelBR_MK3_DVT(), "BR_Mk3_DVT_", true, new float[]{-1.5F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK4_DVT(EntityElectricBR_MK4_DVT.class, new ModelBR_MK4_DVT(), "BR_Mk4_DVT_", true, new float[]{-1.9F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK4_Coach(EntityPassengerBR_MK4_Coach.class, new ModelBR_MK4_Coach(), "BR_Mk4_", true, new float[]{0.2F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK4_Buffet(EntityPassengerBR_MK4_Buffet.class, new ModelBR_MK4_Buffet(), "BR_Mk4_Buffet_", true, new float[]{0.22F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class43(EntityLocoDieselClass43.class, new ModelClass43(), "Class_43_", true, new float[]{-0.65F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class90(EntityElectricClass90.class, new ModelClass90(), "Class_90_", true, new float[]{-0.55F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class91(EntityElectricClass91.class, new ModelClass91(), "Class_91_", true, new float[]{-1.2F, 0.05F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class321(EntityElectricClass321.class, new ModelClass321(), "Class_321_", true, new float[]{-1.2F, -0.455F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class321Panto(EntityPassengerClass321Panto.class, new ModelClass321_Panto(), "Class_321_Panto_Car_", true, new float[]{0.6F, -0.455F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class321Coach(EntityPassengerClass321Coach.class, new ModelClass321Coach(), "Class_321_Trailer_Car_", true, new float[]{0.6F, -0.455F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerMinetrain(EntityPassengerMinetrain.class, new ModelPassengerMinetrain(), "minetrain", false, new float[]{0.0F, -0.47F, 0.0F}, null, null, "", 0, null, "", null, 0, false), + asteri(EntityLocoSteamasteri.class, new Modelasteri(), "asteri", false, new float[]{-1.0F, 0.16F, 0F}, new float[]{5F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + //TCCE6 + C415H(EntityLocoDieselC415H.class, new ModelC415H(), "C415h_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + C415S(EntityLocoDieselC415S.class, new ModelC415S(), "C415s_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + } + }, "", null, 0, false), + C415L(EntityLocoDieselC415L.class, new ModelC415L(), "C415l_", true, new float[]{-1.2F, 0.105F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + add(new double[]{1.85D, 1.55D, 0.0D}); + } + }, "", null, 0, false), + GE25Ton(EntityLocoDieselGE25Ton.class, new ModelGE25Ton(), "25ton_", true, new float[]{0.0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + add(new double[]{0.6D, 1.1D, 0.0D}); + } + }, "", null, 0, false), + GSI60FootBulkhead(EntityFreightGSI60FootBulkhead.class, new ModelGSI60FootBulkheadFlat(), "gsi_60bulk_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + GSC60FootFlat(EntityFreightGSC60FootFlat.class, new ModelGSI60FootBulkheadFlat(), "gsc_60flat_", true, new float[]{0F, 0.0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + FMH24_66(EntityLocoDieselFMH24_66.class, new ModelFMH24_66(), "FM_H24-66_", true, new float[]{-1.9F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + //add(new double[]{1.85D, 1.55D, 0.0D}); + } + }, "", null, 0, false), + FMH24_66L(EntityLocoDieselFMH24_66L.class, new ModelFMH24_66L(), "FM_H24-66_L_", true, new float[]{-1.9F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + EMDE8B(EntityLocoDieselEMDE8B.class, new ModelEMDE8B(), "EMDE8B_", true, new float[]{-1.75F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + passengerPSLunchCounter_Lounge(EntityPassengerPSLunchCounter_Lounge.class, new ModelPSLunchCounter_Lounge(), "PS_lightweight_LunchCounter_Lounge_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPS30SeatParlor(EntityPassengerPS30SeatParlor.class, new ModelPS30SeatParlor(), "PS_lightweight_30SeatParlor_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPS54SeatCoach_Lounge(EntityPassengerPS54SeatCoach_Lounge.class, new ModelPS54SeatCoach_Lounge(), "PS_lightweight_54SeatCoach_Lounge_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPS58SeatCoach_Observation(EntityPassengerPS58SeatCoach_Observation.class, new ModelPS58SeatCoach_Observation(), "PS_lightweight_58SeatCoach_Observation_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPSBM56SeatCoach(EntityPassengerPSBM56SeatCoach.class, new ModelPSBM56SeatCoach(), "PS_lightweight_BM56SeatCoach_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPSBMCombine(EntityPassengerPSBMCombine.class, new ModelPSBMCombine(), "PS_lightweight_BMCombine_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + passengerPSBMDiner_Lounge(EntityPassengerPSBMDiner_Lounge.class, new ModelPSBMDiner_Lounge(), "PS_lightweight_BMDiner_Lounge_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + EMDE7A(EntityLocoDieselEMDE7A.class, new ModelEMDE7A(), "EMDE7A_", true, new float[]{-1.85F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + EMDE7B(EntityLocoDieselEMDE7B.class, new ModelEMDE7B(), "EMDE7B_", true, new float[]{-1.75F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, new float[]{1F, 1.0F, 1F}, "smoke", 3, new ArrayList() { + { + } + }, "", null, 0, false), + freight5Plank(EntityFreight5Plank.class, new Model5Plank(), "5_plank_", true, new float[]{0f, 0.15f, 0f}, new float[]{0f, 180f, 180f}, null, "", 0, null, "", null, 0, false), + NMBS_HLE_18(EntityLocoElectricNMBS_HLE_18.class, new ModelNMBS_HLE_18(), "hle19_", true, new float[]{-1.5F, 0.05F, 0}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_Mk_1_BSO(EntityPassengerBR_Mk1_BSO.class, new ModelBR_Mk1_BSO(), "BR_Mk1_BSO_", true, new float[]{0, 0, 0,}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + BR_Mk_1_TSO(EntityPassengerBR_Mk1_TSO.class, new ModelBR_Mk1_TSO(), "BR_Mk1_TSO_", true, new float[]{0, 0, 0,}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + BR_Mk_1_Buffet(EntityPassengerBR_Mk1_Buffet.class, new ModelBR_Mk1_Buffet(), "BR_Mk1_Buffet_", true, new float[]{0, 0, 0,}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + BR_Mk_1_TPO_Stowage(EntityFreightBR_Mk1_TPO_Stowage.class, new ModelBR_Mk1_TPO_Stowage(), "BR_Mk1_TPO_", true, new float[]{0F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_Mk_1_BG(EntityPassengerBR_Mk1_BG.class, new ModelBR_Mk1_BG(), "BR_Mk1_BG_", true, new float[]{0, 0, 0}, new float[]{0, 180, 180}, null, "", 0, null, "", null, 0, false), + Class175(EntityLocoDieselClass175.class, new ModelClass175(), "Class_175_", true, new float[]{-2.25f, -0.127f, 0}, new float[]{0, 180, 180}, null, "smoke", 1, new ArrayList() { + }, "", null, 0, false), + Class175Coach(EntityPassengerClass175Coach.class, new ModelClass175Coach(), "Class_175_Middle_Car_", true, new float[]{0, -0.127f, 0}, new float[]{0, 180F, 180F}, null, "", 0, null, "", null, 0, false), + FMH16_66(EntityLocoDieselFMH16_66.class, new ModelFMH16_66(), "FM_H16-66_", true, new float[]{-1.7F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 4, new ArrayList() { + { + //add(new double[]{1.85D, 1.55D, 0.0D}); + } + }, "", null, 0, false), + ACFGNRPO_30(EntityPassengerACFGNRPO_30.class, new ModelACFGNRPO_30(), "AC&F_lightweight_GNRPO30_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + ACFGN60SeatCoach(EntityPassengerACFGN60SeatCoach.class, new ModelACFGN60SeatCoach(), "AC&F_lightweight_GN60SeatCoach_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + FGV4300Motor(EntityLocoElectricFGV4300.class, new ModelFGV4300Motor(), "4300_motorcar", false, new float[]{-1.3F, -0.03F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + FGV4300Coach(EntityPassengerFGV4300Coach.class, new ModelFGV4300Coach(), "4300_middle", false, new float[]{0F, -0.03F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + FGV4300Tail(EntityPassengerFGV4300Tail.class, new ModelFGV4300Tail(), "4300_motorcar", false, new float[]{0F, -0.03F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + MetroMadrid3000Loco(EntityElectricMetro3000Motor.class, new ModelMetroMadrid3000Loco(), "MM3000_", true, new float[]{-1.5F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PassengerMetro3000(EntityPassengerMetro3000.class, new ModelMetroMadrid3000Passenger(), "MM3000_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + PassengerMetro3000Tail(EntityPassengerMetro3000Tail.class, new ModelMetroMadrid3000Loco(), "MM3000_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + CQ310(EntityElectricCQ310Loco.class, new Modelcq310loco(), "CQ_310_", true, new float[]{-1.5F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + CQ310Passenger(EntityPassengerCQ310Passenger.class, new Modelcq310loco(), "CQ_310_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + Class162Engine(EntityElectricClass162.class, new ModelClass162Engine(), "Class_162_engine_", true, new float[]{-2F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class162CoachB(EntityPassengerClass162CoachB.class, new ModelClass162CoachB(), "Class_162_Coach_B_", true, new float[]{0F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class162CoachA(EntityPassengerClass162CoachA.class, new ModelClass162CoachA(), "Class_162_Coach_A_", true, new float[]{0F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class162Tail(EntityPassengerClass162Tail.class, new ModelClass162Engine(), "Class_162_engine_", true, new float[]{0F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class34(EntityLocoDieselClass34.class, new ModelClass34(), "class_34_", true, new float[]{-2.75F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + tankerUK(EntityTankerUK.class, new ModelTankerUK(), "Tanker_UK_", true, new float[]{0F, 0.155F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + MetalTram(EntityLocoElectricMetalTram.class, new ModelMetalTram(), "Metal_Tram_", true, new float[]{-1F, 0.18F, 0.0F}, new float[]{0.0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + MetalTramCoach(EntityPassengerMetalTramCoach.class, new ModelMetalTramCoach(), "Metal_Tram_", true, new float[]{0.0F, 0.18F, 0.0F}, new float[]{0.0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + HopperUK(EntityFreightHopperUK.class, new ModelHopper_UK(), "Hopper_UK_", true, new float[]{0F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + B80C_A(EntityElectricB80C_A.class, new ModelB80C_A(), "B80C_", true, new float[]{-1.25F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + B80C_B(EntityPassengerB80C_B.class, new ModelB80C_B(), "B80C_", true, new float[]{-1.25F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + WoodenTramCoach(EntityPassengerWoodenTramCoach.class, new ModelWoodenTramCoach(), "Wooden_Tram_Coach_", true, new float[]{0.0F, 0.18F, 0.0F}, new float[]{0.0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + MA100_Loco(EntityElectricMA100_Loco.class, new ModelMA100_Loco(), "MA100_", true, new float[]{-0.95F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + MA100_Tail(EntityPassengerMA100_Tail.class, new ModelMA100_Tail(), "MA100_", true, new float[]{0F, 0.16F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + ExpressFreightVan(EntityFreightExpressFreightVan.class, new ModelExpressFreightVan(), "Express_Freight_Van_", true, new float[]{0F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class390Front(EntityElectricClass390.class, new ModelClass390Front(), "Class_390_Front_", true, new float[]{-2.3F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class390Coach(EntityPassengerClass390Coach.class, new ModelClass390Coach(), "Class_390_Coach_", true, new float[]{0F, 0.F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class390Panto(EntityPassengerClass390Panto.class, new ModelClass390Panto(), "Class_390_Panto_", true, new float[]{0F, 0.F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class121Bubblecar(EntityLocoDieselClass121.class, new ModelClass121(), "bubble_car_", true, new float[]{-2.1F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + Class121Trailer(EntityPassengerClass121Trailer.class, new ModelClass121Trailer(), "bubble_car_", true, new float[]{0F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class117(EntityLocoDieselClass117.class, new ModelClass117(), "bubble_car_", true, new float[]{-2.1F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + Class117Middle(EntityPassengerClass117Middle.class, new ModelClass117Middle(), "bubble_car_", true, new float[]{0F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + TipperUK(EntityFreightTipperUK.class, new ModelTipperUK(), "tipper_", true, new float[]{0F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + ShuntingTenderUK(EntityTenderShuntingTenderUK.class, new ModelShuntingTenderUK(), "shunting_tender_", true, new float[]{0f, 0.15f, 0f}, new float[]{0f, 180f, 180f}, null, "", 0, null, "", null, 0, false), + BRBrakeVan(EntityCabooseBRBrakeVan.class, new ModelBRBrakeVan(), "br_brake_van_", true, new float[]{0F, 0.1F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + + //TCCE7 + DuewagT4ER(EntityElectricDuewagT4ER.class, new ModelDuewagT4ER(), "Duewag_T4_", true, new float[]{-1.25F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DuewagGT6ZRLoco(EntityElectricDuewagGT6ZRLoco.class, new ModelDuewagGT6ZRLoco(), "Duewag_GT6_", true, new float[]{-0.85F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DuewagGT6ZTail(EntityPassengerDuewagGT6ZRTail.class, new ModelDuewagGT6ZRTail(), "Duewag_GT6_", true, new float[]{-0.85F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + M8CLoco(EntityElectricM8CLoco.class, new ModelM8CLoco(), "M8C_", true, new float[]{-1F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + M8CTail(EntityPassengerM8CTail.class, new ModelM8CTail(), "M8C_", true, new float[]{-1F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class416Loco(EntityElectricClass416Loco.class, new ModelClass416Engine(), "Class_205_", true, new float[]{-2F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class416Tail(EntityPassengerClass416Tail.class, new ModelClass416Tail(), "Class_205_", true, new float[]{0f, 0.15f, 0f}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + DB420Loco(EntityElectricDB420Loco.class, new ModelDB420End(), "db420_", true, new float[]{-1.5F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DB420Middle(EntityPassengerDB420Middle.class, new ModelDB420Middle(), "db420_", true, new float[]{0F, 0.16F, 0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + DB420Tail(EntityPassengerDB420Tail.class, new ModelDB420End(), "db420_", true, new float[]{-1.5F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + CattleVan(EntityCattleVan.class, new ModelCattleVan(), "cattle_van", false, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + Class401Loco(EntityLocoElectricClass401.class, new ModelClass401Engine(), "2-bil_", true, new float[]{-1.7F, 0.17F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class401Tail(EntityPassengerClass401Tail.class, new ModelClass401tail(), "2-bil_", true, new float[]{0.02F, 0.17F, 0.03F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + passenger10tonBrakeVan(EntityPassenger10tonBrakeVan.class, new Model10tonBrakeVan(), "10ton_brakevan_", true, new float[]{0F, 0.15F, 0.0F}, new float[]{0F, 0F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK2C_Coach(EntityPassengerBR_MK2C_Coach.class, new ModelBR_MK2C_Coach(), "BR_Mk2c_", true, new float[]{0.485F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + BR_MK2C_BSO(EntityPassengerBR_MK2C_BSO.class, new ModelBR_MK2C_BSO(), "BR_Mk2c_BSO_", true, new float[]{0.485F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class230Engine(EntityElectricClass230.class, new ModelClass230(), "Class_230_", true, new float[]{-1.3F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class230Middle(EntityClass230Middle.class, new ModelClass230Middle(), "Class_230_", true, new float[]{0F, 0.16F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DuewagGT6ERLoco(EntityElectricDuewagGT6ERLoco.class, new ModelDuewagGT6ERLoco(), "Duewag_GT6ER_", true, new float[]{-0.85F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + DuewagGT6ERTail(EntityPassengerDuewagGT6ERTail.class, new ModelDuewagGT6ERTail(), "Duewag_GT6ER_", true, new float[]{-0.85F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Mineralwagon(EntityFreightMineralwagon.class, new ModelMineralwagon(), "Mineral_wagon_", true, new float[]{0f, 0.15f, 0f}, new float[]{0f, 180f, 180f}, null, "", 0, null, "", null, 0, false), + VentilatedVan(EntityFreightVentilatedVan.class, new ModelVentilatedVan(), "Ventilated_van_", true, new float[]{0f, 0.15f, 0f}, new float[]{0f, 180f, 180f}, null, "", 0, null, "", null, 0, false), + Class143Rear(EntityPassengerClass143.class, new ModelClass143(), "Class143_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class143Middle(EntityPassengerClass143M.class, new ModelClass144(), "Class143_", true, new float[]{0F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class374Front(EntityElectricClass374.class, new ModelClass374Front(), "Class_374_Front_", true, new float[]{-2.6F, 0.162F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class374PremierPanto(EntityPassengerClass374PremierPanto.class, new ModelClass374PremierPanto(), "Class_374_Premier_Panto_", true, new float[]{0F, 0.162F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class374StandardPanto(EntityPassengerClass374StandardPanto.class, new ModelClass374StandardPanto(), "Class_374_Standard_Panto_", true, new float[]{0F, 0.162F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class374Buffet(EntityPassengerClass374Buffet.class, new ModelClass374Buffet(), "Class_374_Buffet_", true, new float[]{0F, 0.162F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class387Front(EntityElectricClass387Front.class, new ModelClass387Front(), "Class_387_", true, new float[]{-2F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class387Coach(EntityPassengerClass387Coach.class, new ModelClass387Coach(), "Class_387_Middle_", true, new float[]{0F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class387Panto(EntityPassengerClass387Panto.class, new ModelClass387Panto(), "Class_387_Middle_", true, new float[]{0F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class387Tail(EntityPassengerClass387Tail.class, new ModelClass387Front(), "Class_387_", true, new float[]{0F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class378Front(EntityElectricClass378Front.class, new ModelClass378Front(), "Class_378_", true, new float[]{-1.9F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class378Middle(EntityPassengerClass378Middle.class, new ModelClass378Middle(), "Class_378_Middle_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class378Tail(EntityPassengerClass378Tail.class, new ModelClass378Front(), "Class_378_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class142Front(EntityLocoDieselClass142.class, new ModelClass142(), "Class_142_", true, new float[]{-1.8F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 2, new ArrayList() { + }, "", null, 0, false), + Class142Tail(EntityPassengerClass142Tail.class, new ModelClass142(), "Class_142_", true, new float[]{-0.53F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Bagnall(EntityLocoDieselBagnall.class, new ModelBagnall(), "Bagnall_Shunter_0-4-0_", true, new float[]{-0.85F, 0.18F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 2, new ArrayList() { + }, "", null, 0, false), + Class389Front(EntityElectricClass389Front.class, new ModelClass389Front(), "Class_389_", true, new float[]{-2.4F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class389Middle(EntityPassengerClass389Middle.class, new ModelClass389Middle(), "Class_389_Middle_", true, new float[]{-0.31F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class389Tail(EntityPassengerClass389Tail.class, new ModelClass389Front(), "Class_389_", true, new float[]{-0.31F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class442DTS(EntityElectricClass442DTS.class, new ModelClass442DTS(), "class_442_DTS_", true, new float[]{-2F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class442TS(EntityPassengerClass442TS.class, new ModelClass442TS(), "class_442_TS_", true, new float[]{0.15F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class442MBLS(EntityPassengerClass442MBLS.class, new ModelClass442MBLS(), "class_442_MBLS_", true, new float[]{0.15F, 0F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class205loco(EntityLocoDieselClass205loco.class, new ModelClass205(), "Class_205_", true, new float[]{-2F, 0.15F, 0F}, new float[]{0F, 180F, 180F}, null, "smoke", 3, new ArrayList() { + }, "", null, 0, false), + Class205tso(EntityPassengerClass205tso.class, new ModelClass205tso(), "Class_205_", true, new float[]{0f, 0.15f, 0f}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + Class205tail(EntityPassengerClass205tail.class, new ModelClass205tail(), "Class_205_", true, new float[]{0f, 0.15f, 0f}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + M8DNF1Loco(EntityElectricM8DNF1Loco.class, new ModelM8DNF1End(), "m8d_nf1_", true, new float[]{-0.65F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + M8DNF1Middlelong(EntityPassengerM8DNF1MiddleLong.class, new ModelM8DNF1Middle1(), "m8d_nf1_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + M8DNF1Middleshort(EntityPassengerM8DNF1MiddleShort.class, new ModelM8DNF1Middle2(), "m8d_nf1_", true, new float[]{0F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + M8DNF1Tail(EntityPassengerM8DNF1Tail.class, new ModelM8DNF1End(), "m8d_nf1_", true, new float[]{-0.65F, 0.2F, 0F}, new float[]{0F, 180F, 180F}, null, "", 0, null, "", null, 0, false), + ; + + private final Class entityClass; + private final ModelBase model; + private final String texture; + private final boolean multiTexture; + private final float[] trans; + private final float[] rotate; + private final float[] scale; + private final String smokeType; + private final ArrayList smokeFX; + private final String explosionType; + private final ArrayList explosionFX; + private final int smokeIterations; + private final int explosionFXIterations; + private final boolean hasSmokeOnSlopes; + + /** + * Defines the render @param for a RollingStock + * + * @param model ModelBase + * @param texture String + * @param multiTexture boolean + * @param trans float[] + * @param rotate float[] + * @param scale float[] + * @param smokeType String + * @param smokeFX ArrayList + * @param explosionType String + * @param explosionFX ArrayList + * @see RenderRollingStock + */ + RenderEnum(Class entityClass, ModelBase model, String texture, boolean multiTexture, float[] trans, float[] rotate, float[] scale, String smokeType, int smokeIterations, ArrayList smokeFX, String explosionType, ArrayList explosionFX, int explosionFXIterations, boolean hasSmokeOnSlopes) { + this.entityClass = entityClass; + this.model = model; + this.texture = texture; + this.multiTexture = multiTexture; + this.trans = trans; + this.rotate = rotate; + this.scale = scale; + this.smokeType = smokeType; + this.smokeFX = smokeFX; + this.explosionType = explosionType; + this.explosionFX = explosionFX; + this.smokeIterations = smokeIterations; + this.explosionFXIterations = explosionFXIterations; + this.hasSmokeOnSlopes = hasSmokeOnSlopes; + } + + @Override + public Class getEntityClass() { + return entityClass; + } + + @Override + public ModelBase getModel() { + return model; + } + + public boolean getIsMultiTextured() { + return multiTexture; + } + + @Override + public boolean hasSmoke() { + return !smokeType.isEmpty(); + } + + @Override + public boolean hasSmokeOnSlopes() { + return hasSmokeOnSlopes; + } + + @Override + public String getSmokeType() { + return smokeType; + } + + @Override + public ArrayList getSmokeFX() { + return smokeFX; + } + + @Override + public String getExplosionType() { + return explosionType; + } + + @Override + public boolean hasExplosion() { + return !explosionType.isEmpty(); + } + + @Override + public ArrayList getExplosionFX() { + return explosionFX; + } + + @Override + public float[] getTrans() { + return trans; + } + + @Override + public float[] getRotate() { + return rotate; + } + + @Override + public float[] getScale() { + return scale; + } + + @Override + public ResourceLocation getTextureFile(String colorString) { + if (multiTexture) { + return new ResourceLocation(Info.resourceLocation, Info.trainsPrefix + texture + colorString + ".png"); + } else { + return new ResourceLocation(Info.resourceLocation, Info.trainsPrefix + texture + ".png"); + } + } + + @Override + public int getSmokeIterations() { + return smokeIterations; + } + + @Override + public int getExplosionFXIterations() { + return explosionFXIterations; + } } diff --git a/src/main/java/train/client/render/RenderGeneratorDiesel.java b/src/main/java/train/client/render/RenderGeneratorDiesel.java index b9818aa599..b653fbdd92 100644 --- a/src/main/java/train/client/render/RenderGeneratorDiesel.java +++ b/src/main/java/train/client/render/RenderGeneratorDiesel.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -17,27 +17,27 @@ public class RenderGeneratorDiesel extends TileEntitySpecialRenderer { - private static final ModelGeneratorDiesel modelGenerator = new ModelGeneratorDiesel((float) (1.0 / 16.0)); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "generator_diesel.png"); + private static final ModelGeneratorDiesel modelGenerator = new ModelGeneratorDiesel((float) (1.0 / 16.0)); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "generator_diesel.png"); - public RenderGeneratorDiesel() { - } + public RenderGeneratorDiesel() { + } - public void render(TileEntity var1, double x, double y, double z) { - GL11.glPushMatrix(); + public void render(TileEntity var1, double x, double y, double z) { + GL11.glPushMatrix(); - GL11.glTranslated(x, y, z); - tmt.Tessellator.bindTexture(texture); + GL11.glTranslated(x, y, z); + tmt.Tessellator.bindTexture(texture); - //System.out.println(((TileStopper) var1).getFacing()); - GL11.glTranslatef(0.5F, 0.0F, 0.5F); - modelGenerator.render(0.0625F, ((TileGeneratorDiesel) var1).getFacing()); + //System.out.println(((TileStopper) var1).getFacing()); + GL11.glTranslatef(0.5F, 0.0F, 0.5F); + modelGenerator.render(0.0625F, ((TileGeneratorDiesel) var1).getFacing()); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - @Override - public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { - render(var1, var2, var4, var6); - } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { + render(var1, var2, var4, var6); + } } diff --git a/src/main/java/train/client/render/RenderLasersLines.java b/src/main/java/train/client/render/RenderLasersLines.java index 034b493e44..f68def5f3e 100644 --- a/src/main/java/train/client/render/RenderLasersLines.java +++ b/src/main/java/train/client/render/RenderLasersLines.java @@ -9,65 +9,67 @@ import train.common.entity.EntityLasersLines; public class RenderLasersLines extends Render { - /** instance of ModelBoat for rendering */ - private static final ModelBase model = new ModelBase() {}; - private ModelRenderer box; + /** + * instance of ModelBoat for rendering + */ + private static final ModelBase model = new ModelBase() { + }; + private final ModelRenderer box; - public RenderLasersLines() { - this.shadowSize = 0.5F; - box = new ModelRenderer(model, 0, 0); - box.addBox(0, -0.5F, -0.5F, 16, 1, 1); - box.rotationPointX = 0; - box.rotationPointY = 0; - box.rotationPointZ = 0; - } + public RenderLasersLines() { + this.shadowSize = 0.5F; + box = new ModelRenderer(model, 0, 0); + box.addBox(0, -0.5F, -0.5F, 16, 1, 1); + box.rotationPointX = 0; + box.rotationPointY = 0; + box.rotationPointZ = 0; + } - /** - * The render method used in RenderBoat that renders the boat model. - */ - public void renderLasersLines(EntityLasersLines en, double x, double y, double z, float f, float f1) { - if (en.hidden ^ en.isDead) { - return; - } + /** + * The render method used in RenderBoat that renders the boat model. + */ + public void renderLasersLines(EntityLasersLines en, double x, double y, double z, float f, float f1) { + if (en.hidden ^ en.isDead) { + return; + } - GL11.glPushMatrix(); - GL11.glTranslated(x, y, z); - GL11.glRotatef((float) en.angleZ, 0, 1, 0); - GL11.glRotatef((float) en.angleY, 0, 0, 1); + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + GL11.glRotatef((float) en.angleZ, 0, 1, 0); + GL11.glRotatef((float) en.angleY, 0, 0, 1); - //en.getTexture(); - //loadTexture(en.getTexture()); - float lasti = 0; + //en.getTexture(); + //loadTexture(en.getTexture()); + float lasti = 0; - for (float i = 0; i <= en.renderSize - 1; ++i) { - getBox(en).render(1.0F / 16.0F); - GL11.glTranslated(1, 0, 0); - lasti = i; - } + for (float i = 0; i <= en.renderSize - 1; ++i) { + getBox(en).render(1.0F / 16.0F); + GL11.glTranslated(1, 0, 0); + lasti = i; + } - lasti++; + lasti++; - GL11.glScalef(((float) en.renderSize - lasti), 1, 1); - getBox(en).render(1); - GL11.glPopMatrix(); - } + GL11.glScalef(((float) en.renderSize - lasti), 1, 1); + getBox(en).render(1); + GL11.glPopMatrix(); + } - protected ModelRenderer getBox(EntityLasersLines laser) { - return box; - } + protected ModelRenderer getBox(EntityLasersLines laser) { + return box; + } - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic (Render> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float var13 = (((var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float var14 = (((var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - GL11.glTranslatef(var12, var13, var14); - double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * time; - double var17 = cart.lastTickPosY + (cart.posY - cart.lastTickPosY) * time; - double var19 = cart.lastTickPosZ + (cart.posZ - cart.lastTickPosZ) * time; - Vec3 var23 = cart.func_70489_a(var15, var17, var19); - float pitch = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * time; - Vec3 renderYVect = cart.yVector(var15, var17, var19);//only on TC rails - if (var23 != null) { - Vec3 var25 = cart.func_70495_a(var15, var17, var19, 0.30000001192092896D); - Vec3 var26 = cart.func_70495_a(var15, var17, var19, -0.30000001192092896D); - - if (var25 == null) { - var25 = var23; - } - - if (var26 == null) { - var26 = var23; - } - - x += var23.xCoord - var15; - y += (var25.yCoord + var26.yCoord) / 2.0D - var17; - z += var23.zCoord - var19; - Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord); - - if (var27.lengthVector() != 0.0D) { - var27 = var27.normalize(); - yaw = TraincraftUtil.atan2degreesf(var27.zCoord, var27.xCoord); - pitch = (float) (Math.atan(var27.yCoord) * 73.0D); - } - - }else if (renderYVect != null) {//only on TC rails - Vec3 var25 = cart.renderY(var15, var17, var19, 0.30000001192092896D); - Vec3 var26 = cart.renderY(var15, var17, var19, -0.30000001192092896D); - - if (var25 == null) { - var25 = renderYVect; - } - - if (var26 == null) { - var26 = renderYVect; - } - y += (var25.yCoord + var26.yCoord) / 2.0D - var17; - } - - yaw %= 360.0F; - if (yaw < 0.0F) { - yaw += 360.0F; - } - yaw += 360.0F; - - float serverYaw = (cart.rotationYaw + 180) % 360; - if (serverYaw < 0.0F) { - serverYaw += 360.0F; - } - serverYaw += 360.0F; - if (Math.abs(yaw - serverYaw) > 90.0F) { - yaw += 180.0F; - pitch = -pitch; - } + private static final Random random = new Random(); + + public RenderRollingStock() { + this.shadowSize = 0.5F; + } + + /** + * Renders the Minecart. + */ + public static void renderTheMinecart(EntityRollingStock cart, double x, double y, double z, float yaw, float time) { + Tessellator.bindTexture(getTexture(cart)); + GL11.glPushMatrix(); + long var10 = cart.getEntityId() * 493286711L; + var10 = var10 * var10 * 4392167121L + var10 * 98761L; + float var12 = (((var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float var13 = (((var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float var14 = (((var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + GL11.glTranslatef(var12, var13, var14); + double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * time; + double var17 = cart.lastTickPosY + (cart.posY - cart.lastTickPosY) * time; + double var19 = cart.lastTickPosZ + (cart.posZ - cart.lastTickPosZ) * time; + Vec3 var23 = cart.func_70489_a(var15, var17, var19); + float pitch = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * time; + Vec3 renderYVect = cart.yVector(var15, var17, var19);//only on TC rails + if (var23 != null) { + Vec3 var25 = cart.func_70495_a(var15, var17, var19, 0.30000001192092896D); + Vec3 var26 = cart.func_70495_a(var15, var17, var19, -0.30000001192092896D); + + if (var25 == null) { + var25 = var23; + } + + if (var26 == null) { + var26 = var23; + } + + x += var23.xCoord - var15; + y += (var25.yCoord + var26.yCoord) / 2.0D - var17; + z += var23.zCoord - var19; + Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord); + + if (var27.lengthVector() != 0.0D) { + var27 = var27.normalize(); + yaw = TraincraftUtil.atan2degreesf(var27.zCoord, var27.xCoord); + pitch = (float) (Math.atan(var27.yCoord) * 73.0D); + } + + } else if (renderYVect != null) {//only on TC rails + Vec3 var25 = cart.renderY(var15, var17, var19, 0.30000001192092896D); + Vec3 var26 = cart.renderY(var15, var17, var19, -0.30000001192092896D); + + if (var25 == null) { + var25 = renderYVect; + } + + if (var26 == null) { + var26 = renderYVect; + } + y += (var25.yCoord + var26.yCoord) / 2.0D - var17; + } + + yaw %= 360.0F; + if (yaw < 0.0F) { + yaw += 360.0F; + } + yaw += 360.0F; + + float serverYaw = (cart.rotationYaw + 180) % 360; + if (serverYaw < 0.0F) { + serverYaw += 360.0F; + } + serverYaw += 360.0F; + if (Math.abs(yaw - serverYaw) > 90.0F) { + yaw += 180.0F; + pitch = -pitch; + } /*if (var23 == null && Math.abs(yaw - serverYaw) < 90.0D) { pitch = -pitch; }*/ - //System.out.println(Math.abs(yaw - serverYaw)); - //System.out.println("yaw after "+yaw+" server yaw after "+serverYaw); - - GL11.glTranslatef((float) x, (float) y, (float) z); - int i = MathHelper.floor_double(cart.posX); - int j = MathHelper.floor_double(cart.posY); - int k = MathHelper.floor_double(cart.posZ); - - // NOTE: func_150049_b_ = isRailBlockAt - if (cart.worldObj != null && (BlockRailBase.func_150049_b_(cart.worldObj, i, j, k) - || BlockRailBase.func_150049_b_(cart.worldObj, i, j - 1, k))) { - cart.setMountedYOffset(-0.55); - } else if (cart.posYFromServer != 0) { - cart.setMountedYOffset(-0.5); - GL11.glTranslatef(0f, -0.30f, 0f); - } - if(cart.worldObj != null && cart.worldObj.getBlock(i,j,k).getClass().getName().equals("ebf.tim.blocks.rails.BlockRailCore")){ - GL11.glTranslatef(0f, 0.15f, 0f); - } - if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ - //GL11.glRotatef((float)(90-cart.rotationYawClientReal), 0.0F, 1.0F, 0.0F); - if (cart.oldClientYaw == 0) cart.oldClientYaw = cart.rotationYawClientReal; - - float rotationYawBogie = cart.rotationYawClientReal; - float tempYaw = (cart.rotationYawClientReal - cart.oldClientYaw); - float newYaw = 0; - //System.out.println("rotationYawBogie "+rotationYawBogie+" oldYaw "+cart.oldClientYaw+" tempYaw "+(Math.abs(tempYaw)/10)); - //System.out.println(Math.abs(cart.oldClientYaw-rotationYawBogie)); - if(Math.abs(cart.oldClientYaw-rotationYawBogie)>170){ - cart.oldClientYaw = rotationYawBogie; - } - if (cart.oldClientYaw != rotationYawBogie && Math.abs(cart.oldClientYaw-rotationYawBogie)>(Math.abs(tempYaw)/10)) { - newYaw = cart.oldClientYaw + Math.copySign((Math.abs(tempYaw)/10), tempYaw); - cart.oldClientYaw += Math.copySign((Math.abs(tempYaw)/10), tempYaw); - } - else { - newYaw = rotationYawBogie; - cart.oldClientYaw = rotationYawBogie; - } - //System.out.println("newYaw "+newYaw); - //System.out.println(90 - cart.rotationYawClientReal); - GL11.glRotatef((90.0f-newYaw), 0.0F, 1.0F, 0.0F); - cart.setRenderYaw(newYaw); - cart.setRenderPitch(pitch); - } - else { - // NOTE: func_150049_b_ = isRailBlockAt - if (cart.worldObj!=null && (BlockRailBase.func_150049_b_(cart.worldObj, i, j, k) || BlockRailBase.func_150049_b_(cart.worldObj, i, j-1, k) )){ - if(cart.isClientInReverse){ - yaw+=180; - pitch = -pitch; - } - GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); - cart.setRenderYaw(yaw); - cart.setRenderPitch(pitch); - }else{ - if (cart.oldClientYaw == 0) cart.oldClientYaw = cart.rotationYawClientReal; - - float rotationYaw = cart.rotationYawClientReal; - float tempYaw = (cart.rotationYawClientReal - cart.oldClientYaw); - float newYaw = 0; - //System.out.println("rotationYawBogie "+rotationYawBogie+" oldYaw "+cart.oldClientYaw+" tempYaw "+(Math.abs(tempYaw)/10)); - //System.out.println(Math.abs(cart.oldClientYaw-rotationYawBogie)); - if(Math.abs(cart.oldClientYaw-rotationYaw)>170){ - cart.oldClientYaw = rotationYaw; - } - if (cart.oldClientYaw != rotationYaw && Math.abs(cart.oldClientYaw-rotationYaw)>(Math.abs(tempYaw)/10)) { - newYaw = cart.oldClientYaw + Math.copySign((Math.abs(tempYaw)/10), tempYaw); - cart.oldClientYaw += Math.copySign((Math.abs(tempYaw)/10), tempYaw); - } - else { - newYaw = rotationYaw; - cart.oldClientYaw = rotationYaw; - } - GL11.glRotatef((90.0f-(newYaw+90.0f)), 0.0F, 1.0F, 0.0F); - cart.setRenderYaw(yaw); - cart.setRenderPitch(pitch); - } - } - - //if(cart.bogie!=null)cart.worldObj.spawnParticle("reddust", cart.bogie.posX, cart.bogie.posY, cart.bogie.posZ, 0.1, 0.4, 0.1); - - //GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); - if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ - GL11.glRotatef((float) -cart.anglePitchClient, 0.0F, 0.0F, 1.0F); - } - else { - if(renderYVect != null){ - pitch = (float)cart.anglePitchClient/60; - if(cart.rotationYawClientReal>-5 && cart.rotationYawClientReal<5){ - pitch=-pitch; - } - if(!cart.isClientInReverse && (cart.rotationYawClientReal>85 && cart.rotationYawClientReal<95 )){ - pitch=-pitch; - } - if(cart.isClientInReverse && (cart.rotationYawClientReal<-265 && cart.rotationYawClientReal>-275 )){ - pitch=-pitch; - } - GL11.glRotatef(pitch, 0.0F, 0.0F, 1.0F); - } - else{ - GL11.glRotatef(-pitch, 0.0F, 0.0F, 1.0F); - } - } - float var28 = cart.getRollingAmplitude() - time; - float var30 = cart.getDamage() - time; - - if (var30 < 0.0F) { - var30 = 0.0F; - } - - if (var28 > 0.0F) { - float angle = MathHelper.sin(var28) * var28 * var30 / 10.0F; - angle = Math.min(angle, 0.8F); - angle = Math.copySign(angle, cart.getRollingDirection()); - GL11.glRotatef(angle, 1.0F, 0.0F, 0.0F); - } - TrainRenderRecord render = Traincraft.instance.traincraftRegistry.getTrainRenderRecord(cart.getClass()); - if (render != null) { - //loadTexture(getTextureFile(renders.getTexture(), renders.getIsMultiTextured(), cart)); - - try { - if (render.getModel().getClass().getDeclaredMethod("getTrans") != null) { - Method theTransMethod = render.getModel().getClass().getDeclaredMethod("getTrans"); - float[] theTrans = (float[]) theTransMethod.invoke(render.getModel().getClass().newInstance()); - if (theTrans != null) { - GL11.glTranslatef(theTrans[0], theTrans[1], theTrans[2]); - } - - } - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (Exception e){ - if (render.getTrans() != null) { - GL11.glTranslatef(render.getTrans()[0], render.getTrans()[1], render.getTrans()[2]); - } - } + //System.out.println(Math.abs(yaw - serverYaw)); + //System.out.println("yaw after "+yaw+" server yaw after "+serverYaw); + + GL11.glTranslatef((float) x, (float) y, (float) z); + int i = MathHelper.floor_double(cart.posX); + int j = MathHelper.floor_double(cart.posY); + int k = MathHelper.floor_double(cart.posZ); + + // NOTE: func_150049_b_ = isRailBlockAt + if (cart.worldObj != null && (BlockRailBase.func_150049_b_(cart.worldObj, i, j, k) + || BlockRailBase.func_150049_b_(cart.worldObj, i, j - 1, k))) { + cart.setMountedYOffset(-0.55); + } else if (cart.posYFromServer != 0) { + cart.setMountedYOffset(-0.5); + GL11.glTranslatef(0f, -0.30f, 0f); + } + if (cart.worldObj != null && cart.worldObj.getBlock(i, j, k).getClass().getName().equals("ebf.tim.blocks.rails.BlockRailCore")) { + GL11.glTranslatef(0f, 0.15f, 0f); + } + if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ + //GL11.glRotatef((float)(90-cart.rotationYawClientReal), 0.0F, 1.0F, 0.0F); + if (cart.oldClientYaw == 0) cart.oldClientYaw = cart.rotationYawClientReal; + + float rotationYawBogie = cart.rotationYawClientReal; + float tempYaw = (cart.rotationYawClientReal - cart.oldClientYaw); + float newYaw = 0; + //System.out.println("rotationYawBogie "+rotationYawBogie+" oldYaw "+cart.oldClientYaw+" tempYaw "+(Math.abs(tempYaw)/10)); + //System.out.println(Math.abs(cart.oldClientYaw-rotationYawBogie)); + if (Math.abs(cart.oldClientYaw - rotationYawBogie) > 170) { + cart.oldClientYaw = rotationYawBogie; + } + if (cart.oldClientYaw != rotationYawBogie && Math.abs(cart.oldClientYaw - rotationYawBogie) > (Math.abs(tempYaw) / 10)) { + newYaw = cart.oldClientYaw + Math.copySign((Math.abs(tempYaw) / 10), tempYaw); + cart.oldClientYaw += Math.copySign((Math.abs(tempYaw) / 10), tempYaw); + } else { + newYaw = rotationYawBogie; + cart.oldClientYaw = rotationYawBogie; + } + //System.out.println("newYaw "+newYaw); + //System.out.println(90 - cart.rotationYawClientReal); + GL11.glRotatef((90.0f - newYaw), 0.0F, 1.0F, 0.0F); + cart.setRenderYaw(newYaw); + cart.setRenderPitch(pitch); + } else { + // NOTE: func_150049_b_ = isRailBlockAt + if (cart.worldObj != null && (BlockRailBase.func_150049_b_(cart.worldObj, i, j, k) || BlockRailBase.func_150049_b_(cart.worldObj, i, j - 1, k))) { + if (cart.isClientInReverse) { + yaw += 180; + pitch = -pitch; + } + GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); + cart.setRenderYaw(yaw); + cart.setRenderPitch(pitch); + } else { + if (cart.oldClientYaw == 0) cart.oldClientYaw = cart.rotationYawClientReal; + + float rotationYaw = cart.rotationYawClientReal; + float tempYaw = (cart.rotationYawClientReal - cart.oldClientYaw); + float newYaw = 0; + //System.out.println("rotationYawBogie "+rotationYawBogie+" oldYaw "+cart.oldClientYaw+" tempYaw "+(Math.abs(tempYaw)/10)); + //System.out.println(Math.abs(cart.oldClientYaw-rotationYawBogie)); + if (Math.abs(cart.oldClientYaw - rotationYaw) > 170) { + cart.oldClientYaw = rotationYaw; + } + if (cart.oldClientYaw != rotationYaw && Math.abs(cart.oldClientYaw - rotationYaw) > (Math.abs(tempYaw) / 10)) { + newYaw = cart.oldClientYaw + Math.copySign((Math.abs(tempYaw) / 10), tempYaw); + cart.oldClientYaw += Math.copySign((Math.abs(tempYaw) / 10), tempYaw); + } else { + newYaw = rotationYaw; + cart.oldClientYaw = rotationYaw; + } + GL11.glRotatef((90.0f - (newYaw + 90.0f)), 0.0F, 1.0F, 0.0F); + cart.setRenderYaw(yaw); + cart.setRenderPitch(pitch); + } + } + + //if(cart.bogie!=null)cart.worldObj.spawnParticle("reddust", cart.bogie.posX, cart.bogie.posY, cart.bogie.posZ, 0.1, 0.4, 0.1); + + //GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); + if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ + GL11.glRotatef((float) -cart.anglePitchClient, 0.0F, 0.0F, 1.0F); + } else { + if (renderYVect != null) { + pitch = (float) cart.anglePitchClient / 60; + if (cart.rotationYawClientReal > -5 && cart.rotationYawClientReal < 5) { + pitch = -pitch; + } + if (!cart.isClientInReverse && (cart.rotationYawClientReal > 85 && cart.rotationYawClientReal < 95)) { + pitch = -pitch; + } + if (cart.isClientInReverse && (cart.rotationYawClientReal < -265 && cart.rotationYawClientReal > -275)) { + pitch = -pitch; + } + GL11.glRotatef(pitch, 0.0F, 0.0F, 1.0F); + } else { + GL11.glRotatef(-pitch, 0.0F, 0.0F, 1.0F); + } + } + float var28 = cart.getRollingAmplitude() - time; + float var30 = cart.getDamage() - time; + + if (var30 < 0.0F) { + var30 = 0.0F; + } + + if (var28 > 0.0F) { + float angle = MathHelper.sin(var28) * var28 * var30 / 10.0F; + angle = Math.min(angle, 0.8F); + angle = Math.copySign(angle, cart.getRollingDirection()); + GL11.glRotatef(angle, 1.0F, 0.0F, 0.0F); + } + TrainRenderRecord render = Traincraft.instance.traincraftRegistry.getTrainRenderRecord(cart.getClass()); + if (render != null) { + //loadTexture(getTextureFile(renders.getTexture(), renders.getIsMultiTextured(), cart)); + + try { + if (render.getModel().getClass().getDeclaredMethod("getTrans") != null) { + Method theTransMethod = render.getModel().getClass().getDeclaredMethod("getTrans"); + float[] theTrans = (float[]) theTransMethod.invoke(render.getModel().getClass().newInstance()); + if (theTrans != null) { + GL11.glTranslatef(theTrans[0], theTrans[1], theTrans[2]); + } + + } + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (Exception e) { + if (render.getTrans() != null) { + GL11.glTranslatef(render.getTrans()[0], render.getTrans()[1], render.getTrans()[2]); + } + } /*if (renders.getTrans() != null) { GL11.glTranslatef(renders.getTrans()[0], renders.getTrans()[1], renders.getTrans()[2]); }*/ - try { - if (render.getModel().getClass().getDeclaredMethod("getRotate") != null) { - Method theTransMethod = render.getModel().getClass().getDeclaredMethod("getRotate"); - float[] theRotate = (float[]) theTransMethod.invoke(render.getModel().getClass().newInstance()); - if (theRotate != null) { - GL11.glRotatef(theRotate[0], 1.0F, 0.0F, 0.0F); - GL11.glRotatef(theRotate[1], 0.0F, 1.0F, 0.0F); - GL11.glRotatef(theRotate[2], 0.0F, 0.0F, 1.0F); - } - - } - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (Exception e) { - if (render.getRotate() != null) { - GL11.glRotatef(render.getRotate()[0], 1.0F, 0.0F, 0.0F); - GL11.glRotatef(render.getRotate()[1], 0.0F, 1.0F, 0.0F); - GL11.glRotatef(render.getRotate()[2], 0.0F, 0.0F, 1.0F); - } - } + try { + if (render.getModel().getClass().getDeclaredMethod("getRotate") != null) { + Method theTransMethod = render.getModel().getClass().getDeclaredMethod("getRotate"); + float[] theRotate = (float[]) theTransMethod.invoke(render.getModel().getClass().newInstance()); + if (theRotate != null) { + GL11.glRotatef(theRotate[0], 1.0F, 0.0F, 0.0F); + GL11.glRotatef(theRotate[1], 0.0F, 1.0F, 0.0F); + GL11.glRotatef(theRotate[2], 0.0F, 0.0F, 1.0F); + } + + } + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (Exception e) { + if (render.getRotate() != null) { + GL11.glRotatef(render.getRotate()[0], 1.0F, 0.0F, 0.0F); + GL11.glRotatef(render.getRotate()[1], 0.0F, 1.0F, 0.0F); + GL11.glRotatef(render.getRotate()[2], 0.0F, 0.0F, 1.0F); + } + } /*if (renders.getRotate() != null) { GL11.glRotatef(renders.getRotate()[0], 1.0F, 0.0F, 0.0F); @@ -274,22 +270,22 @@ public static void renderTheMinecart(EntityRollingStock cart, double x, double y GL11.glRotatef(renders.getRotate()[2], 0.0F, 0.0F, 1.0F); }*/ - try { - if (render.getModel().getClass().getDeclaredMethod("getScale") != null) { - Method theScaleMethod = render.getModel().getClass().getDeclaredMethod("getScale"); - float[] theRotate = (float[]) theScaleMethod.invoke(render.getModel().getClass().newInstance()); - if (theRotate != null) { - GL11.glScalef(theRotate[0], theRotate[1], theRotate[2]); - } - } - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (Exception e) { - if (render.getScale() != null) { - GL11.glScalef(render.getScale()[0], render.getScale()[1], render.getScale()[2]); - } + try { + if (render.getModel().getClass().getDeclaredMethod("getScale") != null) { + Method theScaleMethod = render.getModel().getClass().getDeclaredMethod("getScale"); + float[] theRotate = (float[]) theScaleMethod.invoke(render.getModel().getClass().newInstance()); + if (theRotate != null) { + GL11.glScalef(theRotate[0], theRotate[1], theRotate[2]); + } + } + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (Exception e) { + if (render.getScale() != null) { + GL11.glScalef(render.getScale()[0], render.getScale()[1], render.getScale()[2]); + } - } + } /*if (renders.getScale() != null) { @@ -297,158 +293,155 @@ public static void renderTheMinecart(EntityRollingStock cart, double x, double y }*/ - - GL11.glEnable(GL11.GL_LIGHTING); - int skyLight = cart.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyLight % 65536, - skyLight / 65536f); - - - render.getModel().render(cart, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); - - //GL11.glEnable(GL11.GL_LIGHTING); - - if (render.hasSmoke()) { - ArrayList smokePosition = new ArrayList(); - try { - if (render.getModel().getClass().getDeclaredMethod("getSmokePosition") != null) { - Method theScaleMethod = render.getModel().getClass().getDeclaredMethod("getSmokePosition"); - ArrayList thePos = (ArrayList) theScaleMethod.invoke(render.getModel().getClass().newInstance()); - if (thePos != null) { - smokePosition = thePos; - } - } - } catch (Exception e) { - - smokePosition = render.getSmokeFX(); - } - - if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ - renderSmokeFX(cart, 90 + cart.rotationYawClientReal, (float) cart.anglePitchClient, render.getSmokeType(), smokePosition, render.getSmokeIterations(), time, render.hasSmokeOnSlopes()); - } - else { - renderSmokeFX(cart, (yaw), pitch, render.getSmokeType(), smokePosition, render.getSmokeIterations(), time, render.hasSmokeOnSlopes()); - } - } - if (render.hasExplosion()) { - if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ - renderExplosionFX(cart, 90 + cart.rotationYawClientReal, (float) cart.anglePitchClient, render.getExplosionType(), render.getExplosionFX(), render.getExplosionFXIterations(), render.hasSmokeOnSlopes()); - } - else { - renderExplosionFX(cart, yaw, pitch, render.getExplosionType(), render.getExplosionFX(), render.getExplosionFXIterations(), render.hasSmokeOnSlopes()); - } - } - } - - GL11.glPopMatrix(); - } - - private static void renderSmokeFX(EntityRollingStock cart, float yaw, float pitch, String smokeType, ArrayList smokeFX, int smokeIterations, float time, boolean hasSmokeOnSlopes) { - if(cart instanceof Locomotive && !((Locomotive)cart).isLocoTurnedOn()){return;} - if(Math.abs(pitch)>30)return; - //if (pitch != 0 && !hasSmokeOnSlopes) { return; } - if ((cart instanceof Locomotive && ((Locomotive) cart).getFuel() > 0) || (cart instanceof EntityTracksBuilder && ((EntityTracksBuilder) cart).getFuel() > 0)) { - int r = random.nextInt(10 * smokeIterations); - double speed = 0; - if (cart instanceof Locomotive) speed = ((Locomotive) cart).getSpeed(); - if (r < ((smokeIterations * 4) + (speed * 5))) { - double rotatedvec[]; - for (int j = 0; j < smokeIterations; j++) { - - - for (double[] explosion : smokeFX) { - rotatedvec = rotatePointF(explosion[0], explosion[1], explosion[2], pitch, yaw); - cart.worldObj.spawnParticle(smokeType, - cart.posX + rotatedvec[0], cart.posY + rotatedvec[1], cart.posZ +rotatedvec[2], - 0,0,0); - } - } - } - } - } - public static final float radianF = (float) Math.PI / 180.0f; - public static double[] rotatePointF(double x, double y, double z, float pitch, float yaw) { - double[] xyz = new double[]{x,y,z}; - float sin, cos; - //rotate pitch - if (pitch != 0.0F) { - pitch *= radianF; - cos = MathHelper.cos(pitch); - sin = MathHelper.sin(pitch); - - xyz[0] = (y * sin) + (x * cos); - xyz[1] = (y * cos) - (x * sin); - } - //rotate yaw - if (yaw != 0.0F) { - yaw *= radianF; - cos = MathHelper.cos(yaw); - sin = MathHelper.sin(yaw); - - xyz[0] = (x * cos) - (z * sin); - xyz[2] = (x * sin) + (z * cos); - } - - return xyz; - } - - - private static void renderExplosionFX(EntityRollingStock cart, float yaw, float pitch, String explosionType, ArrayList explosionFX, int explosionFXIterations, boolean hasSmokeOnSlopes) { - if(cart instanceof Locomotive && !((Locomotive)cart).isLocoTurnedOn())return; - float yawMod = yaw % 360; - double pitchRads = Math.toDegrees(pitch); - //if (pitch != 0 && !hasSmokeOnSlopes) { return; } - if(Math.abs(pitch)>30)return; - if (cart instanceof Locomotive && ((Locomotive) cart).getFuel() > 0) { - int r = random.nextInt(300); - if (r < (explosionFXIterations * 10)) { - for (int j = 0; j < explosionFXIterations; j++) { - if (yawMod == 180) { - for (double[] explosion : explosionFX) { - cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads)* 4 * -explosion[1])), cart.posZ + explosion[2], 0.0D, 0.0D, 0.0D); - cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads)* 4 * -explosion[1])), cart.posZ - explosion[2], 0.0D, 0.0D, 0.0D); - } - } - else if (yawMod == 90) { - for (double[] explosion : explosionFX) { - cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads)*4 * -explosion[1])), cart.posZ + explosion[0], 0.0D, 0.0D, 0.0D); - cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads)*4 * -explosion[1])), cart.posZ + explosion[0], 0.0D, 0.0D, 0.0D); - } - } - else if (yawMod == 0) { - for (double[] explosion : explosionFX) { - cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads)*4 * -explosion[1])), cart.posZ + explosion[2], 0.0D, 0.0D, 0.0D); - cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads)*4 * -explosion[1])), cart.posZ - explosion[2], 0.0D, 0.0D, 0.0D); - } - } - else if (yawMod == -90) { - for (double[] explosion : explosionFX) { - cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads)*4 * -explosion[1])), cart.posZ - explosion[0], 0.0D, 0.0D, 0.0D); - cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads)*4 * -explosion[1])), cart.posZ - explosion[0], 0.0D, 0.0D, 0.0D); - } - } - } - } - } - } - - @Override - public void doRender(Entity par1Entity, double x, double y, double d2, float yaw, float time) { - renderTheMinecart((EntityRollingStock) par1Entity, x, y, d2, yaw, time); - } - - - - //@Override - protected ResourceLocation getEntityTexture(Entity entity) { - return getTexture(entity); - } - - public static ResourceLocation getTexture(Entity entity) { - TrainRenderRecord render = Traincraft.instance.traincraftRegistry.getTrainRenderRecord(entity.getClass()); - if (render != null) { - return render.getTextureFile(((EntityRollingStock) entity).getColor()); - } - return null; - } + GL11.glEnable(GL11.GL_LIGHTING); + int skyLight = cart.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyLight % 65536, + skyLight / 65536f); + + + render.getModel().render(cart, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + + //GL11.glEnable(GL11.GL_LIGHTING); + + if (render.hasSmoke()) { + ArrayList smokePosition = new ArrayList(); + try { + if (render.getModel().getClass().getDeclaredMethod("getSmokePosition") != null) { + Method theScaleMethod = render.getModel().getClass().getDeclaredMethod("getSmokePosition"); + ArrayList thePos = (ArrayList) theScaleMethod.invoke(render.getModel().getClass().newInstance()); + if (thePos != null) { + smokePosition = thePos; + } + } + } catch (Exception e) { + + smokePosition = render.getSmokeFX(); + } + + if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ + renderSmokeFX(cart, 90 + cart.rotationYawClientReal, (float) cart.anglePitchClient, render.getSmokeType(), smokePosition, render.getSmokeIterations(), time, render.hasSmokeOnSlopes()); + } else { + renderSmokeFX(cart, (yaw), pitch, render.getSmokeType(), smokePosition, render.getSmokeIterations(), time, render.hasSmokeOnSlopes()); + } + } + if (render.hasExplosion()) { + if (cart.bogieLoco != null) {// || cart.bogieUtility[0]!=null){ + renderExplosionFX(cart, 90 + cart.rotationYawClientReal, (float) cart.anglePitchClient, render.getExplosionType(), render.getExplosionFX(), render.getExplosionFXIterations(), render.hasSmokeOnSlopes()); + } else { + renderExplosionFX(cart, yaw, pitch, render.getExplosionType(), render.getExplosionFX(), render.getExplosionFXIterations(), render.hasSmokeOnSlopes()); + } + } + } + + GL11.glPopMatrix(); + } + + private static void renderSmokeFX(EntityRollingStock cart, float yaw, float pitch, String smokeType, ArrayList smokeFX, int smokeIterations, float time, boolean hasSmokeOnSlopes) { + if (cart instanceof Locomotive && !((Locomotive) cart).isLocoTurnedOn()) { + return; + } + if (Math.abs(pitch) > 30) return; + //if (pitch != 0 && !hasSmokeOnSlopes) { return; } + if ((cart instanceof Locomotive && ((Locomotive) cart).getFuel() > 0) || (cart instanceof EntityTracksBuilder && ((EntityTracksBuilder) cart).getFuel() > 0)) { + int r = random.nextInt(10 * smokeIterations); + double speed = 0; + if (cart instanceof Locomotive) speed = ((Locomotive) cart).getSpeed(); + if (r < ((smokeIterations * 4) + (speed * 5))) { + double rotatedvec[]; + for (int j = 0; j < smokeIterations; j++) { + + + for (double[] explosion : smokeFX) { + rotatedvec = rotatePointF(explosion[0], explosion[1], explosion[2], pitch, yaw); + cart.worldObj.spawnParticle(smokeType, + cart.posX + rotatedvec[0], cart.posY + rotatedvec[1], cart.posZ + rotatedvec[2], + 0, 0, 0); + } + } + } + } + } + + public static final float radianF = (float) Math.PI / 180.0f; + + public static double[] rotatePointF(double x, double y, double z, float pitch, float yaw) { + double[] xyz = new double[]{x, y, z}; + float sin, cos; + //rotate pitch + if (pitch != 0.0F) { + pitch *= radianF; + cos = MathHelper.cos(pitch); + sin = MathHelper.sin(pitch); + + xyz[0] = (y * sin) + (x * cos); + xyz[1] = (y * cos) - (x * sin); + } + //rotate yaw + if (yaw != 0.0F) { + yaw *= radianF; + cos = MathHelper.cos(yaw); + sin = MathHelper.sin(yaw); + + xyz[0] = (x * cos) - (z * sin); + xyz[2] = (x * sin) + (z * cos); + } + + return xyz; + } + + + private static void renderExplosionFX(EntityRollingStock cart, float yaw, float pitch, String explosionType, ArrayList explosionFX, int explosionFXIterations, boolean hasSmokeOnSlopes) { + if (cart instanceof Locomotive && !((Locomotive) cart).isLocoTurnedOn()) return; + float yawMod = yaw % 360; + double pitchRads = Math.toDegrees(pitch); + //if (pitch != 0 && !hasSmokeOnSlopes) { return; } + if (Math.abs(pitch) > 30) return; + if (cart instanceof Locomotive && ((Locomotive) cart).getFuel() > 0) { + int r = random.nextInt(300); + if (r < (explosionFXIterations * 10)) { + for (int j = 0; j < explosionFXIterations; j++) { + if (yawMod == 180) { + for (double[] explosion : explosionFX) { + cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ + explosion[2], 0.0D, 0.0D, 0.0D); + cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ - explosion[2], 0.0D, 0.0D, 0.0D); + } + } else if (yawMod == 90) { + for (double[] explosion : explosionFX) { + cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ + explosion[0], 0.0D, 0.0D, 0.0D); + cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ + explosion[0], 0.0D, 0.0D, 0.0D); + } + } else if (yawMod == 0) { + for (double[] explosion : explosionFX) { + cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ + explosion[2], 0.0D, 0.0D, 0.0D); + cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[0], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ - explosion[2], 0.0D, 0.0D, 0.0D); + } + } else if (yawMod == -90) { + for (double[] explosion : explosionFX) { + cart.worldObj.spawnParticle(explosionType, cart.posX + explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ - explosion[0], 0.0D, 0.0D, 0.0D); + cart.worldObj.spawnParticle(explosionType, cart.posX - explosion[2], cart.posY + explosion[1] + ((Math.tan(pitchRads) * 4 * -explosion[1])), cart.posZ - explosion[0], 0.0D, 0.0D, 0.0D); + } + } + } + } + } + } + + @Override + public void doRender(Entity par1Entity, double x, double y, double d2, float yaw, float time) { + renderTheMinecart((EntityRollingStock) par1Entity, x, y, d2, yaw, time); + } + + + //@Override + protected ResourceLocation getEntityTexture(Entity entity) { + return getTexture(entity); + } + + public static ResourceLocation getTexture(Entity entity) { + TrainRenderRecord render = Traincraft.instance.traincraftRegistry.getTrainRenderRecord(entity.getClass()); + if (render != null) { + return render.getTextureFile(((EntityRollingStock) entity).getColor()); + } + return null; + } } diff --git a/src/main/java/train/client/render/RenderRotativeDigger.java b/src/main/java/train/client/render/RenderRotativeDigger.java index 6b89b9c028..8644b22ef4 100644 --- a/src/main/java/train/client/render/RenderRotativeDigger.java +++ b/src/main/java/train/client/render/RenderRotativeDigger.java @@ -11,48 +11,49 @@ public class RenderRotativeDigger extends Render { - private static final ModelBase modelRotaryExcavator = new ModelRotaryExcavator(); - - public RenderRotativeDigger() { - shadowSize = 0.5F; - } - - private void func_157_a(EntityRotativeDigger digger, double d, double d1, double d2, float f, float f1) { - GL11.glPushMatrix(); - GL11.glTranslatef((float) d, (float) d1, (float) d2); - GL11.glRotatef(90F - f, 0.0F, 1.0F, 0.0F); - /** - * Damage mouvements - */ - float f2 = (float) digger.boatTimeSinceHit - f1; - float f3 = (float) digger.boatCurrentDamage - f1; - if (f3 < 0.0F) { - f3 = 0.0F; - } - if (f2 > 0.0F) { - GL11.glRotatef(((MathHelper.sin(f2) * f2 * f3) / 10F) * (float) digger.boatRockDirection, 1.0F, 0.0F, 0.0F); - } - - /** - * Pitch - */ - /* float pitch = digger.pitch/1.5F; - * - * if(pitch>30){ pitch=30; } if(pitch<-30){ pitch=-30; } GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F); */ - - GL11.glTranslatef(0.0F, 0.5F, 0.0F); - //loadTexture(Info.trainsPrefix + "rotaryExcavator.png"); - modelRotaryExcavator.render(digger, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); - GL11.glPopMatrix(); - } - @Override - public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { - func_157_a((EntityRotativeDigger) entity, d, d1, d2, f, f1); - } - - - @Override - protected ResourceLocation getEntityTexture(Entity entity) { - return null; - } + private static final ModelBase modelRotaryExcavator = new ModelRotaryExcavator(); + + public RenderRotativeDigger() { + shadowSize = 0.5F; + } + + private void render(EntityRotativeDigger digger, double x, double y, double z, float yaw, float f1) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(90F - yaw, 0.0F, 1.0F, 0.0F); + + // Damage movements + float f2 = (float) digger.boatTimeSinceHit - f1; + float f3 = (float) digger.boatCurrentDamage - f1; + if (f3 < 0.0F) { + f3 = 0.0F; + } + + if (f2 > 0.0F) { + GL11.glRotatef(((MathHelper.sin(f2) * f2 * f3) / 10F) * (float) digger.boatRockDirection, 1.0F, 0.0F, 0.0F); + } + + /** + * Pitch + */ + /* float pitch = digger.pitch/1.5F; + * + * if(pitch>30){ pitch=30; } if(pitch<-30){ pitch=-30; } GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F); */ + + GL11.glTranslatef(0.0F, 0.5F, 0.0F); + //loadTexture(Info.trainsPrefix + "rotaryExcavator.png"); + modelRotaryExcavator.render(digger, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + @Override + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + render((EntityRotativeDigger) entity, d, d1, d2, f, f1); + } + + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return null; + } } diff --git a/src/main/java/train/client/render/RenderRotativeWheel.java b/src/main/java/train/client/render/RenderRotativeWheel.java index 999500d8b8..8c521d6153 100644 --- a/src/main/java/train/client/render/RenderRotativeWheel.java +++ b/src/main/java/train/client/render/RenderRotativeWheel.java @@ -10,48 +10,47 @@ import train.common.entity.digger.EntityRotativeWheel; public class RenderRotativeWheel extends Render { + private long lastframe; + private float mvt = 0.0F; - private long lastframe; - private float mvt = 0.0F; - private EntityRotativeDigger entity; - - private static final ModelBase modelRotaryExcavator_Wheel = new ModelRotaryExcavator_Wheel(); - - public RenderRotativeWheel() { - //shadowSize = 0.5F; - lastframe = System.nanoTime(); - - } - - private void func_157_a(EntityRotativeWheel wheel, double d, double d1, double d2, float f) { - GL11.glPushMatrix(); - GL11.glTranslatef((float) d, (float) d1, (float) d2); - GL11.glRotatef(90F - f, 0.0F, 1.0F, 0.0F); - - GL11.glTranslatef(0.0F, 0.5F, 0.0F); - GL11.glScalef(0.4F, 0.6F, 0.6F); - - entity = (EntityRotativeDigger) wheel.entity; - if (entity != null && entity.getFuel() > 0) { - long now = System.nanoTime(); - int elapsed = (int) ((now - lastframe) / (1000 * 1000)); - mvt -= (float) elapsed / 300.0f; - lastframe = now; - - GL11.glRotatef((mvt + 0.4188790204786391F) * 100, 1F, 0F, 0F); - } - //loadTexture(Info.trainsPrefix + "rotativeExcavatorWheel.png"); - modelRotaryExcavator_Wheel.render(wheel, 0.0F, +0.2F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL11.glPopMatrix(); - } - @Override - public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { - func_157_a((EntityRotativeWheel) entity, d, d1, d2, f); - } - - - @Override - protected ResourceLocation getEntityTexture(Entity entity) { - return null; - } + private static final ModelBase modelRotaryExcavator_Wheel = new ModelRotaryExcavator_Wheel(); + + public RenderRotativeWheel() { + //shadowSize = 0.5F; + lastframe = System.nanoTime(); + + } + + private void render(EntityRotativeWheel wheel, double x, double y, double z, float f) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(90F - f, 0.0F, 1.0F, 0.0F); + + GL11.glTranslatef(0.0F, 0.5F, 0.0F); + GL11.glScalef(0.4F, 0.6F, 0.6F); + + EntityRotativeDigger entity = (EntityRotativeDigger) wheel.entity; + + if (entity != null && entity.getFuel() > 0) { + long now = System.nanoTime(); + int elapsed = (int) ((now - lastframe) / (1000 * 1000)); + mvt -= (float) elapsed / 300.0f; + lastframe = now; + + GL11.glRotatef((mvt + 0.4188790204786391F) * 100, 1F, 0F, 0F); + } + + modelRotaryExcavator_Wheel.render(wheel, 0.0F, +0.2F, -0.1F, 0.0F, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + @Override + public void doRender(Entity entity, double x, double y, double z, float yaw, float pitch) { + render((EntityRotativeWheel) entity, x, y, z, yaw); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return null; + } } diff --git a/src/main/java/train/client/render/RenderSignal.java b/src/main/java/train/client/render/RenderSignal.java index 94359d2195..51eac5e272 100644 --- a/src/main/java/train/client/render/RenderSignal.java +++ b/src/main/java/train/client/render/RenderSignal.java @@ -8,26 +8,20 @@ public class RenderSignal extends TileEntitySpecialRenderer { - private static final ModelBlockSignal modelSignal = new ModelBlockSignal(1.0F / 16.0F); + private static final ModelBlockSignal modelSignal = new ModelBlockSignal(1.0F / 16.0F); - public RenderSignal() { - } + public RenderSignal() { + } - public void renderAModelAt(TileSignal var1, double d, double d1, double d2, float f) { - GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.46F, (float) d1 + 0.0F, (float) d2 + 0.46F); - /*if (var1.state == 1) { - bindTextureByName(Info.trainsPrefix + "signal_suisse_green.png"); - } - else { - bindTextureByName(Info.trainsPrefix + "signal_suisse_red.png"); - }*/ - modelSignal.render(0.0625F, var1.getFacing()); - GL11.glPopMatrix(); - } - - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileSignal) tileentity, d, d1, d2, f); - } + public void renderAModelAt(TileSignal tile, double x, double y, double z, float f) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.46F, (float) y + 0.0F, (float) z + 0.46F); + modelSignal.render(0.0625F, tile.getFacing()); + GL11.glPopMatrix(); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { + renderAModelAt((TileSignal) tileentity, x, y, z, f); + } } \ No newline at end of file diff --git a/src/main/java/train/client/render/RenderStopper.java b/src/main/java/train/client/render/RenderStopper.java index 40bae34705..80946e4e87 100644 --- a/src/main/java/train/client/render/RenderStopper.java +++ b/src/main/java/train/client/render/RenderStopper.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -17,26 +17,26 @@ public class RenderStopper extends TileEntitySpecialRenderer { - private static final ModelStopper modelStopper = new ModelStopper(1.0F / 16.0F); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "buffer.png"); + private static final ModelStopper modelStopper = new ModelStopper(1.0F / 16.0F); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "buffer.png"); - public RenderStopper() { - } + public RenderStopper() { + } - public void render(TileEntity var1, double x, double y, double z) { - GL11.glPushMatrix(); + public void render(TileEntity tile, double x, double y, double z) { + GL11.glPushMatrix(); - GL11.glTranslated(x, y, z); - tmt.Tessellator.bindTexture(texture); + GL11.glTranslated(x, y, z); + tmt.Tessellator.bindTexture(texture); - GL11.glTranslatef(0.5F, 0.0F, 0.5F); - modelStopper.render(0.0625F, ((TileStopper) var1).getFacing()); + GL11.glTranslatef(0.5F, 0.0F, 0.5F); + modelStopper.render(0.0625F, ((TileStopper) tile).getFacing()); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - @Override - public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { - render(var1, var2, var4, var6); - } + @Override + public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8) { + render(tile, x, z, z); + } } diff --git a/src/main/java/train/client/render/RenderSwitchStand.java b/src/main/java/train/client/render/RenderSwitchStand.java index 9ea0f3e251..bff467a3ff 100644 --- a/src/main/java/train/client/render/RenderSwitchStand.java +++ b/src/main/java/train/client/render/RenderSwitchStand.java @@ -12,60 +12,63 @@ import train.common.tile.TileSwitchStand; public class RenderSwitchStand extends TileEntitySpecialRenderer { - private static final ModelSwitchStandOn modelSwitch = new ModelSwitchStandOn(); - private static final ModelSwitchStandOff modelSwitch2 = new ModelSwitchStandOff(); - private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "switchStand_uv_draw_1.png"); - private static final ResourceLocation texture2 = new ResourceLocation(Info.resourceLocation,Info.modelTexPrefix + "switchStand_uv_draw_2.png"); + private static final ModelSwitchStandOn modelSwitch = new ModelSwitchStandOn(); + private static final ModelSwitchStandOff modelSwitch2 = new ModelSwitchStandOff(); + private static final ResourceLocation texture = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "switchStand_uv_draw_1.png"); + private static final ResourceLocation texture2 = new ResourceLocation(Info.resourceLocation, Info.modelTexPrefix + "switchStand_uv_draw_2.png"); - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { + boolean skipRender = false, powered = tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord).isProvidingWeakPower(tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 0) > 0; + TileSwitchStand tile = ((TileSwitchStand) tileEntity); + if (tile.getFacing() != ForgeDirection.UNKNOWN) { + Tessellator.bindTexture(powered ? texture2 : texture); + } - boolean skipRender = false, powered = tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord).isProvidingWeakPower(tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 0) > 0; - TileSwitchStand tile = ((TileSwitchStand)tileEntity); - if(tile.getFacing()!= ForgeDirection.UNKNOWN){ - Tessellator.bindTexture(powered?texture2:texture); - } + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5, y + 0.6, z + 0.5); + GL11.glRotated(180, 0, 1, 0); - GL11.glPushMatrix(); - GL11.glTranslated(x+0.5,y+0.6,z+0.5); - GL11.glRotated(180,0,1,0); + switch (((TileSwitchStand) tileEntity).getFacing()) { + case NORTH: { + GL11.glRotated(180, 0, 0, 1); + GL11.glRotated(90, 0, 1, 0); + GL11.glTranslated(0, 0, 0.125); + break; + } - switch (((TileSwitchStand)tileEntity).getFacing()){ - case NORTH:{ - GL11.glRotated(180,0,0,1); - GL11.glRotated(90,0,1,0); - GL11.glTranslated(0,0,0.125); - break; - } - case SOUTH:{ - GL11.glRotated(180,0,0,1); - GL11.glRotated(270,0,1,0); - GL11.glTranslated(0,0,-0.125); - break; - } - case EAST:{ - GL11.glRotated(180,0,0,1); - GL11.glRotated(180,0,1,0); - GL11.glTranslated(0.125,0,0); - break; - } - case WEST:{ - GL11.glRotated(180,0,0,1); - GL11.glTranslated(-0.125,0,0); - break; - } - default:{ - skipRender = true; - } - } + case SOUTH: { + GL11.glRotated(180, 0, 0, 1); + GL11.glRotated(270, 0, 1, 0); + GL11.glTranslated(0, 0, -0.125); + break; + } - if (!skipRender) { - if (powered) { - modelSwitch2.render(null, 0, 0, 0, 0, 0, 0.0625f); - } else { - modelSwitch.render(null, 0, 0, 0, 0, 0, 0.0625f); - } - } - GL11.glPopMatrix(); - } + case EAST: { + GL11.glRotated(180, 0, 0, 1); + GL11.glRotated(180, 0, 1, 0); + GL11.glTranslated(0.125, 0, 0); + break; + } + + case WEST: { + GL11.glRotated(180, 0, 0, 1); + GL11.glTranslated(-0.125, 0, 0); + break; + } + + default: { + skipRender = true; + } + } + + if (!skipRender) { + if (powered) { + modelSwitch2.render(null, 0, 0, 0, 0, 0, 0.0625f); + } else { + modelSwitch.render(null, 0, 0, 0, 0, 0, 0.0625f); + } + } + GL11.glPopMatrix(); + } } diff --git a/src/main/java/train/client/render/RenderTCBook.java b/src/main/java/train/client/render/RenderTCBook.java index 2d10b6d639..9edf9fefbf 100644 --- a/src/main/java/train/client/render/RenderTCBook.java +++ b/src/main/java/train/client/render/RenderTCBook.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2013 Mrbrutal. All rights reserved. - * + * * @name Traincraft * @author Mrbrutal ******************************************************************************/ @@ -14,10 +14,10 @@ public class RenderTCBook extends TileEntitySpecialRenderer { - private ModelTCBook book = new ModelTCBook(); - - @Override - public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tick) { - book.render((TileBook) tileentity, x, y, z); - } + private final ModelTCBook book = new ModelTCBook(); + + @Override + public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tick) { + book.render((TileBook) tileentity, x, y, z); + } } \ No newline at end of file diff --git a/src/main/java/train/client/render/RenderTCRail.java b/src/main/java/train/client/render/RenderTCRail.java index c7b0300397..8aa1048faf 100644 --- a/src/main/java/train/client/render/RenderTCRail.java +++ b/src/main/java/train/client/render/RenderTCRail.java @@ -6,567 +6,551 @@ import train.common.tile.TileTCRail; public class RenderTCRail extends TileEntitySpecialRenderer { - /**Normal Tracks*/ - public static final ModelSmallStraightTCTrack modelSmallStraight = new ModelSmallStraightTCTrack(); - public static final ModelSmallStraightTCTrack modelRoadCrossing = new ModelSmallStraightTCTrack(); - public static final ModelMediumStraightTCTrack modelMediumStraight = new ModelMediumStraightTCTrack(); - public static final ModelSmallDiagonalStraightTCTrack modelSmallDiagonalStraight = new ModelSmallDiagonalStraightTCTrack(); - public static final ModelMediumDiagonalStraightTCTrack modelMediumDiagonalStraight = new ModelMediumDiagonalStraightTCTrack(); - public static final ModelRightTurnTCTrack modelRightTurn = new ModelRightTurnTCTrack(); - public static final ModelLeftTurnTCTrack modelLeftTurn = new ModelLeftTurnTCTrack(); - public static final ModelRight45DegreeTurnTCTrack model45DegreeRightTurn = new ModelRight45DegreeTurnTCTrack(); - public static final ModelLeft45DegreeTurnTCTrack model45DegreeLeftTurn = new ModelLeft45DegreeTurnTCTrack(); - public static final ModelRightParallelCurveTCTrack modelRightParallelCurve = new ModelRightParallelCurveTCTrack(); - public static final ModelLeftParallelCurveTCTrack modelLeftParallelCurve = new ModelLeftParallelCurveTCTrack(); - public static final ModelTwoWaysCrossingTCTrack modelTwoWaysCrossing = new ModelTwoWaysCrossingTCTrack(); - public static final ModelRightSwitchTCTrack modelRightSwitchTurn = new ModelRightSwitchTCTrack(); - public static final ModelLeftSwitchTCTrack modelLeftSwitchTurn = new ModelLeftSwitchTCTrack(); - public static final ModelSlopeTCTrack modelSlope = new ModelSlopeTCTrack(); - public static final ModelLargeSlopeTCTrack modelLargeSlope = new ModelLargeSlopeTCTrack(); - public static final ModelVeryLargeSlopeTCTrack modelVeryLargeSlope = new ModelVeryLargeSlopeTCTrack(); - public static final ModelRightCurvedSlopeTCTrack modelRightCurvedSlope = new ModelRightCurvedSlopeTCTrack(); - public static final ModelLeftCurvedSlopeTCTrack modelLeftCurvedSlope = new ModelLeftCurvedSlopeTCTrack(); - public static final ModelRightDiamondCrossing modelRightDiamondCrossing = new ModelRightDiamondCrossing(); - public static final ModelLeftDiamondCrossing modelLeftDiamondCrossing = new ModelLeftDiamondCrossing(); + /** + * Normal Tracks + */ + public static final ModelSmallStraightTCTrack modelSmallStraight = new ModelSmallStraightTCTrack(); + public static final ModelSmallStraightTCTrack modelRoadCrossing = new ModelSmallStraightTCTrack(); + public static final ModelMediumStraightTCTrack modelMediumStraight = new ModelMediumStraightTCTrack(); + public static final ModelSmallDiagonalStraightTCTrack modelSmallDiagonalStraight = new ModelSmallDiagonalStraightTCTrack(); + public static final ModelMediumDiagonalStraightTCTrack modelMediumDiagonalStraight = new ModelMediumDiagonalStraightTCTrack(); + public static final ModelRightTurnTCTrack modelRightTurn = new ModelRightTurnTCTrack(); + public static final ModelLeftTurnTCTrack modelLeftTurn = new ModelLeftTurnTCTrack(); + public static final ModelRight45DegreeTurnTCTrack model45DegreeRightTurn = new ModelRight45DegreeTurnTCTrack(); + public static final ModelLeft45DegreeTurnTCTrack model45DegreeLeftTurn = new ModelLeft45DegreeTurnTCTrack(); + public static final ModelRightParallelCurveTCTrack modelRightParallelCurve = new ModelRightParallelCurveTCTrack(); + public static final ModelLeftParallelCurveTCTrack modelLeftParallelCurve = new ModelLeftParallelCurveTCTrack(); + public static final ModelTwoWaysCrossingTCTrack modelTwoWaysCrossing = new ModelTwoWaysCrossingTCTrack(); + public static final ModelRightSwitchTCTrack modelRightSwitchTurn = new ModelRightSwitchTCTrack(); + public static final ModelLeftSwitchTCTrack modelLeftSwitchTurn = new ModelLeftSwitchTCTrack(); + public static final ModelSlopeTCTrack modelSlope = new ModelSlopeTCTrack(); + public static final ModelLargeSlopeTCTrack modelLargeSlope = new ModelLargeSlopeTCTrack(); + public static final ModelVeryLargeSlopeTCTrack modelVeryLargeSlope = new ModelVeryLargeSlopeTCTrack(); + public static final ModelRightCurvedSlopeTCTrack modelRightCurvedSlope = new ModelRightCurvedSlopeTCTrack(); + public static final ModelLeftCurvedSlopeTCTrack modelLeftCurvedSlope = new ModelLeftCurvedSlopeTCTrack(); + public static final ModelRightDiamondCrossing modelRightDiamondCrossing = new ModelRightDiamondCrossing(); + public static final ModelLeftDiamondCrossing modelLeftDiamondCrossing = new ModelLeftDiamondCrossing(); - /**Embedded Tracks*/ + /** + * Embedded Tracks + */ + public RenderTCRail() { + } + @Override + public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8) { + if (var1 instanceof TileTCRail) { + TileTCRail railTile = (TileTCRail) var1; + if (railTile.hasModel && railTile.getTrackType() != null) { + switch (railTile.getTrackType()) { + // Normal Tracks + case SMALL_STRAIGHT: { + modelSmallStraight.render("normal", railTile, x, y, z); + break; + } + case MEDIUM_STRAIGHT: + case LONG_STRAIGHT: + case VERY_LONG_STRAIGHT: { + modelMediumStraight.render("medium", railTile, x, y, z); + break; + } + case SMALL_DIAGONAL_STRAIGHT: { + modelSmallDiagonalStraight.render("diagonal", railTile, x, y, z); + break; + } + case MEDIUM_DIAGONAL_STRAIGHT: + case LONG_DIAGONAL_STRAIGHT: + case VERY_LONG_DIAGONAL_STRAIGHT: { + modelMediumDiagonalStraight.render("diagonal", railTile, x, y, z); + break; + } + case MEDIUM_TURN: + case MEDIUM_RIGHT_TURN: { + modelRightTurn.render("medium", railTile, x, y, z); + break; + } + case MEDIUM_LEFT_TURN: { + modelLeftTurn.render("medium", railTile, x, y, z); + break; + } + case LARGE_TURN: + case LARGE_RIGHT_TURN: { + modelRightTurn.render("large", railTile, x, y, z); + break; + } + case LARGE_LEFT_TURN: { + modelLeftTurn.render("large", railTile, x, y, z); + break; + } + case VERY_LARGE_TURN: + case VERY_LARGE_RIGHT_TURN: { + modelRightTurn.render("very_large", railTile, x, y, z); + break; + } + case VERY_LARGE_LEFT_TURN: { + modelLeftTurn.render("very_large", railTile, x, y, z); + break; + } + case SUPER_LARGE_TURN: + case SUPER_LARGE_RIGHT_TURN: { + modelRightTurn.render("super_large", railTile, x, y, z); + break; + } + case SUPER_LARGE_LEFT_TURN: { + modelLeftTurn.render("super_large", railTile, x, y, z); + break; + } + case MEDIUM_45DEGREE_TURN: + case MEDIUM_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("medium", "", railTile, x, y, z); + break; + } + case MEDIUM_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("medium", "", railTile, x, y, z); + break; + } + case LARGE_45DEGREE_TURN: + case LARGE_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("large", "", railTile, x, y, z); + break; + } + case LARGE_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("large", "", railTile, x, y, z); + break; + } + case VERY_LARGE_45DEGREE_TURN: + case VERY_LARGE_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("verylarge", "", railTile, x, y, z); + break; + } + case VERY_LARGE_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("verylarge", "", railTile, x, y, z); + break; + } + case SUPER_LARGE_45DEGREE_TURN: + case SUPER_LARGE_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("superlarge", "", railTile, x, y, z); + break; + } + case SUPER_LARGE_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("superlarge", "", railTile, x, y, z); + break; + } + case SMALL_PARALLEL_CURVE: + case SMALL_RIGHT_PARALLEL_CURVE: { + modelRightParallelCurve.render("small", "", railTile, x, y, z); + break; + } + case SMALL_LEFT_PARALLEL_CURVE: { + modelLeftParallelCurve.render("small", "", railTile, x, y, z); + break; + } - public RenderTCRail() { + case MEDIUM_PARALLEL_CURVE: + case MEDIUM_RIGHT_PARALLEL_CURVE: { + modelRightParallelCurve.render("medium", "", railTile, x, y, z); + break; + } + case MEDIUM_LEFT_PARALLEL_CURVE: { + modelLeftParallelCurve.render("medium", "", railTile, x, y, z); + break; + } + case LARGE_PARALLEL_CURVE: + case LARGE_RIGHT_PARALLEL_CURVE: { + modelRightParallelCurve.render("large", "", railTile, x, y, z); + break; + } + case LARGE_LEFT_PARALLEL_CURVE: { + modelLeftParallelCurve.render("large", "", railTile, x, y, z); + break; + } + case TWO_WAYS_CROSSING: { + modelTwoWaysCrossing.render("normal_crossing", railTile, x, y, z); + break; + } + case FOUR_WAYS_CROSSING: { + modelTwoWaysCrossing.render("normal_universal_crossing", railTile, x, y, z); + break; + } + case DIAMOND_CROSSING: + case RIGHT_DIAMOND_CROSSING: { + modelRightDiamondCrossing.render("normal", railTile, x, y, z); + break; + } + case LEFT_DIAMOND_CROSSING: { + modelLeftDiamondCrossing.render("normal", railTile, x, y, z); + break; + } + case DOUBLE_DIAMOND_CROSSING: { + modelTwoWaysCrossing.render("normal_diamond", railTile, x, y, z); + break; + } + case DIAGONAL_TWO_WAYS_CROSSING: { + modelTwoWaysCrossing.render("normal_diagonal_crossing", railTile, x, y, z); + break; + } + case MEDIUM_SWITCH: + case MEDIUM_RIGHT_SWITCH: { + modelRightSwitchTurn.render("medium", "", railTile, x, y, z); + break; + } + case MEDIUM_LEFT_SWITCH: { + modelLeftSwitchTurn.render("medium", "", railTile, x, y, z); + break; + } + case LARGE_SWITCH: + case LARGE_RIGHT_SWITCH: { + modelRightSwitchTurn.render("large_90", "", railTile, x, y, z); + break; + } + case LARGE_LEFT_SWITCH: { + modelLeftSwitchTurn.render("large_90", "", railTile, x, y, z); + break; + } + case MEDIUM_PARALLEL_SWITCH: + case MEDIUM_RIGHT_PARALLEL_SWITCH: { + modelRightSwitchTurn.render("medium_parallel", "", railTile, x, y, z); + break; + } + case MEDIUM_LEFT_PARALLEL_SWITCH: { + modelLeftSwitchTurn.render("medium_parallel", "", railTile, x, y, z); + break; + } + case MEDIUM_45DEGREE_SWITCH: + case MEDIUM_RIGHT_45DEGREE_SWITCH: { + modelRightSwitchTurn.render("medium_45degree", "", railTile, x, y, z); + break; + } + case MEDIUM_LEFT_45DEGREE_SWITCH: { + modelLeftSwitchTurn.render("medium_45degree", "", railTile, x, y, z); + break; + } + case SLOPE_WOOD: { + modelSlope.render("wood", railTile, x, y, z); + break; + } + case SLOPE_GRAVEL: { + modelSlope.render("gravel", railTile, x, y, z); + break; + } + case SLOPE_BALLAST: { + modelSlope.render("ballast", railTile, x, y, z); + break; + } + case SLOPE_SNOW_GRAVEL: { + modelSlope.render("snow", railTile, x, y, z); + break; + } + case SLOPE_DYNAMIC: { + modelSlope.render("dynamic", railTile, x, y, z); + break; + } + case EMBEDDED_SLOPE_DYNAMIC: { + modelSlope.render("embedded_dynamic", railTile, x, y, z); + break; + } + case LARGE_SLOPE_WOOD: { + modelLargeSlope.render("wood", railTile, x, y, z); + break; + } + case LARGE_SLOPE_GRAVEL: { + modelLargeSlope.render("gravel", railTile, x, y, z); + break; + } + case LARGE_SLOPE_BALLAST: { + modelLargeSlope.render("ballast", railTile, x, y, z); + break; + } + case LARGE_SLOPE_SNOW_GRAVEL: { + modelLargeSlope.render("snow", railTile, x, y, z); + break; + } + case LARGE_SLOPE_DYNAMIC: { + modelLargeSlope.render("dynamic", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_SLOPE_DYNAMIC: { + modelLargeSlope.render("embedded_dynamic", railTile, x, y, z); + break; + } + case VERY_LARGE_SLOPE_WOOD: { + modelVeryLargeSlope.render("wood", railTile, x, y, z); + break; + } + case VERY_LARGE_SLOPE_GRAVEL: { + modelVeryLargeSlope.render("gravel", railTile, x, y, z); + break; + } + case VERY_LARGE_SLOPE_BALLAST: { + modelVeryLargeSlope.render("ballast", railTile, x, y, z); + break; + } + case VERY_LARGE_SLOPE_SNOW_GRAVEL: { + modelVeryLargeSlope.render("snow", railTile, x, y, z); + break; + } + case VERY_LARGE_SLOPE_DYNAMIC: { + modelVeryLargeSlope.render("dynamic", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_SLOPE_DYNAMIC: { + modelVeryLargeSlope.render("embedded_dynamic", railTile, x, y, z); + break; + } + case LARGE_CURVED_SLOPE_DYNAMIC: + case LARGE_RIGHT_CURVED_SLOPE_DYNAMIC: { + modelRightCurvedSlope.render("large", railTile, x, y, z); + break; + } + case LARGE_LEFT_CURVED_SLOPE_DYNAMIC: { + modelLeftCurvedSlope.render("large", railTile, x, y, z); + break; + } + case VERY_LARGE_CURVED_SLOPE_DYNAMIC: + case VERY_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC: { + modelRightCurvedSlope.render("verylarge", railTile, x, y, z); + break; + } + case VERY_LARGE_LEFT_CURVED_SLOPE_DYNAMIC: { + modelLeftCurvedSlope.render("verylarge", railTile, x, y, z); + break; + } + case SUPER_LARGE_CURVED_SLOPE_DYNAMIC: + case SUPER_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC: { + modelRightCurvedSlope.render("superlarge", railTile, x, y, z); + break; + } + case SUPER_LARGE_LEFT_CURVED_SLOPE_DYNAMIC: { + modelLeftCurvedSlope.render("superlarge", railTile, x, y, z); + break; + } - } + // Embedded Tracks + case EMBEDDED_SMALL_STRAIGHT: { + modelSmallStraight.render("embedded", railTile, x, y, z); + break; + } + case SMALL_ROAD_CROSSING: { + modelRoadCrossing.render("crossing", railTile, x, y, z); + break; + } + case SMALL_ROAD_CROSSING_1: { + modelRoadCrossing.render("crossing1", railTile, x, y, z); + break; + } + case SMALL_ROAD_CROSSING_2: { + modelRoadCrossing.render("crossing2", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_STRAIGHT: + case EMBEDDED_LONG_STRAIGHT: + case EMBEDDED_VERY_LONG_STRAIGHT: { + modelMediumStraight.render("embedded_medium", railTile, x, y, z); + break; + } + case EMBEDDED_SMALL_DIAGONAL_STRAIGHT: { + modelSmallDiagonalStraight.render("embedded_diagonal", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_DIAGONAL_STRAIGHT: + case EMBEDDED_LONG_DIAGONAL_STRAIGHT: + case EMBEDDED_VERY_LONG_DIAGONAL_STRAIGHT: { + modelMediumDiagonalStraight.render("embedded_diagonal", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_TURN: + case EMBEDDED_MEDIUM_RIGHT_TURN: { + modelRightTurn.render("embedded_medium", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_LEFT_TURN: { + modelLeftTurn.render("embedded_medium", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_TURN: + case EMBEDDED_LARGE_RIGHT_TURN: { + modelRightTurn.render("embedded_large", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_LEFT_TURN: { + modelLeftTurn.render("embedded_large", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_TURN: + case EMBEDDED_VERY_LARGE_RIGHT_TURN: { + modelRightTurn.render("embedded_very_large", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_LEFT_TURN: { + modelLeftTurn.render("embedded_very_large", railTile, x, y, z); + break; + } + case EMBEDDED_SUPER_LARGE_TURN: + case EMBEDDED_SUPER_LARGE_RIGHT_TURN: { + modelRightTurn.render("embedded_super_large", railTile, x, y, z); + break; + } + case EMBEDDED_SUPER_LARGE_LEFT_TURN: { + modelLeftTurn.render("embedded_super_large", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_45DEGREE_TURN: + case EMBEDDED_MEDIUM_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("medium", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("medium", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_45DEGREE_TURN: + case EMBEDDED_LARGE_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("large", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("large", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_45DEGREE_TURN: + case EMBEDDED_VERY_LARGE_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("verylarge", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("verylarge", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_SUPER_LARGE_45DEGREE_TURN: + case EMBEDDED_SUPER_LARGE_RIGHT_45DEGREE_TURN: { + model45DegreeRightTurn.render("superlarge", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_SUPER_LARGE_LEFT_45DEGREE_TURN: { + model45DegreeLeftTurn.render("superlarge", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_SMALL_PARALLEL_CURVE: + case EMBEDDED_SMALL_RIGHT_PARALLEL_CURVE: { + modelRightParallelCurve.render("small", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_SMALL_LEFT_PARALLEL_CURVE: { + modelLeftParallelCurve.render("small", "embedded", railTile, x, y, z); + break; + } - @Override - public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8 ) { - if(var1 instanceof TileTCRail){ - TileTCRail railTile = (TileTCRail) var1; - if (railTile.hasModel && railTile.getTrackType() != null) { - switch (railTile.getTrackType()){ + case EMBEDDED_MEDIUM_PARALLEL_CURVE: + case EMBEDDED_MEDIUM_RIGHT_PARALLEL_CURVE: { + modelRightParallelCurve.render("medium", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_LEFT_PARALLEL_CURVE: { + modelLeftParallelCurve.render("medium", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_PARALLEL_CURVE: + case EMBEDDED_LARGE_RIGHT_PARALLEL_CURVE: { + modelRightParallelCurve.render("large", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_LEFT_PARALLEL_CURVE: { + modelLeftParallelCurve.render("large", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_TWO_WAYS_CROSSING: { + modelTwoWaysCrossing.render("embedded_crossing", railTile, x, y, z); + break; + } + case EMBEDDED_FOUR_WAYS_CROSSING: { + modelTwoWaysCrossing.render("embedded_universal_crossing", railTile, x, y, z); + break; + } + case EMBEDDED_DIAGONAL_TWO_WAYS_CROSSING: { + modelTwoWaysCrossing.render("embedded_diagonal_crossing", railTile, x, y, z); + break; + } - - /**Normal Tracks*/ - case SMALL_STRAIGHT:{ - modelSmallStraight.render("normal", railTile, x, y, z); - break; - } - case MEDIUM_STRAIGHT: - case LONG_STRAIGHT: - case VERY_LONG_STRAIGHT:{ - modelMediumStraight.render("medium", railTile, x, y, z); - break; - } - case SMALL_DIAGONAL_STRAIGHT:{ - modelSmallDiagonalStraight.render("diagonal", railTile, x, y, z); - break; - } - case MEDIUM_DIAGONAL_STRAIGHT: - case LONG_DIAGONAL_STRAIGHT: - case VERY_LONG_DIAGONAL_STRAIGHT:{ - modelMediumDiagonalStraight.render("diagonal", railTile, x, y, z); - break; - } - - case MEDIUM_TURN: - case MEDIUM_RIGHT_TURN: { - modelRightTurn.render("medium", railTile, x, y, z); - break; - } - case MEDIUM_LEFT_TURN: { - modelLeftTurn.render("medium", railTile, x, y, z); - break; - } - case LARGE_TURN: - case LARGE_RIGHT_TURN: { - modelRightTurn.render("large", railTile, x, y, z); - break; - } - case LARGE_LEFT_TURN: { - modelLeftTurn.render("large", railTile, x, y, z); - break; - } - case VERY_LARGE_TURN: - case VERY_LARGE_RIGHT_TURN: { - modelRightTurn.render("very_large", railTile, x, y, z); - break; - } - case VERY_LARGE_LEFT_TURN: { - modelLeftTurn.render("very_large", railTile, x, y, z); - break; - } - case SUPER_LARGE_TURN: - case SUPER_LARGE_RIGHT_TURN: { - modelRightTurn.render("super_large", railTile, x , y, z); - break; - } - case SUPER_LARGE_LEFT_TURN: { - modelLeftTurn.render("super_large", railTile, x , y, z); - break; - } - case MEDIUM_45DEGREE_TURN: - case MEDIUM_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("medium", "", railTile, x, y, z); - break; - } - case MEDIUM_LEFT_45DEGREE_TURN:{ - model45DegreeLeftTurn.render("medium", "", railTile, x, y, z); - break; - } - case LARGE_45DEGREE_TURN: - case LARGE_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("large","", railTile, x, y, z); - break; - } - case LARGE_LEFT_45DEGREE_TURN:{ - model45DegreeLeftTurn.render("large","", railTile, x, y, z); - break; - } - case VERY_LARGE_45DEGREE_TURN: - case VERY_LARGE_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("verylarge","", railTile, x, y, z); - break; - } - case VERY_LARGE_LEFT_45DEGREE_TURN:{ - model45DegreeLeftTurn.render("verylarge","", railTile, x, y, z); - break; - } - case SUPER_LARGE_45DEGREE_TURN: - case SUPER_LARGE_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("superlarge","", railTile, x, y, z); - break; - } - case SUPER_LARGE_LEFT_45DEGREE_TURN:{ - model45DegreeLeftTurn.render("superlarge","", railTile, x, y, z); - break; - } - case SMALL_PARALLEL_CURVE: - case SMALL_RIGHT_PARALLEL_CURVE:{ - modelRightParallelCurve.render("small", "", railTile, x, y, z); - break; - } - case SMALL_LEFT_PARALLEL_CURVE:{ - modelLeftParallelCurve.render("small", "",railTile, x, y, z); - break; - } - - case MEDIUM_PARALLEL_CURVE: - case MEDIUM_RIGHT_PARALLEL_CURVE:{ - modelRightParallelCurve.render("medium","", railTile, x, y, z); - break; - } - case MEDIUM_LEFT_PARALLEL_CURVE:{ - modelLeftParallelCurve.render("medium", "",railTile, x, y, z); - break; - } - case LARGE_PARALLEL_CURVE: - case LARGE_RIGHT_PARALLEL_CURVE: { - modelRightParallelCurve.render("large","", railTile, x, y, z); - break; - } - case LARGE_LEFT_PARALLEL_CURVE: { - modelLeftParallelCurve.render("large","", railTile, x, y, z); - break; - } - case TWO_WAYS_CROSSING: { - modelTwoWaysCrossing.render("normal_crossing",railTile, x, y, z); - break; - } - case FOUR_WAYS_CROSSING: { - modelTwoWaysCrossing.render("normal_universal_crossing",railTile, x, y, z); - break; - } - case DIAMOND_CROSSING: - case RIGHT_DIAMOND_CROSSING: { - modelRightDiamondCrossing.render("normal", railTile, x, y, z); - break; - } - case LEFT_DIAMOND_CROSSING: { - modelLeftDiamondCrossing.render("normal", railTile,x, y, z); - break; - } - case DOUBLE_DIAMOND_CROSSING:{ - modelTwoWaysCrossing.render("normal_diamond", railTile, x, y, z); - break; - } - case DIAGONAL_TWO_WAYS_CROSSING:{ - modelTwoWaysCrossing.render("normal_diagonal_crossing", railTile, x, y, z); - break; - } - case MEDIUM_SWITCH: - case MEDIUM_RIGHT_SWITCH: { - modelRightSwitchTurn.render("medium", "", railTile, x, y, z); - break; - } - case MEDIUM_LEFT_SWITCH: { - modelLeftSwitchTurn.render("medium", "", railTile, x, y, z); - break; - } - case LARGE_SWITCH: - case LARGE_RIGHT_SWITCH: { - modelRightSwitchTurn.render("large_90", "", railTile, x, y, z); - break; - } - case LARGE_LEFT_SWITCH: { - modelLeftSwitchTurn.render("large_90","", railTile, x, y, z); - break; - } - case MEDIUM_PARALLEL_SWITCH: - case MEDIUM_RIGHT_PARALLEL_SWITCH: { - modelRightSwitchTurn.render("medium_parallel", "",railTile, x, y, z); - break; - } - case MEDIUM_LEFT_PARALLEL_SWITCH: { - modelLeftSwitchTurn.render("medium_parallel", "",railTile, x, y, z); - break; - } - case MEDIUM_45DEGREE_SWITCH: - case MEDIUM_RIGHT_45DEGREE_SWITCH: { - modelRightSwitchTurn.render("medium_45degree","", railTile, x, y, z); - break; - } - case MEDIUM_LEFT_45DEGREE_SWITCH: { - modelLeftSwitchTurn.render("medium_45degree","", railTile, x, y, z); - break; - } - case SLOPE_WOOD: { - modelSlope.render("wood", railTile, x, y, z); - break; - } - case SLOPE_GRAVEL: { - modelSlope.render("gravel", railTile, x, y, z); - break; - } - case SLOPE_BALLAST: { - modelSlope.render("ballast", railTile, x, y, z); - break; - } - case SLOPE_SNOW_GRAVEL: { - modelSlope.render("snow", railTile, x, y, z); - break; - } - case SLOPE_DYNAMIC: { - modelSlope.render("dynamic", railTile, x, y, z); - break; - } - case EMBEDDED_SLOPE_DYNAMIC: { - modelSlope.render("embedded_dynamic", railTile, x, y, z); - break; - } - case LARGE_SLOPE_WOOD: { - modelLargeSlope.render("wood", railTile, x, y, z); - break; - } - case LARGE_SLOPE_GRAVEL: { - modelLargeSlope.render("gravel", railTile, x, y, z); - break; - } - case LARGE_SLOPE_BALLAST: { - modelLargeSlope.render("ballast", railTile, x, y, z); - break; - } - case LARGE_SLOPE_SNOW_GRAVEL: { - modelLargeSlope.render("snow", railTile, x, y, z); - break; - } - case LARGE_SLOPE_DYNAMIC: { - modelLargeSlope.render("dynamic", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_SLOPE_DYNAMIC: { - modelLargeSlope.render("embedded_dynamic", railTile, x, y, z); - break; - } - case VERY_LARGE_SLOPE_WOOD: { - modelVeryLargeSlope.render("wood", railTile, x, y, z); - break; - } - case VERY_LARGE_SLOPE_GRAVEL: { - modelVeryLargeSlope.render("gravel", railTile, x, y, z); - break; - } - case VERY_LARGE_SLOPE_BALLAST: { - modelVeryLargeSlope.render("ballast", railTile, x, y, z); - break; - } - case VERY_LARGE_SLOPE_SNOW_GRAVEL: { - modelVeryLargeSlope.render("snow", railTile, x, y, z); - break; - } - case VERY_LARGE_SLOPE_DYNAMIC: { - modelVeryLargeSlope.render("dynamic", railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_SLOPE_DYNAMIC: { - modelVeryLargeSlope.render("embedded_dynamic", railTile, x, y, z); - break; - } - case LARGE_CURVED_SLOPE_DYNAMIC: - case LARGE_RIGHT_CURVED_SLOPE_DYNAMIC:{ - modelRightCurvedSlope.render("large", railTile, x, y, z); - break; - } - case LARGE_LEFT_CURVED_SLOPE_DYNAMIC:{ - modelLeftCurvedSlope.render("large", railTile, x, y, z); - break; - } - case VERY_LARGE_CURVED_SLOPE_DYNAMIC: - case VERY_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC:{ - modelRightCurvedSlope.render("verylarge", railTile, x, y, z); - break; - } - case VERY_LARGE_LEFT_CURVED_SLOPE_DYNAMIC:{ - modelLeftCurvedSlope.render("verylarge", railTile, x, y, z); - break; - } - case SUPER_LARGE_CURVED_SLOPE_DYNAMIC: - case SUPER_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC:{ - modelRightCurvedSlope.render("superlarge", railTile, x, y, z); - break; - } - case SUPER_LARGE_LEFT_CURVED_SLOPE_DYNAMIC:{ - modelLeftCurvedSlope.render("superlarge", railTile, x, y, z); - break; - } - - - /**Embedded Tracks*/ - case EMBEDDED_SMALL_STRAIGHT: { - modelSmallStraight.render("embedded", railTile, x, y, z); - break; - } - case SMALL_ROAD_CROSSING:{ - modelRoadCrossing.render("crossing", railTile, x, y, z); - break; - } - case SMALL_ROAD_CROSSING_1:{ - modelRoadCrossing.render("crossing1", railTile, x, y, z); - break; - } - case SMALL_ROAD_CROSSING_2:{ - modelRoadCrossing.render("crossing2", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_STRAIGHT: - case EMBEDDED_LONG_STRAIGHT: - case EMBEDDED_VERY_LONG_STRAIGHT:{ - modelMediumStraight.render("embedded_medium", railTile, x, y, z); - break; - } - case EMBEDDED_SMALL_DIAGONAL_STRAIGHT:{ - modelSmallDiagonalStraight.render("embedded_diagonal", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_DIAGONAL_STRAIGHT: - case EMBEDDED_LONG_DIAGONAL_STRAIGHT: - case EMBEDDED_VERY_LONG_DIAGONAL_STRAIGHT:{ - modelMediumDiagonalStraight.render("embedded_diagonal", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_TURN: - case EMBEDDED_MEDIUM_RIGHT_TURN: { - modelRightTurn.render("embedded_medium", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_LEFT_TURN: { - modelLeftTurn.render("embedded_medium", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_TURN: - case EMBEDDED_LARGE_RIGHT_TURN: { - modelRightTurn.render("embedded_large", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_LEFT_TURN: { - modelLeftTurn.render("embedded_large", railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_TURN: - case EMBEDDED_VERY_LARGE_RIGHT_TURN: { - modelRightTurn.render("embedded_very_large", railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_LEFT_TURN: { - modelLeftTurn.render("embedded_very_large", railTile, x, y, z); - break; - } - case EMBEDDED_SUPER_LARGE_TURN: - case EMBEDDED_SUPER_LARGE_RIGHT_TURN: { - modelRightTurn.render("embedded_super_large", railTile, x, y, z); - break; - } - case EMBEDDED_SUPER_LARGE_LEFT_TURN: { - modelLeftTurn.render("embedded_super_large", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_45DEGREE_TURN: - case EMBEDDED_MEDIUM_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("medium", "embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_LEFT_45DEGREE_TURN:{ - model45DegreeLeftTurn.render("medium", "embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_45DEGREE_TURN: - case EMBEDDED_LARGE_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("large", "embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_LEFT_45DEGREE_TURN:{ - model45DegreeLeftTurn.render("large","embedded" , railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_45DEGREE_TURN: - case EMBEDDED_VERY_LARGE_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("verylarge","embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_LEFT_45DEGREE_TURN: { - model45DegreeLeftTurn.render("verylarge","embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_SUPER_LARGE_45DEGREE_TURN: - case EMBEDDED_SUPER_LARGE_RIGHT_45DEGREE_TURN: { - model45DegreeRightTurn.render("superlarge","embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_SUPER_LARGE_LEFT_45DEGREE_TURN: { - model45DegreeLeftTurn.render("superlarge", "embedded" ,railTile, x, y, z); - break; - } - case EMBEDDED_SMALL_PARALLEL_CURVE: - case EMBEDDED_SMALL_RIGHT_PARALLEL_CURVE:{ - modelRightParallelCurve.render("small", "embedded", railTile, x, y, z); - break; - } - case EMBEDDED_SMALL_LEFT_PARALLEL_CURVE:{ - modelLeftParallelCurve.render("small", "embedded", railTile, x, y, z); - break; - } - - case EMBEDDED_MEDIUM_PARALLEL_CURVE: - case EMBEDDED_MEDIUM_RIGHT_PARALLEL_CURVE:{ - modelRightParallelCurve.render("medium", "embedded", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_LEFT_PARALLEL_CURVE:{ - modelLeftParallelCurve.render("medium", "embedded",railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_PARALLEL_CURVE: - case EMBEDDED_LARGE_RIGHT_PARALLEL_CURVE:{ - modelRightParallelCurve.render("large", "embedded",railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_LEFT_PARALLEL_CURVE:{ - modelLeftParallelCurve.render("large", "embedded", railTile, x, y, z); - break; - } - - case EMBEDDED_TWO_WAYS_CROSSING: { - modelTwoWaysCrossing.render("embedded_crossing", railTile, x, y, z); - break; - } - case EMBEDDED_FOUR_WAYS_CROSSING: { - modelTwoWaysCrossing.render("embedded_universal_crossing", railTile, x, y, z); - break; - } - case EMBEDDED_DIAGONAL_TWO_WAYS_CROSSING:{ - modelTwoWaysCrossing.render("embedded_diagonal_crossing", railTile, x, y, z); - break; - } - - case EMBEDDED_DIAMOND_CROSSING: - case EMBEDDED_RIGHT_DIAMOND_CROSSING: { - modelRightDiamondCrossing.render("embedded", railTile, x, y, z); - break; - } - case EMBEDDED_LEFT_DIAMOND_CROSSING: { - modelLeftDiamondCrossing.render("embedded", railTile,x, y, z); - break; - } - case EMBEDDED_DOUBLE_DIAMOND_CROSSING:{ - modelTwoWaysCrossing.render("embedded_diamond", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_SWITCH: - case EMBEDDED_MEDIUM_RIGHT_SWITCH: { - modelRightSwitchTurn.render("medium", "embedded", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_LEFT_SWITCH: { - modelLeftSwitchTurn.render("medium","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_SWITCH: - case EMBEDDED_LARGE_RIGHT_SWITCH: { - modelRightSwitchTurn.render("large_90","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_LEFT_SWITCH: { - modelLeftSwitchTurn.render("large_90","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_PARALLEL_SWITCH: - case EMBEDDED_MEDIUM_RIGHT_PARALLEL_SWITCH: { - modelRightSwitchTurn.render("medium_parallel","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_LEFT_PARALLEL_SWITCH: { - modelLeftSwitchTurn.render("medium_parallel","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_45DEGREE_SWITCH: - case EMBEDDED_MEDIUM_RIGHT_45DEGREE_SWITCH: { - modelRightSwitchTurn.render("medium_45degree","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_MEDIUM_LEFT_45DEGREE_SWITCH: { - modelLeftSwitchTurn.render("medium_45degree","embedded", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_CURVED_SLOPE_DYNAMIC: - case EMBEDDED_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC:{ - modelRightCurvedSlope.render("embedded_large", railTile, x, y, z); - break; - } - case EMBEDDED_LARGE_LEFT_CURVED_SLOPE_DYNAMIC:{ - modelLeftCurvedSlope.render("embedded_large", railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_CURVED_SLOPE_DYNAMIC: - case EMBEDDED_VERY_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC:{ - modelRightCurvedSlope.render("embedded_verylarge", railTile, x, y, z); - break; - } - case EMBEDDED_VERY_LARGE_LEFT_CURVED_SLOPE_DYNAMIC:{ - modelLeftCurvedSlope.render("embedded_verylarge", railTile, x, y, z); - break; - } - case EMBEDDED_SUPER_LARGE_CURVED_SLOPE_DYNAMIC: - case EMBEDDED_SUPER_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC:{ - modelRightCurvedSlope.render("embedded_superlarge", railTile, x, y, z); - break; - } - case EMBEDDED_SUPER_LARGE_LEFT_CURVED_SLOPE_DYNAMIC:{ - modelLeftCurvedSlope.render("embedded_superlarge", railTile, x, y, z); - break; - } - - - - - - - - - - - } - - - } - } - } + case EMBEDDED_DIAMOND_CROSSING: + case EMBEDDED_RIGHT_DIAMOND_CROSSING: { + modelRightDiamondCrossing.render("embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LEFT_DIAMOND_CROSSING: { + modelLeftDiamondCrossing.render("embedded", railTile, x, y, z); + break; + } + case EMBEDDED_DOUBLE_DIAMOND_CROSSING: { + modelTwoWaysCrossing.render("embedded_diamond", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_SWITCH: + case EMBEDDED_MEDIUM_RIGHT_SWITCH: { + modelRightSwitchTurn.render("medium", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_LEFT_SWITCH: { + modelLeftSwitchTurn.render("medium", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_SWITCH: + case EMBEDDED_LARGE_RIGHT_SWITCH: { + modelRightSwitchTurn.render("large_90", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_LEFT_SWITCH: { + modelLeftSwitchTurn.render("large_90", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_PARALLEL_SWITCH: + case EMBEDDED_MEDIUM_RIGHT_PARALLEL_SWITCH: { + modelRightSwitchTurn.render("medium_parallel", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_LEFT_PARALLEL_SWITCH: { + modelLeftSwitchTurn.render("medium_parallel", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_45DEGREE_SWITCH: + case EMBEDDED_MEDIUM_RIGHT_45DEGREE_SWITCH: { + modelRightSwitchTurn.render("medium_45degree", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_MEDIUM_LEFT_45DEGREE_SWITCH: { + modelLeftSwitchTurn.render("medium_45degree", "embedded", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_CURVED_SLOPE_DYNAMIC: + case EMBEDDED_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC: { + modelRightCurvedSlope.render("embedded_large", railTile, x, y, z); + break; + } + case EMBEDDED_LARGE_LEFT_CURVED_SLOPE_DYNAMIC: { + modelLeftCurvedSlope.render("embedded_large", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_CURVED_SLOPE_DYNAMIC: + case EMBEDDED_VERY_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC: { + modelRightCurvedSlope.render("embedded_verylarge", railTile, x, y, z); + break; + } + case EMBEDDED_VERY_LARGE_LEFT_CURVED_SLOPE_DYNAMIC: { + modelLeftCurvedSlope.render("embedded_verylarge", railTile, x, y, z); + break; + } + case EMBEDDED_SUPER_LARGE_CURVED_SLOPE_DYNAMIC: + case EMBEDDED_SUPER_LARGE_RIGHT_CURVED_SLOPE_DYNAMIC: { + modelRightCurvedSlope.render("embedded_superlarge", railTile, x, y, z); + break; + } + case EMBEDDED_SUPER_LARGE_LEFT_CURVED_SLOPE_DYNAMIC: { + modelLeftCurvedSlope.render("embedded_superlarge", railTile, x, y, z); + break; + } + } + } + } + } } diff --git a/src/main/java/train/client/render/RenderWaterWheel.java b/src/main/java/train/client/render/RenderWaterWheel.java index 9de3f866ab..4f80d7fd01 100644 --- a/src/main/java/train/client/render/RenderWaterWheel.java +++ b/src/main/java/train/client/render/RenderWaterWheel.java @@ -6,10 +6,10 @@ import train.common.tile.TileWaterWheel; public class RenderWaterWheel extends TileEntitySpecialRenderer { - private static final ModelWaterWheel modelWaterWheel = new ModelWaterWheel(); + private static final ModelWaterWheel modelWaterWheel = new ModelWaterWheel(); - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { - modelWaterWheel.render((TileWaterWheel) tileEntity, x, y, z); - } + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { + modelWaterWheel.render((TileWaterWheel) tileEntity, x, y, z); + } } diff --git a/src/main/java/train/client/render/RenderWindMill.java b/src/main/java/train/client/render/RenderWindMill.java index e56e8530f7..41fe5de0e6 100644 --- a/src/main/java/train/client/render/RenderWindMill.java +++ b/src/main/java/train/client/render/RenderWindMill.java @@ -7,12 +7,12 @@ import train.common.tile.TileWindMill; public class RenderWindMill extends TileEntitySpecialRenderer { - private static final ModelWindMill modelWindMill = new ModelWindMill(); - private static final ModelWindMillWheel modelWindMillWheel = new ModelWindMillWheel(); + private static final ModelWindMill modelWindMill = new ModelWindMill(); + private static final ModelWindMillWheel modelWindMillWheel = new ModelWindMillWheel(); - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { - modelWindMill.render((TileWindMill) tileEntity, x, y, z); - modelWindMillWheel.render((TileWindMill) tileEntity, x, y, z); - } + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { + modelWindMill.render((TileWindMill) tileEntity, x, y, z); + modelWindMillWheel.render((TileWindMill) tileEntity, x, y, z); + } } diff --git a/src/main/java/train/client/render/RenderZeppelins.java b/src/main/java/train/client/render/RenderZeppelins.java index 4b573bdfbe..b4af0ab449 100644 --- a/src/main/java/train/client/render/RenderZeppelins.java +++ b/src/main/java/train/client/render/RenderZeppelins.java @@ -14,82 +14,75 @@ public class RenderZeppelins extends Render { - private static final ModelBase modelZeppelinTwoBalloons = new ModelZeppelinTwoBalloons(); - private static final ModelBase modelZeppelinOneBalloon = new ModelZeppelinOneBalloon(); - - private static final ResourceLocation oneBalloon = new ResourceLocation(Info.resourceLocation, Info.zeppelinTexturePrefix + "zeppelin_one_balloon.png"); - private static final ResourceLocation twoBalloon = new ResourceLocation(Info.resourceLocation, Info.zeppelinTexturePrefix + "zeppelin_two_balloons.png"); - - public RenderZeppelins() { - shadowSize = 0.5F; - } - - private void func_157_a(AbstractZeppelin entityzepplin, double d, double d1, double d2, float f, float f1) { - GL11.glPushMatrix(); - GL11.glTranslatef((float) d, (float) d1, (float) d2); - GL11.glRotatef(90F - f, 0.0F, 1.0F, 0.0F); - /** - * Damage mouvements - */ - float f2 = (float) entityzepplin.boatTimeSinceHit - f1; - float f3 = (float) entityzepplin.boatCurrentDamage - f1; - if (f3 < 0.0F) { - f3 = 0.0F; - } - if (f2 > 0.0F) { - GL11.glRotatef(((MathHelper.sin(f2) * f2 * f3) / 10F) * (float) entityzepplin.boatRockDirection, 1.0F, 0.0F, 0.0F); - } - - /** - * Pitch - */ - float pitch = entityzepplin.pitch / 1.5F; - - if (pitch > 30) { - pitch = 30; - } - if (pitch < -30) { - pitch = -30; - } - GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F); - - /** - * Roll - */ - float roll = entityzepplin.roll * 20F; - if (roll > 15) { - roll = 15; - } - if (roll < -15) { - roll = -15; - } - - GL11.glRotatef(roll, 0.0F, 0.0F, 1.0F); - - - bindEntityTexture(entityzepplin); - if(entityzepplin instanceof EntityZeppelinOneBalloon){ - GL11.glTranslatef(0.0F, -0.45F, 0.55F); - GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); - modelZeppelinOneBalloon.render(entityzepplin, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); - }else{ - GL11.glTranslatef(0.0F, -0.25F, 0.9F); - modelZeppelinTwoBalloons.render(entityzepplin, 0.0F, +0.2F, -0.1F, 0.0F, 0.0F, 0.0625F); - } - GL11.glPopMatrix(); - } - - @Override - public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { - func_157_a((AbstractZeppelin) entity, d, d1, d2, f, f1); - } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) { - if(entity instanceof EntityZeppelinOneBalloon){ - return oneBalloon; - } else { - return twoBalloon; - } - } + private static final ModelBase modelZeppelinTwoBalloons = new ModelZeppelinTwoBalloons(); + private static final ModelBase modelZeppelinOneBalloon = new ModelZeppelinOneBalloon(); + + private static final ResourceLocation oneBalloon = new ResourceLocation(Info.resourceLocation, Info.zeppelinTexturePrefix + "zeppelin_one_balloon.png"); + private static final ResourceLocation twoBalloon = new ResourceLocation(Info.resourceLocation, Info.zeppelinTexturePrefix + "zeppelin_two_balloons.png"); + + public RenderZeppelins() { + shadowSize = 0.5F; + } + + private void func_157_a(AbstractZeppelin entityzepplin, double d, double d1, double d2, float f, float f1) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) d, (float) d1, (float) d2); + GL11.glRotatef(90F - f, 0.0F, 1.0F, 0.0F); + + // Damage movements + float f2 = (float) entityzepplin.boatTimeSinceHit - f1; + float f3 = (float) entityzepplin.boatCurrentDamage - f1; + if (f3 < 0.0F) { + f3 = 0.0F; + } + + if (f2 > 0.0F) { + GL11.glRotatef(((MathHelper.sin(f2) * f2 * f3) / 10F) * (float) entityzepplin.boatRockDirection, 1.0F, 0.0F, 0.0F); + } + + // Pitch + float pitch = entityzepplin.pitch / 1.5F; + if (pitch > 30) { + pitch = 30; + } + + if (pitch < -30) { + pitch = -30; + } + + GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F); + + // Roll + float roll = entityzepplin.roll * 20F; + if (roll > 15) { + roll = 15; + } + + if (roll < -15) { + roll = -15; + } + + GL11.glRotatef(roll, 0.0F, 0.0F, 1.0F); + + bindEntityTexture(entityzepplin); + if (entityzepplin instanceof EntityZeppelinOneBalloon) { + GL11.glTranslatef(0.0F, -0.45F, 0.55F); + GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); + modelZeppelinOneBalloon.render(entityzepplin, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + } else { + GL11.glTranslatef(0.0F, -0.25F, 0.9F); + modelZeppelinTwoBalloons.render(entityzepplin, 0.0F, +0.2F, -0.1F, 0.0F, 0.0F, 0.0625F); + } + GL11.glPopMatrix(); + } + + @Override + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + func_157_a((AbstractZeppelin) entity, d, d1, d2, f, f1); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return entity instanceof EntityZeppelinOneBalloon ? oneBalloon : twoBalloon; + } } diff --git a/src/main/java/train/client/render/TileLinesRenderer.java b/src/main/java/train/client/render/TileLinesRenderer.java index ad4af5adbf..b0a23d4ac9 100644 --- a/src/main/java/train/client/render/TileLinesRenderer.java +++ b/src/main/java/train/client/render/TileLinesRenderer.java @@ -8,22 +8,22 @@ * @author Spitfire4466 */ public class TileLinesRenderer extends TileEntitySpecialRenderer { - private static final ModelLines model = new ModelLines(); + private static final ModelLines model = new ModelLines(); - public TileLinesRenderer() { - } + public TileLinesRenderer() { + } - /* public void renderAModelAt(TileEntityElectricConverter tile, double d, double d1, double d2, float f) { int i = 0; - * - * if (tile.worldObj != null) { i = tile.getBlockMetadata(); } GL11.glPushMatrix(); bindTextureByName("/train_textures/overheadlines.png"); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); if(tile.Up == true)model.renderUp(); if(tile.Down == true)model.renderDown(); if(tile.Left == true)model.renderLeft(); if(tile.Right == true)model.renderRight(); if(tile.Back == true)model.renderBack(); if(tile.Front == true)model.renderFront(); model.renderMiddle(); GL11.glPopMatrix(); - * - * - * - * } */ - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - // renderAModelAt((TileEntityElectricConverter)tileentity, d, d1, d2, f); - } + /* public void renderAModelAt(TileEntityElectricConverter tile, double d, double d1, double d2, float f) { int i = 0; + * + * if (tile.worldObj != null) { i = tile.getBlockMetadata(); } GL11.glPushMatrix(); bindTextureByName("/train_textures/overheadlines.png"); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); if(tile.Up == true)model.renderUp(); if(tile.Down == true)model.renderDown(); if(tile.Left == true)model.renderLeft(); if(tile.Right == true)model.renderRight(); if(tile.Back == true)model.renderBack(); if(tile.Front == true)model.renderFront(); model.renderMiddle(); GL11.glPopMatrix(); + * + * + * + * } */ + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + // renderAModelAt((TileEntityElectricConverter)tileentity, d, d1, d2, f); + } } \ No newline at end of file diff --git a/src/main/java/train/common/Traincraft.java b/src/main/java/train/common/Traincraft.java index cd74f6ba3b..870f6a2a85 100644 --- a/src/main/java/train/common/Traincraft.java +++ b/src/main/java/train/common/Traincraft.java @@ -237,4 +237,8 @@ public static boolean hasComputerCraft() { public static boolean hasNotEnoughItems() { return Loader.isModLoaded("NotEnoughItems"); } + + public static boolean hasRailcraft() { + return Loader.isModLoaded("Railcraft"); + } } diff --git a/src/main/java/train/common/adminbook/GUIAdminBook.java b/src/main/java/train/common/adminbook/GUIAdminBook.java index d5ef515905..c92ae0eb9b 100644 --- a/src/main/java/train/common/adminbook/GUIAdminBook.java +++ b/src/main/java/train/common/adminbook/GUIAdminBook.java @@ -21,29 +21,29 @@ public class GUIAdminBook extends GuiScreen { /**the amount to scale the GUI by, same as vanilla*/ private static final float guiScaler = 0.00390625F; - private String[] list; + private final String[] list; static boolean isTrainPage = false; private int guiLeft; private int guiTop; - private int page=0; - private List items = new ArrayList(); + private int page = 0; + private List items = new ArrayList<>(); - public GUIAdminBook(String csv){ + public GUIAdminBook(String csv) { //if its the xml enable train page mode. - if (csv.length()<3){ - list=null; + if (csv.length() < 3) { + list = null; return; } - if(csv.charAt(0) == '<') { - isTrainPage=true; + if (csv.charAt(0) == '<') { + isTrainPage = true; } else { isTrainPage = false; } list = csv.split(","); } + @Override - public boolean doesGuiPauseGame() - { + public boolean doesGuiPauseGame() { return false; } @@ -51,41 +51,43 @@ public boolean doesGuiPauseGame() @Override public void actionPerformed(GuiButton button) { - switch (button.id){ - case -1:{ - Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient( "0:"+list[0].substring(1,list[0].length()), Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to drop items + switch (button.id) { + case -1: { + // Tell the server to drop items + Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient("0:" + list[0].substring(1), Minecraft.getMinecraft().thePlayer.getEntityId())); break; } - case 0:{ - Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient( "1:"+list[0].substring(1), Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to drop items + case 0: { + // Tell the server to drop items + Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient("1:" + list[0].substring(1), Minecraft.getMinecraft().thePlayer.getEntityId())); break; } - case 1:{ - if (!isTrainPage){ + case 1: { + if (!isTrainPage) { page--; - buttonList = new ArrayList(); + buttonList = new ArrayList<>(); initGui(); } else { - Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient( list[1], Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to send a new gui + Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient(list[1], Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to send a new gui } break; } - case 2:{ + case 2: { page++; - buttonList = new ArrayList(); + buttonList = new ArrayList<>(); initGui(); break; } - case 3:{ - if(list[0]!=null && list[0].length()>1) { + case 3: { + if (list[0] != null && list[0].length() > 1) { Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient("0:" + list[0].substring(1), Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to drop items Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient("1:" + list[0].substring(1), Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to drop items } break; } - default:{ - Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient( list[button.id-3], Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to send a new gui + default: { + Traincraft.keyChannel.sendToServer(new ItemAdminBook.PacketAdminBookClient(list[button.id - 3], Minecraft.getMinecraft().thePlayer.getEntityId()));//tell server to send a new gui break; } } @@ -95,61 +97,68 @@ public void actionPerformed(GuiButton button) { @Override public void initGui() { super.initGui(); - if(list==null){ + if (list == null) { return; } + this.guiLeft = (this.width - 176) / 2; this.guiTop = (this.height - 166) / 2; - if(!isTrainPage) { - int index=0; - for (int i = 6 * page; i < 6+(6*page) && i0 && list[i].indexOf(".txt")>0) { + if (!isTrainPage) { + int index = 0; + for (int i = 6 * page; i < 6 + (6 * page) && i < list.length; i++) {//only show 6 entries per page + this.buttonList.add(new GuiButton(i + 3, guiLeft - 80, guiTop + 20 + (index * 18), 140, 20, + list[i].isEmpty() ? "Back" : + list[i].contains("_") ? + list[i].substring(list[i].indexOf("~") + 1, list[i].lastIndexOf("_")).replace("minecart", "") : + list[i])); + + if (list[i].lastIndexOf("_") > 0 && list[i].indexOf(".txt") > 0) { this.buttonList.add(new GuiButton(i + 3, guiLeft + 70, guiTop + 20 + (index * 18), 220, 20, - list[i].substring(list[i].lastIndexOf("_")+1, list[i].indexOf(".txt")))); + list[i].substring(list[i].lastIndexOf("_") + 1, list[i].indexOf(".txt")))); } index++; } - if(list.length-6-(page*6)>0){ + + if (list.length - 6 - (page * 6) > 0) { //draw next - this.buttonList.add(new GuiButton(2, guiLeft-70, guiTop+140 , 70, 20, "next page")); + this.buttonList.add(new GuiButton(2, guiLeft - 70, guiTop + 140, 70, 20, "next page")); } - if (page>0){ - this.buttonList.add(new GuiButton(1, guiLeft+10, guiTop+140 , 70, 20, "back")); + + if (page > 0) { + this.buttonList.add(new GuiButton(1, guiLeft + 10, guiTop + 140, 70, 20, "back")); } } else { try { //draw back - this.buttonList.add(new GuiButton(-1,guiLeft+85,guiTop+140,90,20,"clone inventory")); - this.buttonList.add(new GuiButton(0,guiLeft+5,guiTop+140,70,20,"delete entry")); - this.buttonList.add(new GuiButton(3,guiLeft+180,guiTop+140,80,20,"clone & delete")); - this.buttonList.add(new GuiButton(1, guiLeft-70, guiTop+140 , 70, 20, "back")); + this.buttonList.add(new GuiButton(-1, guiLeft + 85, guiTop + 140, 90, 20, "clone inventory")); + this.buttonList.add(new GuiButton(0, guiLeft + 5, guiTop + 140, 70, 20, "delete entry")); + this.buttonList.add(new GuiButton(3, guiLeft + 180, guiTop + 140, 80, 20, "clone & delete")); + this.buttonList.add(new GuiButton(1, guiLeft - 70, guiTop + 140, 70, 20, "back")); items = ServerLogger.getItems(list[9]); - } catch (Exception e){} + } catch (Exception e) { + } } } @Override - public void drawScreen(int mouseX, int mouseY, float par3){ + public void drawScreen(int mouseX, int mouseY, float par3) { super.drawScreen(mouseX, mouseY, par3); - if(list==null){ + if (list == null) { return; } - if(isTrainPage){ - for (int i = 2+(6 * page); i < Math.min(list.length, 9); i++) {//only show 6 entries per page - drawTextOutlined(fontRendererObj, list[(page*i)+i], guiLeft-70, guiTop-16 +(i*16), 16777215); + + if (isTrainPage) { + for (int i = 2 + (6 * page); i < Math.min(list.length, 9); i++) {//only show 6 entries per page + drawTextOutlined(fontRendererObj, list[(page * i) + i], guiLeft - 70, guiTop - 16 + (i * 16), 16777215); } - drawTextOutlined(fontRendererObj, I18n.format("container.inventory", new Object()), guiLeft+80, guiTop+10, 16777215); - int index=0; - for (int y =0; y<6; y++){ - for(int x=0; x<9; x++){ - if(items.size()>index && items.get(index) !=null) { + + drawTextOutlined(fontRendererObj, I18n.format("container.inventory", new Object()), guiLeft + 80, guiTop + 10, 16777215); + int index = 0; + for (int y = 0; y < 6; y++) { + for (int x = 0; x < 9; x++) { + if (items.size() > index && items.get(index) != null) { func_146977_a(items.get(index), guiLeft + 80 + (x * 16), guiTop + 26 + (y * 16)); } index++; @@ -159,26 +168,25 @@ public void drawScreen(int mouseX, int mouseY, float par3){ } - public static void drawTextOutlined(FontRenderer font, String string, int x, int y, int color){ + public static void drawTextOutlined(FontRenderer font, String string, int x, int y, int color) { //bottom left - font.drawString(string, x-1, y+1, 0); + font.drawString(string, x - 1, y + 1, 0); //bottom - font.drawString(string, x, y+1, 0); + font.drawString(string, x, y + 1, 0); //bottom right - font.drawString(string, x+1, y+1, 0); + font.drawString(string, x + 1, y + 1, 0); //left - font.drawString(string, x-1, y, 0); + font.drawString(string, x - 1, y, 0); //right - font.drawString(string, x+1, y, 0); + font.drawString(string, x + 1, y, 0); //top left - font.drawString(string, x-1, y-1, 0); + font.drawString(string, x - 1, y - 1, 0); //top - font.drawString(string, x, y-1, 0); + font.drawString(string, x, y - 1, 0); //top right - font.drawString(string, x+1, y-1, 0); - + font.drawString(string, x + 1, y - 1, 0); - font.drawString(string,x,y,color); + font.drawString(string, x, y, color); } /** @@ -203,6 +211,7 @@ public static void drawTexturedRect(int posX, int posY, int posU, int posV, int tessellator.addVertexWithUV(posX, posY, 0, posU * guiScaler, posV * guiScaler); tessellator.draw(); } + public static void drawTexturedRect(int posX, int posY, int posU, int posV, int width, int height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.startDrawing(GL11.GL_QUADS); @@ -214,7 +223,6 @@ public static void drawTexturedRect(int posX, int posY, int posU, int posV, int } - private void func_146977_a(ItemStack p_146977_1_, int xDisplayPosition, int yDisplayPosition) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); @@ -223,6 +231,4 @@ private void func_146977_a(ItemStack p_146977_1_, int xDisplayPosition, int yDis GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } - - } \ No newline at end of file diff --git a/src/main/java/train/common/adminbook/ItemAdminBook.java b/src/main/java/train/common/adminbook/ItemAdminBook.java index 99c70d6bf2..aa06175f26 100644 --- a/src/main/java/train/common/adminbook/ItemAdminBook.java +++ b/src/main/java/train/common/adminbook/ItemAdminBook.java @@ -19,12 +19,13 @@ import train.common.library.Info; import java.io.File; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.Comparator; import java.util.List; +import java.util.Objects; /** *

Key Item

@@ -33,7 +34,7 @@ */ public class ItemAdminBook extends Item { - public ItemAdminBook(){ + public ItemAdminBook() { setCreativeTab(Traincraft.tcTab); setUnlocalizedName("adminbook"); } @@ -50,6 +51,7 @@ public void addInformation(ItemStack thisStack, EntityPlayer player, List string stringList.add("- drop trains/rollingstock and their inventory lost during a crash"); stringList.add("- Lock or unlock trains/rollingstock"); } + @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { try { @@ -63,10 +65,10 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla //if player wasin't looking at a train StringBuilder sb = new StringBuilder(); File[] list = new File(Traincraft.configDirectory.getAbsolutePath() + "/traincraft/").listFiles(); - if (list!=null) { + if (list != null) { Arrays.sort(list, new compareFile()); for (File f : list) { - if (f.isDirectory() && f.list() != null && f.list().length > 0) { + if (f.isDirectory() && f.list() != null && Objects.requireNonNull(f.list()).length > 0) { sb.append(f.getName()); sb.append(","); } @@ -78,14 +80,14 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla } else { return stack; } - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } return super.onItemRightClick(stack, world, player); } - class compareFile implements Comparator { + static class compareFile implements Comparator { // Overriding the compare method to sort the age public int compare(File d, File d1) { return d.getName().toLowerCase().compareTo(d1.getName().toLowerCase()); @@ -93,7 +95,6 @@ public int compare(File d, File d1) { } - @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { @@ -101,7 +102,6 @@ public void registerIcons(IIconRegister iconRegister) { } - public static class PacketAdminBookClient implements IMessage { private String id; private int player; @@ -118,106 +118,103 @@ public PacketAdminBookClient(String data, int playerID) { /**reads the packet on server to get the variables from the Byte Buffer*/ @Override public void fromBytes(ByteBuf bbuf) { - try { - String data = new String(bbuf.array(), "UTF-8"); - if (!data.equals("")) { - player = Integer.parseInt(data.substring(data.indexOf(":") + 1, data.indexOf(","))); - id = data.substring(data.indexOf(",")+1, data.length()); - } - } catch (UnsupportedEncodingException e){ - + String data = new String(bbuf.array(), StandardCharsets.UTF_8); + if (!data.isEmpty()) { + player = Integer.parseInt(data.substring(data.indexOf(":") + 1, data.indexOf(","))); + id = data.substring(data.indexOf(",") + 1); } } + /**puts the variables into a Byte Buffer so they can be sent to server*/ @Override public void toBytes(ByteBuf bbuf) { - try{ - bbuf.writeBytes((":" + player +"," + id).getBytes("UTF-8")); - } catch (UnsupportedEncodingException e){ - - } + bbuf.writeBytes((":" + player + "," + id).getBytes(StandardCharsets.UTF_8)); } + public static class Handler implements IMessageHandler { @Override public IMessage onMessage(PacketAdminBookClient message, MessageContext context) { - int event=0; - if(message.id.length()>2 && message.id.substring(0,2).equals("0:")){ - message.id = message.id.substring(2, message.id.length()); - event=1; + int event = 0; + if (message.id.length() > 2 && message.id.startsWith("0:")) { + message.id = message.id.substring(2); + event = 1; } - if(message.id.length()>2 && message.id.substring(0,2).equals("1:")){ - message.id = message.id.substring(2, message.id.length()); - event=2; + if (message.id.length() > 2 && message.id.startsWith("1:")) { + message.id = message.id.substring(2); + event = 2; } File f = new File(Traincraft.configDirectory.getAbsolutePath() + "/traincraft/" + message.id); if (f.exists()) { - //if player wasin't looking at a train + // If player was not looking at a train StringBuilder sb = new StringBuilder(); - if (!f.isDirectory()){ + if (!f.isDirectory()) { try { - if(event==0) { + if (event == 0) { sb.append("<"); sb.append(message.id); sb.append(","); - sb.append(message.id.substring(0, message.id.indexOf("/") + 1)); + sb.append(message.id, 0, message.id.indexOf("/") + 1); sb.append(","); - String document = new String(Files.readAllBytes(Paths.get(Traincraft.configDirectory.getAbsolutePath() + "/traincraft/" + message.id)), "UTF-8"); + String document = new String(Files.readAllBytes(Paths.get(Traincraft.configDirectory.getAbsolutePath() + "/traincraft/" + message.id)), StandardCharsets.UTF_8); sb.append("Delegate:,"); - sb.append(document.substring(document.indexOf("") + 10, document.indexOf(""))); + sb.append(document, document.indexOf("") + 10, document.indexOf("")); sb.append(",UUID:,"); - sb.append(document.substring(document.indexOf("") + 6, document.indexOf("")).substring(0, 19)); + sb.append(document.substring(document.indexOf("") + 6, document.indexOf("")), 0, 19); sb.append(","); sb.append(document.substring(document.indexOf("") + 6, document.indexOf("")).substring(19)); sb.append(",Last Known Position:,X:"); - sb.append(document.substring(document.indexOf("") + 7, document.indexOf(""))); + sb.append(document, document.indexOf("") + 7, document.indexOf("")); sb.append("- Y:"); - sb.append(document.substring(document.indexOf("") + 7, document.indexOf(""))); + sb.append(document, document.indexOf("") + 7, document.indexOf("")); sb.append("- Z:"); - sb.append(document.substring(document.indexOf("") + 7, document.indexOf(""))); + sb.append(document, document.indexOf("") + 7, document.indexOf("")); + if (document.contains("")) { sb.append(",Fuel amount: "); - sb.append(document.substring(document.indexOf("") + 6, document.indexOf(""))); + sb.append(document, document.indexOf("") + 6, document.indexOf("")); } + if (document.contains("")) { sb.append(","); - sb.append(document.substring(document.indexOf(""), document.indexOf("") + 12)); + sb.append(document, document.indexOf(""), document.indexOf("") + 12); } - } - else if (event==1){ + } else if (event == 1) { for (WorldServer world : DimensionManager.getWorlds()) { if (world.getEntityByID(message.player) != null) { EntityPlayerMP p = (EntityPlayerMP) world.getEntityByID(message.player); - List items = ServerLogger.getItems(new String(Files.readAllBytes(Paths.get(Traincraft.configDirectory.getAbsolutePath() + "/traincraft/" + message.id)), "UTF-8")); - for (ItemStack i : items){ - if (i.stackSize != 0 && i.getItem() != null) - { + List items = ServerLogger.getItems(new String(Files.readAllBytes(Paths.get(Traincraft.configDirectory.getAbsolutePath() + "/traincraft/" + message.id)), StandardCharsets.UTF_8)); + for (ItemStack i : items) { + if (i.stackSize != 0 && i.getItem() != null) { EntityItem entityitem = new EntityItem(world, p.posX, p.posY + 3, p.posZ, i); entityitem.delayBeforeCanPickup = 120; if (p.captureDrops) { p.capturedDrops.add(entityitem); - } else{ + } else { world.spawnEntityInWorld(entityitem); } } } } } - } else if (event==2){ + } else { if (f.exists()) { f.delete(); } } - } catch (Exception e){} + } catch (Exception ignored) { + } } else { - if(!message.id.equals("")) { + if (!message.id.isEmpty()) { sb.append(","); } + File[] folder = f.listFiles(); - if (folder !=null) { + + if (folder != null) { for (File file : folder) { if (file != null) { sb.append(message.id); - if(!message.id.equals("")) { + if (!message.id.isEmpty()) { sb.append("/"); } sb.append(file.getName()); @@ -226,9 +223,11 @@ else if (event==1){ } } } - if(sb.toString().length()<5){ + + if (sb.toString().length() < 5) { return null; } + for (WorldServer world : DimensionManager.getWorlds()) { if (world.getEntityByID(message.player) != null) { Traincraft.keyChannel.sendTo(new PacketAdminBook(1, -1, sb.toString()), (EntityPlayerMP) world.getEntityByID(message.player)); @@ -239,20 +238,16 @@ else if (event==1){ return null; } } - } - public static class PacketAdminBook implements IMessage { - - /**the key to define what function to use*/ private int key; private int ID; private String datacsv; - public PacketAdminBook(){ + public PacketAdminBook() { } @@ -261,37 +256,29 @@ public PacketAdminBook(int key, int ID, String data) { this.ID = ID; this.datacsv = data; } + /**reads the packet on server to get the variables from the Byte Buffer*/ @Override public void fromBytes(ByteBuf bbuf) { - try { - String data = new String(bbuf.array(), "UTF-8"); - if (!data.equals("")) { - key = Integer.parseInt(data.substring(data.indexOf(":")+1, data.indexOf(","))); - data = data.substring(data.indexOf(",") + 1, data.length()); - ID = Integer.parseInt(data.substring(0, data.indexOf(","))); - datacsv = data.substring(data.indexOf(",") + 1, data.length()); - } - } catch (UnsupportedEncodingException e){ - + String data = new String(bbuf.array(), StandardCharsets.UTF_8); + if (!data.isEmpty()) { + key = Integer.parseInt(data.substring(data.indexOf(":") + 1, data.indexOf(","))); + data = data.substring(data.indexOf(",") + 1); + ID = Integer.parseInt(data.substring(0, data.indexOf(","))); + datacsv = data.substring(data.indexOf(",") + 1); } } + /**puts the variables into a Byte Buffer so they can be sent to server*/ @Override public void toBytes(ByteBuf bbuf) { - try{ - StringBuilder sb=new StringBuilder(); - sb.append(":"); - sb.append(key); - sb.append(","); - sb.append(ID); - sb.append(","); - sb.append(datacsv); - bbuf.writeBytes(sb.toString().getBytes("UTF-8")); - - } catch (UnsupportedEncodingException e){ - - } + String sb = ":" + + key + + "," + + ID + + "," + + datacsv; + bbuf.writeBytes(sb.getBytes(StandardCharsets.UTF_8)); } @@ -299,7 +286,6 @@ public static class Handler implements IMessageHandler");//seemingly unnecessary new line added to the end, linux needs this sometimes. fileoutputstream.write(sb.toString().getBytes()); fileoutputstream.close(); - } catch (Exception e){ + } catch (Exception e) { //apparently we don't have permission, so, nevermind. } } //run this on attack entity event if the entity dies - public static void deleteWagon(EntityRollingStock wagon){ + public static void deleteWagon(EntityRollingStock wagon) { StringBuilder sb = new StringBuilder(); sb.append(Traincraft.configDirectory.getAbsolutePath()); sb.append("/traincraft/"); - if(wagon.getOwner() != null && wagon.getOwner().getName()!=null && !wagon.getOwner().getName().equals("")){ + + if (wagon.getOwner() != null && wagon.getOwner().getName() != null && !wagon.getOwner().getName().isEmpty()) { sb.append(wagon.getOwner().getName().toLowerCase()); - } else if (wagon.getTrainOwner() !=null && !wagon.getTrainOwner().equals("")){ + } else if (wagon.getTrainOwner() != null && !wagon.getTrainOwner().isEmpty()) { sb.append(wagon.getTrainOwner().toLowerCase()); } else { - sb.append("unknown_player"); + sb.append("unknown_player"); } + sb.append("/"); sb.append(wagon.getCartItem().getItem().delegate.name().replace(":", "~").toLowerCase()); sb.append("_"); @@ -114,15 +116,16 @@ public static void deleteWagon(EntityRollingStock wagon){ if (f.exists() && !f.isDirectory()) { f.delete(); } - } catch (Exception e){}//if it fails there was nothing to delete, so same result + } catch (Exception ignored) { + }//if it fails there was nothing to delete, so same result } - - private static void addItemXML(StringBuilder string, ItemStack item){ - if (item == null || item.getItem() == null || item.stackSize<=0){ + private static void addItemXML(StringBuilder string, ItemStack item) { + if (item == null || item.getItem() == null || item.stackSize <= 0) { return; } + string.append(" \n "); string.append(Item.getIdFromItem(item.getItem())); string.append("\n "); @@ -134,15 +137,15 @@ private static void addItemXML(StringBuilder string, ItemStack item){ string.append("\n \n"); } - private static void addFluidXML(StringBuilder string, FluidStack item){ - if (item == null || item.getFluid() == null || item.amount<=0){ + private static void addFluidXML(StringBuilder string, FluidStack item) { + if (item == null || item.getFluid() == null || item.amount <= 0) { return; } - int fill=1000; - while(fill < item.amount) { - addItemXML(string, FluidContainerRegistry.fillFluidContainer(item, new ItemStack(Items.bucket))); - fill +=1000; + int fill = 1000; + while (fill < item.amount) { + addItemXML(string, FluidContainerRegistry.fillFluidContainer(item, new ItemStack(Items.bucket))); + fill += 1000; } } @@ -156,47 +159,44 @@ private static void addFluidXML(StringBuilder string, FluidStack item){ */ //parses the document for itemstacks - public static List getItems(String doc){ + public static List getItems(String doc) { try { - ArrayList itemStacks = new ArrayList(); - itemStacks.add(new ItemStack(GameData.getItemRegistry().getObject(doc.substring(doc.indexOf("")+10, doc.indexOf(""))))); + ArrayList itemStacks = new ArrayList<>(); + itemStacks.add(new ItemStack(GameData.getItemRegistry().getObject(doc.substring(doc.indexOf("") + 10, doc.indexOf(""))))); - List stacks = new ArrayList(); - while (doc.contains("")){ - stacks.add(doc.substring(doc.indexOf("")+11, doc.indexOf(""))); - doc = doc.substring(doc.indexOf("")+12); + List stacks = new ArrayList<>(); + while (doc.contains("")) { + stacks.add(doc.substring(doc.indexOf("") + 11, doc.indexOf(""))); + doc = doc.substring(doc.indexOf("") + 12); } - - for (String s : stacks){ + for (String s : stacks) { ItemStack stack = parseItemFromXML(s); - if (stack != null){ + if (stack != null) { itemStacks.add(stack); } } return itemStacks; - - } catch (Exception e){ - return new ArrayList(); + } catch (Exception e) { + return new ArrayList<>(); } } //parses the individual item - public static ItemStack parseItemFromXML(String doc){ + public static ItemStack parseItemFromXML(String doc) { try { ItemStack stack = new ItemStack( - GameData.getItemRegistry().getObject(doc.substring(doc.indexOf("")+10, doc.indexOf(""))),//get item by delegate name since it's static - Integer.parseInt(doc.substring(doc.indexOf("")+11, doc.indexOf("")))//we always get strings so gotta parse. + GameData.getItemRegistry().getObject(doc.substring(doc.indexOf("") + 10, doc.indexOf(""))),//get item by delegate name since it's static + Integer.parseInt(doc.substring(doc.indexOf("") + 11, doc.indexOf("")))//we always get strings so gotta parse. ); - stack.setItemDamage(Integer.parseInt(doc.substring(doc.indexOf("")+6, doc.indexOf("")))); + stack.setItemDamage(Integer.parseInt(doc.substring(doc.indexOf("") + 6, doc.indexOf("")))); return stack; - } catch (Exception e){ + } catch (Exception e) { return null; } } - } diff --git a/src/main/java/train/common/api/AbstractTrains.java b/src/main/java/train/common/api/AbstractTrains.java index 80eb99e17b..8a4c0d2852 100644 --- a/src/main/java/train/common/api/AbstractTrains.java +++ b/src/main/java/train/common/api/AbstractTrains.java @@ -36,127 +36,123 @@ public abstract class AbstractTrains extends EntityMinecart implements IMinecart, IRoutableCart, IEntityAdditionalSpawnData { - public boolean isAttached = false; - public boolean isAttaching = false; - public static int numberOfTrains; - public EntityPlayer playerEntity; - public double Link1; - public double Link2; - protected boolean linked = false; - public EntityRollingStock cartLinked1; - public EntityRollingStock cartLinked2; - //private Set chunks; - protected Ticket chunkTicket; - public float renderYaw; - protected float renderPitch; - public TrainHandler train; - public List loadedChunks = new ArrayList(); - public boolean shouldChunkLoad = true; - protected boolean itemdropped =false; - - public XmlBuilder entity_data= new XmlBuilder(); - /** - * A reference to EnumTrains containing all spec for this specific train - */ - private TrainRecord trainSpec=null; - - public TrainRecord getSpec(){ - if(trainSpec==null){ - trainSpec=Traincraft.instance.traincraftRegistry.getTrainRecord(this.getClass()); - } - return trainSpec; - } - - /** - * The name of the train based on the item name - */ - public String trainName = ""; - public double accelerate = 0.7D; - public double brake = 0.96D; - /** - * determines the mass of the carts from 0 to 10 it's then multiplied by 10 - * to pretend this is [tons] - */ - public double mass = 1; - /** - * the default mass, not affected by weight of items/liquids - */ - public double defaultMass = 1; - /** - * the power of locomotives, 0 for carts - */ - public int power = 0; - /** - * Whether this train is locked and can only be used by the Owner - */ - public boolean locked = false; - /** - * The owner of the train: The user who spawned it - */ - public String trainOwner = ""; - - public String getTrainOwner() { - return trainOwner; - } - - - public void setTrainOwner(String trainOwner) { - this.trainOwner = trainOwner; - } - - /** - * The creator of the train - */ - public String trainCreator = ""; - - /** - * The type of the train: steam tender diesel electric freight flat tank - * passenger work special - */ - public String trainType = ""; - - /** - * player who destroyed the train - */ - protected String trainDestroyer = ""; - - /** - * unique ID for a train. ID is create when item is created. This allows to - * track a train not only in his entity form - */ - public int uniqueID = -1; - /** - * supposed to store the last ID given; - */ - public static int uniqueIDs = 1; - - - /** - * The distance this train has traveled - */ - public double trainDistanceTraveled = 0; - - public String destination = ""; - - - public AbstractTrains(World world) { - super(world); - renderDistanceWeight = 2.0D; - if (getSpec().getLiveries().size()>0) { - entity_data.putString("color", getSpec().getLiveries().get(0)); - } else { - entity_data.putString("color", ""); - } - dataWatcher.addObject(12, entity_data.toXMLString()); - dataWatcher.addObject(6, trainType); - dataWatcher.addObject(7, trainOwner); - dataWatcher.addObject(8, trainDestroyer); - dataWatcher.addObject(9, trainName); - dataWatcher.addObject(10, numberOfTrains); - dataWatcher.addObject(11, uniqueID); - dataWatcher.addObject(13, trainCreator); - shouldChunkLoad=ConfigHandler.CHUNK_LOADING; - this.setFlag(7, shouldChunkLoad); + public boolean isAttached = false; + public boolean isAttaching = false; + public static int numberOfTrains; + public EntityPlayer playerEntity; + public double Link1; + public double Link2; + protected boolean linked = false; + public EntityRollingStock cartLinked1; + public EntityRollingStock cartLinked2; + //private Set chunks; + protected Ticket chunkTicket; + public float renderYaw; + protected float renderPitch; + public TrainHandler train; + public List loadedChunks = new ArrayList<>(); + public boolean shouldChunkLoad = true; + protected boolean itemdropped = false; + + public XmlBuilder entity_data = new XmlBuilder(); + /** + * A reference to EnumTrains containing all spec for this specific train + */ + private TrainRecord trainSpec = null; + + public TrainRecord getSpec() { + if (trainSpec == null) { + trainSpec = Traincraft.instance.traincraftRegistry.getTrainRecord(this.getClass()); + } + return trainSpec; + } + + /** + * The name of the train based on the item name + */ + public String trainName = ""; + public double accelerate = 0.7D; + public double brake = 0.96D; + /** + * determines the mass of the carts from 0 to 10 it's then multiplied by 10 + * to pretend this is [tons] + */ + public double mass = 1; + /** + * the default mass, not affected by weight of items/liquids + */ + public double defaultMass = 1; + /** + * the power of locomotives, 0 for carts + */ + public int power = 0; + /** + * Whether this train is locked and can only be used by the Owner + */ + public boolean locked = false; + /** + * The owner of the train: The user who spawned it + */ + public String trainOwner = ""; + + public String getTrainOwner() { + return trainOwner; + } + + + public void setTrainOwner(String trainOwner) { + this.trainOwner = trainOwner; + } + + /** + * The creator of the train + */ + public String trainCreator = ""; + + /** + * The type of the train: steam tender diesel electric freight flat tank + * passenger work special + */ + public String trainType = ""; + + /** + * player who destroyed the train + */ + protected String trainDestroyer = ""; + + /** + * unique ID for a train. ID is create when item is created. This allows to + * track a train not only in his entity form + */ + public int uniqueID = -1; + /** + * supposed to store the last ID given; + */ + public static int uniqueIDs = 1; + + + /** + * The distance this train has traveled + */ + public double trainDistanceTraveled = 0; + + public String destination = ""; + + + public AbstractTrains(World world) { + super(world); + renderDistanceWeight = 2.0D; + entity_data.putString("color", !getSpec().getLiveries().isEmpty() ? getSpec().getLiveries().get(0) : ""); + dataWatcher.addObject(12, entity_data.toXMLString()); + dataWatcher.addObject(6, trainType); + dataWatcher.addObject(7, trainOwner); + dataWatcher.addObject(8, trainDestroyer); + dataWatcher.addObject(9, trainName); + dataWatcher.addObject(10, numberOfTrains); + dataWatcher.addObject(11, uniqueID); + dataWatcher.addObject(13, trainCreator); + shouldChunkLoad = ConfigHandler.CHUNK_LOADING; + this.setFlag(7, shouldChunkLoad); /*for (EnumTrains trains : EnumTrains.values()) { @@ -174,170 +170,170 @@ public AbstractTrains(World world) { break; } }*/ - if (getSpec() != null) { - this.setDefaultMass(getSpec().getMass()); - this.setSize(0.98f, 1.98f); - this.setMinecartName(getSpec().getName()); - } - } - - public AbstractTrains(World world, double x, double y, double z){ - this(world); - this.setPosition(x, y, z); - } - - @Override - public AxisAlignedBB getCollisionBox(Entity p_70114_1_) { - if(riddenByEntity!=p_70114_1_){ - return super.getCollisionBox(p_70114_1_); - } else { - return null; - } - } - - /** - * this is basically NBT for entity spawn, to keep data between client and server in sync because some data is not automatically shared. - */ - @Override - public void readSpawnData(ByteBuf additionalData) { - locked = additionalData.readBoolean(); - } - @Override - public void writeSpawnData(ByteBuf buffer) { - buffer.writeBoolean(locked); - } - - - public abstract boolean isLocomotive(); - - public abstract boolean isPassenger(); - - public abstract boolean isFreightCart(); - - public abstract boolean isFreightOrPassenger(); - - public abstract boolean isBuilder(); - - public abstract boolean isTender(); - - public abstract boolean isWorkCart(); - - public abstract boolean isElectricTrain(); - - public abstract boolean isLinked(); - - protected abstract boolean canOverheat(); - - protected abstract int getOverheatTime(); - - public abstract float getLinkageDistance(EntityMinecart cart); - - //public abstract int getID(); - - public abstract boolean canBeAdjusted(EntityMinecart cart2); - - public abstract float getOptimalDistance(EntityMinecart cart2); - - public abstract List getItemsDropped(); - - public int getUniqueTrainID(){ - return uniqueID; - } - - public void manageChunkLoading(){ - //if(this instanceof Locomotive)System.out.println("I'm alive. Remote: " + worldObj.isRemote); - if (!worldObj.isRemote && this.uniqueID == -1) { - if (FMLCommonHandler.instance().getMinecraftServerInstance() != null) { - //TraincraftSaveHandler.createFile(FMLCommonHandler.instance().getMinecraftServerInstance()); - //int readID = TraincraftSaveHandler.readInt(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:"); - //int newID = setNewUniqueID(readID); - setNewUniqueID(this.getEntityId()); - //TraincraftSaveHandler.writeValue(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:", new String("" + newID)); - //System.out.println("Train is missing an ID, adding new one for "+this.trainName+" "+this.uniqueID); - } - } - shouldChunkLoad = getFlag(7); - if (shouldChunkLoad){ - if(this.chunkTicket == null) { - this.requestTicket(); - } - } - } - - @Override - public void onUpdate() { - super.onUpdate(); - if(!(this instanceof EntityRollingStock)) { - manageChunkLoading(); - } - /* - * if (worldObj.isRemote) { if (this.getFlag(6)) { if (this.chunks != - * null) { Iterator var3 = this.chunks.iterator(); while - * (var3.hasNext()) { ChunkCoordIntPair var4 = (ChunkCoordIntPair) - * var3.next(); int x = var4.getCenterXPos(); int z = - * var4.getCenterZPosition(); - * this.worldObj.spawnParticle("mobSpellAmbient", x, posY, z, 0, 0, 0); - * for (int i = 0; i < 10; i++) { this.worldObj.spawnParticle("portal", - * x + (this.rand.nextDouble() - 0.5D) * (double) 8, this.posY + - * this.rand.nextDouble() * (double) 6 - 0.25D, z + - * (this.rand.nextDouble() - 0.5D) * (double) 8, (this.rand.nextDouble() - * - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - - * 0.5D) * 2.0D); } } } else { this.setupChunks(this.chunkCoordX, - * this.chunkCoordZ); } } } else if (!ConfigHandler.CHUNK_LOADING) { - * this.releaseTicket(); } else { if (this.ticket == null) { - * this.requestTicket(); } } - */ - } - @Override - public void setDead() { - ForgeChunkManager.releaseTicket(chunkTicket); - } - - public int setNewUniqueID(int numberOfTrains) { - // System.out.println(numberOfTrains); - if (numberOfTrains <= 0) { - numberOfTrains = uniqueIDs++; - } - else { - uniqueIDs = numberOfTrains++; - } - this.uniqueID = numberOfTrains; - getEntityData().setInteger("uniqueID", numberOfTrains); - // System.out.println("setting new ID "+uniqueID); - return numberOfTrains; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if (!worldObj.isRemote && ConfigHandler.CHUNK_LOADING && (this instanceof Locomotive) ) { - if (itemstack != null && itemstack.getItem() instanceof ItemChunkLoaderActivator) { - this.playerEntity = entityplayer; - if (getFlag(7)) { - this.setFlag(7, false); - entityplayer.addChatMessage(new ChatComponentText("Stop loading chunks")); - ForgeChunkManager.releaseTicket(chunkTicket); - chunkTicket = null; - } - else if (!getFlag(7)) { - this.setFlag(7, true); - entityplayer.addChatMessage(new ChatComponentText("Start loading chunks")); - } - itemstack.damageItem(1, entityplayer); - return true; - } else if(lockThisCart(itemstack, entityplayer)) { - return true; - } - } - return false; - } - - /** - * set the color of the rollingstock - * - * @see ItemRollingStock - * @param color - */ + if (getSpec() != null) { + this.setDefaultMass(getSpec().getMass()); + this.setSize(0.98f, 1.98f); + this.setMinecartName(getSpec().getName()); + } + } + + public AbstractTrains(World world, double x, double y, double z) { + this(world); + this.setPosition(x, y, z); + } + + @Override + public AxisAlignedBB getCollisionBox(Entity p_70114_1_) { + if (riddenByEntity != p_70114_1_) { + return super.getCollisionBox(p_70114_1_); + } else { + return null; + } + } + + /** + * this is basically NBT for entity spawn, to keep data between client and server in sync because some data is not automatically shared. + */ + @Override + public void readSpawnData(ByteBuf additionalData) { + locked = additionalData.readBoolean(); + } + + @Override + public void writeSpawnData(ByteBuf buffer) { + buffer.writeBoolean(locked); + } + + + public abstract boolean isLocomotive(); + + public abstract boolean isPassenger(); + + public abstract boolean isFreightCart(); + + public abstract boolean isFreightOrPassenger(); + + public abstract boolean isBuilder(); + + public abstract boolean isTender(); + + public abstract boolean isWorkCart(); + + public abstract boolean isElectricTrain(); + + public abstract boolean isLinked(); + + protected abstract boolean canOverheat(); + + protected abstract int getOverheatTime(); + + public abstract float getLinkageDistance(EntityMinecart cart); + + //public abstract int getID(); + + public abstract boolean canBeAdjusted(EntityMinecart cart2); + + public abstract float getOptimalDistance(EntityMinecart cart2); + + public abstract List getItemsDropped(); + + public int getUniqueTrainID() { + return uniqueID; + } + + public void manageChunkLoading() { + //if(this instanceof Locomotive)System.out.println("I'm alive. Remote: " + worldObj.isRemote); + if (!worldObj.isRemote && this.uniqueID == -1) { + if (FMLCommonHandler.instance().getMinecraftServerInstance() != null) { + //TraincraftSaveHandler.createFile(FMLCommonHandler.instance().getMinecraftServerInstance()); + //int readID = TraincraftSaveHandler.readInt(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:"); + //int newID = setNewUniqueID(readID); + setNewUniqueID(this.getEntityId()); + //TraincraftSaveHandler.writeValue(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:", new String("" + newID)); + //System.out.println("Train is missing an ID, adding new one for "+this.trainName+" "+this.uniqueID); + } + } + shouldChunkLoad = getFlag(7); + if (shouldChunkLoad) { + if (this.chunkTicket == null) { + this.requestTicket(); + } + } + } + + @Override + public void onUpdate() { + super.onUpdate(); + if (!(this instanceof EntityRollingStock)) { + manageChunkLoading(); + } + /* + * if (worldObj.isRemote) { if (this.getFlag(6)) { if (this.chunks != + * null) { Iterator var3 = this.chunks.iterator(); while + * (var3.hasNext()) { ChunkCoordIntPair var4 = (ChunkCoordIntPair) + * var3.next(); int x = var4.getCenterXPos(); int z = + * var4.getCenterZPosition(); + * this.worldObj.spawnParticle("mobSpellAmbient", x, posY, z, 0, 0, 0); + * for (int i = 0; i < 10; i++) { this.worldObj.spawnParticle("portal", + * x + (this.rand.nextDouble() - 0.5D) * (double) 8, this.posY + + * this.rand.nextDouble() * (double) 6 - 0.25D, z + + * (this.rand.nextDouble() - 0.5D) * (double) 8, (this.rand.nextDouble() + * - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - + * 0.5D) * 2.0D); } } } else { this.setupChunks(this.chunkCoordX, + * this.chunkCoordZ); } } } else if (!ConfigHandler.CHUNK_LOADING) { + * this.releaseTicket(); } else { if (this.ticket == null) { + * this.requestTicket(); } } + */ + } + + @Override + public void setDead() { + ForgeChunkManager.releaseTicket(chunkTicket); + } + + public int setNewUniqueID(int numberOfTrains) { + // System.out.println(numberOfTrains); + if (numberOfTrains <= 0) { + numberOfTrains = uniqueIDs++; + } else { + uniqueIDs = numberOfTrains++; + } + this.uniqueID = numberOfTrains; + getEntityData().setInteger("uniqueID", numberOfTrains); + // System.out.println("setting new ID "+uniqueID); + return numberOfTrains; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + if (!worldObj.isRemote && ConfigHandler.CHUNK_LOADING && (this instanceof Locomotive)) { + if (itemstack != null && itemstack.getItem() instanceof ItemChunkLoaderActivator) { + this.playerEntity = entityplayer; + if (getFlag(7)) { + this.setFlag(7, false); + entityplayer.addChatMessage(new ChatComponentText("Stop loading chunks")); + ForgeChunkManager.releaseTicket(chunkTicket); + chunkTicket = null; + } else if (!getFlag(7)) { + this.setFlag(7, true); + entityplayer.addChatMessage(new ChatComponentText("Start loading chunks")); + } + itemstack.damageItem(1, entityplayer); + return true; + } else if (lockThisCart(itemstack, entityplayer)) { + return true; + } + } + return false; + } + + /** + * set the color of the rollingstock + * + * @param color + * @see ItemRollingStock + */ /*public void setColor(int color) { if (color==-1 && EnumTrains.getCurrentTrain(getCartItem().getItem()).getColors()!=null){ color = getColorFromString(EnumTrains.getCurrentTrain(getCartItem().getItem()).getColors()[0]); @@ -353,410 +349,417 @@ else if (!getFlag(7)) { dataWatcher.updateObject(12, color); this.getEntityData().setInteger("color", color); }*/ - public void setColor(int color) { - TrainRecord trainRecord = Traincraft.instance.traincraftRegistry.findTrainRecordByItem(getCartItem().getItem()); - if (trainRecord != null && trainRecord.getLiveries().size()>0){ - if (color==-1 || !trainRecord.getLiveries().contains(getColorAsString(color))) { - color = 0; - } - } - - entity_data.stringMap.put("color", trainRecord.getLiveries().get(color)); - dataWatcher.updateObject(12, entity_data.toXMLString()); - this.getEntityData().setString("xml", entity_data.toXMLString()); - } - - public void setColor(String color) { - TrainRecord trainRecord = Traincraft.instance.traincraftRegistry.findTrainRecordByItem(getCartItem().getItem()); - if (trainRecord != null && trainRecord.getLiveries() != null){ - if (color.equals("-1") || trainRecord.getLiveries().contains(color)) { - color = (trainRecord.getLiveries().get(0)); - } - } - - entity_data.stringMap.put("color", color); - dataWatcher.updateObject(12, entity_data.toXMLString()); - this.getEntityData().setString("xml", entity_data.toXMLString()); - } - - public void setRenderYaw(float yaw) { - this.renderYaw = yaw; - } - - public void setRenderPitch(float pitch) { - this.renderPitch = pitch; - } - - public String getColor() { - entity_data = new XmlBuilder(dataWatcher.getWatchableObjectString(12)); - return entity_data.getString("color"); - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - //super.writeEntityToNBT(nbttagcompound); - if(getColor().length()>0) { - nbttagcompound.setString("colorstr", getColor()); - } - nbttagcompound.setBoolean("chunkLoadingState", getFlag(7)); - nbttagcompound.setDouble("trainDistanceTraveled", trainDistanceTraveled); - nbttagcompound.setString("theOwner", trainOwner); - nbttagcompound.setBoolean("locked", locked); - nbttagcompound.setString("theCreator", trainCreator); - nbttagcompound.setString("theName", trainName); - nbttagcompound.setString("theType", trainType); - nbttagcompound.setInteger("uniqueID", uniqueID); - //nbttagcompound.setInteger("uniqueIDs",uniqueIDs); - - nbttagcompound.setInteger("numberOfTrains", AbstractTrains.numberOfTrains); - nbttagcompound.setBoolean("isAttached", this.isAttached); - nbttagcompound.setBoolean("linked", this.linked); - //nbttagcompound.setDouble("motionX", motionX); - //nbttagcompound.setDouble("motionZ", motionZ); - nbttagcompound.setDouble("Link1", Link1); - nbttagcompound.setDouble("Link2", Link2); - - nbttagcompound.setInteger("Dim", this.dimension); - - nbttagcompound.setLong("UUIDM", this.getUniqueID().getMostSignificantBits()); - nbttagcompound.setLong("UUIDL", this.getUniqueID().getLeastSignificantBits()); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - //super.readEntityFromNBT(nbttagcompound); - if(nbttagcompound.hasKey("color")) { - setColor(nbttagcompound.getInteger("color")); - } else if(nbttagcompound.hasKey("colorstr")) { - setColor(nbttagcompound.getString("colorstr")); - } - setFlag(7, nbttagcompound.getBoolean("chunkLoadingState")); - trainDistanceTraveled = nbttagcompound.getDouble("trainDistanceTraveled"); - trainOwner = nbttagcompound.getString("theOwner"); - this.locked = nbttagcompound.getBoolean("locked"); - setFlag(8, locked); - trainCreator = nbttagcompound.getString("theCreator"); - trainName = nbttagcompound.getString("theName"); - trainType = nbttagcompound.getString("theType"); - uniqueID = nbttagcompound.getInteger("uniqueID"); - //uniqueIDs = nbttagcompound.getInteger("uniqueIDs"); - setInformation(trainType, trainOwner, trainCreator, trainName, uniqueID); - - numberOfTrains = nbttagcompound.getInteger("numberOfTrains"); - isAttached = nbttagcompound.getBoolean("isAttached"); - linked = nbttagcompound.getBoolean("linked"); - //motionX = nbttagcompound.getDouble("motionX"); - //motionZ = nbttagcompound.getDouble("motionZ"); - Link1 = nbttagcompound.getDouble("Link1"); - Link2 = nbttagcompound.getDouble("Link2"); - if(nbttagcompound.hasKey("Dim")){ - this.dimension=nbttagcompound.getInteger("Dim"); - } - - if(nbttagcompound.hasKey("UUIDM")){ - this.entityUniqueID = new UUID(nbttagcompound.getLong("UUIDM"), nbttagcompound.getLong("UUIDL")); - } - } - - @Override - public boolean writeMountToNBT(NBTTagCompound tag){ - return false; - } - @Override - public boolean writeToNBTOptional(NBTTagCompound p_70039_1_) { - if (!this.isDead && this.getEntityString() != null) { - p_70039_1_.setString("id", this.getEntityString()); - this.writeToNBT(p_70039_1_); - return true; - } - return false; - } - - public void setInformation(String trainType, String trainOwner, String trainCreator, String trainName, int uniqueID) { - if (!worldObj.isRemote) { - dataWatcher.updateObject(6, trainType); - dataWatcher.updateObject(7, trainOwner); - dataWatcher.updateObject(9, trainName); - dataWatcher.updateObject(11, uniqueID); - if (trainCreator != null && trainCreator.length() > 0){ dataWatcher.updateObject(13, trainCreator);} - } - } - - public static String getColorAsString(int i) { - switch (i) { - case 0: - return "Black"; - case 1: - return "Red"; - case 2: - return "Green"; - case 3: - return "Brown"; - case 4: - return "Blue"; - case 5: - return "Purple"; - case 6: - return "Cyan"; - case 7: - return "LightGrey"; - case 8: - return "Grey"; - case 13: - return "Magenta"; - case 10: - return "Lime"; - case 11: - return "Yellow"; - case 12: - return "LightBlue"; - case 9: - return "Pink"; - case 14: - return "Orange"; - case 15: - return "White"; - case 16: - return "Skin16"; - case 17: - return "Skin17"; - case 18: - return "Skin18"; - case 19: - return "Skin19"; - case 20: - return "Skin20"; - case 21: - return "Skin21"; - case 22: - return "Skin22"; - case 23: - return "Skin23"; - case 24: - return "Skin24"; - case 25: - return "Skin25"; - case 26: - return "Skin26"; - case 27: - return "Skin27"; - case 28: - return "Skin28"; - case 29: - return "Skin29"; - case 30: - return "Skin30"; - case 100: - return "Empty"; - case 101: - return "Full"; - default: - return "" + i; - } - } - - public static int getColorFromString(String color) { - if (color.equals("Black")) return 0; - if (color.equals("Red")) return 1; - if (color.equals("Green")) return 2; - if (color.equals("Brown")) return 3; - if (color.equals("Blue")) return 4; - if (color.equals("Purple")) return 5; - if (color.equals("Cyan")) return 6; - if (color.equals("LightGrey")) return 7; - if (color.equals("Grey")) return 8; - if (color.equals("Magenta")) return 13; - if (color.equals("Lime")) return 10; - if (color.equals("Yellow")) return 11; - if (color.equals("LightBlue")) return 12; - if (color.equals("Pink")) return 9; - if (color.equals("Orange")) return 14; - if (color.equals("White")) return 15; - if (color.equals("Skin16")) return 16; - if (color.equals("Skin17")) return 17; - if (color.equals("Skin18")) return 18; - if (color.equals("Skin19")) return 19; - if (color.equals("Skin20")) return 20; - if (color.equals("Skin21")) return 21; - if (color.equals("Skin22")) return 22; - if (color.equals("Skin23")) return 23; - if (color.equals("Skin24")) return 24; - if (color.equals("Skin25")) return 25; - if (color.equals("Empty")) return 100; - if (color.equals("Full")) return 101; - return -1; - } - - public void dropCartAsItem(boolean isCreative) { - if (!isCreative && !itemdropped) { - itemdropped=true; - for (ItemStack item : getItemsDropped()) { - if (item.getItem() instanceof ItemRollingStock){ - ItemStack stack = ItemRollingStock.setPersistentData(item,this,this.getUniqueTrainID(),trainCreator, trainOwner, getColor()); - entityDropItem(stack!=null?stack:item,0); - } else { - setUniqueIDToItem(item); - entityDropItem(item, 0); - } - } - } - } - - protected void setUniqueIDToItem(ItemStack stack) { - NBTTagCompound var3 = stack.getTagCompound(); - if (var3 == null) { - var3 = new NBTTagCompound(); - stack.setTagCompound(var3); - } - if (this.uniqueID != -1) stack.getTagCompound().setInteger("uniqueID", this.uniqueID); - if (this.trainCreator != null && this.trainCreator.length() > 0) stack.getTagCompound().setString("trainCreator", this.trainCreator); - stack.getTagCompound().setString("trainColor", this.getColor()); - } - - protected void setDefaultMass(double def) { - this.mass = def; - this.defaultMass = def; - } - - protected double getDefaultMass() { - return defaultMass; - } - - /** - * Lock packet - */ - public boolean getTrainLockedFromPacket() { - return locked; - } - - /** - * Lock packet - */ - public void setTrainLockedFromPacket(boolean set) { - // System.out.println(worldObj.isRemote + " " + set); - locked = set; - } - - - /** Locking for passengers, flat, caboose, jukebox,workcart */ - protected boolean lockThisCart(ItemStack itemstack, EntityPlayer entityplayer) { - if (itemstack != null && (itemstack.getItem() instanceof ItemWrench || itemstack.getItem() instanceof ItemAdminBook)) { - if (entityplayer.getDisplayName().equals(this.trainOwner) || entityplayer.getGameProfile().getName().equals(this.trainOwner) - || this.trainOwner.equals("") || entityplayer.canCommandSenderUseCommand(2, "")) { - if (locked) { - locked = false; - if(worldObj.isRemote) { - entityplayer.addChatMessage(new ChatComponentText("Unlocked.")); - } - } - else { - locked = true; - if(worldObj.isRemote) { - entityplayer.addChatMessage(new ChatComponentText("Locked.")); - } - } - } - else if (worldObj.isRemote) { - entityplayer.addChatMessage(new ChatComponentText("You are not the owner!")); - } - return true; - } - return false; - } - - protected boolean canBeRiddenWhileLocked(AbstractTrains train) { - return (train instanceof Locomotive) || (train instanceof IPassenger) || (train instanceof AbstractWorkCart); - } - - protected boolean canBeDestroyedByPlayer(DamageSource damagesource) { - if (this.getTrainLockedFromPacket()) { - if (damagesource.getEntity() instanceof EntityPlayer) { - if ((damagesource.getEntity() instanceof EntityPlayerMP) && - ((EntityPlayerMP)damagesource.getEntity()).canCommandSenderUseCommand(2, "") && - ((EntityPlayer) damagesource.getEntity()).inventory.getCurrentItem() != null && - ((EntityPlayer) damagesource.getEntity()).inventory.getCurrentItem().getItem() instanceof ItemWrench) { - - ((EntityPlayer) damagesource.getEntity()).addChatMessage(new ChatComponentText("Removing the train using OP permission")); - return false; - } - else if (!((EntityPlayer) damagesource.getEntity()).getDisplayName().toLowerCase().equals(this.trainOwner.toLowerCase())) { - ((EntityPlayer) damagesource.getEntity()).addChatMessage(new ChatComponentText("You are not the owner!")); - return true; - } - } - else if (!damagesource.isProjectile()) { - return true; - } - } - return false; - } - - /** Railcraft routing integration */ - @Override - public boolean doesCartMatchFilter(ItemStack stack, EntityMinecart cart) { - if (stack == null || cart == null) { return false; } - ItemStack cartItem = cart.getCartItem(); - return cartItem.getItem() == stack.getItem(); - } - - @Override - public String getDestination() { - if (destination == null) return ""; - return destination; - } - - /** - * Only locomotives can receive a destination from a track. It is then - * transmitted to attached carts - */ - @Override - public boolean setDestination(ItemStack ticket) { - return false; - } - - public static String getTicketDestination(ItemStack ticket) { - if ((ticket == null)) { return ""; } - NBTTagCompound nbt = ticket.getTagCompound(); - if (nbt == null) { return ""; } - return nbt.getString("dest"); - } - - - @Override - public String getCommandSenderName(){ - String s = EntityList.getEntityString(this); - if (s == null) { - s = "generic"; - } - - return StatCollector.translateToLocal("entity." + s + ".name"); - } - - - - public void setTicket(ForgeChunkManager.Ticket ticket){ - this.chunkTicket = ticket; - } - public ForgeChunkManager.Ticket getTicket(){ - return this.chunkTicket; - } - - public void requestTicket() { - ForgeChunkManager.Ticket chunkTicket = ForgeChunkManager.requestTicket(Traincraft.instance, worldObj , ForgeChunkManager.Type.ENTITY); - if(chunkTicket != null) { - chunkTicket.setChunkListDepth(25); - chunkTicket.bindEntity(this); - this.setTicket(chunkTicket); - } - } - - public String getPersistentUUID() { - if(getEntityData().hasKey("puuid")) { - return getEntityData().getString("puuid"); - } else { - getEntityData().setString("puuid", getUniqueID().toString()); - return this.getUniqueID().toString(); - } - } + public void setColor(int color) { + TrainRecord trainRecord = Traincraft.instance.traincraftRegistry.findTrainRecordByItem(getCartItem().getItem()); + if (trainRecord != null && !trainRecord.getLiveries().isEmpty()) { + if (color == -1 || !trainRecord.getLiveries().contains(getColorAsString(color))) { + color = 0; + } + entity_data.stringMap.put("color", trainRecord.getLiveries().get(color)); + } + dataWatcher.updateObject(12, entity_data.toXMLString()); + this.getEntityData().setString("xml", entity_data.toXMLString()); + } + + public void setColor(String color) { + TrainRecord trainRecord = Traincraft.instance.traincraftRegistry.findTrainRecordByItem(getCartItem().getItem()); + if (trainRecord != null && trainRecord.getLiveries() != null) { + if (color.equals("-1") || trainRecord.getLiveries().contains(color)) { + color = (trainRecord.getLiveries().get(0)); + } + } + + entity_data.stringMap.put("color", color); + dataWatcher.updateObject(12, entity_data.toXMLString()); + this.getEntityData().setString("xml", entity_data.toXMLString()); + } + + public void setRenderYaw(float yaw) { + this.renderYaw = yaw; + } + + public void setRenderPitch(float pitch) { + this.renderPitch = pitch; + } + + public String getColor() { + entity_data = new XmlBuilder(dataWatcher.getWatchableObjectString(12)); + return entity_data.getString("color"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + //super.writeEntityToNBT(nbttagcompound); + if (!getColor().isEmpty()) { + nbttagcompound.setString("colorstr", getColor()); + } + nbttagcompound.setBoolean("chunkLoadingState", getFlag(7)); + nbttagcompound.setDouble("trainDistanceTraveled", trainDistanceTraveled); + nbttagcompound.setString("theOwner", trainOwner); + nbttagcompound.setBoolean("locked", locked); + nbttagcompound.setString("theCreator", trainCreator); + nbttagcompound.setString("theName", trainName); + nbttagcompound.setString("theType", trainType); + nbttagcompound.setInteger("uniqueID", uniqueID); + //nbttagcompound.setInteger("uniqueIDs",uniqueIDs); + + nbttagcompound.setInteger("numberOfTrains", AbstractTrains.numberOfTrains); + nbttagcompound.setBoolean("isAttached", this.isAttached); + nbttagcompound.setBoolean("linked", this.linked); + //nbttagcompound.setDouble("motionX", motionX); + //nbttagcompound.setDouble("motionZ", motionZ); + nbttagcompound.setDouble("Link1", Link1); + nbttagcompound.setDouble("Link2", Link2); + + nbttagcompound.setInteger("Dim", this.dimension); + + nbttagcompound.setLong("UUIDM", this.getUniqueID().getMostSignificantBits()); + nbttagcompound.setLong("UUIDL", this.getUniqueID().getLeastSignificantBits()); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + //super.readEntityFromNBT(nbttagcompound); + if (nbttagcompound.hasKey("color")) { + setColor(nbttagcompound.getInteger("color")); + } else if (nbttagcompound.hasKey("colorstr")) { + setColor(nbttagcompound.getString("colorstr")); + } + setFlag(7, nbttagcompound.getBoolean("chunkLoadingState")); + trainDistanceTraveled = nbttagcompound.getDouble("trainDistanceTraveled"); + trainOwner = nbttagcompound.getString("theOwner"); + this.locked = nbttagcompound.getBoolean("locked"); + setFlag(8, locked); + trainCreator = nbttagcompound.getString("theCreator"); + trainName = nbttagcompound.getString("theName"); + trainType = nbttagcompound.getString("theType"); + uniqueID = nbttagcompound.getInteger("uniqueID"); + //uniqueIDs = nbttagcompound.getInteger("uniqueIDs"); + setInformation(trainType, trainOwner, trainCreator, trainName, uniqueID); + + numberOfTrains = nbttagcompound.getInteger("numberOfTrains"); + isAttached = nbttagcompound.getBoolean("isAttached"); + linked = nbttagcompound.getBoolean("linked"); + //motionX = nbttagcompound.getDouble("motionX"); + //motionZ = nbttagcompound.getDouble("motionZ"); + Link1 = nbttagcompound.getDouble("Link1"); + Link2 = nbttagcompound.getDouble("Link2"); + if (nbttagcompound.hasKey("Dim")) { + this.dimension = nbttagcompound.getInteger("Dim"); + } + + if (nbttagcompound.hasKey("UUIDM")) { + this.entityUniqueID = new UUID(nbttagcompound.getLong("UUIDM"), nbttagcompound.getLong("UUIDL")); + } + } + + @Override + public boolean writeMountToNBT(NBTTagCompound tag) { + return false; + } + + @Override + public boolean writeToNBTOptional(NBTTagCompound p_70039_1_) { + if (!this.isDead && this.getEntityString() != null) { + p_70039_1_.setString("id", this.getEntityString()); + this.writeToNBT(p_70039_1_); + return true; + } + return false; + } + + public void setInformation(String trainType, String trainOwner, String trainCreator, String trainName, int uniqueID) { + if (!worldObj.isRemote) { + dataWatcher.updateObject(6, trainType); + dataWatcher.updateObject(7, trainOwner); + dataWatcher.updateObject(9, trainName); + dataWatcher.updateObject(11, uniqueID); + if (trainCreator != null && !trainCreator.isEmpty()) { + dataWatcher.updateObject(13, trainCreator); + } + } + } + + public static String getColorAsString(int i) { + switch (i) { + case 0: + return "Black"; + case 1: + return "Red"; + case 2: + return "Green"; + case 3: + return "Brown"; + case 4: + return "Blue"; + case 5: + return "Purple"; + case 6: + return "Cyan"; + case 7: + return "LightGrey"; + case 8: + return "Grey"; + case 13: + return "Magenta"; + case 10: + return "Lime"; + case 11: + return "Yellow"; + case 12: + return "LightBlue"; + case 9: + return "Pink"; + case 14: + return "Orange"; + case 15: + return "White"; + case 16: + return "Skin16"; + case 17: + return "Skin17"; + case 18: + return "Skin18"; + case 19: + return "Skin19"; + case 20: + return "Skin20"; + case 21: + return "Skin21"; + case 22: + return "Skin22"; + case 23: + return "Skin23"; + case 24: + return "Skin24"; + case 25: + return "Skin25"; + case 26: + return "Skin26"; + case 27: + return "Skin27"; + case 28: + return "Skin28"; + case 29: + return "Skin29"; + case 30: + return "Skin30"; + case 100: + return "Empty"; + case 101: + return "Full"; + default: + return "" + i; + } + } + + public static int getColorFromString(String color) { + if (color.equals("Black")) return 0; + if (color.equals("Red")) return 1; + if (color.equals("Green")) return 2; + if (color.equals("Brown")) return 3; + if (color.equals("Blue")) return 4; + if (color.equals("Purple")) return 5; + if (color.equals("Cyan")) return 6; + if (color.equals("LightGrey")) return 7; + if (color.equals("Grey")) return 8; + if (color.equals("Magenta")) return 13; + if (color.equals("Lime")) return 10; + if (color.equals("Yellow")) return 11; + if (color.equals("LightBlue")) return 12; + if (color.equals("Pink")) return 9; + if (color.equals("Orange")) return 14; + if (color.equals("White")) return 15; + if (color.equals("Skin16")) return 16; + if (color.equals("Skin17")) return 17; + if (color.equals("Skin18")) return 18; + if (color.equals("Skin19")) return 19; + if (color.equals("Skin20")) return 20; + if (color.equals("Skin21")) return 21; + if (color.equals("Skin22")) return 22; + if (color.equals("Skin23")) return 23; + if (color.equals("Skin24")) return 24; + if (color.equals("Skin25")) return 25; + if (color.equals("Empty")) return 100; + if (color.equals("Full")) return 101; + return -1; + } + + public void dropCartAsItem(boolean isCreative) { + if (!isCreative && !itemdropped) { + itemdropped = true; + for (ItemStack item : getItemsDropped()) { + if (item.getItem() instanceof ItemRollingStock) { + ItemStack stack = ItemRollingStock.setPersistentData(item, this, this.getUniqueTrainID(), trainCreator, trainOwner, getColor()); + entityDropItem(stack != null ? stack : item, 0); + } else { + setUniqueIDToItem(item); + entityDropItem(item, 0); + } + } + } + } + + protected void setUniqueIDToItem(ItemStack stack) { + NBTTagCompound var3 = stack.getTagCompound(); + if (var3 == null) { + var3 = new NBTTagCompound(); + stack.setTagCompound(var3); + } + if (this.uniqueID != -1) stack.getTagCompound().setInteger("uniqueID", this.uniqueID); + if (this.trainCreator != null && !this.trainCreator.isEmpty()) + stack.getTagCompound().setString("trainCreator", this.trainCreator); + stack.getTagCompound().setString("trainColor", this.getColor()); + } + + protected void setDefaultMass(double def) { + this.mass = def; + this.defaultMass = def; + } + + protected double getDefaultMass() { + return defaultMass; + } + + /** + * Lock packet + */ + public boolean getTrainLockedFromPacket() { + return locked; + } + + /** + * Lock packet + */ + public void setTrainLockedFromPacket(boolean set) { + // System.out.println(worldObj.isRemote + " " + set); + locked = set; + } + + + /** + * Locking for passengers, flat, caboose, jukebox,workcart + */ + protected boolean lockThisCart(ItemStack itemstack, EntityPlayer entityplayer) { + if (itemstack != null && (itemstack.getItem() instanceof ItemWrench || itemstack.getItem() instanceof ItemAdminBook)) { + if (entityplayer.getDisplayName().equals(this.trainOwner) || entityplayer.getGameProfile().getName().equals(this.trainOwner) + || this.trainOwner.isEmpty() || entityplayer.canCommandSenderUseCommand(2, "")) { + if (locked) { + locked = false; + if (worldObj.isRemote) { + entityplayer.addChatMessage(new ChatComponentText("Unlocked.")); + } + } else { + locked = true; + if (worldObj.isRemote) { + entityplayer.addChatMessage(new ChatComponentText("Locked.")); + } + } + } else if (worldObj.isRemote) { + entityplayer.addChatMessage(new ChatComponentText("You are not the owner!")); + } + return true; + } + return false; + } + + protected boolean canBeRiddenWhileLocked(AbstractTrains train) { + return (train instanceof Locomotive) || (train instanceof IPassenger) || (train instanceof AbstractWorkCart); + } + + protected boolean canBeDestroyedByPlayer(DamageSource damagesource) { + if (this.getTrainLockedFromPacket()) { + if (damagesource.getEntity() instanceof EntityPlayer) { + if ((damagesource.getEntity() instanceof EntityPlayerMP) && + ((EntityPlayerMP) damagesource.getEntity()).canCommandSenderUseCommand(2, "") && + ((EntityPlayer) damagesource.getEntity()).inventory.getCurrentItem() != null && + ((EntityPlayer) damagesource.getEntity()).inventory.getCurrentItem().getItem() instanceof ItemWrench) { + + ((EntityPlayer) damagesource.getEntity()).addChatMessage(new ChatComponentText("Removing the train using OP permission")); + return false; + } else if (!((EntityPlayer) damagesource.getEntity()).getDisplayName().equalsIgnoreCase(this.trainOwner)) { + ((EntityPlayer) damagesource.getEntity()).addChatMessage(new ChatComponentText("You are not the owner!")); + return true; + } + } else return !damagesource.isProjectile(); + } + return false; + } + + /** + * Railcraft routing integration + */ + @Override + public boolean doesCartMatchFilter(ItemStack stack, EntityMinecart cart) { + if (stack == null || cart == null) { + return false; + } + ItemStack cartItem = cart.getCartItem(); + return cartItem.getItem() == stack.getItem(); + } + + @Override + public String getDestination() { + if (destination == null) return ""; + return destination; + } + + /** + * Only locomotives can receive a destination from a track. It is then + * transmitted to attached carts + */ + @Override + public boolean setDestination(ItemStack ticket) { + return false; + } + + public static String getTicketDestination(ItemStack ticket) { + if ((ticket == null)) { + return ""; + } + NBTTagCompound nbt = ticket.getTagCompound(); + if (nbt == null) { + return ""; + } + return nbt.getString("dest"); + } + + + @Override + public String getCommandSenderName() { + String s = EntityList.getEntityString(this); + if (s == null) { + s = "generic"; + } + + return StatCollector.translateToLocal("entity." + s + ".name"); + } + + + public void setTicket(ForgeChunkManager.Ticket ticket) { + this.chunkTicket = ticket; + } + + public ForgeChunkManager.Ticket getTicket() { + return this.chunkTicket; + } + + public void requestTicket() { + ForgeChunkManager.Ticket chunkTicket = ForgeChunkManager.requestTicket(Traincraft.instance, worldObj, ForgeChunkManager.Type.ENTITY); + if (chunkTicket != null) { + chunkTicket.setChunkListDepth(25); + chunkTicket.bindEntity(this); + this.setTicket(chunkTicket); + } + } + + public String getPersistentUUID() { + if (getEntityData().hasKey("puuid")) { + return getEntityData().getString("puuid"); + } else { + getEntityData().setString("puuid", getUniqueID().toString()); + return this.getUniqueID().toString(); + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/api/EntityRollingStock.java b/src/main/java/train/common/api/EntityRollingStock.java index b82c16276e..cb5b503452 100644 --- a/src/main/java/train/common/api/EntityRollingStock.java +++ b/src/main/java/train/common/api/EntityRollingStock.java @@ -66,2557 +66,2513 @@ import static train.common.core.util.TraincraftUtil.isRailBlockAt; public class EntityRollingStock extends AbstractTrains implements ILinkableCart { - public int fuelTrain; - protected static final int[][][] matrix = { - { { 0, 0,-1}, { 0, 0, 1} }, - { {-1, 0, 0}, { 1, 0, 0} }, - { {-1,-1, 0}, { 1, 0, 0} }, - { {-1, 0, 0}, { 1,-1, 0} }, - { { 0, 0,-1}, { 0,-1, 1} }, - { { 0,-1,-1}, { 0, 0, 1} }, - { { 0, 0, 1}, { 1, 0, 0} }, - { { 0, 0, 1}, {-1, 0, 0} }, - { { 0, 0,-1}, {-1, 0, 0} }, - { { 0, 0,-1}, { 1, 0, 0} } }; - - protected EntityPlayer playerEntity; - - /** Axis aligned bounding box. this needs to be it's own thing because collisions */ - private AxisAlignedBB boundingBoxSmall; - - public float maxSpeed; - public float railMaxSpeed; - public double speedLimiter = 1; - public boolean speedWasSet = false; - - public ItemStack item; - public float rotation; - - public int rail; - public int meta; - public double d6; - public double d7; - - /** appears to be the progress of the turn */ - private int rollingturnProgress; - private double rollingX; - private double rollingY; - private double rollingZ; - private float rollingServerPitch; - public double rotationYawClient; - public float rotationYawClientReal; - public float anglePitchClient;//was a double - public float serverRealRotation; - private float previousServerRealRotation; - public boolean isServerInReverse = false; - public boolean isClientInReverse = false; - public boolean serverInReverseSignPositive = false; - public float serverRealPitch; - private double rollingPitch; - public float oldClientYaw = 0;//used in rendering class - @SideOnly(Side.CLIENT) - private double rollingVelocityX; - @SideOnly(Side.CLIENT) - private double rollingVelocityY; - @SideOnly(Side.CLIENT) - private double rollingVelocityZ; - - private CollisionHandler collisionhandler; - private LinkHandler linkhandler; - private TrainsOnClick trainsOnClick; - public boolean isBraking; - public boolean isClimbing; - public int overheatLevel; - public int linkageNumber; - - public Side side; - @SideOnly(Side.CLIENT) - private SoundHandler theSoundManager; - @SideOnly(Side.CLIENT) - private SoundUpdaterRollingStock sndUpdater; - /** - * Array containing @TrainHandler objects. In other words it contains all - * the "trains" object the train object contains an array which contains all @RollingStocks - * that are part of the train - */ - public static ArrayList allTrains = new ArrayList(); - public int updateTicks = 0; - private HandleOverheating handleOverheating; - public ArrayList RollingStock; - /** - * each ticks: numLaps++ used for fuel consumption rate - */ - private int numLaps; - - private int ticksSinceHeld = 0; - private boolean cartLocked = false; - - /** - * New physics integration - */ - private double bogieShift = 0; - private boolean needsBogieUpdate; - private boolean firstLoad = true; - public EntityBogie bogieLoco = null; - private boolean hasSpawnedBogie = false; - private double mountedOffset = -0.5; - public double posYFromServer; - private double derailSpeed = 0.46; - - private int scrollPosition; - - public EntityRollingStock(World world) { - super(world); - initRollingStock(world); - } - - @Override - public GameProfile getOwner() { - return CartTools.getCartOwner(this); - } - - public EntityRollingStock(World world, double d, double d1, double d2) { - super(world,d,d1,d2); - initRollingStock(world); - setPosition(d, d1 + yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - public void initRollingStock(World world) { - dataWatcher.addObject(20, 0);//heat - dataWatcher.addObject(14, 0); - dataWatcher.addObject(21, 0); - - preventEntitySpawning = true; - isImmuneToFire = true; - //field_70499_f = false; - - setSize(0.98F, 1.98F); - //yOffset = 0; - //ySize = 0.98F; - yOffset = 0.65f; - - linkageNumber = 0; - - entityCollisionReduction = 0.8F; - - boundingBoxSmall = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 2.0D, 1.0D); - //setBoundingBoxSmall(0.0D, 0.0D, 0.0D, 0.98F, 0.7F); - setBoundingBoxSmall(0.0D, 0.0D, 0.0D, 2.0F, 1.5F); - RollingStock = new ArrayList(); - handleOverheating = new HandleOverheating(this); - - collisionhandler = new CollisionHandler(world); - linkhandler = new LinkHandler(world); - trainsOnClick = new TrainsOnClick(); - - /* Railcraft's stuff */ - //maxSpeed = defaultMaxSpeedRail; - //maxSpeedGround = defaultMaxSpeedGround; - maxSpeedAirLateral = defaultMaxSpeedAirLateral; - maxSpeedAirVertical = defaultMaxSpeedAirVertical; - dragAir = defaultDragAir; - - /** - * Trains are always rendered even if out player's sight => no more - * flickering/disappearing - */ - if (ConfigHandler.FLICKERING) { - this.ignoreFrustumCheck = true; - } - side = FMLCommonHandler.instance().getEffectiveSide(); - if (side == Side.CLIENT) { - sndUpdater = new SoundUpdaterRollingStock(); - } - - this.needsBogieUpdate = false; - setCollisionHandler(null); - //this.boundingBox.offset(0, 0.5, 0); - } - - - /** - * this is basically NBT for entity spawn, to keep data between client and server in sync because some data is not automatically shared. - */ - @Override - public void readSpawnData(ByteBuf additionalData) { - isBraking = additionalData.readBoolean(); - setTrainLockedFromPacket(additionalData.readBoolean()); - } - @Override - public void writeSpawnData(ByteBuf buffer) { - buffer.writeBoolean(isBraking); - buffer.writeBoolean(getTrainLockedFromPacket()); - } - - public String getTrainName() { - return dataWatcher.getWatchableObjectString(9); - } - - public String getTrainType() { - return dataWatcher.getWatchableObjectString(6); - } - - @Override - public String getTrainOwner() { - return dataWatcher.getWatchableObjectString(7); - } - - public String getTrainCreator() { - return dataWatcher.getWatchableObjectString(13); - } - - public int getIDForServer() { - return dataWatcher.getWatchableObjectInt(5); - } - - public int getNumberOfTrainsForServer() { - return dataWatcher.getWatchableObjectInt(10); - } - - public int getUniqueTrainIDClient() { - return dataWatcher.getWatchableObjectInt(11); - } - - /* - * @Override public int getID() { return ID; } - */ - - @Override - protected boolean canTriggerWalking() { - return false; - } - - @Override - public double getMountedYOffset() { - return mountedOffset; - } - - public void setMountedYOffset(double offset) { - mountedOffset = offset; - } - - public void setYFromServer(double posYServer) { - this.posYFromServer = posYServer; - } - - @Override - protected void entityInit() { - dataWatcher.addObject(16, (byte) 0); - dataWatcher.addObject(17, 0); - dataWatcher.addObject(18, 1); - dataWatcher.addObject(19, 0.0F); - } - - @Override - public AxisAlignedBB getCollisionBox(Entity entity) { - return null; - } - - @Override - public boolean canBePushed() { - return true; - } - - @Override - public boolean isLocomotive() { - return (this instanceof Locomotive); - } - - @Override - public boolean isPassenger() { - return (this instanceof IPassenger); - } - - @Override - public boolean isFreightCart() { - return (this instanceof Freight || this instanceof LiquidTank); - } - - @Override - public boolean isFreightOrPassenger() { - return (this instanceof Freight || this instanceof IPassenger || this instanceof LiquidTank); - } - - @Override - public boolean isBuilder() { - return (this instanceof EntityTracksBuilder); - } - - @Override - public boolean isTender() { - return (this instanceof Tender); - } - - @Override - public boolean isWorkCart() { - return (this instanceof AbstractWorkCart); - } - - @Override - public boolean isElectricTrain() { - return (this instanceof ElectricTrain); - } - - protected int steamFuelLast(ItemStack it) { - return FuelHandler.steamFuelLast(it); - } - - @Override - public boolean attackEntityFrom(DamageSource damagesource, float i) { - if (worldObj.isRemote || isDead) { return true; } - if (damagesource.getEntity() instanceof EntityPlayer && !damagesource.isProjectile()) { - if(this instanceof IPassenger){ - if (canBeDestroyedByPlayer(damagesource)) return false; - } - setRollingDirection(-getRollingDirection()); - setRollingAmplitude(10); - setBeenAttacked(); - if (((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode) { - this.setDamage(1000); - if (ConfigHandler.ENABLE_WAGON_REMOVAL_NOTICES && ((EntityPlayer) damagesource.getEntity()).canCommandSenderUseCommand(2,"")) { - ((EntityPlayer) damagesource.getEntity()).addChatComponentMessage(new ChatComponentText("Operator removed train owned by " + getTrainOwner())); - } - } - setDamage(getDamage() + i * 10); - if (getDamage() > 40) { - if (riddenByEntity != null) { - riddenByEntity.mountEntity(this); - } - ServerLogger.deleteWagon(this); - /** - * Destroy IPassenger since they don't extend Freight or - * Locomotive and don't have a proper attackEntityFrom() method - */ - if (this instanceof IPassenger) { - this.setDead(); - dropCartAsItem(((EntityPlayer)damagesource.getEntity()).capabilities.isCreativeMode); - } - } - } - return true; - } - - @Override - @SideOnly(Side.CLIENT) - public void performHurtAnimation() { - setRollingDirection(-getRollingDirection()); - setRollingAmplitude(10); - setDamage(getDamage() + getDamage() * 10); - } - - public void unLink(){ - if (this.isAttached) { - if (this.cartLinked1 != null) { - if (cartLinked1.Link1 == this.uniqueID) { - cartLinked1.Link1 = 0; - cartLinked1.cartLinked1 = null; - if(cartLinked1.RollingStock!=null)cartLinked1.RollingStock.clear(); - - } - else if (cartLinked1.Link2 == this.uniqueID) { - cartLinked1.Link2 = 0; - cartLinked1.cartLinked2 = null; - if(cartLinked1.RollingStock!=null)cartLinked1.RollingStock.clear(); - - } - } - if (this.cartLinked2 != null) { - if (cartLinked2.Link1 == this.uniqueID) { - cartLinked2.Link1 = 0; - cartLinked2.cartLinked1 = null; - if(cartLinked2.RollingStock!=null)cartLinked2.RollingStock.clear(); - - } - else if (cartLinked2.Link2 == this.uniqueID) { - cartLinked2.Link2 = 0; - cartLinked2.cartLinked2 = null; - if(cartLinked2.RollingStock!=null)cartLinked2.RollingStock.clear(); - - } - } - this.cartLinked1 = null; - this.cartLinked2 = null; - this.isAttached = false; - } - } - - @Override - public void setDead() { - super.setDead(); - this.unLink(); - if (train != null) { - if (train.getTrains() != null) { - for (int i2 = 0; i2 < train.getTrains().size(); i2++) { - if ((train.getTrains().get(i2)) instanceof Locomotive) { - train.getTrains().get(i2).cartLinked1 = null; - train.getTrains().get(i2).Link1 = 0; - train.getTrains().get(i2).cartLinked2 = null; - train.getTrains().get(i2).Link2 = 0; - } - if ((train.getTrains().get(i2)) != this) { - if (train != null && train.getTrains() != null && train.getTrains().get(i2) != null && train.getTrains().get(i2).train != null && train.getTrains().get(i2).train.getTrains() != null) train.getTrains().get(i2).train.getTrains().clear(); - } - } - } - } - if (train != null && train.getTrains().size() <= 1) { - train.getTrains().clear(); - allTrains.remove(train); - } - if (this.bogieLoco != null) { - bogieLoco.setDead(); - bogieLoco.isDead = true; - } - isDead = true; - Side side = FMLCommonHandler.instance().getEffectiveSide(); - if (side == Side.CLIENT) { - soundUpdater(); - } - } - - @Override - public boolean canBeCollidedWith() { - return !isDead; - } - - public void pressKey(int i) {} - - /** - * gets packet from server and distribute for GUI handles motion - * - * @param i - */ - public void keyHandlerFromPacket(int i) { - this.pressKey(i); - } - - private void handleTrain() { - if (this instanceof Locomotive && train != null) { - for (int i2 = 0; i2 < train.getTrains().size(); i2++) { - if (RailTools.isCartLockedDown(train.getTrains().get(i2))) { - cartLocked = true; - /** If something in the train is locked down */ - ticksSinceHeld = 40; - if (!((Locomotive) this).canBeAdjusted) { - ((Locomotive) this).setCanBeAdjusted(true); - - } - } - cartLocked = false; - } - if (ticksSinceHeld > 0 && !cartLocked) { - ticksSinceHeld--; - } - if (ticksSinceHeld <= 0 && !cartLocked) { - if (((Locomotive) this).canBeAdjusted && !((Locomotive) this).canBePulled) { - ((Locomotive) this).setCanBeAdjusted(false); - - } - } - } - - /* - * if(train!=null && RailTools.isCartLockedDown((EntityMinecart) this)){ - * train.setTicksSinceHeld(100); train.setCartLocked(true); for(int - * i2=0;i2 1) { - if (this instanceof Locomotive && !((Locomotive) this).canBeAdjusted && this.getDestination().length() > 0) { - for (int i = 0; i < train.getTrains().size(); i++) { - if (train.getTrains().get(i) != null && !train.getTrains().get(i).equals(this)) train.getTrains().get(i).destination = this.getDestination(); - CartTools.setCartOwner(train.getTrains().get(i), CartTools.getCartOwner(this)); - } - } - } - /** - * Resets destination - */ - else if (!(this instanceof Locomotive)) { - destination = ""; - } - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, - * posY, posZ, yaw, pitch - */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { - this.rollingX = par1; - this.rollingY = par3; - this.rollingZ = par5; - this.rollingPitch = par8; - this.rollingturnProgress = par9 + 2; - this.motionX = this.rollingVelocityX; - this.motionY = this.rollingVelocityY; - this.motionZ = this.rollingVelocityZ; - } - - List list =null; - Block l; - - @Override - public void onUpdate() { - - if (addedToChunk && !this.hasSpawnedBogie && this.getSpec().getBogieLocoPosition() != 0) { - - if (bogieLoco == null) { - this.bogieShift = this.getSpec().getBogieLocoPosition(); - this.bogieLoco = new EntityBogie(worldObj, - (posX - Math.cos(this.serverRealRotation * TraincraftUtil.radian) * this.bogieShift), - posY + ((Math.tan(this.renderPitch * TraincraftUtil.radian) * -this.bogieShift) + getMountedYOffset()-0.1d), - (posZ - Math.sin(this.serverRealRotation * TraincraftUtil.radian) * this.bogieShift), this, this.uniqueID, 0, this.bogieShift); - - - if (!worldObj.isRemote) worldObj.spawnEntityInWorld(bogieLoco); - this.needsBogieUpdate = true; - } - this.hasSpawnedBogie = true; - } - - super.manageChunkLoading(); - - /** - * Set the uniqueID if the entity doesn't have one. - */ - if (!worldObj.isRemote && this.uniqueID == -1) { - if (FMLCommonHandler.instance().getMinecraftServerInstance() != null) { - //TraincraftSaveHandler.createFile(FMLCommonHandler.instance().getMinecraftServerInstance()); - //int readID = TraincraftSaveHandler.readInt(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:"); - //int newID = setNewUniqueID(readID); - - //TraincraftSaveHandler seems to not work, may cause uniqueID bug. - setNewUniqueID(this.getEntityId()); - - //TraincraftSaveHandler.writeValue(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:", "" + newID); - - } - } - - if (riddenByEntity instanceof EntityPlayer){ - ((EntityPlayer) riddenByEntity).addPotionEffect(new PotionEffect(Potion.resistance.id, 20, 5, true)); - } - - if (getRollingAmplitude() > 0) { - setRollingAmplitude(getRollingAmplitude() - 1); - } - if (getDamage() > 0) { - setDamage(getDamage() - 1); - } - - isBraking = false; - - if (worldObj.isRemote && Traincraft.proxy.getCurrentScreen() == null && riddenByEntity instanceof EntityLivingBase) { - EntityLivingBase entity = (EntityLivingBase) riddenByEntity; - if (TraincraftEntityHelper.getIsJumping(entity)) isBraking = true; - } - - int var2; - if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) { - this.worldObj.theProfiler.startSection("portal"); - MinecraftServer var1 = MinecraftServer.getServer(); - var2 = this.getMaxInPortalTime(); - - if (this.inPortal) { - if (var1.getAllowNether()) { - if (this.ridingEntity == null && this.portalCounter++ >= var2) { - this.portalCounter = var2; - this.timeUntilPortal = this.getPortalCooldown(); - byte var3; - - if (this.worldObj.provider.dimensionId == -1) { - var3 = 0; - } - else { - var3 = -1; - } - - this.travelToDimension(var3); - } - - this.inPortal = false; - } - } - else { - if (this.portalCounter > 0) { - this.portalCounter -= 4; - } - - if (this.portalCounter < 0) { - this.portalCounter = 0; - } - } - - if (this.timeUntilPortal > 0) { - --this.timeUntilPortal; - } - - this.worldObj.theProfiler.endSection(); - } - - Side side = FMLCommonHandler.instance().getEffectiveSide(); - if (side == Side.CLIENT) { - soundUpdater(); - } - - if (worldObj.isRemote) { - //rotationYaw = (float) rotationYawClient; - if (rollingturnProgress > 0) { - rotationYaw = (float) rotationYawClient; - this.rotationPitch = (float) (this.rotationPitch + (this.rollingPitch - this.rotationPitch) / this.rollingturnProgress); - - this.setPosition(this.posX + (this.rollingX - this.posX) / this.rollingturnProgress, - this.posY + (this.rollingY - this.posY) / this.rollingturnProgress, - this.posZ + (this.rollingZ - this.posZ) / this.rollingturnProgress); - --this.rollingturnProgress; - this.setRotation(this.rotationYaw, this.rotationPitch); - - } - else { - setPosition(posX, posY, posZ); - setRotation(rotationYaw, rotationPitch); - - } - return; - } - - /* - * if(this.updateTicks<5){ - - */ - /** - * As entities can't be registered in nbttagcompound I had to setup this - * system... When world loads, only the (double) Link1 and Link2 are - * known. This method search for the entity with the ID corresponding to - * Link1 or Link2 When it finds it, (EntityRollingStock)cartLinked1 and - * cartLinked2 will be updated accordingly - */ - if (addedToChunk && ((this.cartLinked1 == null && this.Link1 != 0) || (this.cartLinked2 == null && this.Link2 != 0))) { - list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(15, 15, 15)); - - if (list != null && list.size() > 0) { - for (Object entity : list) { - if (entity instanceof EntityRollingStock) { - if (((EntityRollingStock) entity).uniqueID == this.Link1) { - this.cartLinked1 = (EntityRollingStock) entity; - } - else if (((EntityRollingStock) entity).uniqueID == this.Link2) { - this.cartLinked2 = (EntityRollingStock) entity; - } - } - } - } - } - - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - - int i = MathHelper.floor_double(posX); - int j = MathHelper.floor_double(posY); - int k = MathHelper.floor_double(posZ); - - if (needsBogieUpdate) { - if (bogieLoco != null) { - float rotationCos1 = (float) Math.cos(Math.toRadians(serverRealRotation)); - float rotationSin1 = (float) Math.sin(Math.toRadians((serverRealRotation))); - if (!firstLoad) { - rotationCos1 = (float) Math.cos(Math.toRadians(serverRealRotation + 90)); - rotationSin1 = (float) Math.sin(Math.toRadians((serverRealRotation + 90))); - } - double bogieX1 = (this.posX + (rotationCos1 * Math.abs(bogieShift))); - double bogieZ1 = (this.posZ + (rotationSin1 * Math.abs(bogieShift))); - this.bogieLoco.setPosition(bogieX1, bogieLoco.posY, bogieZ1); - /* - * double rads = this.serverRealRotation * - * 3.141592653589793D / 180.0D; double pitchRads = - * this.renderPitch * 3.141592653589793D / 180.0D; - * this.bogieLoco[bog].setPosition((float) (posX - - * Math.cos(rads) * this.bogieShift[bog]), (float) posY + - * ((Math.tan(pitchRads) * -this.bogieShift[bog]) + - * getMountedYOffset()), (float) (posZ - Math.sin(rads) * - * this.bogieShift[bog])); - */ - } - firstLoad = false; - /* - * for (int bog = 0; bog < this.bogieUtility.length; bog++) { if - * (bogieUtility[bog] != null) { - * - * double rads = this.serverRealRotation * 3.141592653589793D / - * 180.0D; double pitchRads = this.renderPitch * 3.141592653589793D - * / 180.0D; this.bogieUtility[bog].setPosition((float) (posX - - * Math.cos(rads) * this.bogieShift[bog]), (float) posY + - * ((Math.tan(pitchRads) * -this.bogieShift[bog]) + - * getMountedYOffset()), (float) (posZ - Math.sin(rads) * - * this.bogieShift[bog])); - - * [bog].posX+" "+ this.bogieUtility[bog].posY - * +" "+this.bogieUtility[bog].posZ); } } - */ - needsBogieUpdate = false; - } - if (bogieLoco != null) { - bogieLoco.updateDistance(); - } - - if (worldObj.isAirBlock(i,j,k)) { - j--; - } - else if (isRailBlockAt(worldObj, i, j + 1, k) || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRailGag.block) { - j++; - } - - l = worldObj.getBlock(i, j, k); - - updateOnTrack(i, j, k, l); - - - updateTicks++; - d6 = prevPosX - posX; - d7 = prevPosZ - posZ; - prevRotationYaw = rotationYaw; - - //this.rotationPitch = 0.0F; - - if (d6 * d6 + d7 * d7 > 0.0001D) { - this.rotationYaw = (float) (Math.atan2(d7, d6) * 180.0D / Math.PI); - if (this.isClientInReverse) { - this.rotationYaw += 180.0F; - } - } - - //double var49 = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.prevRotationYaw); - - float anglePitch=0; - if (bogieLoco != null) { - - serverRealRotation = MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2((float) (bogieLoco.posZ - this.posZ), (float) (bogieLoco.posX - this.posX))) - 90F); - - anglePitch = (float) Math.atan(((bogieLoco.posY - posY)) / - MathHelper.sqrt_double(((bogieLoco.posX - posX) * (bogieLoco.posX - posX)) + - ((bogieLoco.posZ - posZ) * (bogieLoco.posZ - posZ))));//1.043749988079071 - serverRealPitch = anglePitch +(float) - ((bogieLoco.posZ - posZ) * (bogieLoco.posZ - posZ));//1.043749988079071 - } - else { - float rotation = rotationYaw; - - float delta = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.previousServerRealRotation); //Math.abs(this.rotationYaw - this.previousServerRealRotation); - - this.previousServerRealRotation = this.rotationYaw; - - if (delta < -179.0F || delta > 179.0F) { // if (delta > 170.0F || delta < 190.0F) { - - this.rotationYaw += 180.0F; - this.isServerInReverse = !this.isServerInReverse; - } - previousServerRealRotation = rotation; - if (this.isServerInReverse) { - if (serverInReverseSignPositive) { - rotation += 180.0f; - } - else { - rotation -= 180.0f; - } - } - - serverRealRotation = rotation; - - double zDist = posZ - prevPosZ; - double xDist = posX - prevPosX; - float tempPitch = rollingServerPitch; - float tempPitch2 = tempPitch; - if (Math.abs(zDist) > 0.02) { - double rads = Math.atan((posY - prevPosY) / zDist); - tempPitch = (float) ((Math.atan((posY - prevPosY) / zDist)) * degrees); - } - else if (Math.abs(xDist) > 0.02) { - tempPitch = (float) (( Math.atan((posY - prevPosY) / xDist)) * degrees); - //pitch=tempPitch; - } - - //if (Math.abs(tempPitch) > 16) { - //tempPitch=Math.copySign(16, tempPitch); - //} - if (tempPitch2 < tempPitch && Math.abs(tempPitch2 - tempPitch) > 3) { - tempPitch2 += 3; - } - else if (tempPitch2 > tempPitch && Math.abs(tempPitch2 - tempPitch) > 3) { - tempPitch2 -= 3; - } - else if (tempPitch2 < tempPitch && Math.abs(tempPitch2 - tempPitch) > 0.5) { - tempPitch2 += 0.5; - } - else if (tempPitch2 > tempPitch && Math.abs(tempPitch2 - tempPitch) > 0.5) { - tempPitch2 -= 0.5; - } - anglePitch = -tempPitch2; - rollingServerPitch = 0; - } - - - if (updateTicks % 2 == 0) { - Traincraft.rotationChannel.sendToAllAround(new PacketRollingStockRotation(this, (int) (anglePitch * 60)), new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300.0D)); - } - if(!worldObj.isRemote){ - anglePitchClient=(anglePitch * 60); - } - - //this.setRotation(this.rotationYaw, this.rotationPitch); - - list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, getCollisionHandler()!=null? - getCollisionHandler().getMinecartCollisionBox(this): - boundingBox.expand(0.2D, 0.0D, 0.2D)); - - if (list != null && !list.isEmpty()) { - Entity entity; - for (Object obj : list) { - if(obj==this.riddenByEntity){continue;} - entity = (Entity) obj; - - if (entity.canBePushed() && entity instanceof EntityMinecart) { - entity.applyEntityCollision(this); - } - else if (entity.canBePushed() && !(entity instanceof EntityMinecart)) { - this.applyEntityCollision(entity); - } - } - } - - handleTrain(); - handleOverheating.HandleHeatLevel(this); - linkhandler.handleStake(this, boundingBox); - collisionhandler.handleCollisions(this, boundingBox); - this.func_145775_I(); - MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, i, j, k)); - //setBoundingBoxSmall(posX, posY, posZ, 0.98F, 0.7F); - numLaps++; - if ((this instanceof Locomotive) && (this.Link1 == 0) && (this.Link2 == 0) && numLaps > 700) { - this.RollingStock.clear(); - } - - if (this.riddenByEntity != null && this.riddenByEntity.isDead) { - if (this.riddenByEntity.ridingEntity == this) { - this.riddenByEntity.ridingEntity = null; - } - this.riddenByEntity = null; - } - this.dataWatcher.updateObject(14, (int) (motionX * 100)); - this.dataWatcher.updateObject(21, (int) (motionZ * 100)); - - if (ConfigHandler.ENABLE_LOGGING && !worldObj.isRemote && updateTicks%120==0){ - ServerLogger.writeWagonToFolder(this); - } - } - - boolean flag,flag1; - private void updateOnTrack(int i, int j, int k, Block l) { - if (canUseRail() && BlockRailBase.func_150051_a(l)) { - - Vec3 vec3d = TraincraftUtil.func_514_g(posX, posY, posZ); - int i1 = ((BlockRailBase) l).getBasicRailMetadata(worldObj, this, i, j, k); - meta = i1; - posY = j; - flag = false; - flag1=l == Blocks.golden_rail; - if (l == Blocks.golden_rail) { - flag = worldObj.getBlockMetadata(i,j,k) >2; - if (i1 == 8) {i1 = 0;} - else if(i1 == 9) {i1 = 1;} - } - - if (l == Blocks.detector_rail){ - worldObj.setBlockMetadataWithNotify(i, j, k, meta | 8, 3); - worldObj.notifyBlocksOfNeighborChange(i, j, k, l); - worldObj.notifyBlocksOfNeighborChange(i, j - 1, k, l); - worldObj.markBlockRangeForRenderUpdate(i, j, k, i, j, k); - worldObj.scheduleBlockUpdate(i, j, k, l, l.tickRate(worldObj)); - } - - if (i1 >= 2 && i1 <= 5) { - posY = (j + 1); - } - - adjustSlopeVelocities(i1); - - - int ai[][] = matrix[i1]; - double d9 = ai[1][0] - ai[0][0]; - double d10 = ai[1][2] - ai[0][2]; - double d11 = Math.sqrt(d9 * d9 + d10 * d10); - if (motionX * d9 + motionZ * d10 < 0.0D) { - d9 = -d9; - d10 = -d10; - } - double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ); - motionX = (d13 * d9) / d11; - motionZ = (d13 * d10) / d11; - if (flag1 && !flag && shouldDoRailFunctions()) { - if (Math.sqrt(motionX * motionX + motionZ * motionZ) < 0.029999999999999999D) { - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - } - else { - motionX *= 0.5D; - motionY *= 0.0D; - motionZ *= 0.5D; - } - } - double d17 = 0.0D; - double d18 = i + 0.5D + ai[0][0] * 0.5D; - double d19 = k + 0.5D + ai[0][2] * 0.5D; - double d20 = i + 0.5D + ai[1][0] * 0.5D; - double d21 = k + 0.5D + ai[1][2] * 0.5D; - d9 = d20 - d18; - d10 = d21 - d19; - if (d9 == 0.0D) { - posX = i + 0.5D; - d17 = posZ - k; - } - else if (d10 == 0.0D) { - posZ = k + 0.5D; - d17 = posX - i; - } - else { - double d22 = posX - d18; - double d24 = posZ - d19; - d17 = (d22 * d9 + d24 * d10) * 2D; - //double derailSpeed = 0;//0.46; - } - if(bogieLoco != null) { - if (!bogieLoco.isOnRail()) { - derailSpeed = 0; - this.unLink(); - } - } - /** - * Handles derail - */ - if ((this instanceof Locomotive || this instanceof ISecondBogie) && d13 > derailSpeed && i1 >= 6) { - if (d9 > 0 && d10 < 0) { - d10 = 0; - d9 += 2; - } - else if (d9 < 0 && d10 > 0) { - d9 = 0; - d10 += 2; - } - else if (d10 < 0 && d9 < 0) { - d10 -= 2; - d9 = 0; - } - else if (d9 > 0 && d10 > 0) { - d10 += 2; - d9 = 0; - } - if (FMLCommonHandler.instance().getMinecraftServerInstance() != null && - this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer) { - FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendChatMsg(new - ChatComponentText(((EntityPlayer) this.riddenByEntity).getDisplayName() + "derailed" - + this.trainOwner + "'s locomotive")); - } - } - - - posX = d18 + d9 * d17; - posZ = d19 + d10 * d17; - setPosition(posX, posY + yOffset + 0.35, posZ); - - moveMinecartOnRail(i, j, k, 0.0D); - - if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && - MathHelper.floor_double(posZ) - k == ai[0][2]) { - setPosition(posX, posY + ai[0][1], posZ); - } - else if (ai[1][1] != 0 && MathHelper.floor_double(posX) - i == ai[1][0] && - MathHelper.floor_double(posZ) - k == ai[1][2]) { - setPosition(posX, posY + ai[1][1], posZ); - } - - applyDragAndPushForces(); - - Vec3 vec3d1 = TraincraftUtil.func_514_g(posX, posY, posZ); - double d28 = (vec3d.yCoord - vec3d1.yCoord) * 0.050000000000000003D; - if (this instanceof Locomotive) d28 = 0; - double d14 = Math.sqrt(motionX * motionX + motionZ * motionZ); - if (d14 > 0.0D) { - motionX = (motionX / d14) * (d14 + d28); - motionZ = (motionZ / d14) * (d14 + d28); - } - setPosition(posX, posY + yOffset - 0.8d, posZ); - int k1 = MathHelper.floor_double(posX); - int l1 = MathHelper.floor_double(posZ); - if (k1 != i || l1 != k) { - double d15 = Math.sqrt(motionX * motionX + motionZ * motionZ); - motionX = d15 * (k1 - i); - motionZ = d15 * (l1 - k); - } - - if (shouldDoRailFunctions()) { - ((BlockRailBase) l).onMinecartPass(worldObj, this, i, j, k); - } - - if (flag && shouldDoRailFunctions()) { - double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ); - if (d31 > 0.01D) { - motionX += (motionX / d31) * 0.059999999999999998D; - motionZ += (motionZ / d31) * 0.059999999999999998D; - } - else if (i1 == 1) { - if (worldObj.isBlockNormalCubeDefault(i - 1, j, k,false)) { - motionX = 0.02D; - } - else if (worldObj.isBlockNormalCubeDefault(i + 1, j, k,false)) { - motionX = -0.02D; - } - } - else if (i1 == 0) { - if (worldObj.isBlockNormalCubeDefault(i, j, k - 1,false)) { - motionZ = 0.02D; - } - else if (worldObj.isBlockNormalCubeDefault(i, j, k + 1,false)) { - motionZ = -0.02D; - } - } - } - } - else if (l == BlockIDs.tcRail.block) { - limitSpeedOnTCRail(); - //if(worldObj.getTileEntity(i,j,k)==null || !(worldObj.getTileEntity(i,j,k) instanceof TileTCRail))return; - TileTCRail tile = (TileTCRail) worldObj.getTileEntity(i, j, k); - int meta = tile.getBlockMetadata(); - - if (ItemTCRail.isTCStraightTrack(tile)) { - moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, meta); - } - else if (ItemTCRail.isTCTurnTrack(tile)) { - - if(bogieLoco != null) { - if (!bogieLoco.isOnRail()) { - derailSpeed = 0; - } - } - if(derailSpeed == 0){ - this.unLink(); - moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, meta); - } - else{ - - if (shouldIgnoreSwitch(tile, i, j, k, meta)) { - moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, meta); - } - else { - if (ItemTCRail.isTCTurnTrack(tile)) - moveOnTC90TurnRail(i, j, k, tile.r, tile.cx, tile.cz); - } - // shouldIgnoreSwitch(tile, i, j, k, meta); - // if (ItemTCRail.isTCTurnTrack(tile)) moveOnTC90TurnRail(i, j, k, r, cx, cy, - // cz, tile.getType(), meta); - } - } - else if (ItemTCRail.isTCSlopeTrack(tile)) { - moveOnTCSlope( j, tile.xCoord, tile.zCoord, tile.slopeAngle, tile.slopeHeight, meta); - } - else if (ItemTCRail.isTCTwoWaysCrossingTrack(tile)) { - moveOnTCTwoWaysCrossing(i, j, k, tile.xCoord, tile.yCoord, tile.zCoord, meta); - } - else if (ItemTCRail.isTCDiagonalCrossingTrack(tile)) { - moveOnTCDiamondCrossing(i, j, k, tile.xCoord, tile.yCoord, tile.zCoord, meta ); - } - else if (ItemTCRail.isTCDiagonalStraightTrack(tile)) { - moveOnTCDiagonal(i, j, k, tile.xCoord, tile.zCoord, tile.getBlockMetadata(), tile.getRailLength()); - } - else if (ItemTCRail.isTCCurvedSlopeTrack(tile)) { - moveOnTCCurvedSlope(i, j, k, tile.r, tile.cx, tile.cz, tile.xCoord, tile.zCoord, meta, 1, tile.slopeAngle); - } - - } - else if (l == BlockIDs.tcRailGag.block) { - limitSpeedOnTCRail(); - TileTCRailGag tileGag = (TileTCRailGag) worldObj.getTileEntity(i, j, k); - if (worldObj.getTileEntity(tileGag.originX, tileGag.originY, tileGag.originZ) instanceof TileTCRail) { - TileTCRail tile = (TileTCRail) worldObj.getTileEntity(tileGag.originX, tileGag.originY, tileGag.originZ); - - if (ItemTCRail.isTCTurnTrack(tile)) { - moveOnTC90TurnRail(i, j, k, tile.r, tile.cx, tile.cz); - } - if (ItemTCRail.isTCStraightTrack(tile)) { - moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, tile.getBlockMetadata()); - } - if (ItemTCRail.isTCSlopeTrack(tile)) { - moveOnTCSlope(j, tile.xCoord, tile.zCoord, tile.slopeAngle, tile.slopeHeight, tile.getBlockMetadata()); - } - if (ItemTCRail.isTCDiagonalStraightTrack(tile)) { - moveOnTCDiagonal(i, j, k, tile.xCoord, tile.zCoord, tile.getBlockMetadata(), tile.getRailLength()); - } - else if (ItemTCRail.isTCDiagonalCrossingTrack(tile)) { - moveOnTCDiamondCrossing(i, j, k, tile.xCoord, tile.yCoord, tile.zCoord, meta ); - } - if (ItemTCRail.isTCCurvedSlopeTrack(tile)) { - moveOnTCCurvedSlope(i, j, k, tile.r, tile.cx, tile.cz, tile.xCoord, tile.zCoord, tile.getBlockMetadata(), 1, tile.slopeAngle); - } - } - } - else { - //moveMinecartOffRail(i,j,k); - super.onUpdate(); - } - - } - - private boolean shouldIgnoreSwitch(TileTCRail tile, int i, int j, int k, int meta) { - if (tile != null - && (tile.getType().equals(TrackTypes.MEDIUM_RIGHT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.MEDIUM_LEFT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.LARGE_LEFT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.LARGE_RIGHT_TURN.getLabel())) - || tile.getType().equals(TrackTypes.MEDIUM_RIGHT_45DEGREE_TURN.getLabel()) - || tile.getType().equals(TrackTypes.MEDIUM_LEFT_45DEGREE_TURN.getLabel()) - || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_RIGHT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_LEFT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.EMBEDDED_LARGE_LEFT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.EMBEDDED_LARGE_RIGHT_TURN.getLabel()) - || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_RIGHT_45DEGREE_TURN.getLabel()) - || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_LEFT_45DEGREE_TURN.getLabel()) - - && tile.canTypeBeModifiedBySwitch) { - - /* Handles reverse straight movement of a cart on a switch that happened to be turned on*/ - if (meta == 2) { - if (motionZ > 0 && Math.abs(motionX) < 0.01) { - TileEntity tile2 = worldObj.getTileEntity(i, j, k + 1); - if (tile2 instanceof TileTCRail) { - ((TileTCRail) tile2).setSwitchState(false, true); - } - return true; - } - } - else if (meta == 0) { - if (motionZ < 0 && Math.abs(motionX) < 0.01) { - TileEntity tile2 = worldObj.getTileEntity(i, j, k - 1); - if (tile2 instanceof TileTCRail) { - ((TileTCRail) tile2).setSwitchState(false, true); - } - return true; - } - } - else if (meta == 1) { - if (Math.abs(motionZ) < 0.01 && motionX > 0) { - TileEntity tile2 = worldObj.getTileEntity(i + 1, j, k); - if (tile2 instanceof TileTCRail) { - ((TileTCRail) tile2).setSwitchState(false, true); - } - return true; - } - } - else if (meta == 3) { - if (Math.abs(motionZ) < 0.01 && motionX < 0) { - TileEntity tile2 = worldObj.getTileEntity(i - 1, j, k); - if (tile2 instanceof TileTCRail) { - ((TileTCRail) tile2).setSwitchState(false, true); - } - return true; - } - } - } - return false; - } - - private void moveOnTCDiagonal(int i, int j, int k, double cx, double cz, int meta, double length) { - - double Y_OFFSET = 0.2; - double X_OFFSET = 0.5; - double Z_OFFSET = 1.5; - posY = j + Y_OFFSET; - if (length == 0){ - length = 1; - } - double exitX = 0; - double exitZ = 0; - double directionX; - double directionZ; - double norm = Math.sqrt(motionX * motionX + motionZ * motionZ); - double distanceNorm; - - if (meta == 6) { - exitX = (motionX > 0) ? cx + length + X_OFFSET : cx - X_OFFSET; - exitZ = (motionX > 0) ? cz - length + X_OFFSET : cz + Z_OFFSET; - } else if (meta == 4) { - exitX = (motionX > 0) ? cx + Z_OFFSET : cx - (length - X_OFFSET); - exitZ = (motionX > 0) ? cz - X_OFFSET : cz + (length + X_OFFSET); - } else if (meta == 5) { - exitX = (motionX > 0) ? cx + Z_OFFSET : cx - (length + X_OFFSET); - exitZ = (motionX > 0) ? cz + Z_OFFSET : cz - (length + X_OFFSET); - } else if (meta == 7) { - exitX = (motionX > 0) ? cx + (length + X_OFFSET) : cx - X_OFFSET; - exitZ = (motionX > 0) ? cz + (length + X_OFFSET) : cz - X_OFFSET; - } - - directionX = exitX - posX; - directionZ = exitZ - posZ; - distanceNorm = Math.sqrt(directionX * directionX + directionZ * directionZ); - motionX = (directionX / distanceNorm) * norm; - motionZ = (directionZ / distanceNorm) * norm; - this.boundingBox.offset(Math.copySign(motionX, this.motionX), 0 , Math.copySign(motionZ, this.motionZ)); - - List boxes = worldObj.getCollidingBoundingBoxes(this, boundingBox); - for(Object b : boxes){ - if(!(b instanceof BlockRailBase) && !(b instanceof BlockTCRail) && !(b instanceof BlockTCRailGag) && !(b instanceof BlockAir)){ + public int fuelTrain; + protected static final int[][][] matrix = { + {{0, 0, -1}, {0, 0, 1}}, + {{-1, 0, 0}, {1, 0, 0}}, + {{-1, -1, 0}, {1, 0, 0}}, + {{-1, 0, 0}, {1, -1, 0}}, + {{0, 0, -1}, {0, -1, 1}}, + {{0, -1, -1}, {0, 0, 1}}, + {{0, 0, 1}, {1, 0, 0}}, + {{0, 0, 1}, {-1, 0, 0}}, + {{0, 0, -1}, {-1, 0, 0}}, + {{0, 0, -1}, {1, 0, 0}}}; + + protected EntityPlayer playerEntity; + + /** + * Axis aligned bounding box. this needs to be it's own thing because collisions + */ + private AxisAlignedBB boundingBoxSmall; + + public float maxSpeed; + public float railMaxSpeed; + public double speedLimiter = 1; + public boolean speedWasSet = false; + + public ItemStack item; + public float rotation; + + public int rail; + public int meta; + public double d6; + public double d7; + + /** + * appears to be the progress of the turn + */ + private int rollingturnProgress; + private double rollingX; + private double rollingY; + private double rollingZ; + private float rollingServerPitch; + public double rotationYawClient; + public float rotationYawClientReal; + public float anglePitchClient;//was a double + public float serverRealRotation; + private float previousServerRealRotation; + public boolean isServerInReverse = false; + public boolean isClientInReverse = false; + public boolean serverInReverseSignPositive = false; + public float serverRealPitch; + private double rollingPitch; + public float oldClientYaw = 0;//used in rendering class + @SideOnly(Side.CLIENT) + private double rollingVelocityX; + @SideOnly(Side.CLIENT) + private double rollingVelocityY; + @SideOnly(Side.CLIENT) + private double rollingVelocityZ; + + private CollisionHandler collisionhandler; + private LinkHandler linkhandler; + private TrainsOnClick trainsOnClick; + public boolean isBraking; + public boolean isClimbing; + public int overheatLevel; + public int linkageNumber; + + public Side side; + @SideOnly(Side.CLIENT) + private SoundHandler theSoundManager; + @SideOnly(Side.CLIENT) + private SoundUpdaterRollingStock sndUpdater; + /** + * Array containing @TrainHandler objects. In other words it contains all + * the "trains" object the train object contains an array which contains all @RollingStocks + * that are part of the train + */ + public static ArrayList allTrains = new ArrayList(); + public int updateTicks = 0; + private HandleOverheating handleOverheating; + public ArrayList RollingStock; + /** + * each ticks: numLaps++ used for fuel consumption rate + */ + private int numLaps; + + private int ticksSinceHeld = 0; + private boolean cartLocked = false; + + /** + * New physics integration + */ + private double bogieShift = 0; + private boolean needsBogieUpdate; + private boolean firstLoad = true; + public EntityBogie bogieLoco = null; + private boolean hasSpawnedBogie = false; + private double mountedOffset = -0.5; + public double posYFromServer; + private double derailSpeed = 0.46; + + private int scrollPosition; + + public EntityRollingStock(World world) { + super(world); + initRollingStock(world); + } + + @Override + public GameProfile getOwner() { + return CartTools.getCartOwner(this); + } + + public EntityRollingStock(World world, double d, double d1, double d2) { + super(world, d, d1, d2); + initRollingStock(world); + setPosition(d, d1 + yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + public void initRollingStock(World world) { + dataWatcher.addObject(20, 0);//heat + dataWatcher.addObject(14, 0); + dataWatcher.addObject(21, 0); + + preventEntitySpawning = true; + isImmuneToFire = true; + //field_70499_f = false; + + setSize(0.98F, 1.98F); + //yOffset = 0; + //ySize = 0.98F; + yOffset = 0.65f; + + linkageNumber = 0; + + entityCollisionReduction = 0.8F; + + boundingBoxSmall = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 2.0D, 1.0D); + //setBoundingBoxSmall(0.0D, 0.0D, 0.0D, 0.98F, 0.7F); + setBoundingBoxSmall(0.0D, 0.0D, 0.0D, 2.0F, 1.5F); + RollingStock = new ArrayList(); + handleOverheating = new HandleOverheating(this); + + collisionhandler = new CollisionHandler(world); + linkhandler = new LinkHandler(world); + trainsOnClick = new TrainsOnClick(); + + /* Railcraft's stuff */ + //maxSpeed = defaultMaxSpeedRail; + //maxSpeedGround = defaultMaxSpeedGround; + maxSpeedAirLateral = defaultMaxSpeedAirLateral; + maxSpeedAirVertical = defaultMaxSpeedAirVertical; + dragAir = defaultDragAir; + + /** + * Trains are always rendered even if out player's sight => no more + * flickering/disappearing + */ + if (ConfigHandler.FLICKERING) { + this.ignoreFrustumCheck = true; + } + side = FMLCommonHandler.instance().getEffectiveSide(); + if (side == Side.CLIENT) { + sndUpdater = new SoundUpdaterRollingStock(); + } + + this.needsBogieUpdate = false; + setCollisionHandler(null); + //this.boundingBox.offset(0, 0.5, 0); + } + + + /** + * this is basically NBT for entity spawn, to keep data between client and server in sync because some data is not automatically shared. + */ + @Override + public void readSpawnData(ByteBuf additionalData) { + isBraking = additionalData.readBoolean(); + setTrainLockedFromPacket(additionalData.readBoolean()); + } + + @Override + public void writeSpawnData(ByteBuf buffer) { + buffer.writeBoolean(isBraking); + buffer.writeBoolean(getTrainLockedFromPacket()); + } + + public String getTrainName() { + return dataWatcher.getWatchableObjectString(9); + } + + public String getTrainType() { + return dataWatcher.getWatchableObjectString(6); + } + + @Override + public String getTrainOwner() { + return dataWatcher.getWatchableObjectString(7); + } + + public String getTrainCreator() { + return dataWatcher.getWatchableObjectString(13); + } + + public int getIDForServer() { + return dataWatcher.getWatchableObjectInt(5); + } + + public int getNumberOfTrainsForServer() { + return dataWatcher.getWatchableObjectInt(10); + } + + public int getUniqueTrainIDClient() { + return dataWatcher.getWatchableObjectInt(11); + } + + /* + * @Override public int getID() { return ID; } + */ + + @Override + public double getMountedYOffset() { + return mountedOffset; + } + + public void setMountedYOffset(double offset) { + mountedOffset = offset; + } + + public void setYFromServer(double posYServer) { + this.posYFromServer = posYServer; + } + + @Override + protected void entityInit() { + dataWatcher.addObject(16, (byte) 0); + dataWatcher.addObject(17, 0); + dataWatcher.addObject(18, 1); + dataWatcher.addObject(19, 0.0F); + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) { + return null; + } + + @Override + public boolean canBePushed() { + return true; + } + + @Override + public boolean isLocomotive() { + return (this instanceof Locomotive); + } + + @Override + public boolean isPassenger() { + return (this instanceof IPassenger); + } + + @Override + public boolean isFreightCart() { + return (this instanceof Freight || this instanceof LiquidTank); + } + + @Override + public boolean isFreightOrPassenger() { + return (this instanceof Freight || this instanceof IPassenger || this instanceof LiquidTank); + } + + @Override + public boolean isBuilder() { + return (this instanceof EntityTracksBuilder); + } + + @Override + public boolean isTender() { + return (this instanceof Tender); + } + + @Override + public boolean isWorkCart() { + return (this instanceof AbstractWorkCart); + } + + @Override + public boolean isElectricTrain() { + return (this instanceof ElectricTrain); + } + + protected int steamFuelLast(ItemStack it) { + return FuelHandler.steamFuelLast(it); + } + + @Override + public boolean attackEntityFrom(DamageSource damagesource, float i) { + if (worldObj.isRemote || isDead) { + return true; + } + if (damagesource.getEntity() instanceof EntityPlayer && !damagesource.isProjectile()) { + if (this instanceof IPassenger) { + if (canBeDestroyedByPlayer(damagesource)) return false; + } + setRollingDirection(-getRollingDirection()); + setRollingAmplitude(10); + setBeenAttacked(); + if (((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode) { + this.setDamage(1000); + if (ConfigHandler.ENABLE_WAGON_REMOVAL_NOTICES && ((EntityPlayer) damagesource.getEntity()).canCommandSenderUseCommand(2, "")) { + ((EntityPlayer) damagesource.getEntity()).addChatComponentMessage(new ChatComponentText("Operator removed train owned by " + getTrainOwner())); + } + } + setDamage(getDamage() + i * 10); + if (getDamage() > 40) { + if (riddenByEntity != null) { + riddenByEntity.mountEntity(this); + } + ServerLogger.deleteWagon(this); + /** + * Destroy IPassenger since they don't extend Freight or + * Locomotive and don't have a proper attackEntityFrom() method + */ + if (this instanceof IPassenger) { + this.setDead(); + dropCartAsItem(((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode); + } + } + } + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void performHurtAnimation() { + setRollingDirection(-getRollingDirection()); + setRollingAmplitude(10); + setDamage(getDamage() + getDamage() * 10); + } + + public void unLink() { + if (this.isAttached) { + if (this.cartLinked1 != null) { + if (cartLinked1.Link1 == this.uniqueID) { + cartLinked1.Link1 = 0; + cartLinked1.cartLinked1 = null; + if (cartLinked1.RollingStock != null) cartLinked1.RollingStock.clear(); + + } else if (cartLinked1.Link2 == this.uniqueID) { + cartLinked1.Link2 = 0; + cartLinked1.cartLinked2 = null; + if (cartLinked1.RollingStock != null) cartLinked1.RollingStock.clear(); + + } + } + if (this.cartLinked2 != null) { + if (cartLinked2.Link1 == this.uniqueID) { + cartLinked2.Link1 = 0; + cartLinked2.cartLinked1 = null; + if (cartLinked2.RollingStock != null) cartLinked2.RollingStock.clear(); + + } else if (cartLinked2.Link2 == this.uniqueID) { + cartLinked2.Link2 = 0; + cartLinked2.cartLinked2 = null; + if (cartLinked2.RollingStock != null) cartLinked2.RollingStock.clear(); + + } + } + this.cartLinked1 = null; + this.cartLinked2 = null; + this.isAttached = false; + } + } + + @Override + public void setDead() { + super.setDead(); + this.unLink(); + { + if (train == null) { return; } - } - this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; - this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; - this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; - - } - - - private void moveOnTCCurvedSlope(int i, int j, int k,double r, double cx, double cz, int tilex, int tilez, int meta, double slopeHeight, double slopeAngle) { - double newTilex = tilex; - double newTilez = tilez; - if (meta == 2 ) { - newTilez += 1; - newTilex += 0.5; - } - if (meta == 0) { - newTilex += 0.5; - } - if (meta == 1 ) { - newTilex += 1; - newTilez += 0.5; - } - if (meta == 3) { - newTilez += 0.5; - } - double cpx = posX - cx; - double cpz = posZ - cz; - double tpx = newTilex - posX; - double tpz = newTilez - posZ; - - double tpnorm = Math.sqrt(tpx * tpx + tpz * tpz); - - double cp_norm = Math.sqrt(cpx * cpx + cpz * cpz); - double vnorm = Math.sqrt(motionX * motionX + motionZ * motionZ); - - double norm_cpx = cpx / cp_norm; //u - double norm_cpz = cpz / cp_norm; //v - - double vx2 = -norm_cpz * vnorm;//-v - double vz2 = norm_cpx * vnorm;//u - - double px2 = posX + motionX; - double pz2 = posZ + motionZ; - - double px2_cx = px2 - cx; - double pz2_cz = pz2 - cz; - - double p2_c_norm = Math.sqrt((px2_cx * px2_cx) + (pz2_cz * pz2_cz)); - - double px2_cx_norm = px2_cx / p2_c_norm; - double pz2_cz_norm = pz2_cz / p2_c_norm; - - double px3 = cx + (px2_cx_norm * r); - double pz3 = cz + (pz2_cz_norm * r); - - double signX = px3 - posX; - double signZ = pz3 - posZ; - - vx2 = Math.copySign(vx2, signX); - vz2 = Math.copySign(vz2, signZ); - - double p_corr_x = cx + ((cpx / cp_norm) * r); - double p_corr_z = cz + ((cpz / cp_norm) * r); - motionX = vx2; - motionZ = vz2; - - double newYPos = Math.abs(j+ Math.min(1, (slopeAngle * Math.abs(tpnorm))) + yOffset + 0.34f); - setPosition(p_corr_x, newYPos, p_corr_z); - moveEntity(vx2, 0, vz2); - - - } - - private void moveOnTCStraight(int i, int j, int k, double cx, double cz, int meta) { - posY = j + 0.2; - if (meta == 2 || meta == 0) { - double norm = Math.sqrt(motionX * motionX + motionZ * motionZ); - - setPosition(cx + 0.5, posY + yOffset, posZ); - - motionX = 0; - motionZ = Math.copySign(norm, motionZ); - this.boundingBox.offset(0, 0 , Math.copySign(norm, this.motionZ)); - - List boxes = worldObj.getCollidingBoundingBoxes(this, boundingBox); - for(Object b : boxes){ - if(!(b instanceof BlockRailBase) && !(b instanceof BlockTCRail) && !(b instanceof BlockTCRailGag) && !(b instanceof BlockAir)){ - return; - } - } - this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; - this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; - this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; - - } - else if (meta == 1 || meta == 3) { - - setPosition(posX, posY + yOffset, cz + 0.5); - //setPosition(posX, posY + yOffset, posZ); - - motionX = Math.copySign(Math.sqrt(motionX * motionX + motionZ * motionZ), motionX); - motionZ = 0; - this.boundingBox.offset(motionX, 0 , 0); - - List boxes = worldObj.getCollidingBoundingBoxes(this, boundingBox); - for(Object b : boxes){ - if(!(b instanceof BlockRailBase) && !(b instanceof BlockTCRail) && !(b instanceof BlockTCRailGag) && !(b instanceof BlockAir)){ - return; - } - } - this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; - this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; - this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; - - - } - } - - private void moveOnTCSlope(int j, double cx, double cz, double slopeAngle, double slopeHeight, int meta) { - //posY = j + 2.5; - if (meta == 2 || meta == 0) { - - if (meta == 2) { - cz += 1; - } - - double norm = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.setPosition(cx + 0.5D, Math.abs(j + (Math.tan(slopeAngle * Math.abs(cz - this.posZ))) + this.yOffset +0.3), this.posZ); - this.boundingBox.offset(0, 0 , Math.copySign(norm, this.motionZ)); - this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; - this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; - this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; - - if (!(this instanceof Locomotive) && !(this instanceof EntityTracksBuilder)) { - if ((this.posY - this.prevPosY) < 0) { - norm *= 1.02; - } else if ((this.posY - this.prevPosY) > 0) { - norm *= 0.98; - } - if (norm < 0.01) { - - if ((motionZ) < 0 && meta == 2) { - norm += 0.0001; - motionZ = Math.copySign(motionZ, 1); - } - if ((motionZ) > 0 && meta == 0) { - norm += 0.0001; - motionZ = Math.copySign(motionZ, -1); - } - } - } - - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = Math.copySign(norm, this.motionZ); - } - else if (meta == 1 || meta == 3) { - if (meta == 1) { - cx += 1; - } - - double norm = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.setPosition(this.posX, (j + (Math.tan(slopeAngle * Math.abs(cx - this.posX))) + this.yOffset+0.3), cz + 0.5D); - this.boundingBox.offset(Math.copySign(norm, this.motionX), 0 ,0); - this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; - this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; - this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; - - if (!(this instanceof Locomotive) && !(this instanceof EntityTracksBuilder)) { - if ((this.posY - this.prevPosY) < 0) { - norm *= 1.02; - } else if ((this.posY - this.prevPosY) > 0) { - norm *= 0.98; - } - if (norm < 0.01) { - - if ((motionX) < 0 && meta == 1) { - norm += 0.0001; - motionX = Math.copySign(motionX, 1); - } - if ((motionX) > 0 && meta == 3) { - norm += 0.0001; - motionX = Math.copySign(motionX, -1); - } - } - } - this.motionX = Math.copySign(norm, this.motionX); - this.motionY = 0.0D; - this.motionZ = 0.0D; - } - } - protected void moveOnTC90TurnRail(int i, int j, int k, double r, double cx, double cz) { - posY = j + 0.2; - double cpx = posX - cx; - double cpz = posZ - cz; - - double cp_norm = Math.sqrt(cpx * cpx + cpz * cpz); - double vnorm = Math.sqrt(motionX * motionX + motionZ * motionZ); - - double norm_cpx = cpx / cp_norm; //u - double norm_cpz = cpz / cp_norm; //v - - double vx2 = -norm_cpz * vnorm;//-v - double vz2 = norm_cpx * vnorm;//u - - double px2 = posX + motionX; - double pz2 = posZ + motionZ; - - double px2_cx = px2 - cx; - double pz2_cz = pz2 - cz; - - double p2_c_norm = Math.sqrt((px2_cx * px2_cx) + (pz2_cz * pz2_cz)); - - double px2_cx_norm = px2_cx / p2_c_norm; - double pz2_cz_norm = pz2_cz / p2_c_norm; - - double px3 = cx + (px2_cx_norm * r); - double pz3 = cz + (pz2_cz_norm * r); - - double signX = px3 - posX; - double signZ = pz3 - posZ; - vx2 = Math.copySign(vx2, signX); - vz2 = Math.copySign(vz2, signZ); - - double p_corr_x = cx + ((cpx / cp_norm) * r); - double p_corr_z = cz + ((cpz / cp_norm) * r); - - setPosition(p_corr_x, posY + yOffset, p_corr_z); - moveEntity(vx2, 0.0D, vz2); - - motionX = vx2; - motionZ = vz2; - - } - - protected void moveOnTCTwoWaysCrossing(int i, int j, int k, double cx, double cy, double cz, int meta) { - posY = j + 0.2; - if (!(this instanceof Locomotive)) { - int l = MathHelper.floor_double(serverRealRotation * 4.0F / 360.0F + 0.5D) & 3; - if (l == 2 || l == 0){ - moveEntity(motionX, 0.0D, 0.0D); - } else if (l == 1 || l == 3){ - moveEntity(0.0D, 0.0D, motionZ); - } - } - else { - int l = MathHelper.floor_double(rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - if (l == 2 || l == 0){ - moveEntity(motionX, 0.0D, 0.0D); - } - else if (l == 1 || l == 3){ - moveEntity(0.0D, 0.0D, motionZ); - } - //moveEntity(motionX, 0.0D, motionZ); - } - } protected void moveOnTCDiamondCrossing(int i, int j, int k, double cx, double cy, double cz, int meta) { - - int l; - if ((this.bogieLoco == null)) { - l = MathHelper.floor_double(serverRealRotation * 8.0F / 360.0F + 0.5) & 7; - } - - else { - l = MathHelper.floor_double(rotationYaw * 8.0F / 360.0F + 0.5) & 7; - - } - if (l == 0 || l == 4) { - moveEntity(motionX, 0.0D, 0.0D); - } - else if (l == 2 || l == 6) { - moveEntity(0.0D, 0.0D, motionZ); - } - else if (l == 1) { - moveOnTCDiagonal(i, j, k, cx, cz, 5, 1); - } - else if (l == 3){ - moveOnTCDiagonal(i, j, k, cx, cz, 6, 1); - } - else if (l == 5) { - moveOnTCDiagonal(i, j, k, cx, cz, 7, 1); - } - else if (l == 7) { - moveOnTCDiagonal(i, j, k, cx, cz, 4, 1); - } - } - public void limitSpeedOnTCRail() { - railMaxSpeed = 3; - maxSpeed = Math.min(railMaxSpeed, getMaxCartSpeedOnRail()); - maxSpeed = SpeedHandler.handleSpeed(railMaxSpeed, maxSpeed, this); - - if (this.speedLimiter != 0 && speedWasSet) { - //maxSpeed *= this.speedLimiter; - adjustSpeed(maxSpeed, speedLimiter); - } - motionX *= 0.9D; - motionZ *= 0.9D; - - if (motionX < -maxSpeed) { - motionX = -maxSpeed; - } - if (motionX > maxSpeed) { - motionX = maxSpeed; - } - if (motionZ < -maxSpeed) { - motionZ = -maxSpeed; - } - if (motionZ > maxSpeed) { - motionZ = maxSpeed; - } - } - - protected void moveMinecartOffRail(int i, int j, int k) { - motionY -= 0.039999999105930328D; - double d2 = getMaxCartSpeedOnRail(); - if (!onGround) { - d2 = getMaxSpeedAirLateral(); - } - if (motionX < -d2) motionX = -d2; - if (motionX > d2) motionX = d2; - if (motionZ < -d2) motionZ = -d2; - if (motionZ > d2) motionZ = d2; - double moveY = motionY; - if (getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) { - moveY = getMaxSpeedAirVertical(); - if (Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) { - moveY = 0.15f; - motionY = moveY; - } - } - if (onGround) { - motionX *= 0.5D; - motionY *= 0.5D; - motionZ *= 0.5D; - } - moveEntity(motionX, moveY, motionZ); - if (!onGround) { - motionX *= getDragAir(); - motionY *= getDragAir(); - motionZ *= getDragAir(); - } - } - - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - nbttagcompound.setDouble("speedLimiter", this.speedLimiter); - nbttagcompound.setFloat("serverRealRotation", this.serverRealRotation); - nbttagcompound.setFloat("yawRotation", this.rotationYaw); - //nbttagcompound.setBoolean("hasSpawnedBogie", this.hasSpawnedBogie); - //nbttagcompound.setBoolean("needsBogieUpdate", this.needsBogieUpdate); - nbttagcompound.setBoolean("firstLoad", this.firstLoad); - nbttagcompound.setFloat("rotation", this.rotation); - nbttagcompound.setBoolean("brake", isBraking); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - this.speedLimiter = nbttagcompound.getDouble("speedLimiter"); - this.serverRealRotation = nbttagcompound.getFloat("serverRealRotation"); - - if (nbttagcompound.hasKey("yawRotation")){ - rotationYaw = nbttagcompound.getFloat("yawRotation"); - } - //if (Math.abs(this.serverRealRotation) > 178.5f) this.serverRealRotation = Math.copySign(178.5f, this.serverRealRotation); - //this.hasSpawnedBogie = nbttagcompound.getBoolean("hasSpawnedBogie"); - //this.needsBogieUpdate = nbttagcompound.getBoolean("needsBogieUpdate"); - this.firstLoad = nbttagcompound.getBoolean("firstLoad"); - this.rotation = nbttagcompound.getFloat("rotation"); - this.isBraking = nbttagcompound.getBoolean("brake"); - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if (super.interactFirst(entityplayer)){ - return true; - } - if (entityplayer.ridingEntity == this){ - return false; - } - - if(lockThisCart(entityplayer.inventory.getCurrentItem(), entityplayer)){ - return true; - } - - playerEntity = entityplayer; - ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - - if (this.getTrainLockedFromPacket()) { - if (!playerEntity.getDisplayName().toLowerCase().equals(this.trainOwner.toLowerCase()) && !canBeRiddenWhileLocked(this)) { - if (!worldObj.isRemote) entityplayer.addChatMessage(new ChatComponentText("Train is locked")); - return true; - } - else if (!playerEntity.getDisplayName().toLowerCase().equals(this.trainOwner.toLowerCase()) && entityplayer.inventory.getCurrentItem() != null && entityplayer.inventory.getCurrentItem().getItem() instanceof ItemDye && (this instanceof Locomotive)) { - if (!worldObj.isRemote) entityplayer.addChatMessage(new ChatComponentText("Train is locked")); - return true; - } - - } - - if (itemstack != null && itemstack.getItem() instanceof ItemWrench && this instanceof Locomotive && entityplayer.isSneaking() && !worldObj.isRemote) { - destination = ""; - entityplayer.addChatMessage(new ChatComponentText("Destination reset")); - return true; - } - if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, entityplayer))) { - entityplayer.addChatMessage(new ChatComponentText("test")); } - if (itemstack != null && itemstack.hasTagCompound() && getTicketDestination(itemstack) != null && getTicketDestination(itemstack).length() > 0) { - this.setDestination(itemstack); - /** - * ticket are single use but golden ones are multiple uses - */ - ItemStack ticket = GameRegistry.findItemStack("Railcraft", "railcraft.routing.ticket", 1); - if (ticket != null && ticket.getItem() != null && itemstack.getItem() == ticket.getItem()) { - if (--itemstack.stackSize == 0) { - entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); - } - } - return true; - } - /** - * If the color is valid for the cart, then change it and reduce - * itemstack size - */ - if (itemstack != null && itemstack.getItem() instanceof ItemDye) { - if (this.getSpec().getLiveries().size() > 0) { - for (int i = 0; i < this.getSpec().getLiveries().size(); i++) { - if (itemstack.getItemDamage() == getColorFromString(this.getSpec().getLiveries().get(i))) { - this.setColor(this.getSpec().getLiveries().get(i)); - itemstack.stackSize--; - - //if (!worldObj.isRemote)PacketHandler.sendPacketToClients(PacketHandler.sendStatsToServer(10,this.uniqueID,trainName ,trainType, this.trainOwner, this.getColorAsString(itemstack.getItemDamage()), (int)posX, (int)posY, (int)posZ),this.worldObj, (int)posX,(int)posY,(int)posZ, 12.0D); - - return true; - } - } - if (worldObj.isRemote && ConfigHandler.SHOW_POSSIBLE_COLORS) { - String concatColors = ": "; - for (int t = 0; t < this.getSpec().getLiveries().size(); t++) { - concatColors = concatColors.concat(this.getSpec().getLiveries().get(t) + ", "); - } - entityplayer.addChatMessage(new ChatComponentText("Possible colors" + concatColors)); - entityplayer.addChatMessage(new ChatComponentText("To paint, click me with the right dye")); - return true; - } - } - else if (this.getSpec().getLiveries() != null || this.getSpec().getLiveries().size() == 0) { - entityplayer.addChatMessage(new ChatComponentText("No other colors available")); - } - } - if ((trainsOnClick.onClickWithStake(this, itemstack, playerEntity, worldObj))) { - entityplayer.addChatMessage(new ChatComponentText("test")); - return true; } - - if (itemstack != null && itemstack.getItem() instanceof ItemPaintbrushThing && entityplayer.isSneaking()) { - if (this.getSpec().getLiveries().size() > 0) { - if (scrollPosition > this.getSpec().getLiveries().size() - 1) { - this.setColor(getSpec().getLiveries().get(0)); - scrollPosition = 0; - } else { - this.setColor(getSpec().getLiveries().get(scrollPosition)); - scrollPosition++; - - } - } - - if (this.getSpec().getLiveries().size() == 0) { - entityplayer.addChatMessage(new ChatComponentText("There are no other colors available.")); - } - return true; - } - - return worldObj.isRemote; - } - - @SideOnly(Side.CLIENT) - private void soundUpdater() { - if (FMLClientHandler.instance().getClient() != null) { - this.theSoundManager = FMLClientHandler.instance().getClient().getSoundHandler(); - } - if (FMLClientHandler.instance().getClient() != null && this.theSoundManager != null && FMLClientHandler.instance().getClient().thePlayer != null) { - if (sndUpdater != null) { - sndUpdater.update(FMLClientHandler.instance().getClient().getSoundHandler(), this, FMLClientHandler.instance().getClient().thePlayer); - } - } - } - - /** - * Applies a velocity to each of the entities pushing them away from each - * other. Args: entity - */ - @Override - public void applyEntityCollision(Entity par1Entity) { - //if(par1Entity instanceof EntityPlayer)return; - if (this.bogieLoco == null) return; - - if (par1Entity == this){ - return; - } - if (par1Entity instanceof EntityBogie) { - if (((EntityBogie) par1Entity).entityMainTrainID == this.uniqueID) return; - } - if (par1Entity == bogieLoco){ return;} - if (par1Entity instanceof EntityRollingStock && ((EntityRollingStock) par1Entity).bogieLoco != null) { - if (par1Entity == ((EntityRollingStock) par1Entity).bogieLoco) return; - } - - MinecraftForge.EVENT_BUS.post(new MinecartCollisionEvent(this, par1Entity)); - if (getCollisionHandler() != null) { - getCollisionHandler().onEntityCollision(this, par1Entity); - return; - } - if (!this.worldObj.isRemote) { - if (par1Entity != this.riddenByEntity) { - /* - * if (par1Entity instanceof EntityLiving && !(par1Entity - * instanceof EntityPlayer) && !(par1Entity instanceof - * EntityIronGolem) && canBeRidden() && this.motionX * - * this.motionX + this.motionZ * this.motionZ > 0.01D && - * this.riddenByEntity == null && par1Entity.ridingEntity == - * null) { par1Entity.mountEntity(this); } - */ - /* - * if ((this instanceof EntityStockCar)) { if - * (!(unAutorizedMob(par1Entity, this)) && (par1Entity - * instanceof EntityLiving) && !(par1Entity instanceof - * EntityPlayer)) { if (this.canBeRidden() && - * this.riddenByEntity == null && par1Entity.ridingEntity == - * null) { par1Entity.mountEntity(this); } } } - */ - /* - * if(this.isAttached)return; if(par1Entity instanceof - * EntityRollingStock && - * ((EntityRollingStock)par1Entity).isAttached)return; - * if(par1Entity instanceof EntityBogie){ - * if(((EntityBogie)par1Entity).entityMainTrain!=null && - * ((EntityBogie)par1Entity).entityMainTrain.isAttached)return; - * } - */ - double d0 = par1Entity.posX - this.posX; - double d1 = par1Entity.posZ - this.posZ; - double distancesX[] = new double[4]; - double distancesZ[] = new double[4]; - double euclidian[] = new double[4]; - if (par1Entity instanceof EntityRollingStock) { - EntityRollingStock entity = (EntityRollingStock)par1Entity; - if (((EntityRollingStock) par1Entity).bogieLoco != null || this.bogieLoco != null) { - - if (((EntityRollingStock) par1Entity).bogieLoco != null && this.bogieLoco == null) { - distancesX[0] = entity.posX - this.posX; - distancesZ[0] = entity.posZ - this.posZ; - euclidian[0] = MathHelper.sqrt_double((distancesX[0] * distancesX[0]) + (distancesZ[0] * distancesZ[0])); - distancesX[1] = entity.bogieLoco.posX - this.posX; - distancesZ[1] = entity.bogieLoco.posZ - this.posZ; - euclidian[1] = MathHelper.sqrt_double((distancesX[1] * distancesX[1]) + (distancesZ[1] * distancesZ[1])); - distancesX[2] = 100; - distancesZ[2] = 100; - euclidian[2] = MathHelper.sqrt_double((distancesX[2] * distancesX[2]) + (distancesZ[2] * distancesZ[2])); - distancesX[3] = 100; - distancesZ[3] = 100; - euclidian[3] = MathHelper.sqrt_double((distancesX[3] * distancesX[3]) + (distancesZ[3] * distancesZ[3])); - } - else if (((EntityRollingStock) par1Entity).bogieLoco == null && this.bogieLoco != null) { - distancesX[0] = entity.posX - this.posX; - distancesZ[0] = entity.posZ - this.posZ; - euclidian[0] = MathHelper.sqrt_double((distancesX[0] * distancesX[0]) + (distancesZ[0] * distancesZ[0])); - distancesX[1] = entity.posX - this.bogieLoco.posX; - distancesZ[1] = entity.posZ - this.bogieLoco.posZ; - euclidian[1] = MathHelper.sqrt_double((distancesX[1] * distancesX[1]) + (distancesZ[1] * distancesZ[1])); - distancesX[2] = 100; - distancesZ[2] = 100; - euclidian[2] = MathHelper.sqrt_double((distancesX[2] * distancesX[2]) + (distancesZ[2] * distancesZ[2])); - distancesX[3] = 100; - distancesZ[3] = 100; - euclidian[3] = MathHelper.sqrt_double((distancesX[3] * distancesX[3]) + (distancesZ[3] * distancesZ[3])); - } - else { - distancesX[0] = entity.posX - this.posX; - distancesZ[0] = entity.posZ - this.posZ; - euclidian[0] = MathHelper.sqrt_double((distancesX[0] * distancesX[0]) + (distancesZ[0] * distancesZ[0])); - distancesX[1] = entity.bogieLoco.posX - this.posX; - distancesZ[1] = entity.bogieLoco.posZ - this.posZ; - euclidian[1] = MathHelper.sqrt_double((distancesX[1] * distancesX[1]) + (distancesZ[1] * distancesZ[1])); - distancesX[2] = entity.posX - this.bogieLoco.posX; - distancesZ[2] = entity.posZ - this.bogieLoco.posZ; - euclidian[2] = MathHelper.sqrt_double((distancesX[2] * distancesX[2]) + (distancesZ[2] * distancesZ[2])); - distancesX[3] = entity.bogieLoco.posX - this.bogieLoco.posX; - distancesZ[3] = entity.bogieLoco.posZ - this.bogieLoco.posZ; - euclidian[3] = MathHelper.sqrt_double((distancesX[3] * distancesX[3]) + (distancesZ[3] * distancesZ[3])); - } - double min = euclidian[0]; - int minIndex = 0; - for (int k = 0; k < euclidian.length; k++) { - if (Math.abs(euclidian[k]) < Math.abs(min)) { - min = euclidian[k]; - minIndex = k; - } - } - d0 = distancesX[minIndex]; - d1 = distancesZ[minIndex]; - } - } - double d2 = d0 * d0 + d1 * d1; - - if ((par1Entity instanceof AbstractTrains && d2 <= ((AbstractTrains) par1Entity).getLinkageDistance((EntityMinecart) par1Entity) * 0.7 && d2 >= 9.999999747378752E-5D) || (par1Entity instanceof EntityBogie && ((EntityBogie) par1Entity).entityMainTrain != null && d2 <= ((EntityBogie) par1Entity).entityMainTrain.getLinkageDistance((EntityMinecart) par1Entity) * 0.7 && d2 >= 9.999999747378752E-5D) || (!(par1Entity instanceof AbstractTrains) && d2 >= 9.999999747378752E-5D))// >= 9.999999747378752E-5D) - { - d2 = MathHelper.sqrt_double(d2); - if (d0 != 0) { - d0 /= d2; - } else { - d2=0; - } - if (d1 != 0) { - d1 /= d2; - } else { - d2=0; - } - - if (d2 > 1.0D) { - d2 = 1.0D; - } - - d0 *= d2; - d1 *= d2; - d0 *= 0.10000000149011612D; - d1 *= 0.10000000149011612D; - d0 *= 1.0F - this.entityCollisionReduction; - d1 *= 1.0F - this.entityCollisionReduction; - d0 *= 0.5D; - d1 *= 0.5D; - - if ((par1Entity instanceof EntityMinecart ) && !this.isAttached) { - - Vec3 vec31 = Vec3.createVectorHelper(MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), 0.0D, MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F)).normalize(); - - if (Math.abs(Vec3.createVectorHelper(par1Entity.posX - this.posX, 0.0D,par1Entity.posZ - this.posZ).normalize().dotProduct(vec31)) < 0.800000011920929D) { return; } - - double d9 = par1Entity.motionX + this.motionX; - double d8 = par1Entity.motionZ + this.motionZ; - - if ((par1Entity instanceof Locomotive && !isPoweredCart()) || (((EntityMinecart) par1Entity).isPoweredCart()) && !isPoweredCart()) { - - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; - this.addVelocity(par1Entity.motionX - d0, 0.0D, par1Entity.motionZ - d1); - if (!(par1Entity instanceof Locomotive)) { - par1Entity.motionX *= 0.949999988079071D; - par1Entity.motionZ *= 0.949999988079071D; - } - } - else if ((!(par1Entity instanceof Locomotive) && isPoweredCart()) || (!((EntityMinecart) par1Entity).isPoweredCart() && isPoweredCart())) { - if (par1Entity instanceof EntityBogie && ((EntityBogie) par1Entity).entityMainTrain != null) { - this.motionX *= 0.2; - this.motionZ *= 0.2; - this.addVelocity(this.motionX + d0 * 3, 0.0D, this.motionZ + d1 * 3); - if (this instanceof Locomotive && ((EntityBogie) par1Entity).entityMainTrain instanceof Locomotive) { - this.motionX *= 0; - this.motionZ *= 0; - ((EntityBogie) par1Entity).entityMainTrain.motionX *= 0; - ((EntityBogie) par1Entity).entityMainTrain.motionZ *= 0; - } - } - else { - par1Entity.motionX *= 0.20000000298023224D; - par1Entity.motionZ *= 0.20000000298023224D; - par1Entity.addVelocity(this.motionX + d0, 0.0D, this.motionZ + d1); - } - if (!(this instanceof Locomotive)) { - this.motionX *= 0.949999988079071D; - this.motionZ *= 0.949999988079071D; - } - - } - else { - d9 *= 0.4D; - d8 *= 0.4D; - - if (par1Entity instanceof EntityBogie || par1Entity instanceof Locomotive) { - d9 *= -1;//-3 - d8 *= -1;//-3 - } - - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; - this.addVelocity(d9 - d0, 0.0D, d8 - d1); - if (par1Entity instanceof EntityBogie) { - //d7/=3; - //d8/=3; - d9 *= 0.333333333333; - d8 *= 0.333333333333; - } - - par1Entity.motionX *= 0.20000000298023224D; - par1Entity.motionZ *= 0.20000000298023224D; - par1Entity.addVelocity(d9 + d0, 0.0D, d8 + d1); - - } - } - else { - - if (!(par1Entity instanceof EntityItem) && !(par1Entity instanceof EntityPlayer && this instanceof Locomotive) && !(par1Entity instanceof EntityLiving) && !(par1Entity instanceof EntityBogie)) { - this.addVelocity(-d0 * 2, 0.0D, -d1 * 2); - } - else if ((par1Entity instanceof EntityBogie)) { - this.addVelocity(-d0, 0.0D, -d1); - }/* - * else if(par1Entity instanceof EntityBogie){ - * par1Entity.addVelocity(-d0, 0.0D, -d1); - * - * } - */ - //if(!(par1Entity instanceof EntityPlayer))par1Entity.addVelocity(d0 / 4.0D, 0.0D, d1 / 4.0D); - //par1Entity.setVelocity(0, 0.0D, 0); - par1Entity.addVelocity(d0 * 2, 0.0D, d1 * 2 ); - /* - * if(this.bogieUtility[0]!=null && - * this.bogieUtility[1]!=null){ - * this.bogieUtility[0].addVelocity(-d0*2, 0.0D, -d1*2); - * this.bogieUtility[1].addVelocity(-d0*2, 0.0D, -d1*2); - * } - */ - - if (par1Entity instanceof EntityPlayer) { - - MovingObjectPosition movingobjectposition = new MovingObjectPosition(par1Entity); - if (movingobjectposition.entityHit != null) { - // float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + - // this.motionY * this.motionY + this.motionZ * this.motionZ); - // float f7 = MathHelper.sqrt_double(this.motionX * this.motionX + - // this.motionZ * this.motionZ); - //movingobjectposition.entityHit.setVelocity(-par1Entity.motionX, 0, -par1Entity.motionZ); - //movingobjectposition.entityHit.addVelocity(-((par1Entity.motionX * (double) (Math.abs(this.motionX+0.01)) * 2.60000002384185791D)) / (double) f7, 0.00000000000000001D, -(((par1Entity.motionZ * (double) (Math.abs(this.motionZ+0.01)) * 2.60000002384185791D)) / (double) f7)); - //movingobjectposition.entityHit.addVelocity(-((Math.abs(this.motionX) * (double) 1 * 0.0260000002384185791D)) / (double) f7, 0.00000000000000001D, -(((Math.abs(this.motionZ) * (double) 1 * 0.0260000002384185791D)) / (double) f7)); - par1Entity.velocityChanged = true; - } - } - - if (par1Entity instanceof EntityLiving) { - float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ) *60; - //f1 *= 6;//ratio - //f1 *= 10;//to get speed in "pseudo m/s" - if ((f1 * 3.6) < 35) {//if speed is smaller than 35km/h then don't do any damage but push entities - return; - } - int j1 = (int) Math.ceil((f1) * ((par1Entity instanceof EntityCreeper)?100:1)); - par1Entity.attackEntityFrom(TrainsDamageSource.ranOver, j1); - } - } - } + if (train.getTrains() == null && train.getTrains().isEmpty()) { + return; } - } - } - - /** - * To disable linking altogether, return false here. - * - * @return True if this cart is linkable. - */ - @Override - public boolean isLinkable() { - return true; - } - - /** - * Check called when attempting to link carts. - * - * @param cart - * The cart that we are attempting to link with. - * @return True if we can link with this cart. - */ - @Override - public boolean canLinkWithCart(EntityMinecart cart) { - return true; - } - - /** - * Returns true if this cart has two links or false if it can only link with - * one cart. - * - * @return True if two links - */ - @Override - public boolean hasTwoLinks() { - return true; - } - - /** - * Gets the distance at which this cart can be linked. This is called on - * both carts and added together to determine how close two carts need to be - * for a successful link. Default = LinkageManager.LINKAGE_DISTANCE - * - * @param cart - * The cart that you are attempting to link with. - * @return The linkage distance - */ - @Override - public float getLinkageDistance(EntityMinecart cart) { - return this.getOptimalDistance(cart) + 2.4F; - } - - /** - * Gets the optimal distance between linked carts. This is called on both - * carts and added together to determine the optimal rest distance between - * linked carts. The LinkageManager will attempt to maintain this distance - * between linked carts at all times. Default = - * LinkageManager.OPTIMAL_DISTANCE - * ETERNAL's NOTE: because this is forcing the value of EntityMinecart, it's actually a call to the super but using this instance. Not actually an infinate look like compiler thinks. - * - * @param cart - * The cart that you are linked with. - * @return The optimal rest distance - */ - @Override - public float getOptimalDistance(EntityMinecart cart) { - return this.getOptimalDistance(cart); - } - - /** - * Return false if linked carts have no effect on the velocity of this cart. - * Use carefully, if you link two carts that can't be adjusted, it will - * behave as if they are not linked. - * - * @param cart - * The cart doing the adjusting. - * @return Whether the cart can have its velocity adjusted. - */ - @Override - public boolean canBeAdjusted(EntityMinecart cart) { - return true; - } - - @Override - public void onLinkCreated(EntityMinecart cart) { - linked = true; - } - - /** - * Called when a link is broken (usually). - * - * @param cart - * The cart we were linked with. - */ - @Override - public void onLinkBroken(EntityMinecart cart) { - linked = false; - } - - @Override - public boolean isLinked() { - return linked; - } - - /** - * This function returns an ItemStack that represents this cart. This should - * be an ItemStack that can be used by the player to place the cart. This is - * the item that was registered with the cart via the registerMinecart - * function, but is not necessary the item the cart drops when destroyed. - * - * @return An ItemStack that can be used to place the cart. - */ - @Override - public ItemStack getCartItem() { - return getItemsDropped().get(0); - } - - /** - * Returns true if this cart is self propelled. - * - * @return True if powered. - */ - @Override - public boolean isPoweredCart() { - return (isLocomotive()); - } - - /** - * Returns true if this cart is a storage cart Some carts may have - * inventories but not be storage carts and some carts without inventories - * may be storage carts. - * - * @return True if this cart should be classified as a storage cart. - */ - public boolean isStorageCart() { - return (isFreightCart()); - } - - /** - * Returns true if this cart can be ridden by an Entity. - * - * @return True if this cart can be ridden. - */ - @Override - public boolean canBeRidden() { - return ((isLocomotive() || isPassenger() || isWorkCart())); - } - - /** - * Returns true if this cart can currently use rails. This function is - * mainly used to gracefully detach a minecart from a rail. - * - * @return True if the minecart can use rails. - */ - @Override - public boolean canUseRail() { - return canUseRail; - } - - /** - * Set whether the minecart can use rails. This function is mainly used to - * gracefully detach a minecart from a rail. - * - * @param use - * Whether the minecart can currently use rails. - */ - @Override - public void setCanUseRail(boolean use) { - canUseRail = use; - } - - /** - * Return false if this cart should not call IRail.onMinecartPass() and - * should ignore Powered Rails. - * - * @return True if this cart should call IRail.onMinecartPass(). - */ - @Override - public boolean shouldDoRailFunctions() { - return true; - } - - protected void applyDragAndPushForces() { - motionX *= getDragAir(); - motionY *= 0.0D; - motionZ *= getDragAir(); - } - - /** - * Carts should return their drag factor here - * - * @return The drag rate. - */ - @Override - public double getDragAir() { - return 0.98D; - } - - @Override - public void moveMinecartOnRail(int i, int j, int k, double d) { - Block id = worldObj.getBlock(i, j, k); - if (!BlockRailBase.func_150051_a(id)) { return; } - railMaxSpeed = ((BlockRailBase) id).getRailMaxSpeed(worldObj, this, i, j, k); - maxSpeed = Math.max(railMaxSpeed, getMaxCartSpeedOnRail()); - maxSpeed = SpeedHandler.handleSpeed(railMaxSpeed, maxSpeed, this); - if (this.speedLimiter != 0 && speedWasSet) { - //maxSpeed *= this.speedLimiter; - adjustSpeed(maxSpeed, speedLimiter); - } - if ((!isLocomotive())) { - motionX *= 0.99D; - motionZ *= 0.99D; - } - else { - motionX *= 1D; - motionZ *= 1D; - } - if (motionX < -maxSpeed) { - motionX = -maxSpeed; - } - if (motionX > maxSpeed) { - motionX = maxSpeed; - } - if (motionZ < -maxSpeed) { - motionZ = -maxSpeed; - } - if (motionZ > maxSpeed) { - motionZ = maxSpeed; - } - moveEntity(motionX, 0.0D, motionZ); - } - - public void adjustSpeed(float maxSpeed, double limiter) { - float targetSpeed = (float) (maxSpeed * limiter); - float targetSpeedX = (float) Math.copySign(targetSpeed, motionX); - float targetSpeedZ = (float) Math.copySign(targetSpeed, motionZ); - if (motionX > targetSpeedX && motionX != 0) motionX -= 0.01; - if (motionZ > targetSpeedZ && motionZ != 0) motionZ -= 0.01; - if (motionX < targetSpeedX && motionX != 0) motionX += 0.01; - if (motionZ < targetSpeedZ && motionZ != 0) motionZ += 0.01; - if ((Math.abs(motionX) < Math.abs(targetSpeedX) + 0.01) && (Math.abs(motionX) > Math.abs(targetSpeedX) - 0.01)) { - speedWasSet = false; - } - if ((Math.abs(motionZ) < Math.abs(targetSpeedZ) + 0.01) && (Math.abs(motionZ) > Math.abs(targetSpeedZ) - 0.01)) { - speedWasSet = false; - } - } - - protected void adjustSlopeVelocities(int i1) { - if (this instanceof Locomotive) { return; } - double d4 = -0.002D;//0.0078125D - if (i1 == 2) { - motionX -= d4; - } - else if (i1 == 3) { - motionX += d4; - } - else if (i1 == 4) { - motionZ += d4; - } - else if (i1 == 5) { - motionZ -= d4; - } - } - - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return (!isDead && entityplayer.getDistanceSqToEntity(this) <= 300D); - } - - /** - * Returns the carts max speed. Carts going faster than 1.1 cause issues - * with chunk loading. This value is compared with the rails max speed to determine - * the carts current max speed. A normal rails max speed is 0.4. - * - * @return Carts max speed. - */ - @Override - public float getMaxCartSpeedOnRail() { - return maxSpeed; - } - - @Override - public float getMaxSpeedAirLateral() { - return maxSpeedAirLateral; - } - - @Override - public void setMaxSpeedAirLateral(float value) { - maxSpeedAirLateral = value; - } - - @Override - public float getMaxSpeedAirVertical() { - return maxSpeedAirVertical; - } - - @Override - public void setMaxSpeedAirVertical(float value) { - maxSpeedAirVertical = value; - } - - @Override - public void setDragAir(double value) { - dragAir = value; - } - - @Override - public boolean canOverheat() { - return false; - } - - @Override - public int getOverheatTime() { - return 0; - } - - /** - * returns the middle of the overheat bar in the HUD - * - */ - public int getAverageOverheat() { - return (this.getOverheatTime() + 30) / 2; - } - - /** - * client-server communication - */ - public void setOverheatLevel(int overheatLevel) { - this.overheatLevel = overheatLevel; - this.dataWatcher.updateObject(20, overheatLevel); - } - - /** - * client-server communication - * - */ - public int getOverheatLevel() { - return (this.dataWatcher.getWatchableObjectInt(20)); - } - - /** - * @see SpeedHandler description in SpeedHandler - */ - public double convertSpeed(Locomotive entity) { - double speed = entity.getCustomSpeed();// speed in m/s - if (ConfigHandler.REAL_TRAIN_SPEED) { - speed /= 2;// applying ratio - } - else { - speed /= 6; - } - speed /= 10; - return speed; - } - - /** - * Used in SoundUpdaterRollingStock - * - */ - public int getMotionXClient() { - return (this.dataWatcher.getWatchableObjectInt(14)); - } - - /** - * Used in SoundUpdaterRollingStock - * - */ - public int getMotionZClient() { - return (this.dataWatcher.getWatchableObjectInt(21)); - } - - @Override - protected void func_145775_I() { - int var1 = MathHelper.floor_double(this.boundingBoxSmall.minX + 0.001D); - int var2 = MathHelper.floor_double(this.boundingBoxSmall.minY + 0.001D); - int var3 = MathHelper.floor_double(this.boundingBoxSmall.minZ + 0.001D); - int var4 = MathHelper.floor_double(this.boundingBoxSmall.maxX - 0.001D); - int var5 = MathHelper.floor_double(this.boundingBoxSmall.maxY - 0.001D); - int var6 = MathHelper.floor_double(this.boundingBoxSmall.maxZ - 0.001D); - - if (this.worldObj.checkChunksExist(var1, var2, var3, var4, var5, var6)) { - for (int var7 = var1; var7 <= var4; ++var7) { - for (int var8 = var2; var8 <= var5; ++var8) { - for (int var9 = var3; var9 <= var6; ++var9) { - Block var10 = this.worldObj.getBlock(var7, var8, var9); - - if (var10 != null) { - var10.onEntityCollidedWithBlock(this.worldObj, var7, var8, var9, this); - } - } + for (int i2 = 0; i2 < train.getTrains().size(); i2++) { + if (train.getTrains().get(i2) instanceof Locomotive) { + train.getTrains().get(i2).cartLinked1 = null; + train.getTrains().get(i2).Link1 = 0; + train.getTrains().get(i2).cartLinked2 = null; + train.getTrains().get(i2).Link2 = 0; } - } - } - } - - private void setBoundingBoxSmall(double par1, double par3, double par5, float width, float height) { - float var7 = width * 0.5F; - this.boundingBoxSmall.setBounds(par1 - var7, par3 - this.yOffset + this.ySize, par5 - var7, par1 + var7, par3 - this.yOffset + this.ySize + height, par5 + var7); - } - - public float getYaw() { - return this.rotationYaw; - } - - public float getPitch() { - return this.rotationPitch; - } - - @Override - public int getMinecartType() { - return 0; - } - - @Override - public List getItemsDropped() { - List items = new ArrayList(); - TrainRecord train = Traincraft.instance.traincraftRegistry.getTrainRecord(this.getClass()); - if (train != null) { - items.add(ItemRollingStock.setPersistentData(new ItemStack(train.getItem()), this,this.getUniqueTrainID(),trainCreator, trainOwner, getColor())); - return items; - } - return null; - } - - @SideOnly(Side.CLIENT) - public Vec3 renderY(double par1, double par3, double par5, double par7) { - int i = MathHelper.floor_double(par1); - int j = MathHelper.floor_double(par3); - int k = MathHelper.floor_double(par5); - - if (worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRailGag.block) { - --j; - } else if (worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRailGag.block){ - j++; - } - Block l = this.worldObj.getBlock(i, j, k); - int i1; - if (l == BlockIDs.tcRail.block || l == BlockIDs.tcRailGag.block) { - i1 = worldObj.getBlockMetadata(i, j, k); - if (i1 == 2){ i1 = 0;} - else if (i1 == 3){ i1 = 1;} - } - else { - return null; - } - if (l != BlockIDs.tcRail.block && l != BlockIDs.tcRailGag.block) { - par3 = j; - - if (i1 >= 2 && i1 <= 5) { - par3 = j + 1; - } - } - else if (l == BlockIDs.tcRail.block || l == BlockIDs.tcRailGag.block) { - TileEntity tile = worldObj.getTileEntity(i, j, k); - if (tile != null && tile instanceof TileTCRail) { - if (((TileTCRail) tile).getType() != null && !ItemTCRail.isTCSlopeTrack((TileTCRail) tile)) { - par3 = j; + if ((train.getTrains().get(i2)) != this) { + if (train != null && train.getTrains() != null && train.getTrains().get(i2) != null && train.getTrains().get(i2).train != null && train.getTrains().get(i2).train.getTrains() != null) + train.getTrains().get(i2).train.getTrains().clear(); } - } else if (tile != null && tile instanceof TileTCRailGag) { - int xOrigin = ((TileTCRailGag) tile).originX; - int yOrigin = ((TileTCRailGag) tile).originY; - int zOrigin = ((TileTCRailGag) tile).originZ; - TileEntity tileOrigin = worldObj.getTileEntity(xOrigin, yOrigin, zOrigin); - if (tileOrigin != null && (tileOrigin instanceof TileTCRail) && ((TileTCRail) tileOrigin).getType() != null && !ItemTCRail.isTCSlopeTrack((TileTCRail) tileOrigin)) { - par3 = j; - } - } - } - int[][] aint = matrix[i1]; - double d4 = aint[1][0] - aint[0][0]; - double d5 = aint[1][2] - aint[0][2]; - double d6 = Math.sqrt(d4 * d4 + d5 * d5); - d4 /= d6; - d5 /= d6; - par1 += d4 * par7; - par5 += d5 * par7; - - if (l != BlockIDs.tcRail.block && l != BlockIDs.tcRailGag.block) { - if (aint[0][1] != 0 && MathHelper.floor_double(par1) - i == aint[0][0] && MathHelper.floor_double(par5) - k == aint[0][2]) { - par3 += aint[0][1]; } - else if (aint[1][1] != 0 && MathHelper.floor_double(par1) - i == aint[1][0] && MathHelper.floor_double(par5) - k == aint[1][2]) { - par3 += aint[1][1]; - } - } - return this.func_70489_a(par1, par3, par5); - } - - //private int renderTicks; - public Vec3 yVector(double par1, double par3, double par5) { - int i = MathHelper.floor_double(par1); - int j = MathHelper.floor_double(par3); - int k = MathHelper.floor_double(par5); - if (worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRailGag.block) { - --j; - } else if (worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRailGag.block){ - j++; - } - - Block l = this.worldObj.getBlock(i, j, k); - int i1 = 0; - - /* - * boolean shouldIgnoreYCoord = false; TileEntity tile = - * worldObj.getBlockTileEntity(i, j, k); if(tile!=null && tile - * instanceof TileTCRail){ if(((TileTCRail)tile).getType()!=null && - * ((TileTCRail - * )tile).getType().equals(TrackTypes.MEDIUM_SLOPE.getLabel())){ - * shouldIgnoreYCoord = true; } } if(tile!=null && tile instanceof - * TileTCRailGag){ int xOrigin = ((TileTCRailGag)tile).originX; int - * yOrigin = ((TileTCRailGag)tile).originY; int zOrigin = - * ((TileTCRailGag)tile).originZ; TileEntity tileOrigin = - * worldObj.getBlockTileEntity(xOrigin, yOrigin, zOrigin); - * if(tileOrigin!=null && (tileOrigin instanceof TileTCRail) && - * ((TileTCRail)tileOrigin).getType()!=null && - * ((TileTCRail)tileOrigin).getType - * ().equals(TrackTypes.MEDIUM_SLOPE.getLabel())){ shouldIgnoreYCoord = - * true; } } - */ - if (l == BlockIDs.tcRail.block || l == BlockIDs.tcRailGag.block) { - //par3 = (double) j; - int[][] aint = matrix[i1]; - double d3 = 0.0D; - double d4 = i + 0.5D + aint[0][0] * 0.5D; - double d6 = k + 0.5D + aint[0][2] * 0.5D; - double d10 = (i + 0.5D + aint[1][0] * 0.5D) - d4; - double d12 = (k + 0.5D + aint[1][2] * 0.5D) - d6; - - if (d10 == 0.0D) { - d3 = par5 - k; - } - else if (d12 == 0.0D) { - d3 = par1 - i; - } - else { - double d13 = par1 - d4; - double d14 = par5 - d6; - d3 = (d13 * d10 + d14 * d12) * 2.0D; - } - return Vec3.createVectorHelper(d4 + d10 * d3, par3, d6 + d12 * d3); - } - else { - return null; } - } - public ItemStack[] getInventory(){return null;} + if (train != null && train.getTrains().size() <= 1) { + train.getTrains().clear(); + allTrains.remove(train); + } + + if (this.bogieLoco != null) { + bogieLoco.setDead(); + bogieLoco.isDead = true; + } + + isDead = true; + Side side = FMLCommonHandler.instance().getEffectiveSide(); + if (side == Side.CLIENT) { + soundUpdater(); + } + } + + @Override + public boolean canBeCollidedWith() { + return !isDead; + } + + public void pressKey(int i) { + } + + /** + * gets packet from server and distribute for GUI handles motion + * + * @param i + */ + public void keyHandlerFromPacket(int i) { + this.pressKey(i); + } + + private void handleTrain() { + if (this instanceof Locomotive && train != null) { + for (int i2 = 0; i2 < train.getTrains().size(); i2++) { + if (RailTools.isCartLockedDown(train.getTrains().get(i2))) { + cartLocked = true; + /** If something in the train is locked down */ + ticksSinceHeld = 40; + if (!((Locomotive) this).canBeAdjusted) { + ((Locomotive) this).setCanBeAdjusted(true); + + } + } + cartLocked = false; + } + if (ticksSinceHeld > 0 && !cartLocked) { + ticksSinceHeld--; + } + if (ticksSinceHeld <= 0 && !cartLocked) { + if (((Locomotive) this).canBeAdjusted && !((Locomotive) this).canBePulled) { + ((Locomotive) this).setCanBeAdjusted(false); + + } + } + } + + /* + * if(train!=null && RailTools.isCartLockedDown((EntityMinecart) this)){ + * train.setTicksSinceHeld(100); train.setCartLocked(true); for(int + * i2=0;i2 1) { + if (this instanceof Locomotive && !((Locomotive) this).canBeAdjusted && !this.getDestination().isEmpty()) { + for (int i = 0; i < train.getTrains().size(); i++) { + if (train.getTrains().get(i) != null && !train.getTrains().get(i).equals(this)) + train.getTrains().get(i).destination = this.getDestination(); + CartTools.setCartOwner(train.getTrains().get(i), CartTools.getCartOwner(this)); + } + } + } + /** + * Resets destination + */ + else if (!(this instanceof Locomotive)) { + destination = ""; + } + } + + @Override + @SideOnly(Side.CLIENT) + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { + this.rollingX = par1; + this.rollingY = par3; + this.rollingZ = par5; + this.rollingPitch = par8; + this.rollingturnProgress = par9 + 2; + this.motionX = this.rollingVelocityX; + this.motionY = this.rollingVelocityY; + this.motionZ = this.rollingVelocityZ; + } + + List list = null; + Block l; + + @Override + public void onUpdate() { + + if (addedToChunk && !this.hasSpawnedBogie && this.getSpec().getBogieLocoPosition() != 0) { + + if (bogieLoco == null) { + this.bogieShift = this.getSpec().getBogieLocoPosition(); + this.bogieLoco = new EntityBogie(worldObj, + (posX - Math.cos(this.serverRealRotation * TraincraftUtil.radian) * this.bogieShift), + posY + ((Math.tan(this.renderPitch * TraincraftUtil.radian) * -this.bogieShift) + getMountedYOffset() - 0.1d), + (posZ - Math.sin(this.serverRealRotation * TraincraftUtil.radian) * this.bogieShift), this, this.uniqueID, 0, this.bogieShift); + + + if (!worldObj.isRemote) worldObj.spawnEntityInWorld(bogieLoco); + this.needsBogieUpdate = true; + } + this.hasSpawnedBogie = true; + } + + super.manageChunkLoading(); + + /** + * Set the uniqueID if the entity doesn't have one. + */ + if (!worldObj.isRemote && this.uniqueID == -1) { + if (FMLCommonHandler.instance().getMinecraftServerInstance() != null) { + //TraincraftSaveHandler.createFile(FMLCommonHandler.instance().getMinecraftServerInstance()); + //int readID = TraincraftSaveHandler.readInt(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:"); + //int newID = setNewUniqueID(readID); + + //TraincraftSaveHandler seems to not work, may cause uniqueID bug. + setNewUniqueID(this.getEntityId()); + + //TraincraftSaveHandler.writeValue(FMLCommonHandler.instance().getMinecraftServerInstance(), "numberOfTrains:", "" + newID); + + } + } + + if (riddenByEntity instanceof EntityPlayer) { + ((EntityPlayer) riddenByEntity).addPotionEffect(new PotionEffect(Potion.resistance.id, 20, 5, true)); + } + + if (getRollingAmplitude() > 0) { + setRollingAmplitude(getRollingAmplitude() - 1); + } + if (getDamage() > 0) { + setDamage(getDamage() - 1); + } + + isBraking = false; + + if (worldObj.isRemote && Traincraft.proxy.getCurrentScreen() == null && riddenByEntity instanceof EntityLivingBase) { + EntityLivingBase entity = (EntityLivingBase) riddenByEntity; + if (TraincraftEntityHelper.getIsJumping(entity)) isBraking = true; + } + + int var2; + if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) { + this.worldObj.theProfiler.startSection("portal"); + MinecraftServer var1 = MinecraftServer.getServer(); + var2 = this.getMaxInPortalTime(); + + if (this.inPortal) { + if (var1.getAllowNether()) { + if (this.ridingEntity == null && this.portalCounter++ >= var2) { + this.portalCounter = var2; + this.timeUntilPortal = this.getPortalCooldown(); + byte var3; + + if (this.worldObj.provider.dimensionId == -1) { + var3 = 0; + } else { + var3 = -1; + } + + this.travelToDimension(var3); + } + + this.inPortal = false; + } + } else { + if (this.portalCounter > 0) { + this.portalCounter -= 4; + } + + if (this.portalCounter < 0) { + this.portalCounter = 0; + } + } + + if (this.timeUntilPortal > 0) { + --this.timeUntilPortal; + } + + this.worldObj.theProfiler.endSection(); + } + + Side side = FMLCommonHandler.instance().getEffectiveSide(); + if (side == Side.CLIENT) { + soundUpdater(); + } + + if (worldObj.isRemote) { + //rotationYaw = (float) rotationYawClient; + if (rollingturnProgress > 0) { + rotationYaw = (float) rotationYawClient; + this.rotationPitch = (float) (this.rotationPitch + (this.rollingPitch - this.rotationPitch) / this.rollingturnProgress); + + this.setPosition(this.posX + (this.rollingX - this.posX) / this.rollingturnProgress, + this.posY + (this.rollingY - this.posY) / this.rollingturnProgress, + this.posZ + (this.rollingZ - this.posZ) / this.rollingturnProgress); + --this.rollingturnProgress; + this.setRotation(this.rotationYaw, this.rotationPitch); + + } else { + setPosition(posX, posY, posZ); + setRotation(rotationYaw, rotationPitch); + + } + return; + } + + /* + * if(this.updateTicks<5){ + + */ + /** + * As entities can't be registered in nbttagcompound I had to setup this + * system... When world loads, only the (double) Link1 and Link2 are + * known. This method search for the entity with the ID corresponding to + * Link1 or Link2 When it finds it, (EntityRollingStock)cartLinked1 and + * cartLinked2 will be updated accordingly + */ + if (addedToChunk && ((this.cartLinked1 == null && this.Link1 != 0) || (this.cartLinked2 == null && this.Link2 != 0))) { + list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(15, 15, 15)); + + if (list != null && list.size() > 0) { + for (Object entity : list) { + if (entity instanceof EntityRollingStock) { + if (((EntityRollingStock) entity).uniqueID == this.Link1) { + this.cartLinked1 = (EntityRollingStock) entity; + } else if (((EntityRollingStock) entity).uniqueID == this.Link2) { + this.cartLinked2 = (EntityRollingStock) entity; + } + } + } + } + } + + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + + int i = MathHelper.floor_double(posX); + int j = MathHelper.floor_double(posY); + int k = MathHelper.floor_double(posZ); + + if (needsBogieUpdate) { + if (bogieLoco != null) { + float rotationCos1 = (float) Math.cos(Math.toRadians(serverRealRotation)); + float rotationSin1 = (float) Math.sin(Math.toRadians((serverRealRotation))); + if (!firstLoad) { + rotationCos1 = (float) Math.cos(Math.toRadians(serverRealRotation + 90)); + rotationSin1 = (float) Math.sin(Math.toRadians((serverRealRotation + 90))); + } + double bogieX1 = (this.posX + (rotationCos1 * Math.abs(bogieShift))); + double bogieZ1 = (this.posZ + (rotationSin1 * Math.abs(bogieShift))); + this.bogieLoco.setPosition(bogieX1, bogieLoco.posY, bogieZ1); + /* + * double rads = this.serverRealRotation * + * 3.141592653589793D / 180.0D; double pitchRads = + * this.renderPitch * 3.141592653589793D / 180.0D; + * this.bogieLoco[bog].setPosition((float) (posX - + * Math.cos(rads) * this.bogieShift[bog]), (float) posY + + * ((Math.tan(pitchRads) * -this.bogieShift[bog]) + + * getMountedYOffset()), (float) (posZ - Math.sin(rads) * + * this.bogieShift[bog])); + */ + } + firstLoad = false; + /* + * for (int bog = 0; bog < this.bogieUtility.length; bog++) { if + * (bogieUtility[bog] != null) { + * + * double rads = this.serverRealRotation * 3.141592653589793D / + * 180.0D; double pitchRads = this.renderPitch * 3.141592653589793D + * / 180.0D; this.bogieUtility[bog].setPosition((float) (posX - + * Math.cos(rads) * this.bogieShift[bog]), (float) posY + + * ((Math.tan(pitchRads) * -this.bogieShift[bog]) + + * getMountedYOffset()), (float) (posZ - Math.sin(rads) * + * this.bogieShift[bog])); + + * [bog].posX+" "+ this.bogieUtility[bog].posY + * +" "+this.bogieUtility[bog].posZ); } } + */ + needsBogieUpdate = false; + } + if (bogieLoco != null) { + bogieLoco.updateDistance(); + } + + if (worldObj.isAirBlock(i, j, k)) { + j--; + } else if (isRailBlockAt(worldObj, i, j + 1, k) || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRailGag.block) { + j++; + } + + l = worldObj.getBlock(i, j, k); + + updateOnTrack(i, j, k, l); + + + updateTicks++; + d6 = prevPosX - posX; + d7 = prevPosZ - posZ; + prevRotationYaw = rotationYaw; + + //this.rotationPitch = 0.0F; + + if (d6 * d6 + d7 * d7 > 0.0001D) { + this.rotationYaw = (float) (Math.atan2(d7, d6) * 180.0D / Math.PI); + if (this.isClientInReverse) { + this.rotationYaw += 180.0F; + } + } + + //double var49 = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.prevRotationYaw); + + float anglePitch = 0; + if (bogieLoco != null) { + + serverRealRotation = MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2((float) (bogieLoco.posZ - this.posZ), (float) (bogieLoco.posX - this.posX))) - 90F); + + anglePitch = (float) Math.atan(((bogieLoco.posY - posY)) / + MathHelper.sqrt_double(((bogieLoco.posX - posX) * (bogieLoco.posX - posX)) + + ((bogieLoco.posZ - posZ) * (bogieLoco.posZ - posZ))));//1.043749988079071 + serverRealPitch = anglePitch + (float) + ((bogieLoco.posZ - posZ) * (bogieLoco.posZ - posZ));//1.043749988079071 + } else { + float rotation = rotationYaw; + + float delta = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.previousServerRealRotation); //Math.abs(this.rotationYaw - this.previousServerRealRotation); + + this.previousServerRealRotation = this.rotationYaw; + + if (delta < -179.0F || delta > 179.0F) { // if (delta > 170.0F || delta < 190.0F) { + + this.rotationYaw += 180.0F; + this.isServerInReverse = !this.isServerInReverse; + } + previousServerRealRotation = rotation; + if (this.isServerInReverse) { + if (serverInReverseSignPositive) { + rotation += 180.0f; + } else { + rotation -= 180.0f; + } + } + + serverRealRotation = rotation; + + double zDist = posZ - prevPosZ; + double xDist = posX - prevPosX; + float tempPitch = rollingServerPitch; + float tempPitch2 = tempPitch; + if (Math.abs(zDist) > 0.02) { + double rads = Math.atan((posY - prevPosY) / zDist); + tempPitch = (float) ((Math.atan((posY - prevPosY) / zDist)) * degrees); + } else if (Math.abs(xDist) > 0.02) { + tempPitch = (float) ((Math.atan((posY - prevPosY) / xDist)) * degrees); + //pitch=tempPitch; + } + + //if (Math.abs(tempPitch) > 16) { + //tempPitch=Math.copySign(16, tempPitch); + //} + if (tempPitch2 < tempPitch && Math.abs(tempPitch2 - tempPitch) > 3) { + tempPitch2 += 3; + } else if (tempPitch2 > tempPitch && Math.abs(tempPitch2 - tempPitch) > 3) { + tempPitch2 -= 3; + } else if (tempPitch2 < tempPitch && Math.abs(tempPitch2 - tempPitch) > 0.5) { + tempPitch2 += 0.5; + } else if (tempPitch2 > tempPitch && Math.abs(tempPitch2 - tempPitch) > 0.5) { + tempPitch2 -= 0.5; + } + anglePitch = -tempPitch2; + rollingServerPitch = 0; + } + + + if (updateTicks % 2 == 0) { + Traincraft.rotationChannel.sendToAllAround(new PacketRollingStockRotation(this, (int) (anglePitch * 60)), new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300.0D)); + } + if (!worldObj.isRemote) { + anglePitchClient = (anglePitch * 60); + } + + //this.setRotation(this.rotationYaw, this.rotationPitch); + + list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, getCollisionHandler() != null ? + getCollisionHandler().getMinecartCollisionBox(this) : + boundingBox.expand(0.2D, 0.0D, 0.2D)); + + if (list != null && !list.isEmpty()) { + Entity entity; + for (Object obj : list) { + if (obj == this.riddenByEntity) { + continue; + } + entity = (Entity) obj; + + if (entity.canBePushed() && entity instanceof EntityMinecart) { + entity.applyEntityCollision(this); + } else if (entity.canBePushed() && !(entity instanceof EntityMinecart)) { + this.applyEntityCollision(entity); + } + } + } + + handleTrain(); + handleOverheating.HandleHeatLevel(this); + linkhandler.handleStake(this, boundingBox); + collisionhandler.handleCollisions(this, boundingBox); + this.func_145775_I(); + MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, i, j, k)); + //setBoundingBoxSmall(posX, posY, posZ, 0.98F, 0.7F); + numLaps++; + if ((this instanceof Locomotive) && (this.Link1 == 0) && (this.Link2 == 0) && numLaps > 700) { + this.RollingStock.clear(); + } + + if (this.riddenByEntity != null && this.riddenByEntity.isDead) { + if (this.riddenByEntity.ridingEntity == this) { + this.riddenByEntity.ridingEntity = null; + } + this.riddenByEntity = null; + } + this.dataWatcher.updateObject(14, (int) (motionX * 100)); + this.dataWatcher.updateObject(21, (int) (motionZ * 100)); + + if (ConfigHandler.ENABLE_LOGGING && !worldObj.isRemote && updateTicks % 120 == 0) { + ServerLogger.writeWagonToFolder(this); + } + } + + boolean flag, flag1; + + private void updateOnTrack(int i, int j, int k, Block l) { + if (canUseRail() && BlockRailBase.func_150051_a(l)) { + + Vec3 vec3d = TraincraftUtil.func_514_g(posX, posY, posZ); + int i1 = ((BlockRailBase) l).getBasicRailMetadata(worldObj, this, i, j, k); + meta = i1; + posY = j; + flag = false; + flag1 = l == Blocks.golden_rail; + if (l == Blocks.golden_rail) { + flag = worldObj.getBlockMetadata(i, j, k) > 2; + if (i1 == 8) { + i1 = 0; + } else if (i1 == 9) { + i1 = 1; + } + } + + if (l == Blocks.detector_rail) { + worldObj.setBlockMetadataWithNotify(i, j, k, meta | 8, 3); + worldObj.notifyBlocksOfNeighborChange(i, j, k, l); + worldObj.notifyBlocksOfNeighborChange(i, j - 1, k, l); + worldObj.markBlockRangeForRenderUpdate(i, j, k, i, j, k); + worldObj.scheduleBlockUpdate(i, j, k, l, l.tickRate(worldObj)); + } + + if (i1 >= 2 && i1 <= 5) { + posY = (j + 1); + } + + adjustSlopeVelocities(i1); + + + int ai[][] = matrix[i1]; + double d9 = ai[1][0] - ai[0][0]; + double d10 = ai[1][2] - ai[0][2]; + double d11 = Math.sqrt(d9 * d9 + d10 * d10); + if (motionX * d9 + motionZ * d10 < 0.0D) { + d9 = -d9; + d10 = -d10; + } + double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ); + motionX = (d13 * d9) / d11; + motionZ = (d13 * d10) / d11; + if (flag1 && !flag && shouldDoRailFunctions()) { + if (Math.sqrt(motionX * motionX + motionZ * motionZ) < 0.029999999999999999D) { + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + } else { + motionX *= 0.5D; + motionY *= 0.0D; + motionZ *= 0.5D; + } + } + double d17 = 0.0D; + double d18 = i + 0.5D + ai[0][0] * 0.5D; + double d19 = k + 0.5D + ai[0][2] * 0.5D; + double d20 = i + 0.5D + ai[1][0] * 0.5D; + double d21 = k + 0.5D + ai[1][2] * 0.5D; + d9 = d20 - d18; + d10 = d21 - d19; + if (d9 == 0.0D) { + posX = i + 0.5D; + d17 = posZ - k; + } else if (d10 == 0.0D) { + posZ = k + 0.5D; + d17 = posX - i; + } else { + double d22 = posX - d18; + double d24 = posZ - d19; + d17 = (d22 * d9 + d24 * d10) * 2D; + //double derailSpeed = 0;//0.46; + } + if (bogieLoco != null) { + if (!bogieLoco.isOnRail()) { + derailSpeed = 0; + this.unLink(); + } + } + /** + * Handles derail + */ + if ((this instanceof Locomotive || this instanceof ISecondBogie) && d13 > derailSpeed && i1 >= 6) { + if (d9 > 0 && d10 < 0) { + d10 = 0; + d9 += 2; + } else if (d9 < 0 && d10 > 0) { + d9 = 0; + d10 += 2; + } else if (d10 < 0 && d9 < 0) { + d10 -= 2; + d9 = 0; + } else if (d9 > 0 && d10 > 0) { + d10 += 2; + d9 = 0; + } + if (FMLCommonHandler.instance().getMinecraftServerInstance() != null && + this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer) { + FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendChatMsg(new + ChatComponentText(((EntityPlayer) this.riddenByEntity).getDisplayName() + "derailed" + + this.trainOwner + "'s locomotive")); + } + } + + + posX = d18 + d9 * d17; + posZ = d19 + d10 * d17; + setPosition(posX, posY + yOffset + 0.35, posZ); + + moveMinecartOnRail(i, j, k, 0.0D); + + if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && + MathHelper.floor_double(posZ) - k == ai[0][2]) { + setPosition(posX, posY + ai[0][1], posZ); + } else if (ai[1][1] != 0 && MathHelper.floor_double(posX) - i == ai[1][0] && + MathHelper.floor_double(posZ) - k == ai[1][2]) { + setPosition(posX, posY + ai[1][1], posZ); + } + + applyDragAndPushForces(); + + Vec3 vec3d1 = TraincraftUtil.func_514_g(posX, posY, posZ); + double d28 = (vec3d.yCoord - vec3d1.yCoord) * 0.050000000000000003D; + if (this instanceof Locomotive) d28 = 0; + double d14 = Math.sqrt(motionX * motionX + motionZ * motionZ); + if (d14 > 0.0D) { + motionX = (motionX / d14) * (d14 + d28); + motionZ = (motionZ / d14) * (d14 + d28); + } + setPosition(posX, posY + yOffset - 0.8d, posZ); + int k1 = MathHelper.floor_double(posX); + int l1 = MathHelper.floor_double(posZ); + if (k1 != i || l1 != k) { + double d15 = Math.sqrt(motionX * motionX + motionZ * motionZ); + motionX = d15 * (k1 - i); + motionZ = d15 * (l1 - k); + } + + if (shouldDoRailFunctions()) { + ((BlockRailBase) l).onMinecartPass(worldObj, this, i, j, k); + } + + if (flag && shouldDoRailFunctions()) { + double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ); + if (d31 > 0.01D) { + motionX += (motionX / d31) * 0.059999999999999998D; + motionZ += (motionZ / d31) * 0.059999999999999998D; + } else if (i1 == 1) { + if (worldObj.isBlockNormalCubeDefault(i - 1, j, k, false)) { + motionX = 0.02D; + } else if (worldObj.isBlockNormalCubeDefault(i + 1, j, k, false)) { + motionX = -0.02D; + } + } else if (i1 == 0) { + if (worldObj.isBlockNormalCubeDefault(i, j, k - 1, false)) { + motionZ = 0.02D; + } else if (worldObj.isBlockNormalCubeDefault(i, j, k + 1, false)) { + motionZ = -0.02D; + } + } + } + } else if (l == BlockIDs.tcRail.block) { + limitSpeedOnTCRail(); + //if(worldObj.getTileEntity(i,j,k)==null || !(worldObj.getTileEntity(i,j,k) instanceof TileTCRail))return; + TileTCRail tile = (TileTCRail) worldObj.getTileEntity(i, j, k); + int meta = tile.getBlockMetadata(); + + if (ItemTCRail.isTCStraightTrack(tile)) { + moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, meta); + } else if (ItemTCRail.isTCTurnTrack(tile)) { + + if (bogieLoco != null) { + if (!bogieLoco.isOnRail()) { + derailSpeed = 0; + } + } + if (derailSpeed == 0) { + this.unLink(); + moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, meta); + } else { + + if (shouldIgnoreSwitch(tile, i, j, k, meta)) { + moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, meta); + } else { + if (ItemTCRail.isTCTurnTrack(tile)) + moveOnTC90TurnRail(i, j, k, tile.r, tile.cx, tile.cz); + } + // shouldIgnoreSwitch(tile, i, j, k, meta); + // if (ItemTCRail.isTCTurnTrack(tile)) moveOnTC90TurnRail(i, j, k, r, cx, cy, + // cz, tile.getType(), meta); + } + } else if (ItemTCRail.isTCSlopeTrack(tile)) { + moveOnTCSlope(j, tile.xCoord, tile.zCoord, tile.slopeAngle, tile.slopeHeight, meta); + } else if (ItemTCRail.isTCTwoWaysCrossingTrack(tile)) { + moveOnTCTwoWaysCrossing(i, j, k, tile.xCoord, tile.yCoord, tile.zCoord, meta); + } else if (ItemTCRail.isTCDiagonalCrossingTrack(tile)) { + moveOnTCDiamondCrossing(i, j, k, tile.xCoord, tile.yCoord, tile.zCoord, meta); + } else if (ItemTCRail.isTCDiagonalStraightTrack(tile)) { + moveOnTCDiagonal(i, j, k, tile.xCoord, tile.zCoord, tile.getBlockMetadata(), tile.getRailLength()); + } else if (ItemTCRail.isTCCurvedSlopeTrack(tile)) { + moveOnTCCurvedSlope(i, j, k, tile.r, tile.cx, tile.cz, tile.xCoord, tile.zCoord, meta, 1, tile.slopeAngle); + } + + } else if (l == BlockIDs.tcRailGag.block) { + limitSpeedOnTCRail(); + TileTCRailGag tileGag = (TileTCRailGag) worldObj.getTileEntity(i, j, k); + if (worldObj.getTileEntity(tileGag.originX, tileGag.originY, tileGag.originZ) instanceof TileTCRail) { + TileTCRail tile = (TileTCRail) worldObj.getTileEntity(tileGag.originX, tileGag.originY, tileGag.originZ); + + if (ItemTCRail.isTCTurnTrack(tile)) { + moveOnTC90TurnRail(i, j, k, tile.r, tile.cx, tile.cz); + } + if (ItemTCRail.isTCStraightTrack(tile)) { + moveOnTCStraight(i, j, k, tile.xCoord, tile.zCoord, tile.getBlockMetadata()); + } + if (ItemTCRail.isTCSlopeTrack(tile)) { + moveOnTCSlope(j, tile.xCoord, tile.zCoord, tile.slopeAngle, tile.slopeHeight, tile.getBlockMetadata()); + } + if (ItemTCRail.isTCDiagonalStraightTrack(tile)) { + moveOnTCDiagonal(i, j, k, tile.xCoord, tile.zCoord, tile.getBlockMetadata(), tile.getRailLength()); + } else if (ItemTCRail.isTCDiagonalCrossingTrack(tile)) { + moveOnTCDiamondCrossing(i, j, k, tile.xCoord, tile.yCoord, tile.zCoord, meta); + } + if (ItemTCRail.isTCCurvedSlopeTrack(tile)) { + moveOnTCCurvedSlope(i, j, k, tile.r, tile.cx, tile.cz, tile.xCoord, tile.zCoord, tile.getBlockMetadata(), 1, tile.slopeAngle); + } + } + } else { + //moveMinecartOffRail(i,j,k); + super.onUpdate(); + } + + } + + private boolean shouldIgnoreSwitch(TileTCRail tile, int i, int j, int k, int meta) { + if (tile != null + && (tile.getType().equals(TrackTypes.MEDIUM_RIGHT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.MEDIUM_LEFT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.LARGE_LEFT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.LARGE_RIGHT_TURN.getLabel())) + || tile.getType().equals(TrackTypes.MEDIUM_RIGHT_45DEGREE_TURN.getLabel()) + || tile.getType().equals(TrackTypes.MEDIUM_LEFT_45DEGREE_TURN.getLabel()) + || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_RIGHT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_LEFT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.EMBEDDED_LARGE_LEFT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.EMBEDDED_LARGE_RIGHT_TURN.getLabel()) + || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_RIGHT_45DEGREE_TURN.getLabel()) + || tile.getType().equals(TrackTypes.EMBEDDED_MEDIUM_LEFT_45DEGREE_TURN.getLabel()) + + && tile.canTypeBeModifiedBySwitch) { + + /* Handles reverse straight movement of a cart on a switch that happened to be turned on*/ + if (meta == 2) { + if (motionZ > 0 && Math.abs(motionX) < 0.01) { + TileEntity tile2 = worldObj.getTileEntity(i, j, k + 1); + if (tile2 instanceof TileTCRail) { + ((TileTCRail) tile2).setSwitchState(false, true); + } + return true; + } + } else if (meta == 0) { + if (motionZ < 0 && Math.abs(motionX) < 0.01) { + TileEntity tile2 = worldObj.getTileEntity(i, j, k - 1); + if (tile2 instanceof TileTCRail) { + ((TileTCRail) tile2).setSwitchState(false, true); + } + return true; + } + } else if (meta == 1) { + if (Math.abs(motionZ) < 0.01 && motionX > 0) { + TileEntity tile2 = worldObj.getTileEntity(i + 1, j, k); + if (tile2 instanceof TileTCRail) { + ((TileTCRail) tile2).setSwitchState(false, true); + } + return true; + } + } else if (meta == 3) { + if (Math.abs(motionZ) < 0.01 && motionX < 0) { + TileEntity tile2 = worldObj.getTileEntity(i - 1, j, k); + if (tile2 instanceof TileTCRail) { + ((TileTCRail) tile2).setSwitchState(false, true); + } + return true; + } + } + } + return false; + } + + private void moveOnTCDiagonal(int i, int j, int k, double cx, double cz, int meta, double length) { + + double Y_OFFSET = 0.2; + double X_OFFSET = 0.5; + double Z_OFFSET = 1.5; + posY = j + Y_OFFSET; + if (length == 0) { + length = 1; + } + double exitX = 0; + double exitZ = 0; + double directionX; + double directionZ; + double norm = Math.sqrt(motionX * motionX + motionZ * motionZ); + double distanceNorm; + + if (meta == 6) { + exitX = (motionX > 0) ? cx + length + X_OFFSET : cx - X_OFFSET; + exitZ = (motionX > 0) ? cz - length + X_OFFSET : cz + Z_OFFSET; + } else if (meta == 4) { + exitX = (motionX > 0) ? cx + Z_OFFSET : cx - (length - X_OFFSET); + exitZ = (motionX > 0) ? cz - X_OFFSET : cz + (length + X_OFFSET); + } else if (meta == 5) { + exitX = (motionX > 0) ? cx + Z_OFFSET : cx - (length + X_OFFSET); + exitZ = (motionX > 0) ? cz + Z_OFFSET : cz - (length + X_OFFSET); + } else if (meta == 7) { + exitX = (motionX > 0) ? cx + (length + X_OFFSET) : cx - X_OFFSET; + exitZ = (motionX > 0) ? cz + (length + X_OFFSET) : cz - X_OFFSET; + } + + directionX = exitX - posX; + directionZ = exitZ - posZ; + distanceNorm = Math.sqrt(directionX * directionX + directionZ * directionZ); + motionX = (directionX / distanceNorm) * norm; + motionZ = (directionZ / distanceNorm) * norm; + this.boundingBox.offset(Math.copySign(motionX, this.motionX), 0, Math.copySign(motionZ, this.motionZ)); + + List boxes = worldObj.getCollidingBoundingBoxes(this, boundingBox); + for (Object b : boxes) { + if (!(b instanceof BlockRailBase) && !(b instanceof BlockTCRail) && !(b instanceof BlockTCRailGag) && !(b instanceof BlockAir)) { + return; + } + } + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + + } + + + private void moveOnTCCurvedSlope(int i, int j, int k, double r, double cx, double cz, int tilex, int tilez, int meta, double slopeHeight, double slopeAngle) { + double newTilex = tilex; + double newTilez = tilez; + if (meta == 2) { + newTilez += 1; + newTilex += 0.5; + } + if (meta == 0) { + newTilex += 0.5; + } + if (meta == 1) { + newTilex += 1; + newTilez += 0.5; + } + if (meta == 3) { + newTilez += 0.5; + } + double cpx = posX - cx; + double cpz = posZ - cz; + double tpx = newTilex - posX; + double tpz = newTilez - posZ; + + double tpnorm = Math.sqrt(tpx * tpx + tpz * tpz); + + double cp_norm = Math.sqrt(cpx * cpx + cpz * cpz); + double vnorm = Math.sqrt(motionX * motionX + motionZ * motionZ); + + double norm_cpx = cpx / cp_norm; //u + double norm_cpz = cpz / cp_norm; //v + + double vx2 = -norm_cpz * vnorm;//-v + double vz2 = norm_cpx * vnorm;//u + + double px2 = posX + motionX; + double pz2 = posZ + motionZ; + + double px2_cx = px2 - cx; + double pz2_cz = pz2 - cz; + + double p2_c_norm = Math.sqrt((px2_cx * px2_cx) + (pz2_cz * pz2_cz)); + + double px2_cx_norm = px2_cx / p2_c_norm; + double pz2_cz_norm = pz2_cz / p2_c_norm; + + double px3 = cx + (px2_cx_norm * r); + double pz3 = cz + (pz2_cz_norm * r); + + double signX = px3 - posX; + double signZ = pz3 - posZ; + + vx2 = Math.copySign(vx2, signX); + vz2 = Math.copySign(vz2, signZ); + + double p_corr_x = cx + ((cpx / cp_norm) * r); + double p_corr_z = cz + ((cpz / cp_norm) * r); + motionX = vx2; + motionZ = vz2; + + double newYPos = Math.abs(j + Math.min(1, (slopeAngle * Math.abs(tpnorm))) + yOffset + 0.34f); + setPosition(p_corr_x, newYPos, p_corr_z); + moveEntity(vx2, 0, vz2); + + + } + + private void moveOnTCStraight(int i, int j, int k, double cx, double cz, int meta) { + posY = j + 0.2; + if (meta == 2 || meta == 0) { + double norm = Math.sqrt(motionX * motionX + motionZ * motionZ); + + setPosition(cx + 0.5, posY + yOffset, posZ); + + motionX = 0; + motionZ = Math.copySign(norm, motionZ); + this.boundingBox.offset(0, 0, Math.copySign(norm, this.motionZ)); + + List boxes = worldObj.getCollidingBoundingBoxes(this, boundingBox); + for (Object b : boxes) { + if (!(b instanceof BlockRailBase) && !(b instanceof BlockTCRail) && !(b instanceof BlockTCRailGag) && !(b instanceof BlockAir)) { + return; + } + } + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + + } else if (meta == 1 || meta == 3) { + + setPosition(posX, posY + yOffset, cz + 0.5); + //setPosition(posX, posY + yOffset, posZ); + + motionX = Math.copySign(Math.sqrt(motionX * motionX + motionZ * motionZ), motionX); + motionZ = 0; + this.boundingBox.offset(motionX, 0, 0); + + List boxes = worldObj.getCollidingBoundingBoxes(this, boundingBox); + for (Object b : boxes) { + if (!(b instanceof BlockRailBase) && !(b instanceof BlockTCRail) && !(b instanceof BlockTCRailGag) && !(b instanceof BlockAir)) { + return; + } + } + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + + + } + } + + private void moveOnTCSlope(int j, double cx, double cz, double slopeAngle, double slopeHeight, int meta) { + //posY = j + 2.5; + if (meta == 2 || meta == 0) { + + if (meta == 2) { + cz += 1; + } + + double norm = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.setPosition(cx + 0.5D, Math.abs(j + (Math.tan(slopeAngle * Math.abs(cz - this.posZ))) + this.yOffset + 0.3), this.posZ); + this.boundingBox.offset(0, 0, Math.copySign(norm, this.motionZ)); + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + + if (!(this instanceof Locomotive) && !(this instanceof EntityTracksBuilder)) { + if ((this.posY - this.prevPosY) < 0) { + norm *= 1.02; + } else if ((this.posY - this.prevPosY) > 0) { + norm *= 0.98; + } + if (norm < 0.01) { + + if ((motionZ) < 0 && meta == 2) { + norm += 0.0001; + motionZ = Math.copySign(motionZ, 1); + } + if ((motionZ) > 0 && meta == 0) { + norm += 0.0001; + motionZ = Math.copySign(motionZ, -1); + } + } + } + + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = Math.copySign(norm, this.motionZ); + } else if (meta == 1 || meta == 3) { + if (meta == 1) { + cx += 1; + } + + double norm = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.setPosition(this.posX, (j + (Math.tan(slopeAngle * Math.abs(cx - this.posX))) + this.yOffset + 0.3), cz + 0.5D); + this.boundingBox.offset(Math.copySign(norm, this.motionX), 0, 0); + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + + if (!(this instanceof Locomotive) && !(this instanceof EntityTracksBuilder)) { + if ((this.posY - this.prevPosY) < 0) { + norm *= 1.02; + } else if ((this.posY - this.prevPosY) > 0) { + norm *= 0.98; + } + if (norm < 0.01) { + + if ((motionX) < 0 && meta == 1) { + norm += 0.0001; + motionX = Math.copySign(motionX, 1); + } + if ((motionX) > 0 && meta == 3) { + norm += 0.0001; + motionX = Math.copySign(motionX, -1); + } + } + } + this.motionX = Math.copySign(norm, this.motionX); + this.motionY = 0.0D; + this.motionZ = 0.0D; + } + } + + protected void moveOnTC90TurnRail(int i, int j, int k, double r, double cx, double cz) { + posY = j + 0.2; + double cpx = posX - cx; + double cpz = posZ - cz; + + double cp_norm = Math.sqrt(cpx * cpx + cpz * cpz); + double vnorm = Math.sqrt(motionX * motionX + motionZ * motionZ); + + double norm_cpx = cpx / cp_norm; //u + double norm_cpz = cpz / cp_norm; //v + + double vx2 = -norm_cpz * vnorm;//-v + double vz2 = norm_cpx * vnorm;//u + + double px2 = posX + motionX; + double pz2 = posZ + motionZ; + + double px2_cx = px2 - cx; + double pz2_cz = pz2 - cz; + + double p2_c_norm = Math.sqrt((px2_cx * px2_cx) + (pz2_cz * pz2_cz)); + + double px2_cx_norm = px2_cx / p2_c_norm; + double pz2_cz_norm = pz2_cz / p2_c_norm; + + double px3 = cx + (px2_cx_norm * r); + double pz3 = cz + (pz2_cz_norm * r); + + double signX = px3 - posX; + double signZ = pz3 - posZ; + + vx2 = Math.copySign(vx2, signX); + vz2 = Math.copySign(vz2, signZ); + + double p_corr_x = cx + ((cpx / cp_norm) * r); + double p_corr_z = cz + ((cpz / cp_norm) * r); + + setPosition(p_corr_x, posY + yOffset, p_corr_z); + moveEntity(vx2, 0.0D, vz2); + + motionX = vx2; + motionZ = vz2; + + } + + protected void moveOnTCTwoWaysCrossing(int i, int j, int k, double cx, double cy, double cz, int meta) { + posY = j + 0.2; + if (!(this instanceof Locomotive)) { + int l = MathHelper.floor_double(serverRealRotation * 4.0F / 360.0F + 0.5D) & 3; + if (l == 2 || l == 0) { + moveEntity(motionX, 0.0D, 0.0D); + } else if (l == 1 || l == 3) { + moveEntity(0.0D, 0.0D, motionZ); + } + } else { + int l = MathHelper.floor_double(rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + if (l == 2 || l == 0) { + moveEntity(motionX, 0.0D, 0.0D); + } else if (l == 1 || l == 3) { + moveEntity(0.0D, 0.0D, motionZ); + } + //moveEntity(motionX, 0.0D, motionZ); + } + } + + protected void moveOnTCDiamondCrossing(int i, int j, int k, double cx, double cy, double cz, int meta) { + + int l; + if ((this.bogieLoco == null)) { + l = MathHelper.floor_double(serverRealRotation * 8.0F / 360.0F + 0.5) & 7; + } else { + l = MathHelper.floor_double(rotationYaw * 8.0F / 360.0F + 0.5) & 7; + + } + if (l == 0 || l == 4) { + moveEntity(motionX, 0.0D, 0.0D); + } else if (l == 2 || l == 6) { + moveEntity(0.0D, 0.0D, motionZ); + } else if (l == 1) { + moveOnTCDiagonal(i, j, k, cx, cz, 5, 1); + } else if (l == 3) { + moveOnTCDiagonal(i, j, k, cx, cz, 6, 1); + } else if (l == 5) { + moveOnTCDiagonal(i, j, k, cx, cz, 7, 1); + } else if (l == 7) { + moveOnTCDiagonal(i, j, k, cx, cz, 4, 1); + } + } + + public void limitSpeedOnTCRail() { + railMaxSpeed = 3; + maxSpeed = Math.min(railMaxSpeed, getMaxCartSpeedOnRail()); + maxSpeed = SpeedHandler.handleSpeed(railMaxSpeed, maxSpeed, this); + + if (this.speedLimiter != 0 && speedWasSet) { + //maxSpeed *= this.speedLimiter; + adjustSpeed(maxSpeed, speedLimiter); + } + motionX *= 0.9D; + motionZ *= 0.9D; + + if (motionX < -maxSpeed) { + motionX = -maxSpeed; + } + if (motionX > maxSpeed) { + motionX = maxSpeed; + } + if (motionZ < -maxSpeed) { + motionZ = -maxSpeed; + } + if (motionZ > maxSpeed) { + motionZ = maxSpeed; + } + } + + protected void moveMinecartOffRail(int i, int j, int k) { + motionY -= 0.039999999105930328D; + double d2 = getMaxCartSpeedOnRail(); + if (!onGround) { + d2 = getMaxSpeedAirLateral(); + } + if (motionX < -d2) motionX = -d2; + if (motionX > d2) motionX = d2; + if (motionZ < -d2) motionZ = -d2; + if (motionZ > d2) motionZ = d2; + double moveY = motionY; + if (getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) { + moveY = getMaxSpeedAirVertical(); + if (Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) { + moveY = 0.15f; + motionY = moveY; + } + } + if (onGround) { + motionX *= 0.5D; + motionY *= 0.5D; + motionZ *= 0.5D; + } + moveEntity(motionX, moveY, motionZ); + if (!onGround) { + motionX *= getDragAir(); + motionY *= getDragAir(); + motionZ *= getDragAir(); + } + } + + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + nbttagcompound.setDouble("speedLimiter", this.speedLimiter); + nbttagcompound.setFloat("serverRealRotation", this.serverRealRotation); + nbttagcompound.setFloat("yawRotation", this.rotationYaw); + //nbttagcompound.setBoolean("hasSpawnedBogie", this.hasSpawnedBogie); + //nbttagcompound.setBoolean("needsBogieUpdate", this.needsBogieUpdate); + nbttagcompound.setBoolean("firstLoad", this.firstLoad); + nbttagcompound.setFloat("rotation", this.rotation); + nbttagcompound.setBoolean("brake", isBraking); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + this.speedLimiter = nbttagcompound.getDouble("speedLimiter"); + this.serverRealRotation = nbttagcompound.getFloat("serverRealRotation"); + + if (nbttagcompound.hasKey("yawRotation")) { + rotationYaw = nbttagcompound.getFloat("yawRotation"); + } + //if (Math.abs(this.serverRealRotation) > 178.5f) this.serverRealRotation = Math.copySign(178.5f, this.serverRealRotation); + //this.hasSpawnedBogie = nbttagcompound.getBoolean("hasSpawnedBogie"); + //this.needsBogieUpdate = nbttagcompound.getBoolean("needsBogieUpdate"); + this.firstLoad = nbttagcompound.getBoolean("firstLoad"); + this.rotation = nbttagcompound.getFloat("rotation"); + this.isBraking = nbttagcompound.getBoolean("brake"); + } + + @Override + @SideOnly(Side.CLIENT) + public float getShadowSize() { + return 0.0F; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if (super.interactFirst(entityplayer)) { + return true; + } + if (entityplayer.ridingEntity == this) { + return false; + } + + if (lockThisCart(entityplayer.inventory.getCurrentItem(), entityplayer)) { + return true; + } + + playerEntity = entityplayer; + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + + if (this.getTrainLockedFromPacket()) { + if (!playerEntity.getDisplayName().toLowerCase().equals(this.trainOwner.toLowerCase()) && !canBeRiddenWhileLocked(this)) { + if (!worldObj.isRemote) entityplayer.addChatMessage(new ChatComponentText("Train is locked")); + return true; + } else if (!playerEntity.getDisplayName().toLowerCase().equals(this.trainOwner.toLowerCase()) && entityplayer.inventory.getCurrentItem() != null && entityplayer.inventory.getCurrentItem().getItem() instanceof ItemDye && (this instanceof Locomotive)) { + if (!worldObj.isRemote) entityplayer.addChatMessage(new ChatComponentText("Train is locked")); + return true; + } + + } + + if (itemstack != null && itemstack.getItem() instanceof ItemWrench && this instanceof Locomotive && entityplayer.isSneaking() && !worldObj.isRemote) { + destination = ""; + entityplayer.addChatMessage(new ChatComponentText("Destination reset")); + return true; + } + if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, entityplayer))) { + entityplayer.addChatMessage(new ChatComponentText("test")); + } + if (itemstack != null && itemstack.hasTagCompound() && getTicketDestination(itemstack) != null && getTicketDestination(itemstack).length() > 0) { + this.setDestination(itemstack); + /** + * ticket are single use but golden ones are multiple uses + */ + ItemStack ticket = GameRegistry.findItemStack("Railcraft", "railcraft.routing.ticket", 1); + if (ticket != null && ticket.getItem() != null && itemstack.getItem() == ticket.getItem()) { + if (--itemstack.stackSize == 0) { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); + } + } + return true; + } + /** + * If the color is valid for the cart, then change it and reduce + * itemstack size + */ + if (itemstack != null && itemstack.getItem() instanceof ItemDye) { + if (this.getSpec().getLiveries().size() > 0) { + for (int i = 0; i < this.getSpec().getLiveries().size(); i++) { + if (itemstack.getItemDamage() == getColorFromString(this.getSpec().getLiveries().get(i))) { + this.setColor(this.getSpec().getLiveries().get(i)); + itemstack.stackSize--; + + //if (!worldObj.isRemote)PacketHandler.sendPacketToClients(PacketHandler.sendStatsToServer(10,this.uniqueID,trainName ,trainType, this.trainOwner, this.getColorAsString(itemstack.getItemDamage()), (int)posX, (int)posY, (int)posZ),this.worldObj, (int)posX,(int)posY,(int)posZ, 12.0D); + + return true; + } + } + if (worldObj.isRemote && ConfigHandler.SHOW_POSSIBLE_COLORS) { + String concatColors = ": "; + for (int t = 0; t < this.getSpec().getLiveries().size(); t++) { + concatColors = concatColors.concat(this.getSpec().getLiveries().get(t) + ", "); + } + entityplayer.addChatMessage(new ChatComponentText("Possible colors" + concatColors)); + entityplayer.addChatMessage(new ChatComponentText("To paint, click me with the right dye")); + return true; + } + } else if (this.getSpec().getLiveries() != null || this.getSpec().getLiveries().size() == 0) { + entityplayer.addChatMessage(new ChatComponentText("No other colors available")); + } + } + if ((trainsOnClick.onClickWithStake(this, itemstack, playerEntity, worldObj))) { + entityplayer.addChatMessage(new ChatComponentText("test")); + return true; + } + + if (itemstack != null && itemstack.getItem() instanceof ItemPaintbrushThing && entityplayer.isSneaking()) { + if (this.getSpec().getLiveries().size() > 0) { + if (scrollPosition > this.getSpec().getLiveries().size() - 1) { + this.setColor(getSpec().getLiveries().get(0)); + scrollPosition = 0; + } else { + this.setColor(getSpec().getLiveries().get(scrollPosition)); + scrollPosition++; + + } + } + + if (this.getSpec().getLiveries().size() == 0) { + entityplayer.addChatMessage(new ChatComponentText("There are no other colors available.")); + } + return true; + } + + return worldObj.isRemote; + } + + @SideOnly(Side.CLIENT) + private void soundUpdater() { + if (FMLClientHandler.instance().getClient() != null) { + this.theSoundManager = FMLClientHandler.instance().getClient().getSoundHandler(); + } + if (FMLClientHandler.instance().getClient() != null && this.theSoundManager != null && FMLClientHandler.instance().getClient().thePlayer != null) { + if (sndUpdater != null) { + sndUpdater.update(FMLClientHandler.instance().getClient().getSoundHandler(), this, FMLClientHandler.instance().getClient().thePlayer); + } + } + } + + /** + * Applies a velocity to each of the entities pushing them away from each + * other. Args: entity + */ + @Override + public void applyEntityCollision(Entity par1Entity) { + //if(par1Entity instanceof EntityPlayer)return; + if (this.bogieLoco == null) return; + + if (par1Entity == this) { + return; + } + if (par1Entity instanceof EntityBogie) { + if (((EntityBogie) par1Entity).entityMainTrainID == this.uniqueID) return; + } + if (par1Entity == bogieLoco) { + return; + } + if (par1Entity instanceof EntityRollingStock && ((EntityRollingStock) par1Entity).bogieLoco != null) { + if (par1Entity == ((EntityRollingStock) par1Entity).bogieLoco) return; + } + + MinecraftForge.EVENT_BUS.post(new MinecartCollisionEvent(this, par1Entity)); + if (getCollisionHandler() != null) { + getCollisionHandler().onEntityCollision(this, par1Entity); + return; + } + if (!this.worldObj.isRemote) { + if (par1Entity != this.riddenByEntity) { + /* + * if (par1Entity instanceof EntityLiving && !(par1Entity + * instanceof EntityPlayer) && !(par1Entity instanceof + * EntityIronGolem) && canBeRidden() && this.motionX * + * this.motionX + this.motionZ * this.motionZ > 0.01D && + * this.riddenByEntity == null && par1Entity.ridingEntity == + * null) { par1Entity.mountEntity(this); } + */ + /* + * if ((this instanceof EntityStockCar)) { if + * (!(unAutorizedMob(par1Entity, this)) && (par1Entity + * instanceof EntityLiving) && !(par1Entity instanceof + * EntityPlayer)) { if (this.canBeRidden() && + * this.riddenByEntity == null && par1Entity.ridingEntity == + * null) { par1Entity.mountEntity(this); } } } + */ + /* + * if(this.isAttached)return; if(par1Entity instanceof + * EntityRollingStock && + * ((EntityRollingStock)par1Entity).isAttached)return; + * if(par1Entity instanceof EntityBogie){ + * if(((EntityBogie)par1Entity).entityMainTrain!=null && + * ((EntityBogie)par1Entity).entityMainTrain.isAttached)return; + * } + */ + double d0 = par1Entity.posX - this.posX; + double d1 = par1Entity.posZ - this.posZ; + double distancesX[] = new double[4]; + double distancesZ[] = new double[4]; + double euclidian[] = new double[4]; + if (par1Entity instanceof EntityRollingStock) { + EntityRollingStock entity = (EntityRollingStock) par1Entity; + if (((EntityRollingStock) par1Entity).bogieLoco != null || this.bogieLoco != null) { + + if (((EntityRollingStock) par1Entity).bogieLoco != null && this.bogieLoco == null) { + distancesX[0] = entity.posX - this.posX; + distancesZ[0] = entity.posZ - this.posZ; + euclidian[0] = MathHelper.sqrt_double((distancesX[0] * distancesX[0]) + (distancesZ[0] * distancesZ[0])); + distancesX[1] = entity.bogieLoco.posX - this.posX; + distancesZ[1] = entity.bogieLoco.posZ - this.posZ; + euclidian[1] = MathHelper.sqrt_double((distancesX[1] * distancesX[1]) + (distancesZ[1] * distancesZ[1])); + distancesX[2] = 100; + distancesZ[2] = 100; + euclidian[2] = MathHelper.sqrt_double((distancesX[2] * distancesX[2]) + (distancesZ[2] * distancesZ[2])); + distancesX[3] = 100; + distancesZ[3] = 100; + euclidian[3] = MathHelper.sqrt_double((distancesX[3] * distancesX[3]) + (distancesZ[3] * distancesZ[3])); + } else if (((EntityRollingStock) par1Entity).bogieLoco == null && this.bogieLoco != null) { + distancesX[0] = entity.posX - this.posX; + distancesZ[0] = entity.posZ - this.posZ; + euclidian[0] = MathHelper.sqrt_double((distancesX[0] * distancesX[0]) + (distancesZ[0] * distancesZ[0])); + distancesX[1] = entity.posX - this.bogieLoco.posX; + distancesZ[1] = entity.posZ - this.bogieLoco.posZ; + euclidian[1] = MathHelper.sqrt_double((distancesX[1] * distancesX[1]) + (distancesZ[1] * distancesZ[1])); + distancesX[2] = 100; + distancesZ[2] = 100; + euclidian[2] = MathHelper.sqrt_double((distancesX[2] * distancesX[2]) + (distancesZ[2] * distancesZ[2])); + distancesX[3] = 100; + distancesZ[3] = 100; + euclidian[3] = MathHelper.sqrt_double((distancesX[3] * distancesX[3]) + (distancesZ[3] * distancesZ[3])); + } else { + distancesX[0] = entity.posX - this.posX; + distancesZ[0] = entity.posZ - this.posZ; + euclidian[0] = MathHelper.sqrt_double((distancesX[0] * distancesX[0]) + (distancesZ[0] * distancesZ[0])); + distancesX[1] = entity.bogieLoco.posX - this.posX; + distancesZ[1] = entity.bogieLoco.posZ - this.posZ; + euclidian[1] = MathHelper.sqrt_double((distancesX[1] * distancesX[1]) + (distancesZ[1] * distancesZ[1])); + distancesX[2] = entity.posX - this.bogieLoco.posX; + distancesZ[2] = entity.posZ - this.bogieLoco.posZ; + euclidian[2] = MathHelper.sqrt_double((distancesX[2] * distancesX[2]) + (distancesZ[2] * distancesZ[2])); + distancesX[3] = entity.bogieLoco.posX - this.bogieLoco.posX; + distancesZ[3] = entity.bogieLoco.posZ - this.bogieLoco.posZ; + euclidian[3] = MathHelper.sqrt_double((distancesX[3] * distancesX[3]) + (distancesZ[3] * distancesZ[3])); + } + double min = euclidian[0]; + int minIndex = 0; + for (int k = 0; k < euclidian.length; k++) { + if (Math.abs(euclidian[k]) < Math.abs(min)) { + min = euclidian[k]; + minIndex = k; + } + } + d0 = distancesX[minIndex]; + d1 = distancesZ[minIndex]; + } + } + double d2 = d0 * d0 + d1 * d1; + + if ((par1Entity instanceof AbstractTrains && d2 <= ((AbstractTrains) par1Entity).getLinkageDistance((EntityMinecart) par1Entity) * 0.7 && d2 >= 9.999999747378752E-5D) || (par1Entity instanceof EntityBogie && ((EntityBogie) par1Entity).entityMainTrain != null && d2 <= ((EntityBogie) par1Entity).entityMainTrain.getLinkageDistance((EntityMinecart) par1Entity) * 0.7 && d2 >= 9.999999747378752E-5D) || (!(par1Entity instanceof AbstractTrains) && d2 >= 9.999999747378752E-5D))// >= 9.999999747378752E-5D) + { + d2 = MathHelper.sqrt_double(d2); + if (d0 != 0) { + d0 /= d2; + } else { + d2 = 0; + } + if (d1 != 0) { + d1 /= d2; + } else { + d2 = 0; + } + + if (d2 > 1.0D) { + d2 = 1.0D; + } + + d0 *= d2; + d1 *= d2; + d0 *= 0.10000000149011612D; + d1 *= 0.10000000149011612D; + d0 *= 1.0F - this.entityCollisionReduction; + d1 *= 1.0F - this.entityCollisionReduction; + d0 *= 0.5D; + d1 *= 0.5D; + + if ((par1Entity instanceof EntityMinecart) && !this.isAttached) { + + Vec3 vec31 = Vec3.createVectorHelper(MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), 0.0D, MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F)).normalize(); + + if (Math.abs(Vec3.createVectorHelper(par1Entity.posX - this.posX, 0.0D, par1Entity.posZ - this.posZ).normalize().dotProduct(vec31)) < 0.800000011920929D) { + return; + } + + double d9 = par1Entity.motionX + this.motionX; + double d8 = par1Entity.motionZ + this.motionZ; + + if ((par1Entity instanceof Locomotive && !isPoweredCart()) || (((EntityMinecart) par1Entity).isPoweredCart()) && !isPoweredCart()) { + + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; + this.addVelocity(par1Entity.motionX - d0, 0.0D, par1Entity.motionZ - d1); + if (!(par1Entity instanceof Locomotive)) { + par1Entity.motionX *= 0.949999988079071D; + par1Entity.motionZ *= 0.949999988079071D; + } + } else if ((!(par1Entity instanceof Locomotive) && isPoweredCart()) || (!((EntityMinecart) par1Entity).isPoweredCart() && isPoweredCart())) { + if (par1Entity instanceof EntityBogie && ((EntityBogie) par1Entity).entityMainTrain != null) { + this.motionX *= 0.2; + this.motionZ *= 0.2; + this.addVelocity(this.motionX + d0 * 3, 0.0D, this.motionZ + d1 * 3); + if (this instanceof Locomotive && ((EntityBogie) par1Entity).entityMainTrain instanceof Locomotive) { + this.motionX *= 0; + this.motionZ *= 0; + ((EntityBogie) par1Entity).entityMainTrain.motionX *= 0; + ((EntityBogie) par1Entity).entityMainTrain.motionZ *= 0; + } + } else { + par1Entity.motionX *= 0.20000000298023224D; + par1Entity.motionZ *= 0.20000000298023224D; + par1Entity.addVelocity(this.motionX + d0, 0.0D, this.motionZ + d1); + } + if (!(this instanceof Locomotive)) { + this.motionX *= 0.949999988079071D; + this.motionZ *= 0.949999988079071D; + } + + } else { + d9 *= 0.4D; + d8 *= 0.4D; + + if (par1Entity instanceof EntityBogie || par1Entity instanceof Locomotive) { + d9 *= -1;//-3 + d8 *= -1;//-3 + } + + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; + this.addVelocity(d9 - d0, 0.0D, d8 - d1); + if (par1Entity instanceof EntityBogie) { + //d7/=3; + //d8/=3; + d9 *= 0.333333333333; + d8 *= 0.333333333333; + } + + par1Entity.motionX *= 0.20000000298023224D; + par1Entity.motionZ *= 0.20000000298023224D; + par1Entity.addVelocity(d9 + d0, 0.0D, d8 + d1); + + } + } else { + + if (!(par1Entity instanceof EntityItem) && !(par1Entity instanceof EntityPlayer && this instanceof Locomotive) && !(par1Entity instanceof EntityLiving) && !(par1Entity instanceof EntityBogie)) { + this.addVelocity(-d0 * 2, 0.0D, -d1 * 2); + } else if ((par1Entity instanceof EntityBogie)) { + this.addVelocity(-d0, 0.0D, -d1); + }/* + * else if(par1Entity instanceof EntityBogie){ + * par1Entity.addVelocity(-d0, 0.0D, -d1); + * + * } + */ + //if(!(par1Entity instanceof EntityPlayer))par1Entity.addVelocity(d0 / 4.0D, 0.0D, d1 / 4.0D); + //par1Entity.setVelocity(0, 0.0D, 0); + par1Entity.addVelocity(d0 * 2, 0.0D, d1 * 2); + /* + * if(this.bogieUtility[0]!=null && + * this.bogieUtility[1]!=null){ + * this.bogieUtility[0].addVelocity(-d0*2, 0.0D, -d1*2); + * this.bogieUtility[1].addVelocity(-d0*2, 0.0D, -d1*2); + * } + */ + + if (par1Entity instanceof EntityPlayer) { + + MovingObjectPosition movingobjectposition = new MovingObjectPosition(par1Entity); + if (movingobjectposition.entityHit != null) { + // float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + + // this.motionY * this.motionY + this.motionZ * this.motionZ); + // float f7 = MathHelper.sqrt_double(this.motionX * this.motionX + + // this.motionZ * this.motionZ); + //movingobjectposition.entityHit.setVelocity(-par1Entity.motionX, 0, -par1Entity.motionZ); + //movingobjectposition.entityHit.addVelocity(-((par1Entity.motionX * (double) (Math.abs(this.motionX+0.01)) * 2.60000002384185791D)) / (double) f7, 0.00000000000000001D, -(((par1Entity.motionZ * (double) (Math.abs(this.motionZ+0.01)) * 2.60000002384185791D)) / (double) f7)); + //movingobjectposition.entityHit.addVelocity(-((Math.abs(this.motionX) * (double) 1 * 0.0260000002384185791D)) / (double) f7, 0.00000000000000001D, -(((Math.abs(this.motionZ) * (double) 1 * 0.0260000002384185791D)) / (double) f7)); + par1Entity.velocityChanged = true; + } + } + + if (par1Entity instanceof EntityLiving) { + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ) * 60; + //f1 *= 6;//ratio + //f1 *= 10;//to get speed in "pseudo m/s" + if ((f1 * 3.6) < 35) {//if speed is smaller than 35km/h then don't do any damage but push entities + return; + } + int j1 = (int) Math.ceil((f1) * ((par1Entity instanceof EntityCreeper) ? 100 : 1)); + par1Entity.attackEntityFrom(TrainsDamageSource.ranOver, j1); + } + } + } + } + } + } + + /** + * To disable linking altogether, return false here. + * + * @return True if this cart is linkable. + */ + @Override + public boolean isLinkable() { + return true; + } + + /** + * Check called when attempting to link carts. + * + * @param cart The cart that we are attempting to link with. + * @return True if we can link with this cart. + */ + @Override + public boolean canLinkWithCart(EntityMinecart cart) { + return true; + } + + /** + * Returns true if this cart has two links or false if it can only link with + * one cart. + * + * @return True if two links + */ + @Override + public boolean hasTwoLinks() { + return true; + } + + /** + * Gets the distance at which this cart can be linked. This is called on + * both carts and added together to determine how close two carts need to be + * for a successful link. Default = LinkageManager.LINKAGE_DISTANCE + * + * @param cart The cart that you are attempting to link with. + * @return The linkage distance + */ + @Override + public float getLinkageDistance(EntityMinecart cart) { + return this.getOptimalDistance(cart) + 2.4F; + } + + /** + * Gets the optimal distance between linked carts. This is called on both + * carts and added together to determine the optimal rest distance between + * linked carts. The LinkageManager will attempt to maintain this distance + * between linked carts at all times. Default = + * LinkageManager.OPTIMAL_DISTANCE + * ETERNAL's NOTE: because this is forcing the value of EntityMinecart, it's actually a call to the super but using this instance. Not actually an infinate look like compiler thinks. + * + * @param cart The cart that you are linked with. + * @return The optimal rest distance + */ + @Override + public float getOptimalDistance(EntityMinecart cart) { + return this.getOptimalDistance(cart); + } + + /** + * Return false if linked carts have no effect on the velocity of this cart. + * Use carefully, if you link two carts that can't be adjusted, it will + * behave as if they are not linked. + * + * @param cart The cart doing the adjusting. + * @return Whether the cart can have its velocity adjusted. + */ + @Override + public boolean canBeAdjusted(EntityMinecart cart) { + return true; + } + + @Override + public void onLinkCreated(EntityMinecart cart) { + linked = true; + } + + /** + * Called when a link is broken (usually). + * + * @param cart The cart we were linked with. + */ + @Override + public void onLinkBroken(EntityMinecart cart) { + linked = false; + } + + @Override + public boolean isLinked() { + return linked; + } + + /** + * This function returns an ItemStack that represents this cart. This should + * be an ItemStack that can be used by the player to place the cart. This is + * the item that was registered with the cart via the registerMinecart + * function, but is not necessary the item the cart drops when destroyed. + * + * @return An ItemStack that can be used to place the cart. + */ + @Override + public ItemStack getCartItem() { + return getItemsDropped().get(0); + } + + /** + * Returns true if this cart is self propelled. + * + * @return True if powered. + */ + @Override + public boolean isPoweredCart() { + return (isLocomotive()); + } + + /** + * Returns true if this cart is a storage cart Some carts may have + * inventories but not be storage carts and some carts without inventories + * may be storage carts. + * + * @return True if this cart should be classified as a storage cart. + */ + public boolean isStorageCart() { + return (isFreightCart()); + } + + /** + * Returns true if this cart can be ridden by an Entity. + * + * @return True if this cart can be ridden. + */ + @Override + public boolean canBeRidden() { + return ((isLocomotive() || isPassenger() || isWorkCart())); + } + + /** + * Returns true if this cart can currently use rails. This function is + * mainly used to gracefully detach a minecart from a rail. + * + * @return True if the minecart can use rails. + */ + @Override + public boolean canUseRail() { + return canUseRail; + } + + /** + * Set whether the minecart can use rails. This function is mainly used to + * gracefully detach a minecart from a rail. + * + * @param use Whether the minecart can currently use rails. + */ + @Override + public void setCanUseRail(boolean use) { + canUseRail = use; + } + + /** + * Return false if this cart should not call IRail.onMinecartPass() and + * should ignore Powered Rails. + * + * @return True if this cart should call IRail.onMinecartPass(). + */ + @Override + public boolean shouldDoRailFunctions() { + return true; + } + + protected void applyDragAndPushForces() { + motionX *= getDragAir(); + motionY *= 0.0D; + motionZ *= getDragAir(); + } + + /** + * Carts should return their drag factor here + * + * @return The drag rate. + */ + @Override + public double getDragAir() { + return 0.98D; + } + + @Override + public void moveMinecartOnRail(int i, int j, int k, double d) { + Block id = worldObj.getBlock(i, j, k); + if (!BlockRailBase.func_150051_a(id)) { + return; + } + railMaxSpeed = ((BlockRailBase) id).getRailMaxSpeed(worldObj, this, i, j, k); + maxSpeed = Math.max(railMaxSpeed, getMaxCartSpeedOnRail()); + maxSpeed = SpeedHandler.handleSpeed(railMaxSpeed, maxSpeed, this); + if (this.speedLimiter != 0 && speedWasSet) { + //maxSpeed *= this.speedLimiter; + adjustSpeed(maxSpeed, speedLimiter); + } + if ((!isLocomotive())) { + motionX *= 0.99D; + motionZ *= 0.99D; + } else { + motionX *= 1D; + motionZ *= 1D; + } + if (motionX < -maxSpeed) { + motionX = -maxSpeed; + } + if (motionX > maxSpeed) { + motionX = maxSpeed; + } + if (motionZ < -maxSpeed) { + motionZ = -maxSpeed; + } + if (motionZ > maxSpeed) { + motionZ = maxSpeed; + } + moveEntity(motionX, 0.0D, motionZ); + } + + public void adjustSpeed(float maxSpeed, double limiter) { + float targetSpeed = (float) (maxSpeed * limiter); + float targetSpeedX = (float) Math.copySign(targetSpeed, motionX); + float targetSpeedZ = (float) Math.copySign(targetSpeed, motionZ); + if (motionX > targetSpeedX && motionX != 0) motionX -= 0.01; + if (motionZ > targetSpeedZ && motionZ != 0) motionZ -= 0.01; + if (motionX < targetSpeedX && motionX != 0) motionX += 0.01; + if (motionZ < targetSpeedZ && motionZ != 0) motionZ += 0.01; + if ((Math.abs(motionX) < Math.abs(targetSpeedX) + 0.01) && (Math.abs(motionX) > Math.abs(targetSpeedX) - 0.01)) { + speedWasSet = false; + } + if ((Math.abs(motionZ) < Math.abs(targetSpeedZ) + 0.01) && (Math.abs(motionZ) > Math.abs(targetSpeedZ) - 0.01)) { + speedWasSet = false; + } + } + + + protected void adjustSlopeVelocities(int i1) { + if (this instanceof Locomotive) { + return; + } + double d4 = -0.002D;//0.0078125D + if (i1 == 2) { + motionX -= d4; + } else if (i1 == 3) { + motionX += d4; + } else if (i1 == 4) { + motionZ += d4; + } else if (i1 == 5) { + motionZ -= d4; + } + } + + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + return (!isDead && entityplayer.getDistanceSqToEntity(this) <= 300D); + } + + /** + * Returns the carts max speed. Carts going faster than 1.1 cause issues + * with chunk loading. This value is compared with the rails max speed to determine + * the carts current max speed. A normal rails max speed is 0.4. + * + * @return Carts max speed. + */ + @Override + public float getMaxCartSpeedOnRail() { + return maxSpeed; + } + + @Override + public float getMaxSpeedAirLateral() { + return maxSpeedAirLateral; + } + + @Override + public void setMaxSpeedAirLateral(float value) { + maxSpeedAirLateral = value; + } + + @Override + public float getMaxSpeedAirVertical() { + return maxSpeedAirVertical; + } + + @Override + public void setMaxSpeedAirVertical(float value) { + maxSpeedAirVertical = value; + } + + @Override + public void setDragAir(double value) { + dragAir = value; + } + + @Override + public boolean canOverheat() { + return false; + } + + @Override + public int getOverheatTime() { + return 0; + } + + /** + * returns the middle of the overheat bar in the HUD + */ + public int getAverageOverheat() { + return (this.getOverheatTime() + 30) / 2; + } + + /** + * client-server communication + */ + public void setOverheatLevel(int overheatLevel) { + this.overheatLevel = overheatLevel; + this.dataWatcher.updateObject(20, overheatLevel); + } + + /** + * client-server communication + */ + public int getOverheatLevel() { + return (this.dataWatcher.getWatchableObjectInt(20)); + } + + /** + * @see SpeedHandler description in SpeedHandler + */ + public double convertSpeed(Locomotive entity) { + double speed = entity.getCustomSpeed();// speed in m/s + if (ConfigHandler.REAL_TRAIN_SPEED) { + speed /= 2;// applying ratio + } else { + speed /= 6; + } + speed /= 10; + return speed; + } + + /** + * Used in SoundUpdaterRollingStock + */ + public int getMotionXClient() { + return (this.dataWatcher.getWatchableObjectInt(14)); + } + + /** + * Used in SoundUpdaterRollingStock + */ + public int getMotionZClient() { + return (this.dataWatcher.getWatchableObjectInt(21)); + } + + @Override + protected void func_145775_I() { + int var1 = MathHelper.floor_double(this.boundingBoxSmall.minX + 0.001D); + int var2 = MathHelper.floor_double(this.boundingBoxSmall.minY + 0.001D); + int var3 = MathHelper.floor_double(this.boundingBoxSmall.minZ + 0.001D); + int var4 = MathHelper.floor_double(this.boundingBoxSmall.maxX - 0.001D); + int var5 = MathHelper.floor_double(this.boundingBoxSmall.maxY - 0.001D); + int var6 = MathHelper.floor_double(this.boundingBoxSmall.maxZ - 0.001D); + + if (this.worldObj.checkChunksExist(var1, var2, var3, var4, var5, var6)) { + for (int var7 = var1; var7 <= var4; ++var7) { + for (int var8 = var2; var8 <= var5; ++var8) { + for (int var9 = var3; var9 <= var6; ++var9) { + Block var10 = this.worldObj.getBlock(var7, var8, var9); + + if (var10 != null) { + var10.onEntityCollidedWithBlock(this.worldObj, var7, var8, var9, this); + } + } + } + } + } + } + + private void setBoundingBoxSmall(double par1, double par3, double par5, float width, float height) { + float var7 = width * 0.5F; + this.boundingBoxSmall.setBounds(par1 - var7, par3 - this.yOffset + this.ySize, par5 - var7, par1 + var7, par3 - this.yOffset + this.ySize + height, par5 + var7); + } + + public float getYaw() { + return this.rotationYaw; + } + + public float getPitch() { + return this.rotationPitch; + } + + @Override + public int getMinecartType() { + return 0; + } + + @Override + public List getItemsDropped() { + List items = new ArrayList(); + TrainRecord train = Traincraft.instance.traincraftRegistry.getTrainRecord(this.getClass()); + if (train != null) { + items.add(ItemRollingStock.setPersistentData(new ItemStack(train.getItem()), this, this.getUniqueTrainID(), trainCreator, trainOwner, getColor())); + return items; + } + return null; + } + + @SideOnly(Side.CLIENT) + public Vec3 renderY(double par1, double par3, double par5, double par7) { + int i = MathHelper.floor_double(par1); + int j = MathHelper.floor_double(par3); + int k = MathHelper.floor_double(par5); + + if (worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRailGag.block) { + --j; + } else if (worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRailGag.block) { + j++; + } + + Block l = this.worldObj.getBlock(i, j, k); + int i1; + if (l == BlockIDs.tcRail.block || l == BlockIDs.tcRailGag.block) { + i1 = worldObj.getBlockMetadata(i, j, k); + if (i1 == 2) { + i1 = 0; + } else if (i1 == 3) { + i1 = 1; + } + } else { + return null; + } + if (l != BlockIDs.tcRail.block && l != BlockIDs.tcRailGag.block) { + par3 = j; + + if (i1 >= 2 && i1 <= 5) { + par3 = j + 1; + } + } else if (l == BlockIDs.tcRail.block || l == BlockIDs.tcRailGag.block) { + TileEntity tile = worldObj.getTileEntity(i, j, k); + if (tile != null && tile instanceof TileTCRail) { + if (((TileTCRail) tile).getType() != null && !ItemTCRail.isTCSlopeTrack((TileTCRail) tile)) { + par3 = j; + } + } else if (tile != null && tile instanceof TileTCRailGag) { + int xOrigin = ((TileTCRailGag) tile).originX; + int yOrigin = ((TileTCRailGag) tile).originY; + int zOrigin = ((TileTCRailGag) tile).originZ; + TileEntity tileOrigin = worldObj.getTileEntity(xOrigin, yOrigin, zOrigin); + if (tileOrigin != null && (tileOrigin instanceof TileTCRail) && ((TileTCRail) tileOrigin).getType() != null && !ItemTCRail.isTCSlopeTrack((TileTCRail) tileOrigin)) { + par3 = j; + } + } + } + int[][] aint = matrix[i1]; + double d4 = aint[1][0] - aint[0][0]; + double d5 = aint[1][2] - aint[0][2]; + double d6 = Math.sqrt(d4 * d4 + d5 * d5); + d4 /= d6; + d5 /= d6; + par1 += d4 * par7; + par5 += d5 * par7; + + if (l != BlockIDs.tcRail.block && l != BlockIDs.tcRailGag.block) { + if (aint[0][1] != 0 && MathHelper.floor_double(par1) - i == aint[0][0] && MathHelper.floor_double(par5) - k == aint[0][2]) { + par3 += aint[0][1]; + } else if (aint[1][1] != 0 && MathHelper.floor_double(par1) - i == aint[1][0] && MathHelper.floor_double(par5) - k == aint[1][2]) { + par3 += aint[1][1]; + } + } + return this.func_70489_a(par1, par3, par5); + } + + //private int renderTicks; + public Vec3 yVector(double par1, double par3, double par5) { + int i = MathHelper.floor_double(par1); + int j = MathHelper.floor_double(par3); + int k = MathHelper.floor_double(par5); + if (worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j - 1, k) == BlockIDs.tcRailGag.block) { + --j; + } else if (worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRail.block || worldObj.getBlock(i, j + 1, k) == BlockIDs.tcRailGag.block) { + j++; + } + + Block l = this.worldObj.getBlock(i, j, k); + int i1 = 0; + + /* + * boolean shouldIgnoreYCoord = false; TileEntity tile = + * worldObj.getBlockTileEntity(i, j, k); if(tile!=null && tile + * instanceof TileTCRail){ if(((TileTCRail)tile).getType()!=null && + * ((TileTCRail + * )tile).getType().equals(TrackTypes.MEDIUM_SLOPE.getLabel())){ + * shouldIgnoreYCoord = true; } } if(tile!=null && tile instanceof + * TileTCRailGag){ int xOrigin = ((TileTCRailGag)tile).originX; int + * yOrigin = ((TileTCRailGag)tile).originY; int zOrigin = + * ((TileTCRailGag)tile).originZ; TileEntity tileOrigin = + * worldObj.getBlockTileEntity(xOrigin, yOrigin, zOrigin); + * if(tileOrigin!=null && (tileOrigin instanceof TileTCRail) && + * ((TileTCRail)tileOrigin).getType()!=null && + * ((TileTCRail)tileOrigin).getType + * ().equals(TrackTypes.MEDIUM_SLOPE.getLabel())){ shouldIgnoreYCoord = + * true; } } + */ + if (l == BlockIDs.tcRail.block || l == BlockIDs.tcRailGag.block) { + //par3 = (double) j; + int[][] aint = matrix[i1]; + double d3 = 0.0D; + double d4 = i + 0.5D + aint[0][0] * 0.5D; + double d6 = k + 0.5D + aint[0][2] * 0.5D; + double d10 = (i + 0.5D + aint[1][0] * 0.5D) - d4; + double d12 = (k + 0.5D + aint[1][2] * 0.5D) - d6; + + if (d10 == 0.0D) { + d3 = par5 - k; + } else if (d12 == 0.0D) { + d3 = par1 - i; + } else { + double d13 = par1 - d4; + double d14 = par5 - d6; + d3 = (d13 * d10 + d14 * d12) * 2.0D; + } + return Vec3.createVectorHelper(d4 + d10 * d3, par3, d6 + d12 * d3); + } else { + return null; + } + } + + public ItemStack[] getInventory() { + return null; + } } \ No newline at end of file diff --git a/src/main/java/train/common/api/Freight.java b/src/main/java/train/common/api/Freight.java index 4ec8175881..6bc0083660 100644 --- a/src/main/java/train/common/api/Freight.java +++ b/src/main/java/train/common/api/Freight.java @@ -11,195 +11,210 @@ import train.common.adminbook.ServerLogger; public abstract class Freight extends EntityRollingStock implements IInventory { - public ItemStack cargoItems[]; - protected double itemInsideCount = 0; - private int slotsFilled=0; - public Freight(World world) { - super(world); - dataWatcher.addObject(22, 0); - } - - @Override - public boolean attackEntityFrom(DamageSource damagesource, float i) { - if (worldObj.isRemote) { + public ItemStack[] cargoItems; + protected double itemInsideCount = 0; + private int slotsFilled = 0; + + public Freight(World world) { + super(world); + dataWatcher.addObject(22, 0); + } + + @Override + public boolean attackEntityFrom(DamageSource damagesource, float i) { + if (worldObj.isRemote) { + return true; + } + + if (canBeDestroyedByPlayer(damagesource)) { return true; } - if(canBeDestroyedByPlayer(damagesource))return true; - super.attackEntityFrom(damagesource, i); - setRollingDirection(-getRollingDirection()); - setRollingAmplitude(10); - setBeenAttacked(); - setDamage(getDamage() + i * 10); - if (getDamage() > 40) { - if (riddenByEntity != null) { - riddenByEntity.mountEntity(this); - } - this.setDead(); - ServerLogger.deleteWagon(this); - if(damagesource.getEntity() instanceof EntityPlayer) { - dropCartAsItem(((EntityPlayer)damagesource.getEntity()).capabilities.isCreativeMode); - } - } - return true; - } - - /* IInventory implements */ - @Override - public ItemStack getStackInSlot(int i) { - return cargoItems[i]; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public ItemStack getStackInSlotOnClosing(int par1) { - if (this.cargoItems[par1] != null) { - ItemStack var2 = this.cargoItems[par1]; - this.cargoItems[par1] = null; - return var2; - } - else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int i, int j) { - if (cargoItems[i] != null) { - if (cargoItems[i].stackSize <= j) { - ItemStack itemstack = cargoItems[i]; - cargoItems[i] = null; - return itemstack; - } - ItemStack itemstack1 = cargoItems[i].splitStack(j); - if (cargoItems[i].stackSize == 0) { - cargoItems[i] = null; - } - return itemstack1; - } - else { - return null; - } - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - cargoItems[i] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public void markDirty() { - if(!worldObj.isRemote){ - this.slotsFilled=0; - for (int i = 0; i < getSizeInventory(); i++) { - ItemStack itemstack = getStackInSlot(i); - if(itemstack != null) { - slotsFilled++; - } - } - this.dataWatcher.updateObject(22, slotsFilled); - } - } - - @Override - public String getInventoryName() { - return "Freight cart"; - } - - @Override - public abstract int getSizeInventory(); - - /** - * Returns true if this cart is a storage cart Some carts may have inventories but not be storage carts and some carts without inventories may be storage carts. - * - * @return True if this cart should be classified as a storage cart. - */ - @Override - public boolean isStorageCart() { - return true; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void onUpdate() { - super.onUpdate(); - handleMass(); - } - - /** - * Handle mass depending on item count tenders are done differently - */ - protected void handleMass() { - if (this.updateTicks % 10 != 0) - return; - if (worldObj.isRemote) - return; - this.mass = this.getDefaultMass(); - this.itemInsideCount = 0; - for (int i = 0; i < getSizeInventory(); i++) { - ItemStack itemstack = getStackInSlot(i); - if (itemstack != null && itemstack.stackSize > 0) { - this.itemInsideCount += itemstack.stackSize; - } - } - mass += (this.itemInsideCount * 0.0001); - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } - public int getAmmountOfCargo() { - return this.dataWatcher.getWatchableObjectInt(22); - } - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - ItemStack cargoItemsCount[]; - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItemsCount = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItemsCount.length) { - cargoItemsCount[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - slotsFilled = 0; - for (int i = 0; i < getSizeInventory(); i++) { - ItemStack itemstack = cargoItemsCount[i]; - if(itemstack != null) { - slotsFilled++; - } - } - this.dataWatcher.updateObject(22, slotsFilled); - } - - @Override - public void dropCartAsItem(boolean isCreative){ - if(!itemdropped) { - super.dropCartAsItem(isCreative); - if (!(this instanceof Tender) && cargoItems != null) { - for (ItemStack stack : cargoItems) { - if (stack != null) { - entityDropItem(stack, 0); - } - } - } - } - } - @Override - public ItemStack[] getInventory(){return cargoItems;} + super.attackEntityFrom(damagesource, i); + setRollingDirection(-getRollingDirection()); + setRollingAmplitude(10); + setBeenAttacked(); + setDamage(getDamage() + i * 10); + + if (getDamage() > 40) { + if (riddenByEntity != null) { + riddenByEntity.mountEntity(this); + } + + this.setDead(); + ServerLogger.deleteWagon(this); + + if (damagesource.getEntity() instanceof EntityPlayer) { + dropCartAsItem(((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode); + } + } + return true; + } + + /* IInventory implements */ + @Override + public ItemStack getStackInSlot(int i) { + return cargoItems[i]; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.cargoItems[par1] != null) { + ItemStack var2 = this.cargoItems[par1]; + this.cargoItems[par1] = null; + return var2; + } else { + return null; + } + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if (cargoItems[i] != null) { + if (cargoItems[i].stackSize <= j) { + ItemStack itemstack = cargoItems[i]; + cargoItems[i] = null; + return itemstack; + } + ItemStack itemstack1 = cargoItems[i].splitStack(j); + if (cargoItems[i].stackSize == 0) { + cargoItems[i] = null; + } + return itemstack1; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + cargoItems[i] = itemstack; + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { + itemstack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public void markDirty() { + if (!worldObj.isRemote) { + this.slotsFilled = 0; + for (int i = 0; i < getSizeInventory(); i++) { + ItemStack itemstack = getStackInSlot(i); + if (itemstack != null) { + slotsFilled++; + } + } + this.dataWatcher.updateObject(22, slotsFilled); + } + } + + @Override + public String getInventoryName() { + return "Freight cart"; + } + + @Override + public abstract int getSizeInventory(); + + /** + * Returns true if this cart is a storage cart Some carts may have inventories but not be storage carts and some carts without inventories may be storage carts. + * + * @return True if this cart should be classified as a storage cart. + */ + @Override + public boolean isStorageCart() { + return true; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public void onUpdate() { + super.onUpdate(); + handleMass(); + } + + /** + * Handle mass depending on item count tenders are done differently + */ + protected void handleMass() { + if (this.updateTicks % 10 != 0) + return; + if (worldObj.isRemote) + return; + this.mass = this.getDefaultMass(); + this.itemInsideCount = 0; + for (int i = 0; i < getSizeInventory(); i++) { + ItemStack itemstack = getStackInSlot(i); + if (itemstack != null && itemstack.stackSize > 0) { + this.itemInsideCount += itemstack.stackSize; + } + } + mass += (this.itemInsideCount * 0.0001); + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + public int getAmmountOfCargo() { + return this.dataWatcher.getWatchableObjectInt(22); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + ItemStack[] cargoItemsCount; + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItemsCount = new ItemStack[getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItemsCount.length) { + cargoItemsCount[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + + slotsFilled = 0; + + for (int i = 0; i < getSizeInventory(); i++) { + ItemStack itemstack = cargoItemsCount[i]; + if (itemstack != null) { + slotsFilled++; + } + } + this.dataWatcher.updateObject(22, slotsFilled); + } + + @Override + public void dropCartAsItem(boolean isCreative) { + if (!itemdropped) { + super.dropCartAsItem(isCreative); + if (!(this instanceof Tender) && cargoItems != null) { + for (ItemStack stack : cargoItems) { + if (stack != null) { + entityDropItem(stack, 0); + } + } + } + } + } + + @Override + public ItemStack[] getInventory() { + return cargoItems; + } } \ No newline at end of file diff --git a/src/main/java/train/common/api/TrainRecord.java b/src/main/java/train/common/api/TrainRecord.java index d4ba8f8557..ff42ef1a2f 100644 --- a/src/main/java/train/common/api/TrainRecord.java +++ b/src/main/java/train/common/api/TrainRecord.java @@ -2,10 +2,10 @@ import net.minecraft.item.Item; import net.minecraft.world.World; -import scala.actors.threadpool.Arrays; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public abstract class TrainRecord { @@ -38,11 +38,11 @@ public abstract class TrainRecord { public abstract int getTankCapacity(); - public abstract List getColors(); + public abstract List getColors(); - public List getLiveries(){ - if(skins.size()==0 && getColors()!=null){ - skins=getColors(); + public List getLiveries() { + if (skins.isEmpty() && getColors() != null) { + skins = getColors(); } return skins; } @@ -62,21 +62,19 @@ public List getLiveries(){ public abstract AbstractTrains getEntity(World world, double x, double y, double z); - - - public static TrainRecord makeEntry(String entryName, String internalName, Class entityClass, Item item, String trainType, int MHP, int maxSpeed, double mass, int fuelConsumption, int waterConsumption, int heatingTime, double accelerationRate, double brakeRate, int tankCapacity, String[] colors, int guiRenderScale, double bogieLocoPosition){ - return makeEntry(entryName, internalName, entityClass, item, trainType, MHP, maxSpeed, mass, fuelConsumption, waterConsumption, heatingTime, accelerationRate, brakeRate, tankCapacity,0, colors, guiRenderScale, bogieLocoPosition, ""); + public static TrainRecord makeEntry(String entryName, String internalName, Class entityClass, Item item, String trainType, int MHP, int maxSpeed, double mass, int fuelConsumption, int waterConsumption, int heatingTime, double accelerationRate, double brakeRate, int tankCapacity, String[] colors, int guiRenderScale, double bogieLocoPosition) { + return makeEntry(entryName, internalName, entityClass, item, trainType, MHP, maxSpeed, mass, fuelConsumption, waterConsumption, heatingTime, accelerationRate, brakeRate, tankCapacity, 0, colors, guiRenderScale, bogieLocoPosition, ""); } - public static TrainRecord makeEntry(String entryName, String internalName, Class entityClass, Item item, String trainType, int MHP, int maxSpeed, double mass, int fuelConsumption, int waterConsumption, int heatingTime, double accelerationRate, double brakeRate, int tankCapacity, String[] colors, int guiRenderScale, double bogieLocoPositions, String additionnalTooltip){ - return makeEntry(entryName, internalName, entityClass, item, trainType, MHP, maxSpeed, mass, fuelConsumption, waterConsumption, heatingTime, accelerationRate, brakeRate, tankCapacity,0, colors, guiRenderScale, bogieLocoPositions, additionnalTooltip); + public static TrainRecord makeEntry(String entryName, String internalName, Class entityClass, Item item, String trainType, int MHP, int maxSpeed, double mass, int fuelConsumption, int waterConsumption, int heatingTime, double accelerationRate, double brakeRate, int tankCapacity, String[] colors, int guiRenderScale, double bogieLocoPositions, String additionnalTooltip) { + return makeEntry(entryName, internalName, entityClass, item, trainType, MHP, maxSpeed, mass, fuelConsumption, waterConsumption, heatingTime, accelerationRate, brakeRate, tankCapacity, 0, colors, guiRenderScale, bogieLocoPositions, additionnalTooltip); } - public static TrainRecord makeEntry(String entryName, String internalName,Class entityClass, Item item, String trainType, double mass, String[] colors, int guiRenderScale, int cargoCapacity, String additionnalTooltip){ - return makeEntry(entryName, internalName, entityClass, item, trainType, 0, 0, mass, 0, 0, 0, 0, 0, 0,cargoCapacity, colors, guiRenderScale, 0, additionnalTooltip); + public static TrainRecord makeEntry(String entryName, String internalName, Class entityClass, Item item, String trainType, double mass, String[] colors, int guiRenderScale, int cargoCapacity, String additionnalTooltip) { + return makeEntry(entryName, internalName, entityClass, item, trainType, 0, 0, mass, 0, 0, 0, 0, 0, 0, cargoCapacity, colors, guiRenderScale, 0, additionnalTooltip); } - public static TrainRecord makeEntry(final String entryName, final String internalName, final Class entityClass, final Item item, final String trainType, final int MHP, final int maxSpeed, final double mass, final int fuelConsumption, final int waterConsumption, final int heatingTime, final double accelerationRate, final double brakeRate, final int tankCapacity, final int cargoCapacity, final String[] colors, final int guiRenderScale, final double bogieLocoPositions, final String additionnalTooltip){ + public static TrainRecord makeEntry(final String entryName, final String internalName, final Class entityClass, final Item item, final String trainType, final int MHP, final int maxSpeed, final double mass, final int fuelConsumption, final int waterConsumption, final int heatingTime, final double accelerationRate, final double brakeRate, final int tankCapacity, final int cargoCapacity, final String[] colors, final int guiRenderScale, final double bogieLocoPositions, final String additionnalTooltip) { return new TrainRecord() { @Override public String getName() { @@ -145,7 +143,7 @@ public int getTankCapacity() { @Override public List getColors() { - if(colors==null){ + if (colors == null) { return new ArrayList<>(); } else { return Arrays.asList(colors); @@ -181,17 +179,8 @@ public int getCargoCapacity() { public AbstractTrains getEntity(World world) { try { return (AbstractTrains) entityClass.getConstructor(World.class).newInstance(world); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (SecurityException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { + } catch (IllegalArgumentException | NoSuchMethodException | SecurityException | InstantiationException | + IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } return null; @@ -200,22 +189,13 @@ public AbstractTrains getEntity(World world) { @Override public AbstractTrains getEntity(World world, double x, double y, double z) { try { - if(world.isRemote){ + if (world.isRemote) { entityClass.getConstructor(World.class).newInstance(world); } else { return (AbstractTrains) entityClass.getConstructor(World.class, double.class, double.class, double.class).newInstance(world, x, y, z); } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (SecurityException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { + } catch (IllegalArgumentException | SecurityException | InstantiationException | + IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { e.printStackTrace(); } return null; diff --git a/src/main/java/train/common/core/CommonProxy.java b/src/main/java/train/common/core/CommonProxy.java index 2cd739dee5..1333002154 100644 --- a/src/main/java/train/common/core/CommonProxy.java +++ b/src/main/java/train/common/core/CommonProxy.java @@ -2,7 +2,6 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.registry.GameRegistry; @@ -41,225 +40,229 @@ import java.util.List; public class CommonProxy implements IGuiHandler { - public static List playerList = new ArrayList(); - public static boolean debug = false; - - public void throwAlphaException() { - throw new IllegalStateException("You're trying to use a Traincraft alpha-version past its expiry date. Download a release-build at https://minecraft.curseforge.com/projects/traincraft."); - } - - public void setKeyBinding(String name, int value) {} - - public void registerRenderInformation() {} - - public void registerEvents(FMLPreInitializationEvent event){ - WorldEvents worldEvents = new WorldEvents(); - ChunkEvents chunkEvents = new ChunkEvents(); - - registerEvent(worldEvents); - registerEvent(chunkEvents); - ForgeChunkManager.setForcedChunkLoadingCallback(Traincraft.instance, chunkEvents); - - } - - public void registerEvent(Object o){ - FMLCommonHandler.instance().bus().register(o); - MinecraftForge.EVENT_BUS.register(o); - } - - public void registerTileEntities() { - GameRegistry.registerTileEntity(TileCrafterTierI.class, "TileCrafterTierI"); - GameRegistry.registerTileEntity(TileCrafterTierII.class, "TileCrafterTierII"); - GameRegistry.registerTileEntity(TileCrafterTierIII.class, "TileCrafterTierIII"); - GameRegistry.registerTileEntity(TileTrainWbench.class, "TileTrainWbench"); - GameRegistry.registerTileEntity(TileEntityDistil.class, "Tile Distil"); - GameRegistry.registerTileEntity(TileEntityOpenHearthFurnace.class, "Tile OpenHearthFurnace"); - GameRegistry.registerTileEntity(TileStopper.class, "TileStopper"); - GameRegistry.registerTileEntity(TileEmbeddedStopper.class, "TileEmbeddedStopper"); - GameRegistry.registerTileEntity(TileAmericanStopper.class, "TileAmericanStopper"); - GameRegistry.registerTileEntity(TileSignal.class, "TileTrainSignal"); - GameRegistry.registerTileEntity(TileLantern.class, "tileLantern"); - GameRegistry.registerTileEntity(TileSwitchStand.class, "tileSwitchStand"); - GameRegistry.registerTileEntity(TileMFPBWigWag.class, "tileMFPBWigWag"); - GameRegistry.registerTileEntity(TileWaterWheel.class, "tileWaterWheel"); - GameRegistry.registerTileEntity(TileWindMill.class, "tileWindMill"); - GameRegistry.registerTileEntity(TileGeneratorDiesel.class, "tileGeneratorDiesel"); - GameRegistry.registerTileEntity(TileBook.class, "tileBook"); - GameRegistry.registerTileEntity(TileTCRailGag.class, "tileTCRailGag"); - GameRegistry.registerTileEntity(TileTCRail.class, "tileTCRail"); - GameRegistry.registerTileEntity(TileBridgePillar.class, "tileTCBridgePillar"); - GameRegistry.registerTileEntity(TileMetroMadridPole.class, "tileMetroMadridPole"); - - //switches -hariesh - GameRegistry.registerTileEntity(TileowoSwitchStand.class, "tileowoswitchstand"); - GameRegistry.registerTileEntity(TilecircleSwitchStand.class, "tilecircleswitchstand"); - GameRegistry.registerTileEntity(TileMILWSwitchStand.class, "tileMILWSwitchStand"); - GameRegistry.registerTileEntity(TileautoSwitchStand.class, "tileautoSwitchStand"); - GameRegistry.registerTileEntity(TileowoYardSwitchStand.class, "tileowoYardSwitchStand"); - - GameRegistry.registerTileEntity(TileoverheadWire.class, "tileoverheadwire"); - GameRegistry.registerTileEntity(TileoverheadWireDouble.class, "tileoverheadwiredouble"); - GameRegistry.registerTileEntity(TilesignalSpanish.class, "tilesignalspanish"); - GameRegistry.registerTileEntity(TilekSignal.class, "tileksignal"); - GameRegistry.registerTileEntity(TileSpeedSign.class, "tilespeedsign"); - - if (Loader.isModLoaded("ComputerCraft")) { - GameRegistry.registerTileEntity(TileInfoTransmitterSpeed.class, "tileInfoTransmitterSpeed"); - GameRegistry.registerTileEntity(TileInfoTransmitterMTC.class, "tileInfoTransmitterMTC"); - GameRegistry.registerTileEntity(TileInfoGrabberMTC.class, "tileInfoReceiverMTC"); - GameRegistry.registerTileEntity(TileInfoGrabberDestination.class, "tileInfoReceiverDestination"); - GameRegistry.registerTileEntity(TileATOTransmitterStopPoint.class, "tileATOTransmitterStopPoint"); - GameRegistry.registerTileEntity(TilePDMInstructionRadio.class, "tilePDMInstructionRadio"); - } - - //GameRegistry.registerTileEntity(TileFortyFootContainer.class, "tileFortyFootContainer"); - } - - public void registerComputerCraftPeripherals() throws ClassNotFoundException { - Class computerCraft = Class.forName("dan200.computercraft.ComputerCraft"); - try { - Method computerCraft_registerPeripheralProvider = computerCraft.getMethod("registerPeripheralProvider", new Class[] { Class.forName("dan200.computercraft.api.peripheral.IPeripheralProvider") }); - - //Register all CC required blocks - computerCraft_registerPeripheralProvider.invoke(null, BlockInfoTransmitterSpeed.instance); - computerCraft_registerPeripheralProvider.invoke(null, BlockInfoGrabberMTC.instance); - computerCraft_registerPeripheralProvider.invoke(null, BlockInfoTransmitterMTC.instance); - computerCraft_registerPeripheralProvider.invoke(null, BlockATOTransmitterStopPoint.instance); - - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - TileEntity te = world.getTileEntity(x, y, z); - EntityPlayer riddenByEntity = null; - Entity entity = player.ridingEntity; - - if (player.ridingEntity != null) { - riddenByEntity = (EntityPlayer) entity.riddenByEntity; - } - - Entity entity1 = null; - if (y == -1) { - entity1 = getEntity(world, x); - } - - switch (ID) { - case (GuiIDs.CRAFTER_TIER_I): - return te != null && te instanceof TileCrafterTierI ? new ContainerTier(player.inventory, (TileCrafterTierI) te) : null; - case (GuiIDs.CRAFTER_TIER_II): - return te != null && te instanceof TileCrafterTierII ? new ContainerTier(player.inventory, (TileCrafterTierII) te) : null; - case (GuiIDs.CRAFTER_TIER_III): - return te != null && te instanceof TileCrafterTierIII ? new ContainerTier(player.inventory, (TileCrafterTierIII) te) : null; - case (GuiIDs.DISTIL): - return te != null && te instanceof TileEntityDistil ? new ContainerDistil(player.inventory, (TileEntityDistil) te) : null; - case (GuiIDs.GENERATOR_DIESEL): - return te != null && te instanceof TileGeneratorDiesel ? new ContainerGeneratorDiesel(player.inventory, (TileGeneratorDiesel) te) : null; - case (GuiIDs.OPEN_HEARTH_FURNACE): - return te != null && te instanceof TileEntityOpenHearthFurnace ? new ContainerOpenHearthFurnace(player.inventory, (TileEntityOpenHearthFurnace) te) : null; - case (GuiIDs.TRAIN_WORKBENCH): - return te != null && te instanceof TileTrainWbench ? new ContainerTrainWorkbench(player.inventory, player.worldObj, (TileTrainWbench) te) : null; - case (GuiIDs.LOCO): - return riddenByEntity != null ? new InventoryLoco(riddenByEntity.inventory, (EntityRollingStock) entity) : null; - case (GuiIDs.FORNEY): - return riddenByEntity != null ? new InventoryForney(player.inventory, (EntityRollingStock) entity) : null; - case (GuiIDs.CRAFTING_CART): - return new ContainerWorkbenchCart(player.inventory, player.worldObj); - case (GuiIDs.FURNACE_CART): - return riddenByEntity != null ? new InventoryWorkCart(player.inventory, entity) : null; - case (GuiIDs.ZEPPELIN): - return riddenByEntity != null ? new InventoryZepp(player.inventory, (AbstractZeppelin) entity) : null; - case (GuiIDs.DIGGER): - return riddenByEntity != null ? new InventoryRotativeDigger(player.inventory, (EntityRotativeDigger) entity) : null; - - /* Stationary entities while player is not riding. */ - case (GuiIDs.FREIGHT): - //System.out.println("Freight: " + ID + " | " + entity1.getEntityName() + " | " + x + ":" + y + ":" + z); - return entity1 != null && entity1 instanceof Freight ? new InventoryFreight(player.inventory, (Freight) entity1) : null; - case (GuiIDs.JUKEBOX): - return entity1 != null && entity1 instanceof EntityJukeBoxCart ? new InventoryJukeBoxCart(player.inventory, (EntityJukeBoxCart) entity1) : null; - case (GuiIDs.TENDER): - return entity1 != null && entity1 instanceof Tender ? new InventoryTender(player.inventory, (Tender) entity1) : null; - case (GuiIDs.BUILDER): - return entity1 != null && entity1 instanceof EntityTracksBuilder ? new InventoryBuilder(player.inventory, (EntityTracksBuilder) entity1) : null; - case (GuiIDs.LIQUID): - return entity1 != null && entity1 instanceof LiquidTank ? new InventoryLiquid(player.inventory, (LiquidTank) entity1) : null; + public static List playerList = new ArrayList(); + public static boolean debug = false; + + public void throwAlphaException() { + throw new IllegalStateException("You're trying to use a Traincraft alpha-version past its expiry date. Download a release-build at https://minecraft.curseforge.com/projects/traincraft."); + } + + public void setKeyBinding(String name, int value) { + } + + public void registerRenderInformation() { + } + + public void registerEvents(FMLPreInitializationEvent event) { + WorldEvents worldEvents = new WorldEvents(); + ChunkEvents chunkEvents = new ChunkEvents(); + + registerEvent(worldEvents); + registerEvent(chunkEvents); + ForgeChunkManager.setForcedChunkLoadingCallback(Traincraft.instance, chunkEvents); + + } + + public void registerEvent(Object o) { + FMLCommonHandler.instance().bus().register(o); + MinecraftForge.EVENT_BUS.register(o); + } + + public void registerTileEntities() { + GameRegistry.registerTileEntity(TileCrafterTierI.class, "TileCrafterTierI"); + GameRegistry.registerTileEntity(TileCrafterTierII.class, "TileCrafterTierII"); + GameRegistry.registerTileEntity(TileCrafterTierIII.class, "TileCrafterTierIII"); + GameRegistry.registerTileEntity(TileTrainWbench.class, "TileTrainWbench"); + GameRegistry.registerTileEntity(TileEntityDistil.class, "Tile Distil"); + GameRegistry.registerTileEntity(TileEntityOpenHearthFurnace.class, "Tile OpenHearthFurnace"); + GameRegistry.registerTileEntity(TileStopper.class, "TileStopper"); + GameRegistry.registerTileEntity(TileEmbeddedStopper.class, "TileEmbeddedStopper"); + GameRegistry.registerTileEntity(TileAmericanStopper.class, "TileAmericanStopper"); + GameRegistry.registerTileEntity(TileSignal.class, "TileTrainSignal"); + GameRegistry.registerTileEntity(TileLantern.class, "tileLantern"); + GameRegistry.registerTileEntity(TileSwitchStand.class, "tileSwitchStand"); + GameRegistry.registerTileEntity(TileMFPBWigWag.class, "tileMFPBWigWag"); + GameRegistry.registerTileEntity(TileWaterWheel.class, "tileWaterWheel"); + GameRegistry.registerTileEntity(TileWindMill.class, "tileWindMill"); + GameRegistry.registerTileEntity(TileGeneratorDiesel.class, "tileGeneratorDiesel"); + GameRegistry.registerTileEntity(TileBook.class, "tileBook"); + GameRegistry.registerTileEntity(TileTCRailGag.class, "tileTCRailGag"); + GameRegistry.registerTileEntity(TileTCRail.class, "tileTCRail"); + GameRegistry.registerTileEntity(TileBridgePillar.class, "tileTCBridgePillar"); + GameRegistry.registerTileEntity(TileMetroMadridPole.class, "tileMetroMadridPole"); + + //switches -hariesh + GameRegistry.registerTileEntity(TileowoSwitchStand.class, "tileowoswitchstand"); + GameRegistry.registerTileEntity(TilecircleSwitchStand.class, "tilecircleswitchstand"); + GameRegistry.registerTileEntity(TileMILWSwitchStand.class, "tileMILWSwitchStand"); + GameRegistry.registerTileEntity(TileautoSwitchStand.class, "tileautoSwitchStand"); + GameRegistry.registerTileEntity(TileowoYardSwitchStand.class, "tileowoYardSwitchStand"); + + GameRegistry.registerTileEntity(TileoverheadWire.class, "tileoverheadwire"); + GameRegistry.registerTileEntity(TileoverheadWireDouble.class, "tileoverheadwiredouble"); + GameRegistry.registerTileEntity(TilesignalSpanish.class, "tilesignalspanish"); + GameRegistry.registerTileEntity(TilekSignal.class, "tileksignal"); + GameRegistry.registerTileEntity(TileSpeedSign.class, "tilespeedsign"); + + if (Traincraft.hasComputerCraft()) { + GameRegistry.registerTileEntity(TileInfoTransmitterSpeed.class, "tileInfoTransmitterSpeed"); + GameRegistry.registerTileEntity(TileInfoTransmitterMTC.class, "tileInfoTransmitterMTC"); + GameRegistry.registerTileEntity(TileInfoGrabberMTC.class, "tileInfoReceiverMTC"); + GameRegistry.registerTileEntity(TileInfoGrabberDestination.class, "tileInfoReceiverDestination"); + GameRegistry.registerTileEntity(TileATOTransmitterStopPoint.class, "tileATOTransmitterStopPoint"); + GameRegistry.registerTileEntity(TilePDMInstructionRadio.class, "tilePDMInstructionRadio"); + } + + //GameRegistry.registerTileEntity(TileFortyFootContainer.class, "tileFortyFootContainer"); + } + + public void registerComputerCraftPeripherals() throws ClassNotFoundException { + Class computerCraft = Class.forName("dan200.computercraft.ComputerCraft"); + try { + Method computerCraft_registerPeripheralProvider = computerCraft.getMethod("registerPeripheralProvider", Class.forName("dan200.computercraft.api.peripheral.IPeripheralProvider")); + + //Register all CC required blocks + computerCraft_registerPeripheralProvider.invoke(null, BlockInfoTransmitterSpeed.instance); + computerCraft_registerPeripheralProvider.invoke(null, BlockInfoGrabberMTC.instance); + computerCraft_registerPeripheralProvider.invoke(null, BlockInfoTransmitterMTC.instance); + computerCraft_registerPeripheralProvider.invoke(null, BlockATOTransmitterStopPoint.instance); + + } catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + TileEntity te = world.getTileEntity(x, y, z); + EntityPlayer riddenByEntity = null; + Entity entity = player.ridingEntity; + + if (player.ridingEntity != null) { + riddenByEntity = (EntityPlayer) entity.riddenByEntity; + } + + Entity entity1 = null; + if (y == -1) { + entity1 = getEntity(world, x); + } + + switch (ID) { + case (GuiIDs.CRAFTER_TIER_I): + return te instanceof TileCrafterTierI ? new ContainerTier(player.inventory, (TileCrafterTierI) te) : null; + case (GuiIDs.CRAFTER_TIER_II): + return te instanceof TileCrafterTierII ? new ContainerTier(player.inventory, (TileCrafterTierII) te) : null; + case (GuiIDs.CRAFTER_TIER_III): + return te instanceof TileCrafterTierIII ? new ContainerTier(player.inventory, (TileCrafterTierIII) te) : null; + case (GuiIDs.DISTIL): + return te instanceof TileEntityDistil ? new ContainerDistil(player.inventory, (TileEntityDistil) te) : null; + case (GuiIDs.GENERATOR_DIESEL): + return te instanceof TileGeneratorDiesel ? new ContainerGeneratorDiesel(player.inventory, (TileGeneratorDiesel) te) : null; + case (GuiIDs.OPEN_HEARTH_FURNACE): + return te instanceof TileEntityOpenHearthFurnace ? new ContainerOpenHearthFurnace(player.inventory, (TileEntityOpenHearthFurnace) te) : null; + case (GuiIDs.TRAIN_WORKBENCH): + return te instanceof TileTrainWbench ? new ContainerTrainWorkbench(player.inventory, player.worldObj, (TileTrainWbench) te) : null; + case (GuiIDs.LOCO): + return riddenByEntity != null ? new InventoryLoco(riddenByEntity.inventory, (EntityRollingStock) entity) : null; + case (GuiIDs.FORNEY): + return riddenByEntity != null ? new InventoryForney(player.inventory, (EntityRollingStock) entity) : null; + case (GuiIDs.CRAFTING_CART): + return new ContainerWorkbenchCart(player.inventory, player.worldObj); + case (GuiIDs.FURNACE_CART): + return riddenByEntity != null ? new InventoryWorkCart(player.inventory, entity) : null; + case (GuiIDs.ZEPPELIN): + return riddenByEntity != null ? new InventoryZepp(player.inventory, (AbstractZeppelin) entity) : null; + case (GuiIDs.DIGGER): + return riddenByEntity != null ? new InventoryRotativeDigger(player.inventory, (EntityRotativeDigger) entity) : null; + + /* Stationary entities while player is not riding. */ + case (GuiIDs.FREIGHT): + //System.out.println("Freight: " + ID + " | " + entity1.getEntityName() + " | " + x + ":" + y + ":" + z); + return entity1 instanceof Freight ? new InventoryFreight(player.inventory, (Freight) entity1) : null; + case (GuiIDs.JUKEBOX): + return entity1 instanceof EntityJukeBoxCart ? new InventoryJukeBoxCart(player.inventory, (EntityJukeBoxCart) entity1) : null; + case (GuiIDs.TENDER): + return entity1 instanceof Tender ? new InventoryTender(player.inventory, (Tender) entity1) : null; + case (GuiIDs.BUILDER): + return entity1 instanceof EntityTracksBuilder ? new InventoryBuilder(player.inventory, (EntityTracksBuilder) entity1) : null; + case (GuiIDs.LIQUID): + return entity1 instanceof LiquidTank ? new InventoryLiquid(player.inventory, (LiquidTank) entity1) : null; /*case (GuiIDs.FORTY_FOOT_CONTAINER): return new ContainerStorage((TileFortyFootContainer)te, player);*/ - default: - return null; + default: + return null; - } - } + } + } - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return null; - } + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + return null; + } - public static Entity getEntity(World world, int entityId) { - if ((world != null) && (world instanceof WorldServer)) { - return world.getEntityByID(entityId); - } - return null; - } + public static Entity getEntity(World world, int entityId) { + if (world instanceof WorldServer) { + return world.getEntityByID(entityId); + } + return null; + } - public int addArmor(String armor) { - return 0; - } + public int addArmor(String armor) { + return 0; + } - public Minecraft getClientInstance() { - return FMLClientHandler.instance().getClient(); - } + public Minecraft getClientInstance() { + return FMLClientHandler.instance().getClient(); + } - public GuiScreen getCurrentScreen() { - return null; - } + public GuiScreen getCurrentScreen() { + return null; + } - public void registerTextureFX() {} + public void registerTextureFX() { + } - public void registerSounds() {} + public void registerSounds() { + } - public void registerBookHandler() {} + public void registerBookHandler() { + } - public Minecraft getMinecraft() { - return null; - } + public Minecraft getMinecraft() { + return null; + } - public void registerVillagerSkin(int villagerId, String textureName) {} + public void registerVillagerSkin(int villagerId, String textureName) { + } - public static void killAllStreams() { - for (MP3Player p : playerList) { - p.stop(); - } - } + public static void killAllStreams() { + for (MP3Player p : playerList) { + p.stop(); + } + } - public void openadmingui(String data){} + public void openadmingui(String data) { + } - public static boolean checkJukeboxEntity(World world, int id) { - return world.getEntityByID(id)!=null; - } + public static boolean checkJukeboxEntity(World world, int id) { + return world.getEntityByID(id) != null; + } - public void doNEICheck(ItemStack stack) {} + public void doNEICheck(ItemStack stack) { + } - public EntityPlayer getPlayer() { - return null; - } + public EntityPlayer getPlayer() { + return null; + } - public float getJukeboxVolume() { - return 0; - } + public float getJukeboxVolume() { + return 0; + } - public void registerKeyBindingHandler() {} + public void registerKeyBindingHandler() { + } - public void setHook() {} - + public void setHook() { + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/CreativeTabTraincraft.java b/src/main/java/train/common/core/CreativeTabTraincraft.java index 03ba8246f5..d4da351841 100644 --- a/src/main/java/train/common/core/CreativeTabTraincraft.java +++ b/src/main/java/train/common/core/CreativeTabTraincraft.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -14,20 +14,22 @@ public class CreativeTabTraincraft extends CreativeTabs { - public CreativeTabTraincraft(int par1, String par2Str) { - super(par1, par2Str); - } + public CreativeTabTraincraft(int par1, String par2Str) { + super(par1, par2Str); + } - @Override - public ItemStack getIconItemStack() { - return new ItemStack(ItemIDs.minecartLocoBR80_DB.item); - } + @Override + public ItemStack getIconItemStack() { + return new ItemStack(ItemIDs.minecartLocoBR80_DB.item); + } - @Override - public String getTranslatedTabLabel() { - return super.getTabLabel(); - } + @Override + public String getTranslatedTabLabel() { + return super.getTabLabel(); + } - @Override - public Item getTabIconItem(){return ItemIDs.minecartLocoBR80_DB.item;} + @Override + public Item getTabIconItem() { + return ItemIDs.minecartLocoBR80_DB.item; + } } diff --git a/src/main/java/train/common/core/CreativeTabTraincraftTrains.java b/src/main/java/train/common/core/CreativeTabTraincraftTrains.java index 01dc3542d9..6146972ea9 100644 --- a/src/main/java/train/common/core/CreativeTabTraincraftTrains.java +++ b/src/main/java/train/common/core/CreativeTabTraincraftTrains.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -14,20 +14,22 @@ public class CreativeTabTraincraftTrains extends CreativeTabs { - public CreativeTabTraincraftTrains(int par1, String par2Str) { - super(par1, par2Str); - } + public CreativeTabTraincraftTrains(int par1, String par2Str) { + super(par1, par2Str); + } - @Override - public ItemStack getIconItemStack() { - return new ItemStack(ItemIDs.minecartLocoBR01_DB.item); - } + @Override + public ItemStack getIconItemStack() { + return new ItemStack(ItemIDs.minecartLocoBR01_DB.item); + } - @Override - public String getTranslatedTabLabel() { - return super.getTabLabel(); - } + @Override + public String getTranslatedTabLabel() { + return super.getTabLabel(); + } - @Override - public Item getTabIconItem(){return ItemIDs.minecartLocoBR01_DB.item;} + @Override + public Item getTabIconItem() { + return ItemIDs.minecartLocoBR01_DB.item; + } } diff --git a/src/main/java/train/common/core/EntityIds.java b/src/main/java/train/common/core/EntityIds.java index 260360803a..7d83f9fe74 100644 --- a/src/main/java/train/common/core/EntityIds.java +++ b/src/main/java/train/common/core/EntityIds.java @@ -1,13 +1,13 @@ package train.common.core; public class EntityIds { - public static final int ZEPPELIN = 31; - public static final int LASERS_LINES = 111; - public static final int HELICOPTER = 40; - public static final int ZEPPELIN_BIG = 112; - public static final int ROTATIVE_DIGGER = 116; - public static final int LOCOMOTIVE_BOGIE = 51; - public static final int UTILITY_BOGIE = 52; - - public static final int FALLING = 120; + public static final int ZEPPELIN = 31; + public static final int LASERS_LINES = 111; + public static final int HELICOPTER = 40; + public static final int ZEPPELIN_BIG = 112; + public static final int ROTATIVE_DIGGER = 116; + public static final int LOCOMOTIVE_BOGIE = 51; + public static final int UTILITY_BOGIE = 52; + + public static final int FALLING = 120; } \ No newline at end of file diff --git a/src/main/java/train/common/core/FakePlayer.java b/src/main/java/train/common/core/FakePlayer.java index 14738a03c0..c77e0d4b9c 100644 --- a/src/main/java/train/common/core/FakePlayer.java +++ b/src/main/java/train/common/core/FakePlayer.java @@ -14,7 +14,6 @@ import net.minecraft.stats.StatBase; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.DamageSource; -import net.minecraft.util.FoodStats; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; @@ -22,219 +21,214 @@ /** * Fake player entity, which is used in calls requiring player instance. All methods are modified to do nothing, to prevent modification of player stats. - * + * * @author MightyPork * @copy 2012 */ public class FakePlayer extends EntityPlayer { - /** - * Create fake player in world - * - * @param world the world - */ - public FakePlayer(World world) { - super(world, new GameProfile(new UUID(0,0),"")); - inventory = new InventoryPlayer(this); - inventory.currentItem = 0; - inventory.setInventorySlotContents(0, new ItemStack(Items.diamond_pickaxe, 1, 0)); - flyToggleTimer = 0; - // score = 0; - boolean isSwinging = false; // Maybe spawnForced ?? - xpCooldown = 0; - timeUntilPortal = 20; - inPortal = false; - capabilities = new PlayerCapabilities(); - speedOnGround = 0.1F; - speedInAir = 0.02F; - fishEntity = null; - this.inventoryContainer = new ContainerPlayer(this.inventory, !world.isRemote, this); - this.openContainer = this.inventoryContainer; - yOffset = 1.62F; - - fireResistance = 20; - } - - @Override - protected void entityInit() { - super.entityInit(); - } - - @Override - public void onUpdate() {} - - @Override - public void preparePlayerToSpawn() {} - - @Override - protected void updateEntityActionState() {} - - @Override - public void onLivingUpdate() {} - - @Override - public void onDeath(DamageSource damagesource) { - super.onDeath(damagesource); - } - - - @Override - public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemstack, boolean flag) { - return null; - } - - @Override - public boolean canHarvestBlock(Block block) { - return true; - } - - @Override - public void readEntityFromNBT(NBTTagCompound nbttagcompound) {} - - @Override - public void writeEntityToNBT(NBTTagCompound nbttagcompound) {} - - @Override - public int getTotalArmorValue() { - return 0; - } - - @Override - public ItemStack getCurrentEquippedItem() { - return null; - } - - @Override - public void destroyCurrentEquippedItem() {} - - @Override - public double getYOffset() { - return 0; - } - - @Override - public void swingItem() {} - - @Override - public void attackTargetEntityWithCurrentItem(Entity entity) {} - - @Override - public void onCriticalHit(Entity entity) {} - - @Override - public void onEnchantmentCritical(Entity entity) {} - - @Override - public void respawnPlayer() {} - - @Override - public void setDead() { - super.setDead(); - } - - @Override - public boolean isEntityInsideOpaqueBlock() { - return false; - } - - @Override - public EnumStatus sleepInBedAt(int i, int j, int k) { - return EnumStatus.OK; - } - - @Override - public void wakeUpPlayer(boolean flag, boolean flag1, boolean flag2) {} - - @Override - public float getBedOrientationInDegrees() { - return 0.0F; - } - - @Override - public boolean isPlayerSleeping() { - return sleeping; - } - - @Override - public boolean isPlayerFullyAsleep() { - return false; - } - - @Override - public int getSleepTimer() { - return 0; - } - - @Override - public void addChatMessage(IChatComponent chatComponent) {} - - @Override - public void triggerAchievement(StatBase statbase) {} - - @Override - public void addStat(StatBase statbase, int i) {} - - @Override - public void addToPlayerScore(Entity par1Entity, int par2) {} - - @Override - public void jump() {} - - @Override - public void moveEntityWithHeading(float f, float f1) {} - - @Override - public void addMovementStat(double d, double d1, double d2) {} - - @Override - protected void fall(float f) {} - - @Override - public void setInPortal() {} - - @Override - public int xpBarCap() { - return 1000; - } - - @Override - public void addExhaustion(float f) {} - - @Override - public FoodStats getFoodStats() { - return foodStats; - } - - @Override - public boolean canEat(boolean flag) { - return false; - } - - @Override - public boolean shouldHeal() { - return false; - } - - @Override - public void setItemInUse(ItemStack itemstack, int i) {} - - @Override - protected int getExperiencePoints(EntityPlayer entityplayer) { - return 0; - } - - @Override - protected boolean isPlayer() { - return true; - } - - @Override - public boolean canCommandSenderUseCommand(int var1, String var2) { - return false; - } - - @Override - public ChunkCoordinates getPlayerCoordinates() { - return null; - } + /** + * Create fake player in world + * + * @param world the world + */ + public FakePlayer(World world) { + super(world, new GameProfile(new UUID(0, 0), "")); + inventory = new InventoryPlayer(this); + inventory.currentItem = 0; + inventory.setInventorySlotContents(0, new ItemStack(Items.diamond_pickaxe, 1, 0)); + flyToggleTimer = 0; + xpCooldown = 0; + timeUntilPortal = 20; + inPortal = false; + capabilities = new PlayerCapabilities(); + speedOnGround = 0.1F; + speedInAir = 0.02F; + fishEntity = null; + this.inventoryContainer = new ContainerPlayer(this.inventory, !world.isRemote, this); + this.openContainer = this.inventoryContainer; + yOffset = 1.62F; + + fireResistance = 20; + } + + @Override + protected void entityInit() { + super.entityInit(); + } + + @Override + public void onUpdate() { + } + + @Override + public void preparePlayerToSpawn() { + } + + @Override + protected void updateEntityActionState() { + } + + @Override + public void onLivingUpdate() { + } + + @Override + public void onDeath(DamageSource damagesource) { + super.onDeath(damagesource); + } + + + @Override + public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemstack, boolean flag) { + return null; + } + + @Override + public boolean canHarvestBlock(Block block) { + return true; + } + + @Override + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { + } + + @Override + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { + } + + @Override + public int getTotalArmorValue() { + return 0; + } + + @Override + public ItemStack getCurrentEquippedItem() { + return null; + } + + @Override + public void destroyCurrentEquippedItem() { + } + + @Override + public double getYOffset() { + return 0; + } + + @Override + public void swingItem() { + } + + @Override + public void attackTargetEntityWithCurrentItem(Entity entity) { + } + + @Override + public void respawnPlayer() { + } + + @Override + public void setDead() { + super.setDead(); + } + + @Override + public boolean isEntityInsideOpaqueBlock() { + return false; + } + + @Override + public EnumStatus sleepInBedAt(int i, int j, int k) { + return EnumStatus.OK; + } + + @Override + public void wakeUpPlayer(boolean flag, boolean flag1, boolean flag2) { + } + + @Override + public float getBedOrientationInDegrees() { + return 0.0F; + } + + @Override + public boolean isPlayerFullyAsleep() { + return false; + } + + @Override + public int getSleepTimer() { + return 0; + } + + @Override + public void addChatMessage(IChatComponent chatComponent) { + } + + @Override + public void triggerAchievement(StatBase statbase) { + } + + @Override + public void addToPlayerScore(Entity par1Entity, int par2) { + } + + @Override + public void jump() { + } + + @Override + public void moveEntityWithHeading(float f, float f1) { + } + + @Override + public void addMovementStat(double d, double d1, double d2) { + } + + @Override + protected void fall(float f) { + } + + @Override + public void setInPortal() { + } + + @Override + public int xpBarCap() { + return 1000; + } + + @Override + public void addExhaustion(float f) { + } + + @Override + public boolean canEat(boolean flag) { + return false; + } + + @Override + public boolean shouldHeal() { + return false; + } + + @Override + public void setItemInUse(ItemStack itemstack, int i) { + } + + @Override + protected int getExperiencePoints(EntityPlayer entityplayer) { + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(int var1, String var2) { + return false; + } + + @Override + public ChunkCoordinates getPlayerCoordinates() { + return null; + } } diff --git a/src/main/java/train/common/core/HandleMaxAttachedCarts.java b/src/main/java/train/common/core/HandleMaxAttachedCarts.java index ce59dc03b7..f2615a1bac 100644 --- a/src/main/java/train/common/core/HandleMaxAttachedCarts.java +++ b/src/main/java/train/common/core/HandleMaxAttachedCarts.java @@ -5,165 +5,164 @@ /** * Power is not limited to 1000 anymore. Power is shared between locomotives in a train. - * + *

* Speed: MaxSpeed-= (totalMass/(power/400)); - * + *

* Then fuel rate: fuelRate -= (int) (scaledPower * totalMass*100) - * + *

* Power is scaled again to fit the acceleration/brake values * scaledPower = (totalMass/(power/200)); * Then * scaledPower = scalePower(scaledPower) * scalePower() => (power/1000)*0.8 - * + *

* Then acceleration: accelerate-=ScaledPower*Mass - * + *

* Then brake: brake+=ScaledPower*Mass - * */ public class HandleMaxAttachedCarts { - - public HandleMaxAttachedCarts() { - - } - - /** - * handles the physic for the locomotive speed, acceleration, brake and fuel consumption depending of the carts attached to it - */ - public static void PullPhysic(Locomotive cart1) { - double totalMass = 0; - if (( cart1).train != null && ( cart1).train.getTrains().size() != 0) { - - for (int j1 = 0; j1 < ( cart1).train.getTrains().size(); j1++) { - totalMass += ( cart1).train.getTrains().get(j1).mass; - } - (cart1).currentNumCartsPulled = (cart1).train.getTrains().size() - 1; - ( cart1).currentMassPulled = Math.round(totalMass * 10); - } - else { - totalMass = 0; - (cart1).currentNumCartsPulled = 0; - ( cart1).currentMassPulled = 0; - } - /** - * Speed is scaled by the mass of carts pulled and the power of the locomotive Power is converted before this calculation MaxSpeed-=exp((Power*Mass)/2) - */ - if(totalMass<0){ - totalMass=0; - } else { - totalMass*=0.745; - } - - double power = 0; - if ((cart1).train != null && (cart1).train.getTrains().size() != 0 && ( cart1).train.getTrains().size()>1){ - power = (cart1).getPower(); - for (int i = 0; i < ( cart1).train.getTrains().size(); i++) { - EntityRollingStock stock = (cart1).train.getTrains().get(i); - if(stock instanceof Locomotive && stock.uniqueID != (cart1).uniqueID){ - power += ((Locomotive)stock).getPower(); - } - } - //power = ((Locomotive) cart1).getPower();//((EntityRollingStock) cart1).train.getTrainPower(); - double maxSpeed = (cart1).getMaxSpeed();// reset speed and get default - - maxSpeed -= totalMass==0?0:(totalMass/(power/74.57)); - if (maxSpeed > 0) {// if maxSpeed=0 then default is used: not good here! and we don't want negative speed - (cart1).setCustomSpeed(maxSpeed); - }else{ - (cart1).setCustomSpeed(0.1); - } - (cart1).currentSpeedSlowDown = totalMass==0?0:(totalMass/(power/74.57)); - //System.out.println("mass "+totalMass +" power "+power +" "+cart1 ); - - }else if (( cart1).train == null || ( cart1).train.getTrains().size() < 2) { - double maxSpeed = (cart1).getMaxSpeed(); - ( cart1).setCustomSpeed(maxSpeed); - (cart1).currentSpeedSlowDown = 0; - } - - /** - * acceleration is scaled by the mass of carts pulled and the power of the locomotive Power is converted and scaled before this calculation accelerate-=ScaledPower*Mass - */ - double scaledPower = totalMass==0?0:(totalMass/(power/745.7));//(power*totalMass)/(power*6);//scalePower(power); - scaledPower = scalePower(scaledPower); - double accelerate = (cart1).setAccel(0);// reset acceleration and get default - if((power * totalMass)>0){ - accelerate -= (scaledPower * totalMass * 1.13); - } - if (accelerate > 0) {// if accelerate=0 then default is used: not good here! and we don't want negative acceleration - ( cart1).setAccel(accelerate); - } - if((power * totalMass)>0){ - ( cart1).currentAccelSlowDown = (scaledPower * (totalMass * 1.13)); - }else{ - ( cart1).currentAccelSlowDown =0; - } - - - /** - * brake is scaled by the mass of carts pulled and the power of the locomotive Power is converted and scaled before this calculation brake+=ScaledPower*Mass - */ - double brake = ( cart1).setBrake(0);// reset brake and get default - brake += (scaledPower * totalMass); - if (brake > 1) - brake = 0.998; - if (brake > 0) {// if accelerate=0 then default is used: not good here! and we don't want negative brake or brake values higher than 1 (which mean acceleration) - if((power * totalMass)>0)( cart1).setBrake(brake); - } - if((power * totalMass)>0){ - (cart1).currentBrakeSlowDown = (scaledPower * (totalMass)); - }else{ - ( cart1).currentBrakeSlowDown = 0; - } - - - /** - * fuel consumption is scaled by the mass of carts pulled and the power of the locomotive Power is converted before this calculation fuelRate-=power*Mass - */ - - int fuelRate = (cart1).setFuelConsumption(0);// reset and get default - fuelRate -= (int) (scaledPower * totalMass*100); - //if((power * totalMass)>0)System.out.println(cart1+"fuelRate "+fuelRate); - if (fuelRate > 0) {// if fuelRate=0 then default is used: not good here! and we don't want negative fuelRate - ( cart1).setFuelConsumption(fuelRate); - } - if((power * totalMass)>0){ - ( cart1).currentFuelConsumptionChange = (fuelRate); - }else{ - (cart1).currentFuelConsumptionChange=0; - } - - - } - - /** - * Possible values: from 0 to 1000 example: power=800 800/1000=0.8 1-0.8=0.2 return 0.2 - * - * @param power - * @return - */ - @Deprecated - private double convertPower(double power) { - power /= 1000; - power = 1 - power; - - return power; - - } - - /** - * Used to scale power for calculation like Brake and Acceleration rates - * - * @return - */ - private static double scalePower(double power) { - if (power ==0){ - return 0; - } - power /= 1000; - power *= 0.8; - return power; - - } + + public HandleMaxAttachedCarts() { + + } + + /** + * handles the physic for the locomotive speed, acceleration, brake and fuel consumption depending of the carts attached to it + */ + public static void PullPhysic(Locomotive cart1) { + double totalMass = 0; + if ((cart1).train != null && !(cart1).train.getTrains().isEmpty()) { + + for (int j1 = 0; j1 < (cart1).train.getTrains().size(); j1++) { + totalMass += (cart1).train.getTrains().get(j1).mass; + } + (cart1).currentNumCartsPulled = (cart1).train.getTrains().size() - 1; + (cart1).currentMassPulled = Math.round(totalMass * 10); + } else { + totalMass = 0; + (cart1).currentNumCartsPulled = 0; + (cart1).currentMassPulled = 0; + } + /** + * Speed is scaled by the mass of carts pulled and the power of the locomotive Power is converted before this calculation MaxSpeed-=exp((Power*Mass)/2) + */ + if (totalMass < 0) { + totalMass = 0; + } else { + totalMass *= 0.745; + } + + double power = 0; + if ((cart1).train != null && !(cart1).train.getTrains().isEmpty() && (cart1).train.getTrains().size() > 1) { + power = (cart1).getPower(); + for (int i = 0; i < (cart1).train.getTrains().size(); i++) { + EntityRollingStock stock = (cart1).train.getTrains().get(i); + if (stock instanceof Locomotive && stock.uniqueID != (cart1).uniqueID) { + power += ((Locomotive) stock).getPower(); + } + } + //power = ((Locomotive) cart1).getPower();//((EntityRollingStock) cart1).train.getTrainPower(); + double maxSpeed = (cart1).getMaxSpeed();// reset speed and get default + + double maxSpeed1 = totalMass == 0 ? 0 : (totalMass / (power / 74.57)); + maxSpeed -= maxSpeed1; + if (maxSpeed > 0) {// if maxSpeed=0 then default is used: not good here! and we don't want negative speed + (cart1).setCustomSpeed(maxSpeed); + } else { + (cart1).setCustomSpeed(0.1); + } + (cart1).currentSpeedSlowDown = maxSpeed1; + //System.out.println("mass "+totalMass +" power "+power +" "+cart1 ); + + } else if ((cart1).train == null || (cart1).train.getTrains().size() < 2) { + double maxSpeed = (cart1).getMaxSpeed(); + (cart1).setCustomSpeed(maxSpeed); + (cart1).currentSpeedSlowDown = 0; + } + + /** + * acceleration is scaled by the mass of carts pulled and the power of the locomotive Power is converted and scaled before this calculation accelerate-=ScaledPower*Mass + */ + double scaledPower = totalMass == 0 ? 0 : (totalMass / (power / 745.7));//(power*totalMass)/(power*6);//scalePower(power); + scaledPower = scalePower(scaledPower); + double accelerate = (cart1).setAccel(0);// reset acceleration and get default + if ((power * totalMass) > 0) { + accelerate -= (scaledPower * totalMass * 1.13); + } + if (accelerate > 0) {// if accelerate=0 then default is used: not good here! and we don't want negative acceleration + (cart1).setAccel(accelerate); + } + if ((power * totalMass) > 0) { + (cart1).currentAccelSlowDown = (scaledPower * (totalMass * 1.13)); + } else { + (cart1).currentAccelSlowDown = 0; + } + + + /** + * brake is scaled by the mass of carts pulled and the power of the locomotive Power is converted and scaled before this calculation brake+=ScaledPower*Mass + */ + double brake = (cart1).setBrake(0);// reset brake and get default + brake += (scaledPower * totalMass); + if (brake > 1) + brake = 0.998; + if (brake > 0) {// if accelerate=0 then default is used: not good here! and we don't want negative brake or brake values higher than 1 (which mean acceleration) + if ((power * totalMass) > 0) (cart1).setBrake(brake); + } + if ((power * totalMass) > 0) { + (cart1).currentBrakeSlowDown = (scaledPower * (totalMass)); + } else { + (cart1).currentBrakeSlowDown = 0; + } + + + /** + * fuel consumption is scaled by the mass of carts pulled and the power of the locomotive Power is converted before this calculation fuelRate-=power*Mass + */ + + int fuelRate = (cart1).setFuelConsumption(0);// reset and get default + fuelRate -= (int) (scaledPower * totalMass * 100); + //if((power * totalMass)>0)System.out.println(cart1+"fuelRate "+fuelRate); + if (fuelRate > 0) {// if fuelRate=0 then default is used: not good here! and we don't want negative fuelRate + (cart1).setFuelConsumption(fuelRate); + } + if ((power * totalMass) > 0) { + (cart1).currentFuelConsumptionChange = (fuelRate); + } else { + (cart1).currentFuelConsumptionChange = 0; + } + + + } + + /** + * Possible values: from 0 to 1000 example: power=800 800/1000=0.8 1-0.8=0.2 return 0.2 + * + * @param power the power of the locomotive + * @return the converted power + */ + @Deprecated + private double convertPower(double power) { + power /= 1000; + power = 1 - power; + + return power; + + } + + /** + * Used to scale power for calculation like Brake and Acceleration rates + * + * @return + */ + private static double scalePower(double power) { + if (power == 0) { + return 0; + } + power /= 1000; + power *= 0.8; + return power; + + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/HandleOverheating.java b/src/main/java/train/common/core/HandleOverheating.java index b0d1f91dc4..cc13dd663f 100644 --- a/src/main/java/train/common/core/HandleOverheating.java +++ b/src/main/java/train/common/core/HandleOverheating.java @@ -7,142 +7,147 @@ public class HandleOverheating { - /** - * a delayer to avoid instant overheating - */ - private int breakDelay = 0; - - /** - * constructor - * - * @param entity - */ - public HandleOverheating(EntityRollingStock entity) { - - } - - /** - * Handle the overheating for locomotives - */ - public void HandleHeatLevel(EntityRollingStock entity) { - - entity.overheatLevel = entity.getOverheatLevel(); - - if (entity instanceof Locomotive && entity.canOverheat()) { - double locoActualSpeed = MathHelper.sqrt_double(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ); - - /** - * speed is low, overheat goes down to normal - */ - if ((locoActualSpeed <= 0 + 0.05) && !entity.isBraking && entity.overheatLevel > entity.getAverageOverheat() && (entity.worldObj.rand.nextInt(10) == 0) && !((Locomotive) entity).getState().equals("broken")) { - entity.overheatLevel--; - } - /** - * speed is low, overheat goes down to normal - */ - if ((locoActualSpeed <= 0 + 0.10) && !entity.isBraking && entity.overheatLevel > entity.getAverageOverheat() && (entity.worldObj.rand.nextInt(10) == 0) && !((Locomotive) entity).getState().equals("broken")) { - entity.overheatLevel--; - - } - /** - * fuel is empty, heat level goes down - */ - if (entity.fuelTrain < 1 && entity.overheatLevel > 0 && (entity.worldObj.rand.nextInt(10) == 0) && !((Locomotive) entity).getState().equals("broken")) { - entity.overheatLevel--; - - } - /** - * Heat goes down with time - */ - if ((entity.overheatLevel > (entity.getOverheatTime() + 30) / 2) && (entity.worldObj.rand.nextInt(30) == 0) && !((Locomotive) entity).getState().equals("broken")) { - entity.overheatLevel--; - } - /** - * train is fueled => heat level goes up to normal - */ - if (((Locomotive)entity).isLocoTurnedOn() && entity.fuelTrain > 1 && (entity.overheatLevel < (entity.getOverheatTime() + 30) / 2) && (entity.worldObj.rand.nextInt(7) == 0)) { - entity.overheatLevel++; - } - - /** - * train is breaking, increment a delayer break won't overheat too quickly - */ - if (entity.isBraking) { - breakDelay++; - } - - /** - * Delayer has reached max and speed is not 0: overheat - */ - if (entity.isBraking && breakDelay > 40 && (Math.abs(entity.motionX) + Math.abs(entity.motionZ)) > 0.05) { - if (entity.worldObj.rand.nextInt(10) == 0) { - entity.overheatLevel += 2; - } - } - /** - * When breaking is stopped: delayer goes back to 0 - */ - if (!entity.isBraking) { - breakDelay = 0; - } - - /** - * train is climbing, overheat goes up 0.05 = 10km/h 0.1 = 21km/h - */ - if (entity.isClimbing && (locoActualSpeed >= entity.convertSpeed((Locomotive) entity) - 0.05) && (entity.worldObj.rand.nextInt(10) == 0)) { - //entity.overheatLevel++; - } - - if (entity instanceof SteamTrain) { - int waterLevel = ((SteamTrain) entity).getWater(); - /** - * water is empty => overheats - */ - if ((waterLevel < 1) && entity.fuelTrain > 10) { - if (entity.worldObj.rand.nextInt(10) == 0) { - entity.overheatLevel += 3; - } - } - int maxWaterLevel = ((SteamTrain) entity).getCartTankCapacity(); - if ((waterLevel > maxWaterLevel - (maxWaterLevel / 2)) && entity.overheatLevel > entity.getAverageOverheat() && !((Locomotive) entity).getState().equals("broken")) { - entity.overheatLevel--; - } - } - - if (entity.overheatLevel < entity.getAverageOverheat() - (overheatRatio(17, entity))) { - ((Locomotive) entity).setState("cold"); - } - if (entity.overheatLevel < entity.getAverageOverheat() - (overheatRatio(4, entity)) && entity.overheatLevel > entity.getAverageOverheat() - (overheatRatio(17, entity))) { - ((Locomotive) entity).setState("warm"); - } - if (entity.overheatLevel > entity.getAverageOverheat() - (overheatRatio(4, entity)) && entity.overheatLevel < entity.getAverageOverheat() + (overheatRatio(12, entity))) { - ((Locomotive) entity).setState("hot"); - } - if (entity.overheatLevel > entity.getAverageOverheat() + (overheatRatio(12, entity))) { - ((Locomotive) entity).setState("very hot"); - } - if (entity.overheatLevel > entity.getAverageOverheat() + (overheatRatio(17, entity))) { - ((Locomotive) entity).setState("too hot"); - } - if (entity.overheatLevel > entity.getAverageOverheat() + (overheatRatio(24, entity))) { - ((Locomotive) entity).setState("broken"); - } - entity.setOverheatLevel(entity.overheatLevel); - } - - } - - /** - * locomotives have different heating time this convert to the size of the heat bar in the HUD - * - * @param pixels - * @return - */ - private double overheatRatio(double pixels, EntityRollingStock entity) { - /** - * size in pixels of the heat bar - */ - double barSize = 50; - return (entity.getOverheatTime() * (pixels / barSize)); - } + /** + * a delayer to avoid instant overheating + */ + private int breakDelay = 0; + + /** + * constructor + * + * @param entity the entity to handle + */ + public HandleOverheating(EntityRollingStock entity) { + + } + + /** + * Handle the overheating for locomotives + */ + public void HandleHeatLevel(EntityRollingStock entity) { + + entity.overheatLevel = entity.getOverheatLevel(); + + if (entity instanceof Locomotive && entity.canOverheat()) { + double locoActualSpeed = MathHelper.sqrt_double(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ); + + /** + * speed is low, overheat goes down to normal + */ + if ((locoActualSpeed <= 0 + 0.05) && !entity.isBraking && entity.overheatLevel > entity.getAverageOverheat() && (entity.worldObj.rand.nextInt(10) == 0) && !((Locomotive) entity).getState().equals("broken")) { + entity.overheatLevel--; + } + /** + * speed is low, overheat goes down to normal + */ + if ((locoActualSpeed <= 0 + 0.10) && !entity.isBraking && entity.overheatLevel > entity.getAverageOverheat() && (entity.worldObj.rand.nextInt(10) == 0) && !((Locomotive) entity).getState().equals("broken")) { + entity.overheatLevel--; + + } + /** + * fuel is empty, heat level goes down + */ + if (entity.fuelTrain < 1 && entity.overheatLevel > 0 && (entity.worldObj.rand.nextInt(10) == 0) && !((Locomotive) entity).getState().equals("broken")) { + entity.overheatLevel--; + + } + /** + * Heat goes down with time + */ + if ((entity.overheatLevel > (entity.getOverheatTime() + 30) / 2) && (entity.worldObj.rand.nextInt(30) == 0) && !((Locomotive) entity).getState().equals("broken")) { + entity.overheatLevel--; + } + /** + * train is fueled => heat level goes up to normal + */ + if (((Locomotive) entity).isLocoTurnedOn() && entity.fuelTrain > 1 && (entity.overheatLevel < (entity.getOverheatTime() + 30) / 2) && (entity.worldObj.rand.nextInt(7) == 0)) { + entity.overheatLevel++; + } + + /** + * train is breaking, increment a delayer break won't overheat too quickly + */ + if (entity.isBraking) { + breakDelay++; + } + + /** + * Delayer has reached max and speed is not 0: overheat + */ + if (entity.isBraking && breakDelay > 40 && (Math.abs(entity.motionX) + Math.abs(entity.motionZ)) > 0.05) { + if (entity.worldObj.rand.nextInt(10) == 0) { + entity.overheatLevel += 2; + } + } + /** + * When breaking is stopped: delayer goes back to 0 + */ + if (!entity.isBraking) { + breakDelay = 0; + } + + /** + * train is climbing, overheat goes up 0.05 = 10km/h 0.1 = 21km/h + */ + if (entity.isClimbing && (locoActualSpeed >= entity.convertSpeed((Locomotive) entity) - 0.05) && (entity.worldObj.rand.nextInt(10) == 0)) { + //entity.overheatLevel++; + } + + if (entity instanceof SteamTrain) { + int waterLevel = ((SteamTrain) entity).getWater(); + /** + * water is empty => overheats + */ + if ((waterLevel < 1) && entity.fuelTrain > 10) { + if (entity.worldObj.rand.nextInt(10) == 0) { + entity.overheatLevel += 3; + } + } + int maxWaterLevel = ((SteamTrain) entity).getCartTankCapacity(); + if ((waterLevel > maxWaterLevel - (maxWaterLevel / 2)) && entity.overheatLevel > entity.getAverageOverheat() && !((Locomotive) entity).getState().equals("broken")) { + entity.overheatLevel--; + } + } + + if (entity.overheatLevel < entity.getAverageOverheat() - (overheatRatio(17, entity))) { + ((Locomotive) entity).setState("cold"); + } + + if (entity.overheatLevel < entity.getAverageOverheat() - (overheatRatio(4, entity)) && entity.overheatLevel > entity.getAverageOverheat() - (overheatRatio(17, entity))) { + ((Locomotive) entity).setState("warm"); + } + + if (entity.overheatLevel > entity.getAverageOverheat() - (overheatRatio(4, entity)) && entity.overheatLevel < entity.getAverageOverheat() + (overheatRatio(12, entity))) { + ((Locomotive) entity).setState("hot"); + } + + if (entity.overheatLevel > entity.getAverageOverheat() + (overheatRatio(12, entity))) { + ((Locomotive) entity).setState("very hot"); + } + + if (entity.overheatLevel > entity.getAverageOverheat() + (overheatRatio(17, entity))) { + ((Locomotive) entity).setState("too hot"); + } + + if (entity.overheatLevel > entity.getAverageOverheat() + (overheatRatio(24, entity))) { + ((Locomotive) entity).setState("broken"); + } + entity.setOverheatLevel(entity.overheatLevel); + } + + } + + /** + * locomotives have different heating time this convert to the size of the heat bar in the HUD + * + * @param pixels the size of the heat bar in the HUD + * @return the ratio of the heat bar + */ + private double overheatRatio(double pixels, EntityRollingStock entity) { + /** + * size in pixels of the heat bar + */ + double barSize = 50; + return (entity.getOverheatTime() * (pixels / barSize)); + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/TrainModBlockUtil.java b/src/main/java/train/common/core/TrainModBlockUtil.java index 0009e9e41e..e376e00d81 100644 --- a/src/main/java/train/common/core/TrainModBlockUtil.java +++ b/src/main/java/train/common/core/TrainModBlockUtil.java @@ -7,14 +7,14 @@ import java.util.ArrayList; public class TrainModBlockUtil { - public static ArrayList getItemStackFromBlock(World world, int i, int j, int k) { - Block block = world.getBlock(i, j, k); + public static ArrayList getItemStackFromBlock(World world, int i, int j, int k) { + Block block = world.getBlock(i, j, k); - if (block == null) { - return null; - } + if (block == null) { + return null; + } - int meta = world.getBlockMetadata(i, j, k); - return block.getDrops(world, i, j, k, meta, 0); - } + int meta = world.getBlockMetadata(i, j, k); + return block.getDrops(world, i, j, k, meta, 0); + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/TrainModCore.java b/src/main/java/train/common/core/TrainModCore.java index 6a2e733951..3e42069a0d 100644 --- a/src/main/java/train/common/core/TrainModCore.java +++ b/src/main/java/train/common/core/TrainModCore.java @@ -1,6 +1,5 @@ package train.common.core; -import cpw.mods.fml.common.Loader; import train.common.Traincraft; import train.common.core.plugins.PluginRailcraft; @@ -10,39 +9,39 @@ import java.util.Scanner; public class TrainModCore { - - private static Boolean rcVanillaRecipes = true; - - public static void readRailcraftConfig() { - File file = new File("./config/railcraft/railcraft.cfg"); - try { - @SuppressWarnings("resource") Scanner scanner = new Scanner(new FileInputStream(file)); - - while (scanner.hasNextLine()) { - String line = scanner.nextLine().trim(); - - if (line.equals("B:useAltRecipes=true")) { - rcVanillaRecipes = true; - } else if (line.equals("B:useAltRecipes=false")) { - rcVanillaRecipes = false; - } - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - - public static void ModsLoaded() { - if(Loader.isModLoaded("Railcraft")){ - readRailcraftConfig(); - if (!rcVanillaRecipes) { - PluginRailcraft.init(); - Traincraft.tcLog.info("Enabled Traincraft additional tracks for Railcraft"); - } else { - Traincraft.tcLog.info( - "You've enabled vanilla rail recipes in Railcraft. Disable them to get Traincraft additional tracks"); - } - } - } + + private static Boolean rcVanillaRecipes = true; + + public static void readRailcraftConfig() { + File file = new File("./config/railcraft/railcraft.cfg"); + try { + Scanner scanner = new Scanner(new FileInputStream(file)); + + while (scanner.hasNextLine()) { + String line = scanner.nextLine().trim(); + + if (line.equals("B:useAltRecipes=true")) { + rcVanillaRecipes = true; + } else if (line.equals("B:useAltRecipes=false")) { + rcVanillaRecipes = false; + } + } + } catch (FileNotFoundException exception) { + exception.printStackTrace(); + } + } + + public static void ModsLoaded() { + if (Traincraft.hasRailcraft()) { + readRailcraftConfig(); + if (!rcVanillaRecipes) { + PluginRailcraft.init(); + Traincraft.tcLog.info("Enabled Traincraft additional tracks for Railcraft"); + } else { + Traincraft.tcLog.info( + "You've enabled vanilla rail recipes in Railcraft. Disable them to get Traincraft additional tracks"); + } + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/Traincraft_EventSounds.java b/src/main/java/train/common/core/Traincraft_EventSounds.java index 337744af2b..c747c6543a 100644 --- a/src/main/java/train/common/core/Traincraft_EventSounds.java +++ b/src/main/java/train/common/core/Traincraft_EventSounds.java @@ -2,7 +2,7 @@ public class Traincraft_EventSounds { - //TODO audio has moved to JSON support only + //TODO audio has moved to JSON support only /* @SubscribeEvent public void onSound(SoundLoadEvent event) { diff --git a/src/main/java/train/common/core/handlers/RecipeHandler.java b/src/main/java/train/common/core/handlers/RecipeHandler.java index 418976126a..978d1a922e 100644 --- a/src/main/java/train/common/core/handlers/RecipeHandler.java +++ b/src/main/java/train/common/core/handlers/RecipeHandler.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -15,7 +15,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; -import scala.Char; import train.common.inventory.TrainCraftingManager; import train.common.library.BlockIDs; import train.common.library.ItemIDs; @@ -28,537 +27,526 @@ public class RecipeHandler { - private static ArrayList multiNameOreDict(String ... names){ - ArrayList entries = new ArrayList(); - for (String name : names){ - entries.addAll(OreDictionary.getOres(name)); - - } - return entries; - } - - public static void initBlockRecipes() { - ArrayList iron = OreDictionary.getOres("ingotIron"); - - TrainCraftingManager.instance.getRecipeList().add(new RecipesArmorDyes()); - /* Assembly tables */ - for (ItemStack ironingot : iron) { - GameRegistry.addRecipe(new ItemStack(BlockIDs.assemblyTableI.block, 1), "IPI", "S S", "SPS", Character.valueOf('I'), ironingot, Character.valueOf('P'), Blocks.piston, Character.valueOf('S'), Blocks.stone); - } - GameRegistry.addRecipe(new ItemStack(BlockIDs.assemblyTableII.block, 1), "GPG", "O O", "OPO", Character.valueOf('G'), Items.gold_ingot, Character.valueOf('P'), Blocks.piston, Character.valueOf('O'), Blocks.obsidian ); - GameRegistry.addRecipe(new ItemStack(BlockIDs.assemblyTableIII.block, 1), "GPG", "DLD", "OPO", Character.valueOf('G'), Items.gold_ingot, Character.valueOf('P'), Blocks.piston, Character.valueOf('D'), Items.diamond, Character.valueOf('L'), Blocks.glowstone, Character.valueOf('O'), Blocks.obsidian ); - - if (!ConfigHandler.DISABLE_TRAIN_WORKBENCH) { - for (ItemStack ironingot : iron) { - addDictRecipe(new ItemStack(BlockIDs.trainWorkbench.block, 1), "###", "IFI", "###", Character.valueOf('#'), "plankWood", Character.valueOf('F'), Blocks.furnace, Character.valueOf('I'), ironingot); - } - } - addDictRecipe(new ItemStack(BlockIDs.distilIdle.block, 1), "###", "#F#", "###", Character.valueOf('#'), "ingotSteel", Character.valueOf('F'), ItemIDs.firebox.item ); - - /* Open Hearth Furnace */ - if (!ConfigHandler.MAKE_MODPACKS_GREAT_AGAIN) { - GameRegistry.addRecipe(new ItemStack(BlockIDs.openFurnaceIdle.block, 1), "#L#", "#B#", "#I#", - Character.valueOf('#'), Blocks.nether_brick, Character.valueOf('L'), Items.lava_bucket, - Character.valueOf('B'), Items.bucket, Character.valueOf('I'), Blocks.iron_block); - } - - /* Lantern */ - for (ItemStack ironingot : iron) { - GameRegistry.addRecipe(new ItemStack(BlockIDs.lantern.block, 4), "III", "PTP", "III", Character.valueOf('I'), ironingot, Character.valueOf('P'), Blocks.glass_pane, Character.valueOf('T'), Blocks.torch); - } - - /* Clothes */ - GameRegistry.addRecipe(new ItemStack(ItemIDs.overalls.item, 1), " # ", "X$X", "X$X", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('$'), Items.leather_leggings, Character.valueOf('#'), new ItemStack(Items.dye, 1, 1) ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.jacket.item, 1), "X X", "X$X", "X#X", Character.valueOf('X'), new ItemStack(Items.dye, 1, 14), Character.valueOf('$'), Items.leather_chestplate, Character.valueOf('#'), Items.string ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.hat.item, 1), " X ", "X$X", "#X#", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('$'), Items.leather_helmet, Character.valueOf('#'), Items.string ); - - /* Driver Clothes*/ - GameRegistry.addRecipe(new ItemStack(ItemIDs.pants_driver_paintable.item, 1), "XXX", "XLX", "X$X", Character.valueOf('L'), Items.leather_leggings,Character.valueOf('$'), new ItemStack(Items.dye, 1, 4), Character.valueOf('X'), Items.string); - GameRegistry.addRecipe(new ItemStack(ItemIDs.jacket_driver_paintable.item, 1), "X X", "XRX", "XPX", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('P'), Items.leather_chestplate,Character.valueOf('R'), new ItemStack(Items.dye, 1, 1) ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.hat_driver_paintable.item, 1), "#$#", "# #", Character.valueOf('$'), new ItemStack(Items.dye, 1, 4), Character.valueOf('#'), Items.string ); - - /* Ticket Man Clothes */ - GameRegistry.addRecipe(new ItemStack(ItemIDs.pants_ticketMan_paintable.item, 1), "XXX", "XLX", "X$X", Character.valueOf('L'), Items.leather_leggings,Character.valueOf('$'), new ItemStack(Items.dye, 1, 8), Character.valueOf('X'), Items.string); - GameRegistry.addRecipe(new ItemStack(ItemIDs.jacket_ticketMan_paintable.item, 1), "X X", "XPX", "X#X", Character.valueOf('P'), Items.leather_chestplate, Character.valueOf('#'), new ItemStack(Items.dye, 1, 4), Character.valueOf('X'), Items.string); - GameRegistry.addRecipe(new ItemStack(ItemIDs.hat_ticketMan_paintable.item, 1), "#$#", "# #", Character.valueOf('$'), new ItemStack(Items.dye, 1, 0), Character.valueOf('#'), Items.string ); - - /* Recipe book */ - GameRegistry.addRecipe(new ItemStack(ItemIDs.recipeBook.item, 1), "TTT", "TBT", "TTT", Character.valueOf('T'), Blocks.rail, Character.valueOf('B'), Items.book ); - - - - // Track recipes for crafting table - TheDoctor1138 - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallStraight.item, 16), "G G", "BPB", "G G", Character.valueOf('G'), Items.iron_ingot, Character.valueOf('P'), Blocks.planks, Character.valueOf('B'), ItemIDs.bolt.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumStraight.item, 1), "G ", "G ", "G ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLongStraight.item, 1), "G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailMediumStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongStraight.item, 1), "G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailLongStraight.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumDiagonalStraight.item, 1 ), " G", " G ", "G ", Character.valueOf('G'), ItemIDs.tcRailSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLongDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailMediumDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailLongDiagonalStraight.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumTurn.item, 1), "GG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeTurn.item, 1), " SS", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeTurn.item, 1), "GG ","G "," ", Character.valueOf('G'), ItemIDs.tcRailLargeTurn.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSuperLargeTurn.item, 1), "GG ","G "," ", Character.valueOf('G'), ItemIDs.tcRailVeryLargeTurn.item ); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMedium45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailMediumTurn.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLarge45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailLargeTurn.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLarge45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailVeryLargeTurn.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSuperLarge45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailSuperLargeTurn.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelCurve.item, 1), " S ", "S ", " ", Character.valueOf('S'), ItemIDs.tcRailSmallParallelCurve.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeParallelCurve.item, 1), " S ", "S ", " ", Character.valueOf('S'), ItemIDs.tcRailMediumParallelCurve.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumSwitch.item, 1), "G ", "GHG", "G ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailMediumTurn.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelSwitch.item, 1), "I G", "IHH", "IH ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailMediumTurn.item, Character.valueOf('I'), ItemIDs.tcRailMediumStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSwitch.item, 1), "G ", "HIG", "G ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('I'), ItemIDs.tcRailLargeTurn.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMedium45DegreeSwitch.item, 1), "G D", "GH ", "G ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailMedium45DegreeTurn.item, Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeWood.item, 1), " TP","TPP","PPP", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('P'), Blocks.planks); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeWood.item, 1), " "," T"," T ", Character.valueOf('T'), ItemIDs.tcRailSlopeWood.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeWood.item, 1), " T"," T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeWood.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeSnowGravel.item, 1), " TS","TSS","SSS", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('S'), new ItemStack(BlockIDs.snowGravel.block, 1,4)); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeSnowGravel.item, 1), " "," T"," T ", Character.valueOf('T'), ItemIDs.tcRailSlopeSnowGravel.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeSnowGravel.item, 1), " T"," T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeSnowGravel.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeGravel.item, 1), " TG","TGG","GGG", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('G'), Blocks.gravel); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeGravel.item,1), " "," S"," S ", Character.valueOf('S'), ItemIDs.tcRailSlopeGravel.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeGravel.item, 1), " T", " T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeGravel.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeDynamic.item, 1), " TG","TGG","GGG", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('G'), new ItemStack(Items.dye, 1, 1)); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeDynamic.item,1), " "," S"," S ", Character.valueOf('S'), ItemIDs.tcRailSlopeDynamic.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeDynamic.item, 1), " T", " T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeDynamic.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSlopeDynamic.item, 1), " TG","TGG","GGG", Character.valueOf('T'), ItemIDs.tcRailEmbeddedMediumStraight.item, Character.valueOf('G'), new ItemStack(Items.dye, 1, 1)); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeSlopeDynamic.item,1), " "," S"," S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSlopeDynamic.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeSlopeDynamic.item, 1), " T", " T ","T ", Character.valueOf('T'), ItemIDs.tcRailEmbeddedSlopeDynamic.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", Character.valueOf('T'), ItemIDs.tcRailLargeTurn.item, Character.valueOf('S'), ItemIDs.tcRailSlopeDynamic.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", Character.valueOf('T'), ItemIDs.tcRailVeryLargeTurn.item, Character.valueOf('S'), ItemIDs.tcRailLargeSlopeDynamic.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSuperLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", Character.valueOf('T'), ItemIDs.tcRailSuperLargeTurn.item, Character.valueOf('S'), ItemIDs.tcRailVeryLargeSlopeDynamic.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeBallast.item, 1), " TG","TGG","GGG", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('G'), new ItemStack(BlockIDs.oreTC.block, 1, 3)); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeBallast.item,1), " "," S"," S ", Character.valueOf('S'), ItemIDs.tcRailSlopeBallast.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeBallast.item, 1), " T", " T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeBallast.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailTwoWaysCrossing.item, 1), " S ", "SSS", " S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDiagonalTwoWaysCrossing.item, 1), "D D", " D ","D D", Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item) ; - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDiamondCrossing.item, 1), " SD", " S ", "DS ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDiamondCrossing.item, 1), "DS ", " S ", " SD", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDoubleDiamondCrossing.item, 1),"DSD", " S ", "DSD", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailFourWaysCrossing.item, 1), "DSD", "SDS", "DSD", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallStraight.item, 16), "I I", "B B", "I I", Character.valueOf('I'), Items.iron_ingot, Character.valueOf('B'), ItemIDs.bolt.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumStraight.item, 1), "G ", "G ", "G ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongStraight.item, 1), "G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedMediumStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongStraight.item, 1), "G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedLongStraight.item ); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item, 1 ), " G", " G ", "G ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedLongDiagonalStraight.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumTurn.item, 1), "GG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeTurn.item, 1), " SS", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeTurn.item, 1), "GG ","G "," ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedLargeTurn.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLargeTurn.item, 1), "GG ","G "," ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedVeryLargeTurn.item ); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMedium45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailEmbeddedMediumTurn.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLarge45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailEmbeddedLargeTurn.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLarge45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailEmbeddedVeryLargeTurn.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLarge45DegreeTurn.item, 1), "TG ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('T'), ItemIDs.tcRailEmbeddedSuperLargeTurn.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallParallelCurve.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedMediumParallelCurve.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumSwitch.item, 1), "G ", "GHG", "G ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailEmbeddedMediumTurn.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumParallelSwitch.item, 1), "I G", "IHH", "IH ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailEmbeddedMediumTurn.item, Character.valueOf('I'), ItemIDs.tcRailEmbeddedMediumStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeSwitch.item, 1), "G ", "HIG", "G ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailEmbeddedMediumStraight.item, Character.valueOf('I'), ItemIDs.tcRailEmbeddedLargeTurn.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMedium45DegreeSwitch.item, 1), "G D", "GH ", "G ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('H'), ItemIDs.tcRailEmbeddedMedium45DegreeTurn.item, Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", Character.valueOf('T'), ItemIDs.tcRailEmbeddedLargeTurn.item, Character.valueOf('S'), ItemIDs.tcRailEmbeddedSlopeDynamic.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", Character.valueOf('T'), ItemIDs.tcRailEmbeddedVeryLargeTurn.item, Character.valueOf('S'), ItemIDs.tcRailEmbeddedLargeSlopeDynamic.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", Character.valueOf('T'), ItemIDs.tcRailEmbeddedSuperLargeTurn.item, Character.valueOf('S'), ItemIDs.tcRailEmbeddedVeryLargeSlopeDynamic.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedTwoWaysCrossing.item, 1), " S ", "SSS", " S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDiagonalTwoWaysCrossing.item, 1), "D D", " D ","D D", Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item) ; - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDiamondCrossing.item, 1), " SD", " S ", "DS ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDiamondCrossing.item, 1), "DS ", " S ", " SD", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDoubleDiamondCrossing.item, 1),"DSD", " S ", "DSD", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedFourWaysCrossing.item, 1), "DSD", "SDS", "DSD", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - - - //Track Conversion Recipes to Normal Rails - - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallStraight.item, 1), " ", " R ", " ", Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail));// small straight track - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing.item, 1), " ", "SRS", " ", Character.valueOf('S'), new ItemStack(Blocks.stained_hardened_clay, 1, 15), Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail) ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing1.item, 1), " ", "SRS", " ", Character.valueOf('S'), new ItemStack(Blocks.stained_hardened_clay, 1, 7), Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail) ); - GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing2.item, 1), " ", "SRS", " ", Character.valueOf('S'), new ItemStack(Blocks.stained_hardened_clay, 1, 3), Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail) ); - GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallStraight.item); - GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallRoadCrossing.item); - GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallRoadCrossing1.item); - GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallRoadCrossing2.item); - - GameRegistry.addRecipe(new ItemStack(ItemIDs.paintbrushThing.item,1),"GB ","RIS"," ST", Character.valueOf('G'), new ItemStack(Items.dye,1,2), Character.valueOf('B'), new ItemStack(Items.dye,1,4), Character.valueOf('R'), new ItemStack(Items.dye,1,1), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('S'), new ItemStack(Items.string), Character.valueOf('T'), new ItemStack(Items.stick)); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.poweredGravel.block,1), new ItemStack(Items.redstone), new ItemStack(Blocks.gravel)); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.snowGravel.block,1 ), new ItemStack(Items.snowball), new ItemStack(Blocks.gravel)); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.snowGravel.block,4 ), new ItemStack(Blocks.snow), new ItemStack(Blocks.gravel), new ItemStack(Blocks.gravel), new ItemStack(Blocks.gravel), new ItemStack(Blocks.gravel)); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.asphalt.block, 8), new ItemStack(ItemIDs.coaldust.item),new ItemStack(ItemIDs.coaldust.item),new ItemStack(ItemIDs.coaldust.item),new ItemStack(ItemIDs.coaldust.item), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltSlab.block, 6), "BBB", " ", " ", Character.valueOf('B'), new ItemStack(BlockIDs.asphalt.block)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltSlab.block, 6), " ", "BBB", " ", Character.valueOf('B'), new ItemStack(BlockIDs.asphalt.block)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltSlab.block, 6), " ", " ", "BBB", Character.valueOf('B'), new ItemStack(BlockIDs.asphalt.block)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltStairs.block, 4), "B ", "BB ", "BBB", Character.valueOf('B'), new ItemStack(BlockIDs.asphalt.block)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltStairs.block, 4), " B", " BB", "BBB", Character.valueOf('B'), new ItemStack(BlockIDs.asphalt.block)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.signalSpanish.block,1), " L ", " I ", "RIR", Character.valueOf('L'), new ItemStack(Blocks.redstone_lamp), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('R'), new ItemStack(Items.redstone)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.kSignal.block,1), "RIR", " I ", " L ", Character.valueOf('L'), new ItemStack(Blocks.redstone_lamp), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('R'), new ItemStack(Items.redstone)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.bridgePillar.block, 8), "SSS", "SLS", "SSS", Character.valueOf('S'), new ItemStack(Items.stick), Character.valueOf('L'), new ItemStack(Blocks.log)); - GameRegistry.addRecipe(new ItemStack(BlockIDs.speedSign.block, 8), " R ", " I ", " I ", Character.valueOf('R'), new ItemStack(Items.dye,1,1), Character.valueOf('I'), new ItemStack(Items.iron_ingot)); - - //Gravel - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.oreTC.block, 4,3), Blocks.gravel, Blocks.gravel, Items.clay_ball); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.oreTC.block, 16, 3), Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.clay); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.highSpeedBallast.block, 16),Items.quartz,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel, Blocks.clay); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.dirtyBallast.block, 16),Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel,Blocks.gravel, Blocks.dirt); - GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.dirtierBallast.block, 16), new ItemStack(BlockIDs.dirtyBallast.block,1 ), new ItemStack(BlockIDs.dirtyBallast.block,1 ),new ItemStack(BlockIDs.dirtyBallast.block,1 ),new ItemStack(BlockIDs.dirtyBallast.block,1 ),new ItemStack(BlockIDs.dirtyBallast.block,1 ),new ItemStack(BlockIDs.dirtyBallast.block,1 ),new ItemStack(BlockIDs.dirtyBallast.block,1 ),new ItemStack(BlockIDs.dirtyBallast.block,1 ), Blocks.dirt); - - for (ItemStack ironingot : iron) { - addDictRecipe(new ItemStack(BlockIDs.switchStand.block, 1), " W ", " I ", " R ", Character.valueOf('W'), Blocks.lever, Character.valueOf('R'), Items.stick, Character.valueOf('I'), ironingot); - addDictRecipe(new ItemStack(BlockIDs.MILWSwitchStand.block, 1)," RW","BWR","AAA", Character.valueOf('A'), new ItemStack(Items.stick), Character.valueOf('B'), Blocks.iron_bars, Character.valueOf('R'), new ItemStack(Items.dye, 1, 1), Character.valueOf('W'), new ItemStack(Items.dye, 1, 15)); - addDictRecipe(new ItemStack(BlockIDs.MFPBWigWag.block, 1), "IWI", " I ", " I ", Character.valueOf('W'), Blocks.lever, Character.valueOf('I'), ironingot); - /*Buffer*/ - addDictRecipe(new ItemStack(BlockIDs.stopper.block, 1), "WWW", "I I", "RRR", Character.valueOf('W'), "plankWood", Character.valueOf('R'), Blocks.rail, Character.valueOf('I'), ironingot); - addDictRecipe(new ItemStack(BlockIDs.embeddedStopper.block, 1), " ", "I I", "RRR", Character.valueOf('R'), Blocks.rail, Character.valueOf('I'), ironingot); - addDictRecipe(new ItemStack(BlockIDs.americanstopper.block, 1), "III", "I I", "RRR", Character.valueOf('R'), Blocks.rail, Character.valueOf('I'), ironingot); - addDictRecipe(new ItemStack(BlockIDs.metroMadridPole.block, 1), "III", " I ", "C C", Character.valueOf('I'), ironingot, Character.valueOf('C'), ItemIDs.ingotCopper.item); - } - - GameRegistry.addRecipe(new ItemStack(ItemIDs.bolt.item, 16), " II", " I ", " I ", Character.valueOf('I'), Items.iron_ingot); - - } - - public static void initItemRecipes() { - - ArrayList steel = OreDictionary.getOres("ingotSteel"); - ArrayList iron = OreDictionary.getOres("ingotIron"); - ArrayList planks = OreDictionary.getOres("plankWood"); - ArrayList logs = OreDictionary.getOres("logWood"); - ArrayList plastics = multiNameOreDict("itemPlastic", "dustPlastic");//dustPlastic for MFR support - ArrayList copper = OreDictionary.getOres("ingotCopper"); - ArrayList dustCoal = OreDictionary.getOres("dustCoal"); - List coal = new ArrayList(); - coal.add(new ItemStack(Items.coal)); - coal.addAll(OreDictionary.getOres("coal")); - ArrayList redstone = OreDictionary.getOres("dustRedstone"); - ArrayList waterbucket = waterContainers(); - // Always do this " X " instead of this "X", and do not put "" empty brackets - - /* I placed it here because workbench should be one of the first recipe shown in the recipe book */ - for (ItemStack plank : planks) { - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.trainWorkbench.block, 1), "###", "IFI", "###", Character.valueOf('#'), plank, Character.valueOf('F'), Blocks.furnace, Character.valueOf('I'), ironingot); - } - } - - /* Recipe book */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.recipeBook.item, 1), "TTT", "TBT", "TTT", Character.valueOf('T'), Blocks.rail, Character.valueOf('B'), Items.book ); - - /* Chunk Loader Activator */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.chunkLoaderActivator.item, 1), " P", " S ", "S ", Character.valueOf('S'), Items.blaze_rod, Character.valueOf('P'), Items.ender_pearl ); - - // Switches -hariesh - GameRegistry.addRecipe(new ItemStack(BlockIDs.owoYardSwitchStand.block,1), " ","OS ","IW ", Character.valueOf('O'), new ItemStack(Items.dye, 1, 14), Character.valueOf('S'), Items.stick, Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Blocks.planks); - GameRegistry.addRecipe(new ItemStack(BlockIDs.owoSwitchStand.block, 1), " O "," S ", " IW", Character.valueOf('O'), new ItemStack(Items.dye, 1, 14), Character.valueOf('S'), Items.stick, Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Blocks.planks); - GameRegistry.addRecipe(new ItemStack(BlockIDs.circleSwitchStand.block, 1), " R ", " S ", " IW", Character.valueOf('R'), new ItemStack(Items.dye, 1, 1), Character.valueOf('S'), Items.stick, Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Blocks.planks); - GameRegistry.addRecipe(new ItemStack(BlockIDs.autoSwtichStand.block, 1), " ","C ","BIW", Character.valueOf('C'), new ItemStack(ItemIDs.electronicCircuit.item,1), Character.valueOf('B'), Blocks.iron_block, Character.valueOf('S'), Items.stick, Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Blocks.planks); - GameRegistry.addRecipe(new ItemStack(ItemIDs.paintbrushThing.item,1),"GB ","RIS"," ST", Character.valueOf('G'), new ItemStack(Items.dye,1,2), Character.valueOf('B'), new ItemStack(Items.dye,1,4), Character.valueOf('R'), new ItemStack(Items.dye,1,1), Character.valueOf('I'), new ItemStack(Items.iron_ingot), Character.valueOf('S'), new ItemStack(Items.string), Character.valueOf('T'), new ItemStack(Items.stick)); - - - - /* Assembly tables */ - - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.assemblyTableI.block, 1), "IPI", "S S", "SPS", Character.valueOf('I'), ironingot, Character.valueOf('P'), Blocks.piston, Character.valueOf('S'), Blocks.stone); - } - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.assemblyTableII.block, 1), "GPG", "O O", "OPO", Character.valueOf('G'), Items.gold_ingot, Character.valueOf('P'), Blocks.piston, Character.valueOf('O'), Blocks.obsidian ); - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.assemblyTableIII.block, 1), "GPG", "DLD", "OPO", Character.valueOf('G'), Items.gold_ingot, Character.valueOf('P'), Blocks.piston, Character.valueOf('D'), Items.diamond, Character.valueOf('L'), Blocks.glowstone, Character.valueOf('O'), Blocks.obsidian ); - - /* Open Hearth Furnace */ - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.openFurnaceIdle.block, 1), "#L#", "#B#", "#I#", Character.valueOf('#'), Blocks.nether_brick, Character.valueOf('L'), Items.lava_bucket, Character.valueOf('B'), Items.bucket, Character.valueOf('I'), Blocks.iron_block ); - - /* Lantern */ - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.lantern.block, 4), "III", "PTP", "III", Character.valueOf('I'), ironingot, Character.valueOf('P'), Blocks.glass_pane, Character.valueOf('T'), Blocks.torch); - } - /* Clothes */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.overalls.item, 1), " # ", "X$X", "X X", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('$'), Items.leather_leggings, Character.valueOf('#'), new ItemStack(Items.dye, 1, 1) ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket.item, 1), "X X", "X$X", "X#X", Character.valueOf('X'), new ItemStack(Items.dye, 1, 14), Character.valueOf('$'), Items.leather_chestplate, Character.valueOf('#'), Items.string ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.hat.item, 1), " X ", "X$X", "#X#", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('$'), Items.leather_helmet, Character.valueOf('#'), Items.string ); - - /* Driver Clothes*/ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.pants_driver_paintable.item, 1), "XXX", "XLX", "X$X", Character.valueOf('L'), Items.leather_leggings,Character.valueOf('$'), new ItemStack(Items.dye, 1, 4), Character.valueOf('X'), Items.string); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket_driver_paintable.item, 1), "X X", "XRX", "XPX", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('P'), Items.leather_chestplate,Character.valueOf('R'), new ItemStack(Items.dye, 1, 1) ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.hat_driver_paintable.item, 1), "#$#", "# #", Character.valueOf('$'), new ItemStack(Items.dye, 1, 4), Character.valueOf('#'), Items.string ); - - /* Ticket Man Clothes */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.pants_ticketMan_paintable.item, 1), "XXX", "XLX", "X$X", Character.valueOf('L'), Items.leather_leggings,Character.valueOf('$'), new ItemStack(Items.dye, 1, 8), Character.valueOf('X'), Items.string); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket_ticketMan_paintable.item, 1), "X X", "XPX", "X#X", Character.valueOf('P'), Items.leather_chestplate, Character.valueOf('#'), new ItemStack(Items.dye, 1, 4), Character.valueOf('X'), Items.string); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.hat_ticketMan_paintable.item, 1), "#$#", "# #", Character.valueOf('$'), new ItemStack(Items.dye, 1, 0), Character.valueOf('#'), Items.string ); - - - - if (plastics != null && plastics.size() >= 0) { - for (ItemStack plastic : plastics) { - /* Empty canister */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.emptyCanister.item, 4), "PPP", "P P", "PPP", Character.valueOf('P'), plastic); - for (ItemStack rs :redstone) { - /* Electronic circuit */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.electronicCircuit.item, 1), "XXX", "RPR", "XXX", Character.valueOf('X'), ItemIDs.copperWireFine.item, Character.valueOf('P'), plastic, Character.valueOf('R'), rs.getItem()); - } - /* Composite Material*/ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.reinforcedPlastic.item, 16), "LPL", "PLP", "GPG", Character.valueOf('G'), Blocks.glass_pane, Character.valueOf('P'), ItemIDs.graphite.item, Character.valueOf('L'), plastic); - - if (copper != null && copper.size() >= 0) { - for (ItemStack copp : copper) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.copperWireFine.item, 6), "XXX", "XPX", "XXX", Character.valueOf('X'), copp, Character.valueOf('P'), plastic ); - GameRegistry.addRecipe(new ItemStack(BlockIDs.overheadWire.block, 16), "IC ","I ","I ", Character.valueOf('I'), new ItemStack(Items.iron_ingot,1), Character.valueOf('C'), copp); - GameRegistry.addRecipe(new ItemStack(BlockIDs.overheadWireDouble.block, 16), "ICI","ICI","I I", Character.valueOf('I'), new ItemStack(Items.iron_ingot,1), Character.valueOf('C'), copp); - - } - } - } - } - - /* Composite Suit */ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.boots_suit_paintable.item, 1), " D ","X X", "XFX", Character.valueOf('F'), Items.feather, Character.valueOf('D'), Items.diamond, Character.valueOf('X'), ItemIDs.reinforcedPlates.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.pants_suit_paintable.item, 1), "XDX", "X$X", "X X", Character.valueOf('$'), Items.fire_charge, Character.valueOf('X'), ItemIDs.reinforcedPlates.item,Character.valueOf('D'), Items.diamond); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket_suit_paintable.item, 1), "X X", "XDX", "XAX", Character.valueOf('A'), Items.golden_apple, Character.valueOf('X'), ItemIDs.reinforcedPlates.item,Character.valueOf('D'), Blocks.diamond_block); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.helmet_suit_paintable.item, 1), "#D#", "# #", Character.valueOf('D'), Blocks.diamond_block, Character.valueOf('#'), ItemIDs.reinforcedPlates.item ); - - /* Trains parts */ - - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.generator.item, 1), " ##", "E$$", " ##", Character.valueOf('#'), ItemIDs.copperWireFine.item, Character.valueOf('E'), ItemIDs.electronicCircuit.item, Character.valueOf('$'), ironingot);// generator - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.controls.item, 1), "#X#", "#E#", "$$$", Character.valueOf('#'), Blocks.lever, Character.valueOf('X'), Blocks.stone_button, Character.valueOf('$'), ironingot, Character.valueOf('E'), ItemIDs.electronicCircuit.item);// train controls - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.electmotor.item, 1), "I#I", "#E#", "I#I", Character.valueOf('#'), ItemIDs.copperWireFine.item, Character.valueOf('I'), ironingot, Character.valueOf('E'), ItemIDs.electronicCircuit.item);// Electric motor - for (ItemStack bucketWater : waterbucket) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironBoiler.item, 2), "###", "XXX", "###", Character.valueOf('#'), ironingot, Character.valueOf('X'), bucketWater.getItem());// iron Boiler - } - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironFirebox.item, 2), "###", "#X#", "###", Character.valueOf('#'), ironingot, Character.valueOf('X'), Items.flint_and_steel );// iron Firebox - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironChimney.item, 2), "# #", "# #", "# #", Character.valueOf('#'), ironingot ); - } - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.dieselengine.item, 2), "###", "XXX", "CCC", Character.valueOf('#'), ItemIDs.piston.item, Character.valueOf('X'), ItemIDs.cylinder.item, Character.valueOf('C'), ItemIDs.camshaft.item);// diesel engine - for (ItemStack dustStack : dustCoal) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.graphite.item, 2), "###", "#X#", "###", Character.valueOf('#'), dustStack, Character.valueOf('X'), Items.clay_ball );// Graphite - } - - if (!ConfigHandler.MAKE_MODPACKS_GREAT_AGAIN) { - for (ItemStack c : coal) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.coaldust.item, 4), - "###", " ", " ", Character.valueOf('#'), c.getItem()); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.coaldust.item, 4), - " ", "###", " ", Character.valueOf('#'), c.getItem()); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.coaldust.item, 4), - " ", " ", "###", Character.valueOf('#'), c.getItem()); - } - } - //TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.signal.item, 2), "#", "X", "X", Character.valueOf('X'), ItemIDs.steel.item, Character.valueOf('#'), rs ); - /* diesel generator */ - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.generatorDiesel.block, 1), "C ", "DE ", Character.valueOf('C'), ItemIDs.steelchimney.item, Character.valueOf('D'), ItemIDs.dieselengine.item, Character.valueOf('E'), ItemIDs.electronicCircuit.item ); - - /* Zepplin parts and zeppelin item */ - if (ConfigHandler.ENABLE_ZEPPELIN) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.balloon.item, 1), "###", "# #", "###", Character.valueOf('#'), Blocks.wool );// Balloon - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steamengine.item, 1), "C ", "BF ", Character.valueOf('C'), ItemIDs.steelchimney.item, Character.valueOf('B'), ItemIDs.boiler.item, Character.valueOf('F'), ItemIDs.firebox.item );// Small steam engine - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.airship.item, 1), "B B", "SES", "POP", Character.valueOf('B'), ItemIDs.balloon.item, Character.valueOf('S'), Items.stick, Character.valueOf('E'), ItemIDs.steamengine.item, Character.valueOf('P'), ItemIDs.propeller.item, Character.valueOf('O'), Items.boat ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.zeppelin.item, 1), "BBB", "SES", "POP", Character.valueOf('B'), ItemIDs.balloon.item, Character.valueOf('S'), ItemIDs.propeller.item, Character.valueOf('E'), ItemIDs.controls.item, Character.valueOf('P'), ItemIDs.electmotor.item, Character.valueOf('O'), ItemIDs.seats.item ); - } - - for (ItemStack plankItem : planks) { - for (ItemStack steelItem: steel) { - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.reinforcedPlates.item, 1), "RRR", "SSS", "CCC", Character.valueOf('R'), ItemIDs.reinforcedPlastic.item, Character.valueOf('S'), steelItem, Character.valueOf('C'), Items.clay_ball); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.composite_wrench.item, 1), "S S", " R "," R ", Character.valueOf('R'), ItemIDs.reinforcedPlastic.item, Character.valueOf('S'),steelItem ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelcab.item, 2), "###", "X X", "XXX", Character.valueOf('X'), steelItem, Character.valueOf('#'), plankItem );// Steel cab - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.distilIdle.block, 1), "###", "#F#", "###", Character.valueOf('#'), steelItem, Character.valueOf('F'), ItemIDs.firebox.item ); - for (ItemStack rs :redstone) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.transformer.item, 1), "# #", "XEX", "###", Character.valueOf('#'), steelItem, Character.valueOf('E'), ItemIDs.electronicCircuit.item, Character.valueOf('X'), rs.getItem());// transformer - } - - for (ItemStack bucketWater :waterbucket) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.boiler.item, 2), "###", "XXX", "###", Character.valueOf('#'), steelItem, Character.valueOf('X'), bucketWater.getItem());// Boiler - } - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.firebox.item, 2), "###", "#X#", "###", Character.valueOf('#'), steelItem, Character.valueOf('X'), Items.flint_and_steel );// Firebox - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.bogie.item, 4), " # ", "#X#", " # ", Character.valueOf('#'), steelItem, Character.valueOf('X'), ironingot);// Bogie - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelframe.item, 2), "# #", "AAA", Character.valueOf('A'), steelItem, Character.valueOf('#'), ironingot);// Steel Frame - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelframe.item, 2), " ", "# #", "AAA", Character.valueOf('A'), steelItem, Character.valueOf('#'), ironingot);// Steel Frame - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.stake.item, 1), " ", "IFI", " ", Character.valueOf('I'), steelItem, Character.valueOf('F'), ironingot ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.stake.item, 1), "IFI", " ", " ", Character.valueOf('I'), steelItem, Character.valueOf('F'), ironingot ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.stake.item, 1), " ", " ", "IFI", Character.valueOf('I'), steelItem, Character.valueOf('F'), ironingot ); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.propeller.item, 2), " # ", "#X#", " # ", Character.valueOf('#'), plankItem, Character.valueOf('X'), ironingot );// Propeller - } - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelchimney.item, 2), "# #", "# #", "# #", Character.valueOf('#'), steelItem );// Bogie - TrainCraftingManager.instance.addRecipe(new ItemStack(Items.flint_and_steel, 2), "* ", " #", Character.valueOf('*'), steelItem, Character.valueOf('#'), Items.flint ); - - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.transmition.item, 1), " # ", "#X#", " # ", Character.valueOf('#'), steelItem, Character.valueOf('X'), ItemIDs.diesel.item );// transmition - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.piston.item, 3), " # ", " X ", Character.valueOf('#'), steelItem, Character.valueOf('X'), Items.stick );// piston - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.camshaft.item, 3), "###", " ", " ", Character.valueOf('#'), steelItem );// camshaft - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.camshaft.item, 3), " ", "###", " ", Character.valueOf('#'), steelItem );// camshaft - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.camshaft.item, 3), " ", " ", "###", Character.valueOf('#'), steelItem );// camshaft - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.cylinder.item, 3), "# #", "# #", "###", Character.valueOf('#'), steelItem );// cylinder - - } - - for (ItemStack logStack :logs) { - /* Water Wheel */ - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.waterWheel.block, 1), " P ", "PGP", " P ", Character.valueOf('P'), logStack,Character.valueOf('G'), ItemIDs.generator.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenBogie.item, 4), " # ", "#X#", " # ", Character.valueOf('#'), plankItem, Character.valueOf('X'), logStack );// wooden Bogie - } - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenFrame.item, 2), "# #", "AAA", Character.valueOf('A'), plankItem, Character.valueOf('#'), plankItem );// wooden Frame - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenFrame.item, 2), " ", "# #", "AAA", Character.valueOf('A'), plankItem, Character.valueOf('#'), plankItem );// wooden Frame - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenCab.item, 2), "###", "X X", "XXX", Character.valueOf('X'), plankItem, Character.valueOf('#'), plankItem );// wooden cab - - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.seats.item, 1), "# ", "## ", "XXX", Character.valueOf('#'), plankItem, Character.valueOf('X'), ironingot);// transformer - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironBogie.item, 4), " # ", "#X#", " # ", Character.valueOf('#'), ironingot, Character.valueOf('X'), plankItem);// iron Bogie - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironFrame.item, 2), "# #", "AAA", Character.valueOf('A'), ironingot, Character.valueOf('#'), plankItem);// iron Frame - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironFrame.item, 2), " ", "# #", "AAA", Character.valueOf('A'), ironingot, Character.valueOf('#'), plankItem);// iron Frame - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironCab.item, 2), "###", "X X", "XXX", Character.valueOf('X'), ironingot, Character.valueOf('#'), plankItem);// iron cab - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.stopper.block, 1), "WWW", "I I", "RRR", Character.valueOf('W'), plankItem, Character.valueOf('R'), Blocks.rail, Character.valueOf('I'), ironingot);// stopper - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.switchStand.block, 1), " W ", " I ", " R ", Character.valueOf('W'), Blocks.lever, Character.valueOf('R'), Items.stick, Character.valueOf('I'), ironingot);//switchstand - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.MFPBWigWag.block, 1), "IWI", " I ", " I ", Character.valueOf('W'), Blocks.lever, Character.valueOf('I'), ironingot);//wigwag - } - // Short Wood Slope - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeWood.item, 1), - " MW", "MWW", "WWW", Character.valueOf('M'), ItemIDs.tcRailMediumStraight.item, - Character.valueOf('W'), plankItem ); - } - /* Wind mill */ - for (ItemStack ironingot : iron) { - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.windMill.block, 1), " R ", " G ", "B B", Character.valueOf('G'), ItemIDs.generator.item, Character.valueOf('B'), ironingot, Character.valueOf('R'), ItemIDs.propeller.item); - - if (Loader.isModLoaded("ComputerCraft")) { - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcTransmitterSpeed.block, 1), "SRS", "RTR", "SRS", 'S', ironingot, 'R', Items.redstone, 'T', Blocks.stone_pressure_plate); - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcReceiverMTC.block, 1), "STS", " R ", "SPS", 'S', ironingot, 'R', Items.redstone, 'P', Items.repeater, 'T', new ItemStack(Blocks.torch, 1)); - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcTransmitterMTC.block, 1), "SPS", " R ", "STS", 'S', ironingot, 'R', Items.redstone, 'P', Items.repeater, 'T', new ItemStack(Blocks.torch, 1)); - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcReceiverDestination.block, 1), "SRS", "RTR", "SRS", 'S', ironingot, 'R', Items.redstone, 'T', Items.sign); - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcATOStopTransmitter.block, 1), " S ", "RTS", " R ", 'S', ironingot, 'R', Items.redstone, 'T', ItemIDs.electronicCircuit.item); - } - } - - -/* - for (ItemStack s: iron) { - - }*/ - - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing.item, 1), " ", "SRS", " ", Character.valueOf('S'), new ItemStack(Blocks.stained_hardened_clay, 1, 15), Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail) ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing1.item, 1), " ", "SRS", " ", Character.valueOf('S'), new ItemStack(Blocks.stained_hardened_clay, 1, 7), Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail) ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing2.item, 1), " ", "SRS", " ", Character.valueOf('S'), new ItemStack(Blocks.stained_hardened_clay, 1, 3), Character.valueOf('R'), Item.getItemFromBlock(Blocks.rail) ); - TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallRoadCrossing.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallRoadCrossing1.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", Character.valueOf('R'), ItemIDs.tcRailSmallRoadCrossing2.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeWood.item, 1), " TP","TPP","PPP", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('P'), Blocks.planks); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeWood.item, 1), " "," T"," T ", Character.valueOf('T'), ItemIDs.tcRailSlopeWood.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeWood.item, 1), " T"," T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeWood.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeSnowGravel.item, 1), " TS","TSS","SSS", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('S'), new ItemStack(BlockIDs.snowGravel.block, 1,4)); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeSnowGravel.item, 1), " "," T"," T ", Character.valueOf('T'), ItemIDs.tcRailSlopeSnowGravel.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeSnowGravel.item, 1), " T"," T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeSnowGravel.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeGravel.item, 1), " TG","TGG","GGG", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('G'), Blocks.gravel); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeGravel.item,1), " "," S"," S ", Character.valueOf('S'), ItemIDs.tcRailSlopeGravel.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeGravel.item, 1), " T", " T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeGravel.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeBallast.item, 1), " TG","TGG","GGG", Character.valueOf('T'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('G'), new ItemStack(BlockIDs.oreTC.block, 1, 3)); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeBallast.item,1), " "," S"," S ", Character.valueOf('S'), ItemIDs.tcRailSlopeBallast.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeBallast.item, 1), " T", " T ","T ", Character.valueOf('T'), ItemIDs.tcRailSlopeBallast.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallStraight.item, 16), "G G", "BPB", "G G", Character.valueOf('G'), Items.iron_ingot, Character.valueOf('P'), Blocks.planks, Character.valueOf('B'), ItemIDs.bolt.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumStraight.item, 1), "S ", "S ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLongStraight.item, 1), "M ", "M ", " ", Character.valueOf('M'), ItemIDs.tcRailMediumStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongStraight.item, 1), "L ", "L ", " ", Character.valueOf('L'), ItemIDs.tcRailLongStraight.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallDiagonalStraight.item, 1), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailSmallStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumDiagonalStraight.item, 1), " G", " G ", "G ", Character.valueOf('G'), ItemIDs.tcRailSmallDiagonalStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLongDiagonalStraight.item, 1), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailMediumDiagonalStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongDiagonalStraight.item, 1), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailLongDiagonalStraight.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumTurn.item, 1), "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeTurn.item, 1), " SS", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeTurn.item, 1), "MM ", "M ", " ", Character.valueOf('M'), ItemIDs.tcRailMediumTurn.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSuperLargeTurn.item, 1), "VV ", "V ", " ", Character.valueOf('V'), ItemIDs.tcRailVeryLargeTurn.item ); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelCurve.item, 1), " S ", "S ", " ", Character.valueOf('S'), ItemIDs.tcRailSmallParallelCurve.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeParallelCurve.item, 1), " S ", "S ", " ", Character.valueOf('S'), ItemIDs.tcRailMediumParallelCurve.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumSwitch.item, 1), "S ", "SRS", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('R'), ItemIDs.tcRailMediumTurn.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSwitch.item, 1), "S ", "MRS", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('M'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('R'), ItemIDs.tcRailLargeTurn.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelSwitch.item, 1), "M S", "MRR", "MR ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('M'), ItemIDs.tcRailMediumStraight.item, Character.valueOf('R'), ItemIDs.tcRailMediumTurn.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailTwoWaysCrossing.item, 1), " S ", "SSS", " S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item ); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMedium45DegreeSwitch.item, 1), "S D", "ST ", "S ", Character.valueOf('S'), ItemIDs.tcRailSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailSmallDiagonalStraight.item, Character.valueOf('T'), ItemIDs.tcRailMedium45DegreeTurn.item); - - /**Embedded Versions*/ - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallStraight.item, 16), "I I", "B B", "I I", Character.valueOf('I'), Items.iron_ingot, Character.valueOf('B'), ItemIDs.bolt.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumStraight.item, 1), "S ", "S ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongStraight.item, 1), "M ", "M ", " ", Character.valueOf('M'), ItemIDs.tcRailEmbeddedMediumStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongStraight.item, 1), "L ", "L ", " ", Character.valueOf('L'), ItemIDs.tcRailEmbeddedLongStraight.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item, 1 ), " G", " G ", "G ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongDiagonalStraight.item, 1 ), " G ", "G ", " ", Character.valueOf('G'), ItemIDs.tcRailEmbeddedLongDiagonalStraight.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumTurn.item, 1), "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeTurn.item, 1), " SS", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeTurn.item, 1), "MM ", "M ", " ", Character.valueOf('M'), ItemIDs.tcRailEmbeddedMediumTurn.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLargeTurn.item, 1), "VV ", "V ", " ", Character.valueOf('V'), ItemIDs.tcRailEmbeddedVeryLargeTurn.item ); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallParallelCurve.item); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeParallelCurve.item, 1), " S ", "SS ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedMediumParallelCurve.item); - - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedTwoWaysCrossing.item, 1), " S ", "SSS", " S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item ); - TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMedium45DegreeSwitch.item, 1), "S D", "ST ", "S ", Character.valueOf('S'), ItemIDs.tcRailEmbeddedSmallStraight.item, Character.valueOf('D'), ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item, Character.valueOf('T'), ItemIDs.tcRailEmbeddedMedium45DegreeTurn.item); - // Bridge Pillar - TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.bridgePillar.block, 8), - "SSS", "SLS", "SSS", Character.valueOf('S'), Items.stick, Character.valueOf('L'), Blocks.log ); - } - - public static void initSmeltingRecipes(){ - - /* OpenHearthFurnace recipes */ - if (!ConfigHandler.MAKE_MODPACKS_GREAT_AGAIN) { - ArrayList steel = OreDictionary.getOres("ingotSteel"); - ArrayList iron = OreDictionary.getOres("ingotIron"); - for (ItemStack s : steel) { - for (ItemStack ironitm : iron) - TrainCraftingManager.instance.addHearthFurnaceRecipe(ironitm, - new ItemStack(ItemIDs.graphite.item), s, 2F, 1000); - } - } - - /* Vanilla Furnace recipes */ - GameRegistry.addSmelting(new ItemStack(Item.getItemFromBlock(BlockIDs.oreTC.block), 0), OreDictionary.getOres("ingotCopper").get(0), 0.7f); - } - - public static void addDictRecipe(ItemStack stack, Object... obj) { - ShapedOreRecipe recipe = new ShapedOreRecipe(stack, obj); - GameRegistry.addRecipe(recipe); - } + private static ArrayList multiNameOreDict(String... names) { + ArrayList entries = new ArrayList<>(); + for (String name : names) { + entries.addAll(OreDictionary.getOres(name)); + + } + return entries; + } + + public static void initBlockRecipes() { + ArrayList iron = OreDictionary.getOres("ingotIron"); + + TrainCraftingManager.instance.getRecipeList().add(new RecipesArmorDyes()); + /* Assembly tables */ + for (ItemStack ironingot : iron) { + GameRegistry.addRecipe(new ItemStack(BlockIDs.assemblyTableI.block, 1), "IPI", "S S", "SPS", 'I', ironingot, 'P', Blocks.piston, 'S', Blocks.stone); + } + GameRegistry.addRecipe(new ItemStack(BlockIDs.assemblyTableII.block, 1), "GPG", "O O", "OPO", 'G', Items.gold_ingot, 'P', Blocks.piston, 'O', Blocks.obsidian); + GameRegistry.addRecipe(new ItemStack(BlockIDs.assemblyTableIII.block, 1), "GPG", "DLD", "OPO", 'G', Items.gold_ingot, 'P', Blocks.piston, 'D', Items.diamond, 'L', Blocks.glowstone, 'O', Blocks.obsidian); + + if (!ConfigHandler.DISABLE_TRAIN_WORKBENCH) { + for (ItemStack ironingot : iron) { + addDictRecipe(new ItemStack(BlockIDs.trainWorkbench.block, 1), "###", "IFI", "###", '#', "plankWood", 'F', Blocks.furnace, 'I', ironingot); + } + } + addDictRecipe(new ItemStack(BlockIDs.distilIdle.block, 1), "###", "#F#", "###", '#', "ingotSteel", 'F', ItemIDs.firebox.item); + + /* Open Hearth Furnace */ + if (!ConfigHandler.MAKE_MODPACKS_GREAT_AGAIN) { + GameRegistry.addRecipe(new ItemStack(BlockIDs.openFurnaceIdle.block, 1), "#L#", "#B#", "#I#", + '#', Blocks.nether_brick, 'L', Items.lava_bucket, + 'B', Items.bucket, 'I', Blocks.iron_block); + } + + /* Lantern */ + for (ItemStack ironingot : iron) { + GameRegistry.addRecipe(new ItemStack(BlockIDs.lantern.block, 4), "III", "PTP", "III", 'I', ironingot, 'P', Blocks.glass_pane, 'T', Blocks.torch); + } + + /* Clothes */ + GameRegistry.addRecipe(new ItemStack(ItemIDs.overalls.item, 1), " # ", "X$X", "X$X", 'X', new ItemStack(Items.dye, 1, 4), '$', Items.leather_leggings, '#', new ItemStack(Items.dye, 1, 1)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.jacket.item, 1), "X X", "X$X", "X#X", 'X', new ItemStack(Items.dye, 1, 14), '$', Items.leather_chestplate, '#', Items.string); + GameRegistry.addRecipe(new ItemStack(ItemIDs.hat.item, 1), " X ", "X$X", "#X#", 'X', new ItemStack(Items.dye, 1, 4), '$', Items.leather_helmet, '#', Items.string); + + /* Driver Clothes*/ + GameRegistry.addRecipe(new ItemStack(ItemIDs.pants_driver_paintable.item, 1), "XXX", "XLX", "X$X", 'L', Items.leather_leggings, '$', new ItemStack(Items.dye, 1, 4), 'X', Items.string); + GameRegistry.addRecipe(new ItemStack(ItemIDs.jacket_driver_paintable.item, 1), "X X", "XRX", "XPX", 'X', new ItemStack(Items.dye, 1, 4), 'P', Items.leather_chestplate, 'R', new ItemStack(Items.dye, 1, 1)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.hat_driver_paintable.item, 1), "#$#", "# #", '$', new ItemStack(Items.dye, 1, 4), '#', Items.string); + + /* Ticket Man Clothes */ + GameRegistry.addRecipe(new ItemStack(ItemIDs.pants_ticketMan_paintable.item, 1), "XXX", "XLX", "X$X", 'L', Items.leather_leggings, '$', new ItemStack(Items.dye, 1, 8), 'X', Items.string); + GameRegistry.addRecipe(new ItemStack(ItemIDs.jacket_ticketMan_paintable.item, 1), "X X", "XPX", "X#X", 'P', Items.leather_chestplate, '#', new ItemStack(Items.dye, 1, 4), 'X', Items.string); + GameRegistry.addRecipe(new ItemStack(ItemIDs.hat_ticketMan_paintable.item, 1), "#$#", "# #", '$', new ItemStack(Items.dye, 1, 0), '#', Items.string); + + /* Recipe book */ + GameRegistry.addRecipe(new ItemStack(ItemIDs.recipeBook.item, 1), "TTT", "TBT", "TTT", 'T', Blocks.rail, 'B', Items.book); + + + // Track recipes for crafting table - TheDoctor1138 + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallStraight.item, 16), "G G", "BPB", "G G", 'G', Items.iron_ingot, 'P', Blocks.planks, 'B', ItemIDs.bolt.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumStraight.item, 1), "G ", "G ", "G ", 'G', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLongStraight.item, 1), "G ", "G ", " ", 'G', ItemIDs.tcRailMediumStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongStraight.item, 1), "G ", "G ", " ", 'G', ItemIDs.tcRailLongStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumDiagonalStraight.item, 1), " G", " G ", "G ", 'G', ItemIDs.tcRailSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailMediumDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailLongDiagonalStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumTurn.item, 1), "GG ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeTurn.item, 1), " SS", "SS ", "S ", 'S', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeTurn.item, 1), "GG ", "G ", " ", 'G', ItemIDs.tcRailLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSuperLargeTurn.item, 1), "GG ", "G ", " ", 'G', ItemIDs.tcRailVeryLargeTurn.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMedium45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item, 'T', ItemIDs.tcRailMediumTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLarge45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item, 'T', ItemIDs.tcRailLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLarge45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item, 'T', ItemIDs.tcRailVeryLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSuperLarge45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item, 'T', ItemIDs.tcRailSuperLargeTurn.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelCurve.item, 1), " S ", "S ", " ", 'S', ItemIDs.tcRailSmallParallelCurve.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeParallelCurve.item, 1), " S ", "S ", " ", 'S', ItemIDs.tcRailMediumParallelCurve.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumSwitch.item, 1), "G ", "GHG", "G ", 'G', ItemIDs.tcRailSmallStraight.item, 'H', ItemIDs.tcRailMediumTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelSwitch.item, 1), "I G", "IHH", "IH ", 'G', ItemIDs.tcRailSmallStraight.item, 'H', ItemIDs.tcRailMediumTurn.item, 'I', ItemIDs.tcRailMediumStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSwitch.item, 1), "G ", "HIG", "G ", 'G', ItemIDs.tcRailSmallStraight.item, 'H', ItemIDs.tcRailMediumStraight.item, 'I', ItemIDs.tcRailLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailMedium45DegreeSwitch.item, 1), "G D", "GH ", "G ", 'G', ItemIDs.tcRailSmallStraight.item, 'H', ItemIDs.tcRailMedium45DegreeTurn.item, 'D', ItemIDs.tcRailSmallDiagonalStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeWood.item, 1), " TP", "TPP", "PPP", 'T', ItemIDs.tcRailMediumStraight.item, 'P', Blocks.planks); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeWood.item, 1), " ", " T", " T ", 'T', ItemIDs.tcRailSlopeWood.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeWood.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeWood.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeSnowGravel.item, 1), " TS", "TSS", "SSS", 'T', ItemIDs.tcRailMediumStraight.item, 'S', new ItemStack(BlockIDs.snowGravel.block, 1, 4)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeSnowGravel.item, 1), " ", " T", " T ", 'T', ItemIDs.tcRailSlopeSnowGravel.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeSnowGravel.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeSnowGravel.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeGravel.item, 1), " TG", "TGG", "GGG", 'T', ItemIDs.tcRailMediumStraight.item, 'G', Blocks.gravel); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeGravel.item, 1), " ", " S", " S ", 'S', ItemIDs.tcRailSlopeGravel.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeGravel.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeGravel.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeDynamic.item, 1), " TG", "TGG", "GGG", 'T', ItemIDs.tcRailMediumStraight.item, 'G', new ItemStack(Items.dye, 1, 1)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeDynamic.item, 1), " ", " S", " S ", 'S', ItemIDs.tcRailSlopeDynamic.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeDynamic.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeDynamic.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSlopeDynamic.item, 1), " TG", "TGG", "GGG", 'T', ItemIDs.tcRailEmbeddedMediumStraight.item, 'G', new ItemStack(Items.dye, 1, 1)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeSlopeDynamic.item, 1), " ", " S", " S ", 'S', ItemIDs.tcRailEmbeddedSlopeDynamic.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeSlopeDynamic.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailEmbeddedSlopeDynamic.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", 'T', ItemIDs.tcRailLargeTurn.item, 'S', ItemIDs.tcRailSlopeDynamic.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", 'T', ItemIDs.tcRailVeryLargeTurn.item, 'S', ItemIDs.tcRailLargeSlopeDynamic.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSuperLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", 'T', ItemIDs.tcRailSuperLargeTurn.item, 'S', ItemIDs.tcRailVeryLargeSlopeDynamic.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSlopeBallast.item, 1), " TG", "TGG", "GGG", 'T', ItemIDs.tcRailMediumStraight.item, 'G', new ItemStack(BlockIDs.oreTC.block, 1, 3)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeBallast.item, 1), " ", " S", " S ", 'S', ItemIDs.tcRailSlopeBallast.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeBallast.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeBallast.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailTwoWaysCrossing.item, 1), " S ", "SSS", " S ", 'S', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDiagonalTwoWaysCrossing.item, 1), "D D", " D ", "D D", 'D', ItemIDs.tcRailSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDiamondCrossing.item, 1), " SD", " S ", "DS ", 'S', ItemIDs.tcRailSmallStraight.item, 'D', ItemIDs.tcRailSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDiamondCrossing.item, 1), "DS ", " S ", " SD", 'S', ItemIDs.tcRailSmallStraight.item, 'D', ItemIDs.tcRailSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailDoubleDiamondCrossing.item, 1), "DSD", " S ", "DSD", 'S', ItemIDs.tcRailSmallStraight.item, 'D', ItemIDs.tcRailSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailFourWaysCrossing.item, 1), "DSD", "SDS", "DSD", 'S', ItemIDs.tcRailSmallStraight.item, 'D', ItemIDs.tcRailSmallDiagonalStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallStraight.item, 16), "I I", "B B", "I I", 'I', Items.iron_ingot, 'B', ItemIDs.bolt.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumStraight.item, 1), "G ", "G ", "G ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongStraight.item, 1), "G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedMediumStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongStraight.item, 1), "G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedLongStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item, 1), " G", " G ", "G ", 'G', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedLongDiagonalStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumTurn.item, 1), "GG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeTurn.item, 1), " SS", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeTurn.item, 1), "GG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLargeTurn.item, 1), "GG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedVeryLargeTurn.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMedium45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'T', ItemIDs.tcRailEmbeddedMediumTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLarge45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'T', ItemIDs.tcRailEmbeddedLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLarge45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'T', ItemIDs.tcRailEmbeddedVeryLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLarge45DegreeTurn.item, 1), "TG ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'T', ItemIDs.tcRailEmbeddedSuperLargeTurn.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallParallelCurve.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedMediumParallelCurve.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumSwitch.item, 1), "G ", "GHG", "G ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'H', ItemIDs.tcRailEmbeddedMediumTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumParallelSwitch.item, 1), "I G", "IHH", "IH ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'H', ItemIDs.tcRailEmbeddedMediumTurn.item, 'I', ItemIDs.tcRailEmbeddedMediumStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeSwitch.item, 1), "G ", "HIG", "G ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'H', ItemIDs.tcRailEmbeddedMediumStraight.item, 'I', ItemIDs.tcRailEmbeddedLargeTurn.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMedium45DegreeSwitch.item, 1), "G D", "GH ", "G ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item, 'H', ItemIDs.tcRailEmbeddedMedium45DegreeTurn.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", 'T', ItemIDs.tcRailEmbeddedLargeTurn.item, 'S', ItemIDs.tcRailEmbeddedSlopeDynamic.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", 'T', ItemIDs.tcRailEmbeddedVeryLargeTurn.item, 'S', ItemIDs.tcRailEmbeddedLargeSlopeDynamic.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLargeCurvedSlopeDynamic.item, 1), " ", " T ", " S ", 'T', ItemIDs.tcRailEmbeddedSuperLargeTurn.item, 'S', ItemIDs.tcRailEmbeddedVeryLargeSlopeDynamic.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedTwoWaysCrossing.item, 1), " S ", "SSS", " S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDiagonalTwoWaysCrossing.item, 1), "D D", " D ", "D D", 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDiamondCrossing.item, 1), " SD", " S ", "DS ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDiamondCrossing.item, 1), "DS ", " S ", " SD", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedDoubleDiamondCrossing.item, 1), "DSD", " S ", "DSD", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedFourWaysCrossing.item, 1), "DSD", "SDS", "DSD", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + + + //Track Conversion Recipes to Normal Rails + + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallStraight.item, 1), " ", " R ", " ", 'R', Item.getItemFromBlock(Blocks.rail));// small straight track + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing.item, 1), " ", "SRS", " ", 'S', new ItemStack(Blocks.stained_hardened_clay, 1, 15), 'R', Item.getItemFromBlock(Blocks.rail)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing1.item, 1), " ", "SRS", " ", 'S', new ItemStack(Blocks.stained_hardened_clay, 1, 7), 'R', Item.getItemFromBlock(Blocks.rail)); + GameRegistry.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing2.item, 1), " ", "SRS", " ", 'S', new ItemStack(Blocks.stained_hardened_clay, 1, 3), 'R', Item.getItemFromBlock(Blocks.rail)); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallStraight.item); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallRoadCrossing.item); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallRoadCrossing1.item); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallRoadCrossing2.item); + + GameRegistry.addRecipe(new ItemStack(ItemIDs.paintbrushThing.item, 1), "GB ", "RIS", " ST", 'G', new ItemStack(Items.dye, 1, 2), 'B', new ItemStack(Items.dye, 1, 4), 'R', new ItemStack(Items.dye, 1, 1), 'I', new ItemStack(Items.iron_ingot), 'S', new ItemStack(Items.string), 'T', new ItemStack(Items.stick)); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.poweredGravel.block, 1), new ItemStack(Items.redstone), new ItemStack(Blocks.gravel)); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.snowGravel.block, 1), new ItemStack(Items.snowball), new ItemStack(Blocks.gravel)); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.snowGravel.block, 4), new ItemStack(Blocks.snow), new ItemStack(Blocks.gravel), new ItemStack(Blocks.gravel), new ItemStack(Blocks.gravel), new ItemStack(Blocks.gravel)); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.asphalt.block, 8), new ItemStack(ItemIDs.coaldust.item), new ItemStack(ItemIDs.coaldust.item), new ItemStack(ItemIDs.coaldust.item), new ItemStack(ItemIDs.coaldust.item), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltSlab.block, 6), "BBB", " ", " ", 'B', new ItemStack(BlockIDs.asphalt.block)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltSlab.block, 6), " ", "BBB", " ", 'B', new ItemStack(BlockIDs.asphalt.block)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltSlab.block, 6), " ", " ", "BBB", 'B', new ItemStack(BlockIDs.asphalt.block)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltStairs.block, 4), "B ", "BB ", "BBB", 'B', new ItemStack(BlockIDs.asphalt.block)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.asphaltStairs.block, 4), " B", " BB", "BBB", 'B', new ItemStack(BlockIDs.asphalt.block)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.signalSpanish.block, 1), " L ", " I ", "RIR", 'L', new ItemStack(Blocks.redstone_lamp), 'I', new ItemStack(Items.iron_ingot), 'R', new ItemStack(Items.redstone)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.kSignal.block, 1), "RIR", " I ", " L ", 'L', new ItemStack(Blocks.redstone_lamp), 'I', new ItemStack(Items.iron_ingot), 'R', new ItemStack(Items.redstone)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.bridgePillar.block, 8), "SSS", "SLS", "SSS", 'S', new ItemStack(Items.stick), 'L', new ItemStack(Blocks.log)); + GameRegistry.addRecipe(new ItemStack(BlockIDs.speedSign.block, 8), " R ", " I ", " I ", 'R', new ItemStack(Items.dye, 1, 1), 'I', new ItemStack(Items.iron_ingot)); + + //Gravel + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.oreTC.block, 4, 3), Blocks.gravel, Blocks.gravel, Items.clay_ball); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.oreTC.block, 16, 3), Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.clay); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.highSpeedBallast.block, 16), Items.quartz, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.clay); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.dirtyBallast.block, 16), Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.dirt); + GameRegistry.addShapelessRecipe(new ItemStack(BlockIDs.dirtierBallast.block, 16), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), new ItemStack(BlockIDs.dirtyBallast.block, 1), Blocks.dirt); + + for (ItemStack ironingot : iron) { + addDictRecipe(new ItemStack(BlockIDs.switchStand.block, 1), " W ", " I ", " R ", 'W', Blocks.lever, 'R', Items.stick, 'I', ironingot); + addDictRecipe(new ItemStack(BlockIDs.MILWSwitchStand.block, 1), " RW", "BWR", "AAA", 'A', new ItemStack(Items.stick), 'B', Blocks.iron_bars, 'R', new ItemStack(Items.dye, 1, 1), 'W', new ItemStack(Items.dye, 1, 15)); + addDictRecipe(new ItemStack(BlockIDs.MFPBWigWag.block, 1), "IWI", " I ", " I ", 'W', Blocks.lever, 'I', ironingot); + /*Buffer*/ + addDictRecipe(new ItemStack(BlockIDs.stopper.block, 1), "WWW", "I I", "RRR", 'W', "plankWood", 'R', Blocks.rail, 'I', ironingot); + addDictRecipe(new ItemStack(BlockIDs.embeddedStopper.block, 1), " ", "I I", "RRR", 'R', Blocks.rail, 'I', ironingot); + addDictRecipe(new ItemStack(BlockIDs.americanstopper.block, 1), "III", "I I", "RRR", 'R', Blocks.rail, 'I', ironingot); + addDictRecipe(new ItemStack(BlockIDs.metroMadridPole.block, 1), "III", " I ", "C C", 'I', ironingot, 'C', ItemIDs.ingotCopper.item); + } + + GameRegistry.addRecipe(new ItemStack(ItemIDs.bolt.item, 16), " II", " I ", " I ", 'I', Items.iron_ingot); + + } + + public static void initItemRecipes() { + + ArrayList steel = OreDictionary.getOres("ingotSteel"); + ArrayList iron = OreDictionary.getOres("ingotIron"); + ArrayList planks = OreDictionary.getOres("plankWood"); + ArrayList logs = OreDictionary.getOres("logWood"); + ArrayList plastics = multiNameOreDict("itemPlastic", "dustPlastic");//dustPlastic for MFR support + ArrayList copper = OreDictionary.getOres("ingotCopper"); + ArrayList dustCoal = OreDictionary.getOres("dustCoal"); + List coal = new ArrayList(); + coal.add(new ItemStack(Items.coal)); + coal.addAll(OreDictionary.getOres("coal")); + ArrayList redstone = OreDictionary.getOres("dustRedstone"); + ArrayList waterbucket = waterContainers(); + // Always do this " X " instead of this "X", and do not put "" empty brackets + + /* I placed it here because workbench should be one of the first recipe shown in the recipe book */ + for (ItemStack plank : planks) { + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.trainWorkbench.block, 1), "###", "IFI", "###", '#', plank, 'F', Blocks.furnace, 'I', ironingot); + } + } + + /* Recipe book */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.recipeBook.item, 1), "TTT", "TBT", "TTT", 'T', Blocks.rail, 'B', Items.book); + + /* Chunk Loader Activator */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.chunkLoaderActivator.item, 1), " P", " S ", "S ", 'S', Items.blaze_rod, 'P', Items.ender_pearl); + + // Switches -hariesh + GameRegistry.addRecipe(new ItemStack(BlockIDs.owoYardSwitchStand.block, 1), " ", "OS ", "IW ", 'O', new ItemStack(Items.dye, 1, 14), 'S', Items.stick, 'I', Items.iron_ingot, 'W', Blocks.planks); + GameRegistry.addRecipe(new ItemStack(BlockIDs.owoSwitchStand.block, 1), " O ", " S ", " IW", 'O', new ItemStack(Items.dye, 1, 14), 'S', Items.stick, 'I', Items.iron_ingot, 'W', Blocks.planks); + GameRegistry.addRecipe(new ItemStack(BlockIDs.circleSwitchStand.block, 1), " R ", " S ", " IW", 'R', new ItemStack(Items.dye, 1, 1), 'S', Items.stick, 'I', Items.iron_ingot, 'W', Blocks.planks); + GameRegistry.addRecipe(new ItemStack(BlockIDs.autoSwtichStand.block, 1), " ", "C ", "BIW", 'C', new ItemStack(ItemIDs.electronicCircuit.item, 1), 'B', Blocks.iron_block, 'S', Items.stick, 'I', Items.iron_ingot, 'W', Blocks.planks); + GameRegistry.addRecipe(new ItemStack(ItemIDs.paintbrushThing.item, 1), "GB ", "RIS", " ST", 'G', new ItemStack(Items.dye, 1, 2), 'B', new ItemStack(Items.dye, 1, 4), 'R', new ItemStack(Items.dye, 1, 1), 'I', new ItemStack(Items.iron_ingot), 'S', new ItemStack(Items.string), 'T', new ItemStack(Items.stick)); + + + + /* Assembly tables */ + + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.assemblyTableI.block, 1), "IPI", "S S", "SPS", 'I', ironingot, 'P', Blocks.piston, 'S', Blocks.stone); + } + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.assemblyTableII.block, 1), "GPG", "O O", "OPO", 'G', Items.gold_ingot, 'P', Blocks.piston, 'O', Blocks.obsidian); + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.assemblyTableIII.block, 1), "GPG", "DLD", "OPO", 'G', Items.gold_ingot, 'P', Blocks.piston, 'D', Items.diamond, 'L', Blocks.glowstone, 'O', Blocks.obsidian); + + /* Open Hearth Furnace */ + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.openFurnaceIdle.block, 1), "#L#", "#B#", "#I#", '#', Blocks.nether_brick, 'L', Items.lava_bucket, 'B', Items.bucket, 'I', Blocks.iron_block); + + /* Lantern */ + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.lantern.block, 4), "III", "PTP", "III", 'I', ironingot, 'P', Blocks.glass_pane, 'T', Blocks.torch); + } + /* Clothes */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.overalls.item, 1), " # ", "X$X", "X X", 'X', new ItemStack(Items.dye, 1, 4), '$', Items.leather_leggings, '#', new ItemStack(Items.dye, 1, 1)); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket.item, 1), "X X", "X$X", "X#X", 'X', new ItemStack(Items.dye, 1, 14), '$', Items.leather_chestplate, '#', Items.string); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.hat.item, 1), " X ", "X$X", "#X#", 'X', new ItemStack(Items.dye, 1, 4), '$', Items.leather_helmet, '#', Items.string); + + /* Driver Clothes*/ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.pants_driver_paintable.item, 1), "XXX", "XLX", "X$X", 'L', Items.leather_leggings, '$', new ItemStack(Items.dye, 1, 4), 'X', Items.string); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket_driver_paintable.item, 1), "X X", "XRX", "XPX", 'X', new ItemStack(Items.dye, 1, 4), 'P', Items.leather_chestplate, 'R', new ItemStack(Items.dye, 1, 1)); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.hat_driver_paintable.item, 1), "#$#", "# #", '$', new ItemStack(Items.dye, 1, 4), '#', Items.string); + + /* Ticket Man Clothes */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.pants_ticketMan_paintable.item, 1), "XXX", "XLX", "X$X", 'L', Items.leather_leggings, '$', new ItemStack(Items.dye, 1, 8), 'X', Items.string); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket_ticketMan_paintable.item, 1), "X X", "XPX", "X#X", 'P', Items.leather_chestplate, '#', new ItemStack(Items.dye, 1, 4), 'X', Items.string); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.hat_ticketMan_paintable.item, 1), "#$#", "# #", '$', new ItemStack(Items.dye, 1, 0), '#', Items.string); + + + for (ItemStack plastic : plastics) { + /* Empty canister */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.emptyCanister.item, 4), "PPP", "P P", "PPP", 'P', plastic); + for (ItemStack rs : redstone) { + /* Electronic circuit */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.electronicCircuit.item, 1), "XXX", "RPR", "XXX", 'X', ItemIDs.copperWireFine.item, 'P', plastic, 'R', rs.getItem()); + } + /* Composite Material*/ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.reinforcedPlastic.item, 16), "LPL", "PLP", "GPG", 'G', Blocks.glass_pane, 'P', ItemIDs.graphite.item, 'L', plastic); + + if (copper != null) { + for (ItemStack copp : copper) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.copperWireFine.item, 6), "XXX", "XPX", "XXX", 'X', copp, 'P', plastic); + GameRegistry.addRecipe(new ItemStack(BlockIDs.overheadWire.block, 16), "IC ", "I ", "I ", 'I', new ItemStack(Items.iron_ingot, 1), 'C', copp); + GameRegistry.addRecipe(new ItemStack(BlockIDs.overheadWireDouble.block, 16), "ICI", "ICI", "I I", 'I', new ItemStack(Items.iron_ingot, 1), 'C', copp); + + } + } + } + + /* Composite Suit */ + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.boots_suit_paintable.item, 1), " D ", "X X", "XFX", 'F', Items.feather, 'D', Items.diamond, 'X', ItemIDs.reinforcedPlates.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.pants_suit_paintable.item, 1), "XDX", "X$X", "X X", '$', Items.fire_charge, 'X', ItemIDs.reinforcedPlates.item, 'D', Items.diamond); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.jacket_suit_paintable.item, 1), "X X", "XDX", "XAX", 'A', Items.golden_apple, 'X', ItemIDs.reinforcedPlates.item, 'D', Blocks.diamond_block); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.helmet_suit_paintable.item, 1), "#D#", "# #", 'D', Blocks.diamond_block, '#', ItemIDs.reinforcedPlates.item); + + /* Trains parts */ + + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.generator.item, 1), " ##", "E$$", " ##", '#', ItemIDs.copperWireFine.item, 'E', ItemIDs.electronicCircuit.item, '$', ironingot);// generator + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.controls.item, 1), "#X#", "#E#", "$$$", '#', Blocks.lever, 'X', Blocks.stone_button, '$', ironingot, 'E', ItemIDs.electronicCircuit.item);// train controls + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.electmotor.item, 1), "I#I", "#E#", "I#I", '#', ItemIDs.copperWireFine.item, 'I', ironingot, 'E', ItemIDs.electronicCircuit.item);// Electric motor + for (ItemStack bucketWater : waterbucket) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironBoiler.item, 2), "###", "XXX", "###", '#', ironingot, 'X', bucketWater.getItem());// iron Boiler + } + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironFirebox.item, 2), "###", "#X#", "###", '#', ironingot, 'X', Items.flint_and_steel);// iron Firebox + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironChimney.item, 2), "# #", "# #", "# #", '#', ironingot); + } + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.dieselengine.item, 2), "###", "XXX", "CCC", '#', ItemIDs.piston.item, 'X', ItemIDs.cylinder.item, 'C', ItemIDs.camshaft.item);// diesel engine + for (ItemStack dustStack : dustCoal) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.graphite.item, 2), "###", "#X#", "###", '#', dustStack, 'X', Items.clay_ball);// Graphite + } + + if (!ConfigHandler.MAKE_MODPACKS_GREAT_AGAIN) { + for (ItemStack c : coal) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.coaldust.item, 4), + "###", " ", " ", '#', c.getItem()); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.coaldust.item, 4), + " ", "###", " ", '#', c.getItem()); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.coaldust.item, 4), + " ", " ", "###", '#', c.getItem()); + } + } + //TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.signal.item, 2), "#", "X", "X", Character.valueOf('X'), ItemIDs.steel.item, Character.valueOf('#'), rs ); + /* diesel generator */ + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.generatorDiesel.block, 1), "C ", "DE ", 'C', ItemIDs.steelchimney.item, 'D', ItemIDs.dieselengine.item, 'E', ItemIDs.electronicCircuit.item); + + /* Zepplin parts and zeppelin item */ + if (ConfigHandler.ENABLE_ZEPPELIN) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.balloon.item, 1), "###", "# #", "###", '#', Blocks.wool);// Balloon + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steamengine.item, 1), "C ", "BF ", 'C', ItemIDs.steelchimney.item, 'B', ItemIDs.boiler.item, 'F', ItemIDs.firebox.item);// Small steam engine + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.airship.item, 1), "B B", "SES", "POP", 'B', ItemIDs.balloon.item, 'S', Items.stick, 'E', ItemIDs.steamengine.item, 'P', ItemIDs.propeller.item, 'O', Items.boat); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.zeppelin.item, 1), "BBB", "SES", "POP", 'B', ItemIDs.balloon.item, 'S', ItemIDs.propeller.item, 'E', ItemIDs.controls.item, 'P', ItemIDs.electmotor.item, 'O', ItemIDs.seats.item); + } + + for (ItemStack plankItem : planks) { + for (ItemStack steelItem : steel) { + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.reinforcedPlates.item, 1), "RRR", "SSS", "CCC", 'R', ItemIDs.reinforcedPlastic.item, 'S', steelItem, 'C', Items.clay_ball); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.composite_wrench.item, 1), "S S", " R ", " R ", 'R', ItemIDs.reinforcedPlastic.item, 'S', steelItem); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelcab.item, 2), "###", "X X", "XXX", 'X', steelItem, '#', plankItem);// Steel cab + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.distilIdle.block, 1), "###", "#F#", "###", '#', steelItem, 'F', ItemIDs.firebox.item); + for (ItemStack rs : redstone) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.transformer.item, 1), "# #", "XEX", "###", '#', steelItem, 'E', ItemIDs.electronicCircuit.item, 'X', rs.getItem());// transformer + } + + for (ItemStack bucketWater : waterbucket) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.boiler.item, 2), "###", "XXX", "###", '#', steelItem, 'X', bucketWater.getItem());// Boiler + } + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.firebox.item, 2), "###", "#X#", "###", '#', steelItem, 'X', Items.flint_and_steel);// Firebox + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.bogie.item, 4), " # ", "#X#", " # ", '#', steelItem, 'X', ironingot);// Bogie + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelframe.item, 2), "# #", "AAA", 'A', steelItem, '#', ironingot);// Steel Frame + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelframe.item, 2), " ", "# #", "AAA", 'A', steelItem, '#', ironingot);// Steel Frame + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.stake.item, 1), " ", "IFI", " ", 'I', steelItem, 'F', ironingot); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.stake.item, 1), "IFI", " ", " ", 'I', steelItem, 'F', ironingot); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.stake.item, 1), " ", " ", "IFI", 'I', steelItem, 'F', ironingot); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.propeller.item, 2), " # ", "#X#", " # ", '#', plankItem, 'X', ironingot);// Propeller + } + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.steelchimney.item, 2), "# #", "# #", "# #", '#', steelItem);// Bogie + TrainCraftingManager.instance.addRecipe(new ItemStack(Items.flint_and_steel, 2), "* ", " #", '*', steelItem, '#', Items.flint); + + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.transmition.item, 1), " # ", "#X#", " # ", '#', steelItem, 'X', ItemIDs.diesel.item);// transmition + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.piston.item, 3), " # ", " X ", '#', steelItem, 'X', Items.stick);// piston + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.camshaft.item, 3), "###", " ", " ", '#', steelItem);// camshaft + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.camshaft.item, 3), " ", "###", " ", '#', steelItem);// camshaft + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.camshaft.item, 3), " ", " ", "###", '#', steelItem);// camshaft + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.cylinder.item, 3), "# #", "# #", "###", '#', steelItem);// cylinder + + } + + for (ItemStack logStack : logs) { + /* Water Wheel */ + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.waterWheel.block, 1), " P ", "PGP", " P ", 'P', logStack, 'G', ItemIDs.generator.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenBogie.item, 4), " # ", "#X#", " # ", '#', plankItem, 'X', logStack);// wooden Bogie + } + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenFrame.item, 2), "# #", "AAA", 'A', plankItem, '#', plankItem);// wooden Frame + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenFrame.item, 2), " ", "# #", "AAA", 'A', plankItem, '#', plankItem);// wooden Frame + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.woodenCab.item, 2), "###", "X X", "XXX", 'X', plankItem, '#', plankItem);// wooden cab + + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.seats.item, 1), "# ", "## ", "XXX", '#', plankItem, 'X', ironingot);// transformer + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironBogie.item, 4), " # ", "#X#", " # ", '#', ironingot, 'X', plankItem);// iron Bogie + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironFrame.item, 2), "# #", "AAA", 'A', ironingot, '#', plankItem);// iron Frame + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironFrame.item, 2), " ", "# #", "AAA", 'A', ironingot, '#', plankItem);// iron Frame + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.ironCab.item, 2), "###", "X X", "XXX", 'X', ironingot, '#', plankItem);// iron cab + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.stopper.block, 1), "WWW", "I I", "RRR", 'W', plankItem, 'R', Blocks.rail, 'I', ironingot);// stopper + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.switchStand.block, 1), " W ", " I ", " R ", 'W', Blocks.lever, 'R', Items.stick, 'I', ironingot);//switchstand + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.MFPBWigWag.block, 1), "IWI", " I ", " I ", 'W', Blocks.lever, 'I', ironingot);//wigwag + } + // Short Wood Slope + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeWood.item, 1), + " MW", "MWW", "WWW", 'M', ItemIDs.tcRailMediumStraight.item, 'W', plankItem); + } + /* Wind mill */ + for (ItemStack ironingot : iron) { + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.windMill.block, 1), " R ", " G ", "B B", 'G', ItemIDs.generator.item, 'B', ironingot, 'R', ItemIDs.propeller.item); + + if (Loader.isModLoaded("ComputerCraft")) { + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcTransmitterSpeed.block, 1), "SRS", "RTR", "SRS", 'S', ironingot, 'R', Items.redstone, 'T', Blocks.stone_pressure_plate); + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcReceiverMTC.block, 1), "STS", " R ", "SPS", 'S', ironingot, 'R', Items.redstone, 'P', Items.repeater, 'T', new ItemStack(Blocks.torch, 1)); + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcTransmitterMTC.block, 1), "SPS", " R ", "STS", 'S', ironingot, 'R', Items.redstone, 'P', Items.repeater, 'T', new ItemStack(Blocks.torch, 1)); + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcReceiverDestination.block, 1), "SRS", "RTR", "SRS", 'S', ironingot, 'R', Items.redstone, 'T', Items.sign); + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.mtcATOStopTransmitter.block, 1), " S ", "RTS", " R ", 'S', ironingot, 'R', Items.redstone, 'T', ItemIDs.electronicCircuit.item); + } + } + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing.item, 1), " ", "SRS", " ", 'S', new ItemStack(Blocks.stained_hardened_clay, 1, 15), 'R', Item.getItemFromBlock(Blocks.rail)); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing1.item, 1), " ", "SRS", " ", 'S', new ItemStack(Blocks.stained_hardened_clay, 1, 7), 'R', Item.getItemFromBlock(Blocks.rail)); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallRoadCrossing2.item, 1), " ", "SRS", " ", 'S', new ItemStack(Blocks.stained_hardened_clay, 1, 3), 'R', Item.getItemFromBlock(Blocks.rail)); + TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallRoadCrossing.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallRoadCrossing1.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.rail), 1), " ", " R ", " ", 'R', ItemIDs.tcRailSmallRoadCrossing2.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeWood.item, 1), " TP", "TPP", "PPP", 'T', ItemIDs.tcRailMediumStraight.item, 'P', Blocks.planks); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeWood.item, 1), " ", " T", " T ", 'T', ItemIDs.tcRailSlopeWood.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeWood.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeWood.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeSnowGravel.item, 1), " TS", "TSS", "SSS", 'T', ItemIDs.tcRailMediumStraight.item, 'S', new ItemStack(BlockIDs.snowGravel.block, 1, 4)); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeSnowGravel.item, 1), " ", " T", " T ", 'T', ItemIDs.tcRailSlopeSnowGravel.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeSnowGravel.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeSnowGravel.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeGravel.item, 1), " TG", "TGG", "GGG", 'T', ItemIDs.tcRailMediumStraight.item, 'G', Blocks.gravel); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeGravel.item, 1), " ", " S", " S ", 'S', ItemIDs.tcRailSlopeGravel.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeGravel.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeGravel.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSlopeBallast.item, 1), " TG", "TGG", "GGG", 'T', ItemIDs.tcRailMediumStraight.item, 'G', new ItemStack(BlockIDs.oreTC.block, 1, 3)); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSlopeBallast.item, 1), " ", " S", " S ", 'S', ItemIDs.tcRailSlopeBallast.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeSlopeBallast.item, 1), " T", " T ", "T ", 'T', ItemIDs.tcRailSlopeBallast.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallStraight.item, 16), "G G", "BPB", "G G", 'G', Items.iron_ingot, 'P', Blocks.planks, 'B', ItemIDs.bolt.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumStraight.item, 1), "S ", "S ", "S ", 'S', ItemIDs.tcRailSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLongStraight.item, 1), "M ", "M ", " ", 'M', ItemIDs.tcRailMediumStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongStraight.item, 1), "L ", "L ", " ", 'L', ItemIDs.tcRailLongStraight.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumDiagonalStraight.item, 1), " G", " G ", "G ", 'G', ItemIDs.tcRailSmallDiagonalStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailMediumDiagonalStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailLongDiagonalStraight.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumTurn.item, 1), "SS ", "S ", 'S', ItemIDs.tcRailSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeTurn.item, 1), " SS", "SS ", "S ", 'S', ItemIDs.tcRailSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailVeryLargeTurn.item, 1), "MM ", "M ", " ", 'M', ItemIDs.tcRailMediumTurn.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSuperLargeTurn.item, 1), "VV ", "V ", " ", 'V', ItemIDs.tcRailVeryLargeTurn.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailSmallParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelCurve.item, 1), " S ", "S ", " ", 'S', ItemIDs.tcRailSmallParallelCurve.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeParallelCurve.item, 1), " S ", "S ", " ", 'S', ItemIDs.tcRailMediumParallelCurve.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumSwitch.item, 1), "S ", "SRS", "S ", 'S', ItemIDs.tcRailSmallStraight.item, 'R', ItemIDs.tcRailMediumTurn.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailLargeSwitch.item, 1), "S ", "MRS", "S ", 'S', ItemIDs.tcRailSmallStraight.item, 'M', ItemIDs.tcRailMediumStraight.item, 'R', ItemIDs.tcRailLargeTurn.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMediumParallelSwitch.item, 1), "M S", "MRR", "MR ", 'S', ItemIDs.tcRailSmallStraight.item, 'M', ItemIDs.tcRailMediumStraight.item, 'R', ItemIDs.tcRailMediumTurn.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailTwoWaysCrossing.item, 1), " S ", "SSS", " S ", 'S', ItemIDs.tcRailSmallStraight.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailMedium45DegreeSwitch.item, 1), "S D", "ST ", "S ", 'S', ItemIDs.tcRailSmallStraight.item, 'D', ItemIDs.tcRailSmallDiagonalStraight.item, 'T', ItemIDs.tcRailMedium45DegreeTurn.item); + + // Embedded Versions + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallStraight.item, 16), "I I", "B B", "I I", 'I', Items.iron_ingot, 'B', ItemIDs.bolt.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumStraight.item, 1), "S ", "S ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongStraight.item, 1), "M ", "M ", " ", 'M', ItemIDs.tcRailEmbeddedMediumStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongStraight.item, 1), "L ", "L ", " ", 'L', ItemIDs.tcRailEmbeddedLongStraight.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item, 1), " G", " G ", "G ", 'G', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedMediumDiagonalStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLongDiagonalStraight.item, 1), " G ", "G ", " ", 'G', ItemIDs.tcRailEmbeddedLongDiagonalStraight.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumTurn.item, 1), "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeTurn.item, 1), " SS", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedVeryLargeTurn.item, 1), "MM ", "M ", " ", 'M', ItemIDs.tcRailEmbeddedMediumTurn.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSuperLargeTurn.item, 1), "VV ", "V ", " ", 'V', ItemIDs.tcRailEmbeddedVeryLargeTurn.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedSmallParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMediumParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallParallelCurve.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedLargeParallelCurve.item, 1), " S ", "SS ", "S ", 'S', ItemIDs.tcRailEmbeddedMediumParallelCurve.item); + + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedTwoWaysCrossing.item, 1), " S ", "SSS", " S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item); + TrainCraftingManager.instance.addRecipe(new ItemStack(ItemIDs.tcRailEmbeddedMedium45DegreeSwitch.item, 1), "S D", "ST ", "S ", 'S', ItemIDs.tcRailEmbeddedSmallStraight.item, 'D', ItemIDs.tcRailEmbeddedSmallDiagonalStraight.item, 'T', ItemIDs.tcRailEmbeddedMedium45DegreeTurn.item); + // Bridge Pillar + TrainCraftingManager.instance.addRecipe(new ItemStack(BlockIDs.bridgePillar.block, 8), + "SSS", "SLS", "SSS", 'S', Items.stick, 'L', Blocks.log); + } + + public static void initSmeltingRecipes() { + + /* OpenHearthFurnace recipes */ + if (!ConfigHandler.MAKE_MODPACKS_GREAT_AGAIN) { + ArrayList steel = OreDictionary.getOres("ingotSteel"); + ArrayList iron = OreDictionary.getOres("ingotIron"); + for (ItemStack s : steel) { + for (ItemStack ironitm : iron) { + TrainCraftingManager.instance.addHearthFurnaceRecipe(ironitm, + new ItemStack(ItemIDs.graphite.item), s, 2F, 1000); + } + } + } + + /* Vanilla Furnace recipes */ + GameRegistry.addSmelting(new ItemStack(Item.getItemFromBlock(BlockIDs.oreTC.block), 0), OreDictionary.getOres("ingotCopper").get(0), 0.7f); + } + + public static void addDictRecipe(ItemStack stack, Object... obj) { + ShapedOreRecipe recipe = new ShapedOreRecipe(stack, obj); + GameRegistry.addRecipe(recipe); + } } diff --git a/src/main/java/train/common/core/handlers/RetrogenHandler.java b/src/main/java/train/common/core/handlers/RetrogenHandler.java index bab28ff196..253c2d7fdc 100644 --- a/src/main/java/train/common/core/handlers/RetrogenHandler.java +++ b/src/main/java/train/common/core/handlers/RetrogenHandler.java @@ -11,65 +11,78 @@ import java.util.Random; public class RetrogenHandler { - public static final byte VERSION = 1; // useful for world generation changes in future releases, to allow partial retrogen. - private static ArrayList chunksToRetroGen = new ArrayList(); - public static ArrayList gennedChunks = new ArrayList(); - private static Random rand = new Random(); - /** Called whenever a chunk is loaded, checks for retrogen flag and adds it to the list of chunks to retrogen if neededg. */ - @SubscribeEvent - public void onChunkLoad(ChunkDataEvent.Load event) { - ChunkData data = new ChunkData(event.getChunk()); - if (ConfigHandler.RETROGEN_CHUNKS && event.getData().getByte("TraincraftRetrogen") < VERSION && !gennedChunks.contains(data)) { - chunksToRetroGen.add(event.getChunk()); - } - gennedChunks.remove(data); - } - /** Called whenever a chunk is saved, sets the retrogen flag. */ - @SubscribeEvent - public void onChunkSave(ChunkDataEvent.Save event) { - if(event.getData()!=null && !event.getData().hasKey("TraincraftRetrogen")) { - event.getData().setByte("TraincraftRetrogen", VERSION); - } - } - /** called every server tick. Retrogens chunks if needed. **/ - @SubscribeEvent - public void onServerTick(TickEvent.ServerTickEvent event) { - if (ConfigHandler.RETROGEN_CHUNKS && chunksToRetroGen.size()>0) { - if (event.phase == TickEvent.Phase.END) { - WorldServer world; - for (Chunk chunk : chunksToRetroGen) { - if (chunk.worldObj instanceof WorldServer) { - world = (WorldServer) chunk.worldObj; - rand.setSeed((long)chunk.xPosition * 341873128712L + (long)chunk.zPosition * 132897987541L); - Traincraft.tcLog.info("Retrogen chunk at " + chunk.xPosition + ", " + chunk.zPosition + " for dimension " + world.provider.dimensionId + ", Version " + VERSION); - Traincraft.worldGen.generate(rand, chunk.xPosition, chunk.zPosition, world, world.theChunkProviderServer.currentChunkProvider, world.theChunkProviderServer.currentChunkProvider); - } - } - chunksToRetroGen= new ArrayList(); - gennedChunks= new ArrayList(); - } - } - } - - public static class ChunkData { - private final int chunkX, chunkZ, dimension; - private ChunkData(Chunk chunk) { - this.chunkX = chunk.xPosition; - this.chunkZ = chunk.zPosition; - this.dimension = chunk.worldObj.provider.dimensionId; - } - public ChunkData(int chunkX, int chunkZ, int dimension) { - this.chunkX = chunkX; - this.chunkZ = chunkZ; - this.dimension = dimension; - } - @Override - public boolean equals(Object o) { - if (o instanceof ChunkData) { - ChunkData data = (ChunkData) o; - return (data == this) || (data.chunkX == this.chunkX && data.chunkZ == this.chunkZ && data.dimension == this.dimension); - } - return false; - } - } + public static final byte VERSION = 1; // useful for world generation changes in future releases, to allow partial retrogen. + private static ArrayList chunksToRetroGen = new ArrayList<>(); + public static ArrayList gennedChunks = new ArrayList<>(); + private static final Random rand = new Random(); + + /** + * Called whenever a chunk is loaded, checks for retrogen flag and adds it to the list of chunks to retrogen if neededg. + */ + @SubscribeEvent + public void onChunkLoad(ChunkDataEvent.Load event) { + ChunkData data = new ChunkData(event.getChunk()); + if (ConfigHandler.RETROGEN_CHUNKS && event.getData().getByte("TraincraftRetrogen") < VERSION && !gennedChunks.contains(data)) { + chunksToRetroGen.add(event.getChunk()); + } + gennedChunks.remove(data); + } + + /** + * Called whenever a chunk is saved, sets the retrogen flag. + */ + @SubscribeEvent + public void onChunkSave(ChunkDataEvent.Save event) { + if (event.getData() != null && !event.getData().hasKey("TraincraftRetrogen")) { + event.getData().setByte("TraincraftRetrogen", VERSION); + } + } + + /** + * called every server tick. Retrogens chunks if needed. + **/ + @SubscribeEvent + public void onServerTick(TickEvent.ServerTickEvent event) { + if (ConfigHandler.RETROGEN_CHUNKS && !chunksToRetroGen.isEmpty()) { + if (event.phase == TickEvent.Phase.END) { + WorldServer world; + for (Chunk chunk : chunksToRetroGen) { + if (chunk.worldObj instanceof WorldServer) { + world = (WorldServer) chunk.worldObj; + rand.setSeed((long) chunk.xPosition * 341873128712L + (long) chunk.zPosition * 132897987541L); + Traincraft.tcLog.info("Retrogen chunk at " + chunk.xPosition + ", " + chunk.zPosition + " for dimension " + world.provider.dimensionId + ", Version " + VERSION); + Traincraft.worldGen.generate(rand, chunk.xPosition, chunk.zPosition, world, world.theChunkProviderServer.currentChunkProvider, world.theChunkProviderServer.currentChunkProvider); + } + } + + chunksToRetroGen = new ArrayList<>(); + gennedChunks = new ArrayList<>(); + } + } + } + + public static class ChunkData { + private final int chunkX, chunkZ, dimension; + + private ChunkData(Chunk chunk) { + this.chunkX = chunk.xPosition; + this.chunkZ = chunk.zPosition; + this.dimension = chunk.worldObj.provider.dimensionId; + } + + public ChunkData(int chunkX, int chunkZ, int dimension) { + this.chunkX = chunkX; + this.chunkZ = chunkZ; + this.dimension = dimension; + } + + @Override + public boolean equals(Object o) { + if (o instanceof ChunkData) { + ChunkData data = (ChunkData) o; + return (data == this) || (data.chunkX == this.chunkX && data.chunkZ == this.chunkZ && data.dimension == this.dimension); + } + return false; + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/handlers/RollingStockStatsEventHandler.java b/src/main/java/train/common/core/handlers/RollingStockStatsEventHandler.java index 7a0940de3e..8299eeca72 100644 --- a/src/main/java/train/common/core/handlers/RollingStockStatsEventHandler.java +++ b/src/main/java/train/common/core/handlers/RollingStockStatsEventHandler.java @@ -8,63 +8,61 @@ public class RollingStockStatsEventHandler { - /** - * Stores the distance a player has done on this train - */ - private ArrayList plDist = new ArrayList(); - private AbstractTrains train; + /** + * Stores the distance a player has done on this train + */ + private final ArrayList plDist = new ArrayList<>(); + private final AbstractTrains train; - public RollingStockStatsEventHandler(AbstractTrains train) { - this.train = train; - } + public RollingStockStatsEventHandler(AbstractTrains train) { + this.train = train; + } - /** - * Calculates the distance this train has done if a player rides it, also calculates - */ - /* Ready for stats implement, unused for now** */ - public void trainDistance() { - double xDist = train.prevPosX - train.posX; - double yDist = train.prevPosY - train.posY; - double zDist = train.prevPosZ - train.posZ; - int var7 = Math.round(MathHelper.sqrt_double(xDist * xDist + yDist * yDist + zDist * zDist) * 100); - train.trainDistanceTraveled += (var7); - //System.out.println(trainDistanceTraveled); - if (train.riddenByEntity != null && train.riddenByEntity instanceof EntityPlayer) { - for (playerDistance d : plDist) { - if (((EntityPlayer) train.riddenByEntity).getDisplayName().equals(d.getUsername())) { - d.setDistance(d.getDistance() + (var7)); - //System.out.println(d.getDistance()+" "+((EntityPlayer)riddenByEntity).username); - return; - } - } - plDist.add(new playerDistance(((EntityPlayer) train.riddenByEntity).getDisplayName(), (var7))); - } - } + /** + * Calculates the distance this train has done if a player rides it, also calculates + */ + /* Ready for stats implement, unused for now** */ + public void trainDistance() { + double xDist = train.prevPosX - train.posX; + double yDist = train.prevPosY - train.posY; + double zDist = train.prevPosZ - train.posZ; + int var7 = Math.round(MathHelper.sqrt_double(xDist * xDist + yDist * yDist + zDist * zDist) * 100); + train.trainDistanceTraveled += (var7); + //System.out.println(trainDistanceTraveled); + if (train.riddenByEntity != null && train.riddenByEntity instanceof EntityPlayer) { + for (playerDistance d : plDist) { + if (((EntityPlayer) train.riddenByEntity).getDisplayName().equals(d.getUsername())) { + d.setDistance(d.getDistance() + (var7)); + //System.out.println(d.getDistance()+" "+((EntityPlayer)riddenByEntity).username); + return; + } + } + plDist.add(new playerDistance(((EntityPlayer) train.riddenByEntity).getDisplayName(), (var7))); + } + } - /** - * just an object to register the distance a player has done - * - */ - private class playerDistance { - private String username; - private double distance; + /** + * just an object to register the distance a player has done + */ + private static class playerDistance { + private final String username; + private double distance; - private playerDistance(String username, double distance) { - this.username = username; - this.distance = distance; - } + private playerDistance(String username, double distance) { + this.username = username; + this.distance = distance; + } - protected double getDistance() { - return distance; - } + protected double getDistance() { + return distance; + } - protected String getUsername() { - return username; - } - - protected void setDistance(double distance) { - this.distance = distance; - } - } + protected String getUsername() { + return username; + } + protected void setDistance(double distance) { + this.distance = distance; + } + } } diff --git a/src/main/java/train/common/core/handlers/TrainHandler.java b/src/main/java/train/common/core/handlers/TrainHandler.java index 05fc1d6be1..e421decb3d 100644 --- a/src/main/java/train/common/core/handlers/TrainHandler.java +++ b/src/main/java/train/common/core/handlers/TrainHandler.java @@ -4,48 +4,53 @@ import train.common.api.Locomotive; import java.util.ArrayList; +import java.util.List; public class TrainHandler { - private EntityRollingStock rolling; - private ArrayList train = new ArrayList(); + private final List train = new ArrayList<>(); private int trainPower; - public TrainHandler() {} + public TrainHandler() { + } public TrainHandler(EntityRollingStock rolling) { - this.rolling = rolling; addRollingStock(rolling); - rolling.allTrains.add(this); + EntityRollingStock.allTrains.add(this); } public void addRollingStock(EntityRollingStock rolling) { - for (int i = 0; i < train.size(); i++) { - if (train.get(i).equals(rolling)) { - return; - } - } + for (EntityRollingStock entityRollingStock : train) { + if (entityRollingStock.equals(rolling)) { + return; + } + } + if (rolling instanceof Locomotive) { trainPower += ((Locomotive) rolling).getPower(); } + train.add(rolling); (rolling).train = this; //System.out.println("added "+rolling); - if (rolling.cartLinked1 != null) + if (rolling.cartLinked1 != null) { addRollingStock((rolling.cartLinked1)); - if (rolling.cartLinked2 != null) + } + + if (rolling.cartLinked2 != null) { addRollingStock((rolling.cartLinked2)); + } } public void resetTrain() { - for (int i = 0; i < train.size(); i++) { - if (train.get(i) != null) - train.get(i).train = null; - } + for (EntityRollingStock entityRollingStock : train) { + if (entityRollingStock != null) + entityRollingStock.train = null; + } train.clear(); } - public ArrayList getTrains() { - return train; + public List getTrains() { + return this.train; } public int getTrainPower() { diff --git a/src/main/java/train/common/core/handlers/TraincraftSaveHandler.java b/src/main/java/train/common/core/handlers/TraincraftSaveHandler.java index fb413863dc..fc37b6c1b5 100644 --- a/src/main/java/train/common/core/handlers/TraincraftSaveHandler.java +++ b/src/main/java/train/common/core/handlers/TraincraftSaveHandler.java @@ -6,107 +6,103 @@ import java.util.ArrayList; public class TraincraftSaveHandler { - - public static boolean createFile(MinecraftServer server) { - try { - File file; - //System.out.println(server.getFile("Traincraft.dat")); - if (server.isDedicatedServer()) { - file = server.getFile(server.getFolderName() + "/data/Traincraft.dat"); - } - else { - file = server.getFile("saves/" + server.getFolderName() + "/data/Traincraft.dat"); - } - if (file != null && file.exists()) { - return true; - } - else if (file != null) { - file.createNewFile(); - return false; - } - return false; - } catch (Throwable throwable) { - throw new RuntimeException(throwable); - } - } - public static int readInt(MinecraftServer server, String name) { - try { - File file; - if (server.isDedicatedServer()) { - file = server.getFile(server.getFolderName() + "/data/Traincraft.dat"); - } - else { - file = server.getFile("saves/" + server.getFolderName() + "/data/Traincraft.dat"); - } - if (file != null && file.exists()) { - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line; - while ((line = reader.readLine()) != null) { - //if(!line.startsWith(name))continue;//numberOfTrains: - if (line.startsWith(name)) { - return (Integer.parseInt(line.substring(name.length()))); - } - else { - reader.close(); - } - } - } - } catch (Throwable throwable) { - throw new RuntimeException(throwable); - } - return -1; - } + public static boolean createFile(MinecraftServer server) { + try { + File file; + //System.out.println(server.getFile("Traincraft.dat")); + if (server.isDedicatedServer()) { + file = server.getFile(server.getFolderName() + "/data/Traincraft.dat"); + } else { + file = server.getFile("saves/" + server.getFolderName() + "/data/Traincraft.dat"); + } + if (file != null && file.exists()) { + return true; + } else if (file != null) { + file.createNewFile(); + return false; + } + return false; + } catch (Throwable throwable) { + throw new RuntimeException(throwable); + } + } - public static void writeValue(MinecraftServer server, String name, String value) { - try { - File file; - File newFile; - ArrayList content = new ArrayList(); - if (server.isDedicatedServer()) { - file = server.getFile(server.getFolderName() + "/data/Traincraft.dat"); - newFile = server.getFile(server.getFolderName() + "/data/newTraincraft.dat"); - } - else { - file = server.getFile("saves/" + server.getFolderName() + "/data/Traincraft.dat"); - newFile = server.getFile("saves/" + server.getFolderName() + "/data/newTraincraft.dat"); - } - if (file != null && file.exists()) { - newFile.createNewFile(); - BufferedReader reader = new BufferedReader(new FileReader(file)); - BufferedWriter bw = new BufferedWriter(new FileWriter(newFile)); - String line; - while ((line = reader.readLine()) != null) { - content.add(line); - } - reader.close(); - boolean replaced = false; - for (int i = 0; i < content.size(); i++) { - if (content.get(i).startsWith(name)) { - content.remove(i); - content.add(i, name + value); - replaced = true; - } - if (i == content.size() - 1 && !replaced) { - content.add(name + value); - } - } - if (content.size() == 0) { - bw.write(name + value + "\n"); - } - else { - for (String item : content) { - bw.write(item + "\n"); - } - } + public static int readInt(MinecraftServer server, String name) { + try { + File file; + if (server.isDedicatedServer()) { + file = server.getFile(server.getFolderName() + "/data/Traincraft.dat"); + } else { + file = server.getFile("saves/" + server.getFolderName() + "/data/Traincraft.dat"); + } + if (file != null && file.exists()) { + BufferedReader reader = new BufferedReader(new FileReader(file)); + String line; + while ((line = reader.readLine()) != null) { + //if(!line.startsWith(name))continue;//numberOfTrains: + if (line.startsWith(name)) { + return (Integer.parseInt(line.substring(name.length()))); + } else { + reader.close(); + } + } + } + } catch (Throwable throwable) { + throw new RuntimeException(throwable); + } + return -1; + } - bw.close(); + public static void writeValue(MinecraftServer server, String name, String value) { + try { + File file; + File newFile; + ArrayList content = new ArrayList(); + if (server.isDedicatedServer()) { + file = server.getFile(server.getFolderName() + "/data/Traincraft.dat"); + newFile = server.getFile(server.getFolderName() + "/data/newTraincraft.dat"); + } else { + file = server.getFile("saves/" + server.getFolderName() + "/data/Traincraft.dat"); + newFile = server.getFile("saves/" + server.getFolderName() + "/data/newTraincraft.dat"); + } + if (file != null && file.exists()) { + newFile.createNewFile(); + BufferedReader reader = new BufferedReader(new FileReader(file)); + BufferedWriter bw = new BufferedWriter(new FileWriter(newFile)); + String line; + while ((line = reader.readLine()) != null) { + content.add(line); + } - file.delete(); - newFile.renameTo(file); - } - } catch (Throwable throwable) { - throw new RuntimeException(throwable); - } - } + reader.close(); + boolean replaced = false; + for (int i = 0; i < content.size(); i++) { + if (content.get(i).startsWith(name)) { + content.remove(i); + content.add(i, name + value); + replaced = true; + } + if (i == content.size() - 1 && !replaced) { + content.add(name + value); + } + } + + if (content.isEmpty()) { + bw.write(name + value + "\n"); + } else { + for (String item : content) { + bw.write(item + "\n"); + } + } + + bw.close(); + + file.delete(); + newFile.renameTo(file); + } + } catch (Throwable throwable) { + throw new RuntimeException(throwable); + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/handlers/TrainsDamageSource.java b/src/main/java/train/common/core/handlers/TrainsDamageSource.java index 7edc1785c8..e9e81e725d 100644 --- a/src/main/java/train/common/core/handlers/TrainsDamageSource.java +++ b/src/main/java/train/common/core/handlers/TrainsDamageSource.java @@ -11,43 +11,45 @@ public class TrainsDamageSource extends DamageSource { - public static final List damageSources = new ArrayList(); - - public static final TrainsDamageSource ranOver = (TrainsDamageSource) new TrainsDamageSource("ranOver", " was rolled over by a train!").setDamageBypassesArmor(); - public String deathMessage; - - public TrainsDamageSource(String damageType) { - super(damageType); - damageSources.add(this); - } - - public TrainsDamageSource(String damageType, String deathMessage) { - this(damageType); - setDeathMessage(deathMessage); - } - - public TrainsDamageSource setDeathMessage(String deathMessage) { - this.deathMessage = deathMessage; - return this; - } - @Override - public DamageSource setDamageAllowedInCreativeMode() { - return super.setDamageAllowedInCreativeMode(); - } - - /* - * public void registerDeathMessage() { LanguageRegistry.instance().addName("death.ranOver", "was rolled over!");//.addStringLocalization("death." + this.damageType, this.deathMessage); } */ - /** - * Returns the message to be displayed on player death. - */ - @Override - public ChatComponentText func_151519_b(EntityLivingBase living) { - if(living instanceof EntityPlayer) { - return new ChatComponentText(((EntityPlayer) living).getDisplayName() + deathMessage); - } else if(living instanceof EntityLiving &&((EntityLiving)living).getCustomNameTag() !=null && ((EntityLiving)living).getCustomNameTag().length()>0) { - return new ChatComponentText( ((EntityLiving)living).getCustomNameTag() + deathMessage); - } else { - return new ChatComponentText(living.getCommandSenderName() +deathMessage); - } - } + public static final List damageSources = new ArrayList<>(); + + public static final TrainsDamageSource ranOver = (TrainsDamageSource) new TrainsDamageSource("ranOver", " was rolled over by a train!").setDamageBypassesArmor(); + public String deathMessage; + + public TrainsDamageSource(String damageType) { + super(damageType); + damageSources.add(this); + } + + public TrainsDamageSource(String damageType, String deathMessage) { + this(damageType); + setDeathMessage(deathMessage); + } + + public TrainsDamageSource setDeathMessage(String deathMessage) { + this.deathMessage = deathMessage; + return this; + } + + @Override + public DamageSource setDamageAllowedInCreativeMode() { + return super.setDamageAllowedInCreativeMode(); + } + + /* + * public void registerDeathMessage() { LanguageRegistry.instance().addName("death.ranOver", "was rolled over!");//.addStringLocalization("death." + this.damageType, this.deathMessage); } */ + + /** + * Returns the message to be displayed on player death. + */ + @Override + public ChatComponentText func_151519_b(EntityLivingBase living) { + if (living instanceof EntityPlayer) { + return new ChatComponentText(((EntityPlayer) living).getDisplayName() + deathMessage); + } else if (living instanceof EntityLiving && ((EntityLiving) living).getCustomNameTag() != null && !((EntityLiving) living).getCustomNameTag().isEmpty()) { + return new ChatComponentText(((EntityLiving) living).getCustomNameTag() + deathMessage); + } else { + return new ChatComponentText(living.getCommandSenderName() + deathMessage); + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/handlers/VillagerTraincraftHandler.java b/src/main/java/train/common/core/handlers/VillagerTraincraftHandler.java index eeda37e674..c87a1bbb0c 100644 --- a/src/main/java/train/common/core/handlers/VillagerTraincraftHandler.java +++ b/src/main/java/train/common/core/handlers/VillagerTraincraftHandler.java @@ -19,77 +19,77 @@ import java.util.List; import java.util.Random; -public class VillagerTraincraftHandler implements IVillageCreationHandler,IVillageTradeHandler{ - //private Random rand = new Random(); - @Override - public void manipulateTradesForVillager(EntityVillager villager, - MerchantRecipeList recipeList, Random random) { - recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.rail, random,20), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,20), new ItemStack(Blocks.rail))); - - recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.activator_rail, random,4), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,4), new ItemStack(Blocks.activator_rail))); - - recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.detector_rail, random,4), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,4), new ItemStack(Blocks.detector_rail))); - - recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.golden_rail, random,10), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,10), new ItemStack(Blocks.golden_rail))); - - recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.clay, random,10), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,10), new ItemStack(Blocks.brick_block))); - - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.minecart, random,2), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,2), new ItemStack(Items.minecart))); - - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.chest_minecart, random,4), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,4), new ItemStack(Items.chest_minecart))); - - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.hopper_minecart, random,1), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,1), new ItemStack(Items.hopper_minecart))); - - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.furnace_minecart, random,2), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,2), new ItemStack(Items.furnace_minecart))); - - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.tnt_minecart, random,1), Items.emerald)); - recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random,1), new ItemStack(Items.tnt_minecart))); - - for(ItemIDs item : ItemIDs.values()){ - if(item!=null && item.item!=null){ - if(item.item instanceof ItemRollingStock){ - recipeList.add(new MerchantRecipe(new ItemStack(item.item), new ItemStack(Items.emerald,item.amountForEmerald))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald,item.amountForEmerald), item.item)); - }else if(item.amountForEmerald>0){ - if(!(item.item instanceof ItemRollingStock) && item.amountForEmerald>0){ - recipeList.add(new MerchantRecipe(new ItemStack(item.item,item.amountForEmerald), Items.emerald)); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(item.item,item.amountForEmerald))); - } - } - } - } - } - private ItemStack getRandomSizedStack(Block par0, Random random, int amount) - { - return new ItemStack(par0, random.nextInt(amount)+1, 0); +public class VillagerTraincraftHandler implements IVillageCreationHandler, IVillageTradeHandler { + //private Random rand = new Random(); + @Override + public void manipulateTradesForVillager(EntityVillager villager, + MerchantRecipeList recipeList, Random random) { + recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.rail, random, 20), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 20), new ItemStack(Blocks.rail))); + + recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.activator_rail, random, 4), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 4), new ItemStack(Blocks.activator_rail))); + + recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.detector_rail, random, 4), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 4), new ItemStack(Blocks.detector_rail))); + + recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.golden_rail, random, 10), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 10), new ItemStack(Blocks.golden_rail))); + + recipeList.add(new MerchantRecipe(getRandomSizedStack(Blocks.clay, random, 10), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 10), new ItemStack(Blocks.brick_block))); + + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.minecart, random, 2), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 2), new ItemStack(Items.minecart))); + + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.chest_minecart, random, 4), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 4), new ItemStack(Items.chest_minecart))); + + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.hopper_minecart, random, 1), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 1), new ItemStack(Items.hopper_minecart))); + + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.furnace_minecart, random, 2), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 2), new ItemStack(Items.furnace_minecart))); + + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.tnt_minecart, random, 1), Items.emerald)); + recipeList.add(new MerchantRecipe(getRandomSizedItemStack(Items.emerald, random, 1), new ItemStack(Items.tnt_minecart))); + + for (ItemIDs item : ItemIDs.values()) { + if (item != null && item.item != null) { + if (item.item instanceof ItemRollingStock) { + recipeList.add(new MerchantRecipe(new ItemStack(item.item), new ItemStack(Items.emerald, item.amountForEmerald))); + recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, item.amountForEmerald), item.item)); + } else if (item.amountForEmerald > 0) { + recipeList.add(new MerchantRecipe(new ItemStack(item.item, item.amountForEmerald), Items.emerald)); + recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(item.item, item.amountForEmerald))); + } + } + } + } + + private ItemStack getRandomSizedStack(Block par0, Random random, int amount) { + return new ItemStack(par0, random.nextInt(amount) + 1, 0); + } + + private ItemStack getRandomSizedItemStack(Item par0, Random random, int amount) { + return new ItemStack(par0, random.nextInt(amount) + 1, 0); + } + + @Override + public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, + int size) { + return new StructureVillagePieces.PieceWeight(ComponentVillageTrainstation.class, 15, MathHelper.getRandomIntegerInRange(random, size, 1 + size)); + } + + @Override + public Class getComponentClass() { + return ComponentVillageTrainstation.class; + } + + @Override + public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, + StructureVillagePieces.Start startPiece, List pieces, Random random, + int p1, int p2, int p3, int p4, int p5) { + return ComponentVillageTrainstation.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5); } - private ItemStack getRandomSizedItemStack(Item par0, Random random, int amount) - { - return new ItemStack(par0, random.nextInt(amount)+1, 0); - } - - @Override - public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, - int size) { - return new StructureVillagePieces.PieceWeight(ComponentVillageTrainstation.class, 15, MathHelper.getRandomIntegerInRange(random, size, 1 + size)); - } - @Override - public Class getComponentClass() { - return ComponentVillageTrainstation.class; - } - @Override - public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, - StructureVillagePieces.Start startPiece, List pieces, Random random, - int p1, int p2, int p3, int p4, int p5) { - return ComponentVillageTrainstation.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5); - } } diff --git a/src/main/java/train/common/core/handlers/WorldEvents.java b/src/main/java/train/common/core/handlers/WorldEvents.java index 72c8b9cd53..8c039c335b 100644 --- a/src/main/java/train/common/core/handlers/WorldEvents.java +++ b/src/main/java/train/common/core/handlers/WorldEvents.java @@ -14,75 +14,75 @@ import java.util.Random; -public class WorldEvents{ - private int windTicker = 0; - private static Random rand = new Random(); - public static int windStrength = 10 + rand.nextInt(10); +public class WorldEvents { + private int windTicker = 0; + private static final Random rand = new Random(); + public static int windStrength = 10 + rand.nextInt(10); - @SubscribeEvent - public void onWorldTick(TickEvent.WorldTickEvent handler){ - if(handler.world.isRemote){ - if(windTicker % 128 == 0){ - updateWind(); - windTicker=0; - } - windTicker++; - } - } + @SubscribeEvent + public void onWorldTick(TickEvent.WorldTickEvent handler) { + if (handler.world.isRemote) { + if (windTicker % 128 == 0) { + updateWind(); + windTicker = 0; + } + windTicker++; + } + } - private static void updateWind() { - int upChance = 10; - int downChance = 10; - if (windStrength > 20) { - upChance -= windStrength - 20; - } - else if (windStrength < 10) { - downChance -= 10 - windStrength; - } - if (rand.nextInt(100) <= upChance) { - windStrength += 1; - } - if (rand.nextInt(100) <= downChance) { - windStrength -= 1; - } - } - - @SubscribeEvent - public void entitySpawn(EntityJoinWorldEvent event) { - if(event.entity instanceof EntityAnimal) { - ((EntityAnimal) event.entity).tasks.addTask(0, new EntityAIFearHorn(((EntityAnimal) event.entity))); - } - } + private static void updateWind() { + int upChance = 10; + int downChance = 10; + if (windStrength > 20) { + upChance -= windStrength - 20; + } else if (windStrength < 10) { + downChance -= 10 - windStrength; + } - @SubscribeEvent - @SuppressWarnings("unused") - public void playerQuitEvent(PlayerEvent.PlayerLoggedOutEvent event){ - if (event.player.ridingEntity instanceof AbstractTrains){ - if (event.player.ridingEntity instanceof Locomotive) { - ((Locomotive) event.player.ridingEntity).isBraking=true; - ((Locomotive) event.player.ridingEntity).parkingBrake=true; - } - event.player.dismountEntity(event.player.ridingEntity); - event.player.ridingEntity = null; - } - } + if (rand.nextInt(100) <= upChance) { + windStrength += 1; + } - @SubscribeEvent - public void chunkUnloadEvent(ChunkEvent.Unload event){ - for(Object o : event.getChunk().entityLists){ - if (o instanceof EntityJukeBoxCart && ((EntityJukeBoxCart) o).isPlaying){ - ((EntityJukeBoxCart) o).player.stop(); - ((EntityJukeBoxCart) o).player.setVolume(0); - } - } - } + if (rand.nextInt(100) <= downChance) { + windStrength -= 1; + } + } + + @SubscribeEvent + public void entitySpawn(EntityJoinWorldEvent event) { + if (event.entity instanceof EntityAnimal) { + ((EntityAnimal) event.entity).tasks.addTask(0, new EntityAIFearHorn(((EntityAnimal) event.entity))); + } + } + + @SubscribeEvent + public void playerQuitEvent(PlayerEvent.PlayerLoggedOutEvent event) { + if (event.player.ridingEntity instanceof AbstractTrains) { + if (event.player.ridingEntity instanceof Locomotive) { + ((Locomotive) event.player.ridingEntity).isBraking = true; + ((Locomotive) event.player.ridingEntity).parkingBrake = true; + } + + event.player.dismountEntity(event.player.ridingEntity); + event.player.ridingEntity = null; + } + } + + @SubscribeEvent + public void chunkUnloadEvent(ChunkEvent.Unload event) { + for (Object o : event.getChunk().entityLists) { + if (o instanceof EntityJukeBoxCart && ((EntityJukeBoxCart) o).isPlaying) { + ((EntityJukeBoxCart) o).player.stop(); + ((EntityJukeBoxCart) o).player.setVolume(0); + } + } + } + + @SubscribeEvent + public void EntityStruckByLightningEvent(EntityStruckByLightningEvent event) { + if (event.entity instanceof AbstractTrains) { + event.setCanceled(true); + } + } - @SubscribeEvent - @SuppressWarnings("unused") - public void EntityStruckByLightningEvent(EntityStruckByLightningEvent event) { - if (event.entity instanceof AbstractTrains){ - event.setCanceled(true); - } - } - } diff --git a/src/main/java/train/common/core/interfaces/IPlugin.java b/src/main/java/train/common/core/interfaces/IPlugin.java index 26644071a0..a8cdbeab66 100644 --- a/src/main/java/train/common/core/interfaces/IPlugin.java +++ b/src/main/java/train/common/core/interfaces/IPlugin.java @@ -2,9 +2,9 @@ public interface IPlugin { - public abstract boolean isAvailable(); + boolean isAvailable(); - public abstract void initialize(); + void initialize(); //public HashMap getItems(); } \ No newline at end of file diff --git a/src/main/java/train/common/core/interfaces/ITier.java b/src/main/java/train/common/core/interfaces/ITier.java index ffa578e920..54b939313a 100644 --- a/src/main/java/train/common/core/interfaces/ITier.java +++ b/src/main/java/train/common/core/interfaces/ITier.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -11,19 +11,19 @@ import java.util.List; -public abstract interface ITier { +public interface ITier { - public abstract int Tier(); + int Tier(); - public abstract List knownRecipes(); + List knownRecipes(); - public abstract int[] getSlotSelected(); + int[] getSlotSelected(); - public abstract void setSlotSelected(int[] selected); + void setSlotSelected(int[] selected); - public abstract List getResultList(); + List getResultList(); - public abstract String getGUIName(); + String getGUIName(); - public abstract String getGUITexture(); + String getGUITexture(); } diff --git a/src/main/java/train/common/core/managers/TierRecipe.java b/src/main/java/train/common/core/managers/TierRecipe.java index 535aa3e636..75996b4bfd 100644 --- a/src/main/java/train/common/core/managers/TierRecipe.java +++ b/src/main/java/train/common/core/managers/TierRecipe.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -17,88 +17,90 @@ public class TierRecipe implements ITierRecipe { - private final int tier; - private final ItemStack output; - private final int outputSize; - - private final ItemStack[] stacks; - - public TierRecipe(int tier, ItemStack planks, ItemStack wheels, - ItemStack frame, ItemStack coupler, ItemStack chimney, - ItemStack cab, ItemStack boiler, ItemStack firebox, - ItemStack additional, ItemStack dye, ItemStack output, - int outputSize) { - this.tier = tier; - this.output = output; - this.outputSize = outputSize; - - stacks = new ItemStack[] { - planks, - wheels, - frame, - coupler, - chimney, - cab, - boiler, - firebox, - additional, - dye, - }; - } - - @Override - public int getTier() { - return tier; - } - - @Override - public ItemStack getOutput() { - return output; - } - - @Override - public List getInput() { - return Arrays.asList(stacks); - } - - public ItemStack hasComponents(ItemStack... items) { - for (int i = 0; i < stacks.length; i++) { - if(!areItemsIdentical(items[i], stacks[i])) { - return null; - } - if(!areSizesIdentical(items[i], stacks[i])) { - return null; - } - } - return output; - } - - public static boolean areItemsIdentical(ItemStack inSlot, ItemStack inRecipe) { - if (inRecipe == null || inSlot == null) { - return inRecipe == inSlot; - } else { - if (Item.getIdFromItem(inSlot.getItem()) != Item.getIdFromItem(inRecipe.getItem())) { - return false; - } - if (inRecipe.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - return true; - } - return inSlot.getItemDamage() == inRecipe.getItemDamage(); - } - } - - public static boolean areSizesIdentical(ItemStack inSlot, ItemStack inRecipe) { - if (inRecipe == null || inSlot == null) { - return inRecipe == inSlot; - } - return inSlot.stackSize >= inRecipe.stackSize; - } - - @Override - public int toDecrease(int slot) { - if (slot < stacks.length) { - return stacks[slot].stackSize; - } - return 0; - } + private final int tier; + private final ItemStack output; + + private final ItemStack[] stacks; + + public TierRecipe(int tier, ItemStack planks, ItemStack wheels, + ItemStack frame, ItemStack coupler, ItemStack chimney, + ItemStack cab, ItemStack boiler, ItemStack firebox, + ItemStack additional, ItemStack dye, ItemStack output, + int outputSize) { + this.tier = tier; + this.output = output; + + stacks = new ItemStack[]{ + planks, + wheels, + frame, + coupler, + chimney, + cab, + boiler, + firebox, + additional, + dye, + }; + } + + @Override + public int getTier() { + return tier; + } + + @Override + public ItemStack getOutput() { + return output; + } + + @Override + public List getInput() { + return Arrays.asList(stacks); + } + + public ItemStack hasComponents(ItemStack... items) { + for (int i = 0; i < stacks.length; i++) { + if (!areItemsIdentical(items[i], stacks[i])) { + return null; + } + if (!areSizesIdentical(items[i], stacks[i])) { + return null; + } + } + return output; + } + + public static boolean areItemsIdentical(ItemStack inSlot, ItemStack inRecipe) { + if (inRecipe == null || inSlot == null) { + return inRecipe == inSlot; + } else { + if (Item.getIdFromItem(inSlot.getItem()) != Item.getIdFromItem(inRecipe.getItem())) { + return false; + } + + if (inRecipe.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + return true; + } + + return inSlot.getItemDamage() == inRecipe.getItemDamage(); + } + } + + public static boolean areSizesIdentical(ItemStack inSlot, ItemStack inRecipe) { + if (inRecipe == null || inSlot == null) { + return inRecipe == inSlot; + } + + return inSlot.stackSize >= inRecipe.stackSize; + } + + @Override + public int toDecrease(int slot) { + if (slot < stacks.length) { + return stacks[slot].stackSize; + } + + return 0; + } } diff --git a/src/main/java/train/common/core/managers/TierRecipeManager.java b/src/main/java/train/common/core/managers/TierRecipeManager.java index 00e75a4c55..273ae6c263 100644 --- a/src/main/java/train/common/core/managers/TierRecipeManager.java +++ b/src/main/java/train/common/core/managers/TierRecipeManager.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2012 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -17,70 +17,72 @@ public class TierRecipeManager implements ITierCraftingManager { - private final List recipeList; - private static TierRecipeManager instance = new TierRecipeManager(); + private final List recipeList; + private static final TierRecipeManager instance = new TierRecipeManager(); - public TierRecipeManager() { - recipeList = new ArrayList(); - } + public TierRecipeManager() { + recipeList = new ArrayList<>(); + } - public static ITierCraftingManager getInstance() { - return instance; - } + public static ITierCraftingManager getInstance() { + return instance; + } - @Override - public void addRecipe(int tier, ItemStack planks, ItemStack wheels, - ItemStack frame, ItemStack coupler, ItemStack chimney, - ItemStack cab, ItemStack boiler, ItemStack firebox, - ItemStack additional, ItemStack dye, ItemStack output, - int outputSize) { - if ((tier > 0 && tier < 4) && outputSize > 0 && outputSize < 65) { - addRecipeFinal(tier, planks, wheels, frame, coupler, chimney, cab, - boiler, firebox, additional, dye, output, outputSize); - } else { - addRecipeFinal(1, planks, wheels, frame, coupler, chimney, cab, - boiler, firebox, additional, dye, output, 1); - } - } + @Override + public void addRecipe(int tier, ItemStack planks, ItemStack wheels, + ItemStack frame, ItemStack coupler, ItemStack chimney, + ItemStack cab, ItemStack boiler, ItemStack firebox, + ItemStack additional, ItemStack dye, ItemStack output, + int outputSize) { + if ((tier > 0 && tier < 4) && outputSize > 0 && outputSize < 65) { + addRecipeFinal(tier, planks, wheels, frame, coupler, chimney, cab, + boiler, firebox, additional, dye, output, outputSize); + } else { + addRecipeFinal(1, planks, wheels, frame, coupler, chimney, cab, + boiler, firebox, additional, dye, output, 1); + } + } - public void addRecipeFinal(int tier, ItemStack planks, ItemStack wheels, - ItemStack frame, ItemStack coupler, ItemStack chimney, - ItemStack cab, ItemStack boiler, ItemStack firebox, - ItemStack additional, ItemStack dye, ItemStack output, - int outputSize) { - recipeList.add(new TierRecipe(tier, planks, wheels, frame, coupler, - chimney, cab, boiler, firebox, additional, dye, output, - outputSize)); - } + public void addRecipeFinal(int tier, ItemStack planks, ItemStack wheels, + ItemStack frame, ItemStack coupler, ItemStack chimney, + ItemStack cab, ItemStack boiler, ItemStack firebox, + ItemStack additional, ItemStack dye, ItemStack output, + int outputSize) { + recipeList.add(new TierRecipe(tier, planks, wheels, frame, coupler, + chimney, cab, boiler, firebox, additional, dye, output, + outputSize)); + } - @Override - public ITierRecipe getTierRecipe(int tier, ItemStack output) { - if(output == null) { - return null; - } - for(ITierRecipe recipe: recipeList) { - if(Item.getIdFromItem(recipe.getOutput().getItem()) == Item.getIdFromItem(output.getItem()) && - recipe.getTier() == tier) { - return recipe; - } - } - return null; - } + @Override + public ITierRecipe getTierRecipe(int tier, ItemStack output) { + if (output == null) { + return null; + } - @Override - public List getRecipeList() { - return new ArrayList(this.recipeList); - } + for (ITierRecipe recipe : recipeList) { + if (Item.getIdFromItem(recipe.getOutput().getItem()) == Item.getIdFromItem(output.getItem()) && + recipe.getTier() == tier) { + return recipe; + } + } + return null; + } - @Override - public List getTierRecipeList(int tier) { - List list = new ArrayList(); - for (ITierRecipe recipe: recipeList) { - if (recipe.getTier() == tier) { - list.add(recipe); - } - } - return list; - } + @Override + public List getRecipeList() { + return new ArrayList<>(this.recipeList); + } + + @Override + public List getTierRecipeList(int tier) { + List list = new ArrayList<>(); + for (ITierRecipe recipe : recipeList) { + if (recipe.getTier() == tier) { + list.add(recipe); + } + } + + return list; + } } diff --git a/src/main/java/train/common/core/network/PacketDestination.java b/src/main/java/train/common/core/network/PacketDestination.java index 3ba0408d80..6071b70ba0 100644 --- a/src/main/java/train/common/core/network/PacketDestination.java +++ b/src/main/java/train/common/core/network/PacketDestination.java @@ -12,7 +12,8 @@ public class PacketDestination implements IMessage { public int entityID; public String destination; - public PacketDestination() {} + public PacketDestination() { + } public PacketDestination(Integer entityID, String destination) { this.entityID = entityID; @@ -33,14 +34,13 @@ public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketDestination message, MessageContext context) { - Entity TrainEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); if (TrainEntity instanceof Locomotive) { ((Locomotive) TrainEntity).destination = message.destination; } + return null; } } diff --git a/src/main/java/train/common/core/network/PacketHandler.java b/src/main/java/train/common/core/network/PacketHandler.java index 97662b6972..f96134f7cd 100644 --- a/src/main/java/train/common/core/network/PacketHandler.java +++ b/src/main/java/train/common/core/network/PacketHandler.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 20getNetworkID()2 Mrbrutal. All rights reserved. - * + * * @name TrainCraft * @author Mrbrutal ******************************************************************************/ @@ -17,67 +17,58 @@ public class PacketHandler { - public static void init(){ - Traincraft.tcLog.info("Initialize Packets"); - Traincraft.modChannel = NetworkRegistry.INSTANCE.newSimpleChannel(Info.channel); - Traincraft.keyChannel = NetworkRegistry.INSTANCE.newSimpleChannel(Info.keyChannel); - Traincraft.rotationChannel = NetworkRegistry.INSTANCE.newSimpleChannel(Info.rotationChannel); + public static void init() { + Traincraft.tcLog.info("Initialize Packets"); + Traincraft.modChannel = NetworkRegistry.INSTANCE.newSimpleChannel(Info.channel); + Traincraft.keyChannel = NetworkRegistry.INSTANCE.newSimpleChannel(Info.keyChannel); + Traincraft.rotationChannel = NetworkRegistry.INSTANCE.newSimpleChannel(Info.rotationChannel); + Traincraft.slotschannel = NetworkRegistry.INSTANCE.newSimpleChannel("slots"); + Traincraft.ignitionChannel = NetworkRegistry.INSTANCE.newSimpleChannel("ignition"); + Traincraft.brakeChannel = NetworkRegistry.INSTANCE.newSimpleChannel("brake"); + Traincraft.lockChannel = NetworkRegistry.INSTANCE.newSimpleChannel("lock"); + Traincraft.builderChannel = NetworkRegistry.INSTANCE.newSimpleChannel("builder"); - Traincraft.slotschannel = NetworkRegistry.INSTANCE.newSimpleChannel("slots"); - Traincraft.ignitionChannel = NetworkRegistry.INSTANCE.newSimpleChannel("ignition"); - Traincraft.brakeChannel = NetworkRegistry.INSTANCE.newSimpleChannel("brake"); - Traincraft.lockChannel = NetworkRegistry.INSTANCE.newSimpleChannel("lock"); - Traincraft.builderChannel = NetworkRegistry.INSTANCE.newSimpleChannel("builder"); + Traincraft.keyChannel.registerMessage(ItemAdminBook.PacketAdminBook.Handler.class, ItemAdminBook.PacketAdminBook.class, 4, Side.CLIENT); + Traincraft.keyChannel.registerMessage(ItemAdminBook.PacketAdminBookClient.Handler.class, ItemAdminBook.PacketAdminBookClient.class, 5, Side.SERVER); + Traincraft.keyChannel.registerMessage(PacketKeyPress.Handler.class, PacketKeyPress.class, 1, + Side.SERVER); + Traincraft.rotationChannel.registerMessage(PacketRollingStockRotation.Handler.class, + PacketRollingStockRotation.class, 2, Side.CLIENT); + Traincraft.modChannel.registerMessage(PacketSetJukeboxStreamingUrl.Handler.class, + PacketSetJukeboxStreamingUrl.class, 1, Side.SERVER); + Traincraft.slotschannel.registerMessage(PacketSlotsFilled.Handler.class, PacketSlotsFilled.class, + 3, Side.CLIENT); + Traincraft.brakeChannel.registerMessage(PacketParkingBrake.Handler.class, PacketParkingBrake.class, + 4, Side.SERVER); + Traincraft.lockChannel.registerMessage(PacketSetTrainLockedToClient.Handler.class, + PacketSetTrainLockedToClient.class, 5, Side.SERVER); + Traincraft.ignitionChannel.registerMessage(PacketSetLocoTurnedOn.Handler.class, PacketSetLocoTurnedOn.class, + 6, Side.SERVER); + Traincraft.modChannel.registerMessage(PacketLantern.Handler.class, PacketLantern.class, 7, + Side.SERVER); + Traincraft.builderChannel.registerMessage(PacketTrackBuilderHeight.Handler.class, + PacketTrackBuilderHeight.class, 8, Side.SERVER); + Traincraft.builderChannel.registerMessage(PacketTrackBuilderFollow.Handler.class, + PacketTrackBuilderFollow.class, 9, Side.SERVER); - - Traincraft.keyChannel.registerMessage(ItemAdminBook.PacketAdminBook.Handler.class, ItemAdminBook.PacketAdminBook.class, 4, Side.CLIENT); - Traincraft.keyChannel.registerMessage(ItemAdminBook.PacketAdminBookClient.Handler.class, ItemAdminBook.PacketAdminBookClient.class, 5, Side.SERVER); - - Traincraft.keyChannel.registerMessage(PacketKeyPress.Handler.class, PacketKeyPress.class, 1, - Side.SERVER); - Traincraft.rotationChannel.registerMessage(PacketRollingStockRotation.Handler.class, - PacketRollingStockRotation.class, 2, Side.CLIENT); - Traincraft.modChannel.registerMessage(PacketSetJukeboxStreamingUrl.Handler.class, - PacketSetJukeboxStreamingUrl.class, 1, Side.SERVER); - Traincraft.slotschannel.registerMessage(PacketSlotsFilled.Handler.class, PacketSlotsFilled.class, - 3, Side.CLIENT); - Traincraft.brakeChannel.registerMessage(PacketParkingBrake.Handler.class, PacketParkingBrake.class, - 4, Side.SERVER); - Traincraft.lockChannel.registerMessage(PacketSetTrainLockedToClient.Handler.class, - PacketSetTrainLockedToClient.class, 5, Side.SERVER); - Traincraft.ignitionChannel.registerMessage(PacketSetLocoTurnedOn.Handler.class, PacketSetLocoTurnedOn.class, - 6, Side.SERVER); - Traincraft.modChannel.registerMessage(PacketLantern.Handler.class, PacketLantern.class, 7, - Side.SERVER); - Traincraft.builderChannel.registerMessage(PacketTrackBuilderHeight.Handler.class, - PacketTrackBuilderHeight.class, 8, Side.SERVER); - Traincraft.builderChannel.registerMessage(PacketTrackBuilderFollow.Handler.class, - PacketTrackBuilderFollow.class, 9, Side.SERVER); - - //Traincraft.degActivateChannel.registerMessage(PacketDEGActivate.Handler.class, - // PacketDEGActivate.class, 10, Side.SERVER); - - /*Traincraft.degActivateChannel.registerMessage(PacketDEGActivate.Handler.class, - PacketDEGActivate.class, 10, Side.SERVER);*/ - - Traincraft.updateTrainIDChannel.registerMessage(PacketUpdateTrainID.Handler.class, PacketUpdateTrainID.class, 11, Side.SERVER); + Traincraft.updateTrainIDChannel.registerMessage(PacketUpdateTrainID.Handler.class, PacketUpdateTrainID.class, 11, Side.SERVER); Traincraft.updateDestinationChannel.registerMessage(PacketDestination.Handler.class, PacketDestination.class, 12, Side.SERVER); - Traincraft.itsChannel.registerMessage(PacketSetSpeedHandler.class, PacketSetSpeed.class, 200, Side.CLIENT); - Traincraft.itsChannel.registerMessage(PacketSetSpeedHandler.class, PacketSetSpeed.class, 212, Side.SERVER); + Traincraft.itsChannel.registerMessage(PacketSetSpeedHandler.class, PacketSetSpeed.class, 200, Side.CLIENT); + Traincraft.itsChannel.registerMessage(PacketSetSpeedHandler.class, PacketSetSpeed.class, 212, Side.SERVER); + + Traincraft.itnsChannel.registerMessage(PacketNextSpeedHandler.class, PacketNextSpeed.class, 211, Side.CLIENT); + Traincraft.mtlChannel.registerMessage(PacketMTCLevelUpdateHandler.class, PacketMTCLevelUpdate.class, 201, Side.SERVER); + Traincraft.msChannel.registerMessage(PacketMTChandler.class, PacketMTC.class, 202, Side.SERVER); + Traincraft.mscChannel.registerMessage(PacketMTChandler.class, PacketMTC.class, 203, Side.CLIENT); + Traincraft.atoChannel.registerMessage(PacketATOHandler.class, PacketATO.class, 205, Side.SERVER); + Traincraft.atoDoSlowDownChannel.registerMessage(PacketATODOSlowDownHandler.class, PacketATODoSlowDown.class, 206, Side.SERVER); + Traincraft.atoDoAccelChannel.registerMessage(PacketATODoAccelHandler.class, PacketDoAccel.class, 207, Side.SERVER); + Traincraft.atoSetStopPoint.registerMessage(PacketATOSetStopPointHandler.class, PacketATOSetStopPoint.class, 208, Side.CLIENT); + Traincraft.NCSlowDownChannel.registerMessage(PacketNCSlowDownHandler.class, PacketNCSlowDown.class, 209, Side.SERVER); - Traincraft.itnsChannel.registerMessage(PacketNextSpeedHandler.class, PacketNextSpeed.class, 211, Side.CLIENT); - Traincraft.mtlChannel.registerMessage(PacketMTCLevelUpdateHandler.class, PacketMTCLevelUpdate.class, 201, Side.SERVER); - Traincraft.msChannel.registerMessage(PacketMTChandler.class, PacketMTC.class, 202, Side.SERVER); - Traincraft.mscChannel.registerMessage(PacketMTChandler.class, PacketMTC.class, 203, Side.CLIENT); - Traincraft.atoChannel.registerMessage(PacketATOHandler.class, PacketATO.class, 205, Side.SERVER); - Traincraft.atoDoSlowDownChannel.registerMessage(PacketATODOSlowDownHandler.class, PacketATODoSlowDown.class, 206, Side.SERVER); - Traincraft.atoDoAccelChannel.registerMessage(PacketATODoAccelHandler.class, PacketDoAccel.class, 207, Side.SERVER); - Traincraft.atoSetStopPoint.registerMessage(PacketATOSetStopPointHandler.class, PacketATOSetStopPoint.class, 208, Side.CLIENT); - Traincraft.NCSlowDownChannel.registerMessage(PacketNCSlowDownHandler.class, PacketNCSlowDown.class, 209, Side.SERVER); - //Traincraft.ctChannel.registerMessage(PacketWMTCChannelTransmitHandler.class, PacketWMTCChannelTransmit.class, 210, Side.CLIENT); - Traincraft.gsfsChannel.registerMessage(PacketGetSomethingFromServerHandler.class, PacketGetSomethingFromServer.class, 213, Side.SERVER); - Traincraft.gsfsrChannel.registerMessage(PacketThingFromServerHandler.class, PacketThingFromServer.class, 214, Side.CLIENT); - } + Traincraft.gsfsChannel.registerMessage(PacketGetSomethingFromServerHandler.class, PacketGetSomethingFromServer.class, 213, Side.SERVER); + Traincraft.gsfsrChannel.registerMessage(PacketThingFromServerHandler.class, PacketThingFromServer.class, 214, Side.CLIENT); + } } diff --git a/src/main/java/train/common/core/network/PacketKeyPress.java b/src/main/java/train/common/core/network/PacketKeyPress.java index 0b0c21a4b4..cd5c430b9b 100644 --- a/src/main/java/train/common/core/network/PacketKeyPress.java +++ b/src/main/java/train/common/core/network/PacketKeyPress.java @@ -12,79 +12,62 @@ /** * Sent to the server when a key is pressed on the client.

- * + *

* Values and their meanings as adapted from old source code:
- * 7 = R
- * 4 = W
- * 5 = S
- * 8 = H
- * 9 = F
- * 0 = Y
- * 1 = A
- * 2 = X
- * 3 = D
- * 6 = C
- * 10 = B
+ * 7 = R
+ * 4 = W
+ * 5 = S
+ * 8 = H
+ * 9 = F
+ * 0 = Y
+ * 1 = A
+ * 2 = X
+ * 3 = D
+ * 6 = C
+ * 10 = B
*/ public class PacketKeyPress implements IMessage { - /** The key that was pressed. */ - int key; - - public PacketKeyPress() {} - - public PacketKeyPress(int key) { - - this.key = key; - } - - @Override - public void fromBytes(ByteBuf bbuf) { - - this.key = bbuf.readInt(); - } - - @Override - public void toBytes(ByteBuf bbuf) { - - bbuf.writeInt(this.key); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketKeyPress message, MessageContext context) { - - Entity ridingEntity = context.getServerHandler().playerEntity.ridingEntity; - - /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ - if (ridingEntity != null) { - - if (ridingEntity instanceof Locomotive) { - - ((Locomotive) ridingEntity).keyHandlerFromPacket(message.key); - } - else if (ridingEntity instanceof EntityRollingStock) { - - ((EntityRollingStock) ridingEntity).keyHandlerFromPacket(message.key); - } - else if (ridingEntity instanceof AbstractZeppelin) { - - ((AbstractZeppelin) ridingEntity).pressKey(message.key); - } - else if (ridingEntity instanceof EntityRotativeDigger) { - - ((EntityRotativeDigger) ridingEntity).pressKey(message.key); - } - } - - /*if (message.key == 404){ - CommonProxy.debug = CommonProxy.debug; - if (Minecraft.getMinecraft().theWorld != null) { - System.out.println(Minecraft.getMinecraft().theWorld.isRemote); - } - }*/ - return null; - } - } + /** + * The key that was pressed. + */ + int key; + + public PacketKeyPress() { + } + + public PacketKeyPress(int key) { + this.key = key; + } + + @Override + public void fromBytes(ByteBuf bbuf) { + this.key = bbuf.readInt(); + } + + @Override + public void toBytes(ByteBuf bbuf) { + bbuf.writeInt(this.key); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketKeyPress message, MessageContext context) { + Entity ridingEntity = context.getServerHandler().playerEntity.ridingEntity; + + /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ + if (ridingEntity != null) { + if (ridingEntity instanceof Locomotive) { + ((Locomotive) ridingEntity).keyHandlerFromPacket(message.key); + } else if (ridingEntity instanceof EntityRollingStock) { + ((EntityRollingStock) ridingEntity).keyHandlerFromPacket(message.key); + } else if (ridingEntity instanceof AbstractZeppelin) { + ((AbstractZeppelin) ridingEntity).pressKey(message.key); + } else if (ridingEntity instanceof EntityRotativeDigger) { + ((EntityRotativeDigger) ridingEntity).pressKey(message.key); + } + } + return null; + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/network/PacketLantern.java b/src/main/java/train/common/core/network/PacketLantern.java index c3664ecd4d..24b470b9c0 100644 --- a/src/main/java/train/common/core/network/PacketLantern.java +++ b/src/main/java/train/common/core/network/PacketLantern.java @@ -9,15 +9,18 @@ public class PacketLantern implements IMessage { - /** The key that was pressed. */ + /** + * The key that was pressed. + */ int color; int xPos; int yPos; int zPos; - public PacketLantern() {} - public PacketLantern(int color, int x, int y, int z) { + public PacketLantern() { + } + public PacketLantern(int color, int x, int y, int z) { this.color = color; this.xPos = x; this.yPos = y; @@ -26,7 +29,6 @@ public PacketLantern(int color, int x, int y, int z) { @Override public void fromBytes(ByteBuf bbuf) { - this.color = bbuf.readInt(); this.xPos = bbuf.readInt(); this.yPos = bbuf.readInt(); @@ -35,7 +37,6 @@ public void fromBytes(ByteBuf bbuf) { @Override public void toBytes(ByteBuf bbuf) { - bbuf.writeInt(this.color); bbuf.writeInt(this.xPos); bbuf.writeInt(this.yPos); @@ -43,21 +44,17 @@ public void toBytes(ByteBuf bbuf) { } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketLantern message, MessageContext context) { - TileEntity lantern = context.getServerHandler().playerEntity.worldObj.getTileEntity(message.xPos, message.yPos, message.zPos); - /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ + /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ if (lantern != null) { - if (lantern instanceof TileLantern) { ((TileLantern) lantern).setColor(message.color); } } - return null; } } diff --git a/src/main/java/train/common/core/network/PacketParkingBrake.java b/src/main/java/train/common/core/network/PacketParkingBrake.java index a58ad9a757..6fa9cd30e8 100644 --- a/src/main/java/train/common/core/network/PacketParkingBrake.java +++ b/src/main/java/train/common/core/network/PacketParkingBrake.java @@ -10,45 +10,41 @@ public class PacketParkingBrake implements IMessage { - boolean ParkingBrake; - int entityID; - public PacketParkingBrake() {} + boolean ParkingBrake; + int entityID; - public PacketParkingBrake(boolean parking, int trainEntity) { - this.ParkingBrake = parking; - this.entityID = trainEntity; + public PacketParkingBrake() { + } + + public PacketParkingBrake(boolean parking, int trainEntity) { + this.ParkingBrake = parking; + this.entityID = trainEntity; } @Override public void fromBytes(ByteBuf bbuf) { - this.ParkingBrake = bbuf.readBoolean(); - this.entityID = bbuf.readInt(); + this.ParkingBrake = bbuf.readBoolean(); + this.entityID = bbuf.readInt(); } @Override public void toBytes(ByteBuf bbuf) { - bbuf.writeBoolean(this.ParkingBrake); - bbuf.writeInt(this.entityID); + bbuf.writeBoolean(this.ParkingBrake); + bbuf.writeInt(this.entityID); } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketParkingBrake message, MessageContext context) { - - Entity TrainEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); - - if (TrainEntity instanceof Locomotive) { - - ((Locomotive) TrainEntity).setParkingBrakeFromPacket(message.ParkingBrake); - - } - - if (TrainEntity instanceof EntityRollingStock) { + Entity TrainEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); - ((EntityRollingStock) TrainEntity).isBraking = message.ParkingBrake; + if (TrainEntity instanceof Locomotive) { + ((Locomotive) TrainEntity).setParkingBrakeFromPacket(message.ParkingBrake); + } - } + if (TrainEntity instanceof EntityRollingStock) { + ((EntityRollingStock) TrainEntity).isBraking = message.ParkingBrake; + } return null; } diff --git a/src/main/java/train/common/core/network/PacketRollingStockRotation.java b/src/main/java/train/common/core/network/PacketRollingStockRotation.java index 8594065dea..0cbf4d8afb 100644 --- a/src/main/java/train/common/core/network/PacketRollingStockRotation.java +++ b/src/main/java/train/common/core/network/PacketRollingStockRotation.java @@ -10,73 +10,67 @@ /** * Sent to nearby clients to update the rotation of rolling stock.

- * + *

* Field names adapted from 1.6 Packet code. */ public class PacketRollingStockRotation implements IMessage { - int entityID; - int rotationYawServer; - int realRotation; - int anglePitch; - int posY; - boolean isInReverse; - - public PacketRollingStockRotation() {} - - public PacketRollingStockRotation(EntityRollingStock entity, int anglePitch) { - - this.entityID = entity.getEntityId(); - this.rotationYawServer = (int) entity.rotationYaw; // Don't even ASK ME why we do this. Probably an attempt to reduce Packet size, but at what cost of precision..? - this.realRotation = (int) entity.serverRealRotation; - this.anglePitch = anglePitch; - this.posY = Float.floatToIntBits((float) entity.posY); // improved accuracy with no usage increase - this.isInReverse = entity.isServerInReverse; - } - - @Override - public void fromBytes(ByteBuf bbuf) { - - this.entityID = bbuf.readInt(); - this.rotationYawServer = bbuf.readInt(); - this.realRotation = bbuf.readInt(); - this.anglePitch = bbuf.readInt(); - this.posY = bbuf.readInt(); - this.isInReverse = bbuf.readBoolean(); - } - - @Override - public void toBytes(ByteBuf bbuf) { - - bbuf.writeInt(this.entityID); - bbuf.writeInt(this.rotationYawServer); - bbuf.writeInt(this.realRotation); - bbuf.writeInt(this.anglePitch); - bbuf.writeInt(this.posY); - bbuf.writeBoolean(this.isInReverse); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketRollingStockRotation message, MessageContext context) { - - Minecraft mc = Minecraft.getMinecraft(); - if(mc.theWorld != null){ - Entity entity = mc.theWorld.getEntityByID(message.entityID); - if (entity instanceof EntityRollingStock) { - - EntityRollingStock rollingStock = (EntityRollingStock) entity; - rollingStock.rotationYawClient = message.rotationYawServer; - rollingStock.rotationYawClientReal = message.realRotation; - rollingStock.anglePitchClient = message.anglePitch; - rollingStock.isClientInReverse = message.isInReverse; - rollingStock.setYFromServer(Float.intBitsToFloat(message.posY)); - } - - } - - return null; - } - } + int entityID; + int rotationYawServer; + int realRotation; + int anglePitch; + int posY; + boolean isInReverse; + + public PacketRollingStockRotation() { + } + + public PacketRollingStockRotation(EntityRollingStock entity, int anglePitch) { + this.entityID = entity.getEntityId(); + this.rotationYawServer = (int) entity.rotationYaw; // Don't even ASK ME why we do this. Probably an attempt to reduce Packet size, but at what cost of precision..? + this.realRotation = (int) entity.serverRealRotation; + this.anglePitch = anglePitch; + this.posY = Float.floatToIntBits((float) entity.posY); // improved accuracy with no usage increase + this.isInReverse = entity.isServerInReverse; + } + + @Override + public void fromBytes(ByteBuf bbuf) { + this.entityID = bbuf.readInt(); + this.rotationYawServer = bbuf.readInt(); + this.realRotation = bbuf.readInt(); + this.anglePitch = bbuf.readInt(); + this.posY = bbuf.readInt(); + this.isInReverse = bbuf.readBoolean(); + } + + @Override + public void toBytes(ByteBuf bbuf) { + bbuf.writeInt(this.entityID); + bbuf.writeInt(this.rotationYawServer); + bbuf.writeInt(this.realRotation); + bbuf.writeInt(this.anglePitch); + bbuf.writeInt(this.posY); + bbuf.writeBoolean(this.isInReverse); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketRollingStockRotation message, MessageContext context) { + Minecraft mc = Minecraft.getMinecraft(); + if (mc.theWorld != null) { + Entity entity = mc.theWorld.getEntityByID(message.entityID); + if (entity instanceof EntityRollingStock) { + EntityRollingStock rollingStock = (EntityRollingStock) entity; + rollingStock.rotationYawClient = message.rotationYawServer; + rollingStock.rotationYawClientReal = message.realRotation; + rollingStock.anglePitchClient = message.anglePitch; + rollingStock.isClientInReverse = message.isInReverse; + rollingStock.setYFromServer(Float.intBitsToFloat(message.posY)); + } + } + + return null; + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/network/PacketSetJukeboxStreamingUrl.java b/src/main/java/train/common/core/network/PacketSetJukeboxStreamingUrl.java index 9a22c9ffa7..69303cecc9 100644 --- a/src/main/java/train/common/core/network/PacketSetJukeboxStreamingUrl.java +++ b/src/main/java/train/common/core/network/PacketSetJukeboxStreamingUrl.java @@ -10,7 +10,7 @@ /** * Sent to the server to set a Jukebox' music stream URL.

- * + *

* Note:
* The sent packet is handled so that the server directly applies the data.
* This might be considered bad, as the client's data remains unchecked for validity and such.
@@ -18,51 +18,52 @@ */ public class PacketSetJukeboxStreamingUrl implements IMessage { - /** The entity ID of the {@link EntityJukeBoxCart}. */ - int entityID; - /** True if the EntityJukeBoxCart should start playing, false if it should stop playing. */ - boolean setPlaying; - /** The URL of the music that shall be played. */ - String url; - - public PacketSetJukeboxStreamingUrl() {} - - public PacketSetJukeboxStreamingUrl(EntityJukeBoxCart jukeBoxCart, String url, boolean setPlaying) { - - this.entityID = jukeBoxCart.getEntityId(); - this.url = url; - this.setPlaying = setPlaying; - } - - @Override - public void fromBytes(ByteBuf bbuf) { - - this.entityID = bbuf.readInt(); - this.setPlaying = bbuf.readBoolean(); - this.url = ByteBufUtils.readUTF8String(bbuf); - } - - @Override - public void toBytes(ByteBuf bbuf) { - - bbuf.writeInt(this.entityID); - bbuf.writeBoolean(this.setPlaying); - ByteBufUtils.writeUTF8String(bbuf, this.url); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketSetJukeboxStreamingUrl message, MessageContext context) { - - Entity entity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); - - if (entity instanceof EntityJukeBoxCart) { - - ((EntityJukeBoxCart) entity).recievePacket(message.url, message.setPlaying); - } - - return null; - } - } + /** + * The entity ID of the {@link EntityJukeBoxCart}. + */ + int entityID; + /** + * True if the EntityJukeBoxCart should start playing, false if it should stop playing. + */ + boolean setPlaying; + /** + * The URL of the music that shall be played. + */ + String url; + + public PacketSetJukeboxStreamingUrl() { + } + + public PacketSetJukeboxStreamingUrl(EntityJukeBoxCart jukeBoxCart, String url, boolean setPlaying) { + this.entityID = jukeBoxCart.getEntityId(); + this.url = url; + this.setPlaying = setPlaying; + } + + @Override + public void fromBytes(ByteBuf bbuf) { + this.entityID = bbuf.readInt(); + this.setPlaying = bbuf.readBoolean(); + this.url = ByteBufUtils.readUTF8String(bbuf); + } + + @Override + public void toBytes(ByteBuf bbuf) { + bbuf.writeInt(this.entityID); + bbuf.writeBoolean(this.setPlaying); + ByteBufUtils.writeUTF8String(bbuf, this.url); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketSetJukeboxStreamingUrl message, MessageContext context) { + Entity entity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); + + if (entity instanceof EntityJukeBoxCart) { + ((EntityJukeBoxCart) entity).recievePacket(message.url, message.setPlaying); + } + + return null; + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/network/PacketSetLocoTurnedOn.java b/src/main/java/train/common/core/network/PacketSetLocoTurnedOn.java index c0c0367443..131a74d255 100644 --- a/src/main/java/train/common/core/network/PacketSetLocoTurnedOn.java +++ b/src/main/java/train/common/core/network/PacketSetLocoTurnedOn.java @@ -9,37 +9,35 @@ public class PacketSetLocoTurnedOn implements IMessage { - /** The key that was pressed. */ + /** + * The key that was pressed. + */ Boolean LocoOn; - public PacketSetLocoTurnedOn() {} - public PacketSetLocoTurnedOn(Boolean LocoOn) { + public PacketSetLocoTurnedOn() { + } + public PacketSetLocoTurnedOn(Boolean LocoOn) { this.LocoOn = LocoOn; } @Override public void fromBytes(ByteBuf bbuf) { - this.LocoOn = bbuf.readBoolean(); } @Override public void toBytes(ByteBuf bbuf) { - bbuf.writeBoolean(this.LocoOn); } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketSetLocoTurnedOn message, MessageContext context) { - Entity TrainEntity = context.getServerHandler().playerEntity.ridingEntity; - /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ + /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ if (TrainEntity != null) { - if (TrainEntity instanceof Locomotive) { ((Locomotive) TrainEntity).setLocoTurnedOnFromPacket(message.LocoOn); } diff --git a/src/main/java/train/common/core/network/PacketSetTrainLockedToClient.java b/src/main/java/train/common/core/network/PacketSetTrainLockedToClient.java index 32a7447144..a4ebed9182 100644 --- a/src/main/java/train/common/core/network/PacketSetTrainLockedToClient.java +++ b/src/main/java/train/common/core/network/PacketSetTrainLockedToClient.java @@ -9,38 +9,36 @@ public class PacketSetTrainLockedToClient implements IMessage { - boolean bool; - int entityID; - public PacketSetTrainLockedToClient(){} + boolean bool; + int entityID; - public PacketSetTrainLockedToClient(boolean bool, int trainEntity) { + public PacketSetTrainLockedToClient() { + } + + public PacketSetTrainLockedToClient(boolean bool, int trainEntity) { this.bool = bool; - this.entityID = trainEntity; + this.entityID = trainEntity; } @Override public void fromBytes(ByteBuf bbuf) { this.bool = bbuf.readBoolean(); - this.entityID = bbuf.readInt(); + this.entityID = bbuf.readInt(); } @Override public void toBytes(ByteBuf bbuf) { bbuf.writeBoolean(this.bool); - bbuf.writeInt(this.entityID); + bbuf.writeInt(this.entityID); } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketSetTrainLockedToClient message, MessageContext context) { - - Entity TrainEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); + Entity TrainEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); if (TrainEntity instanceof AbstractTrains) { - - ((AbstractTrains) TrainEntity).setTrainLockedFromPacket(message.bool); - + ((AbstractTrains) TrainEntity).setTrainLockedFromPacket(message.bool); } return null; diff --git a/src/main/java/train/common/core/network/PacketSlotsFilled.java b/src/main/java/train/common/core/network/PacketSlotsFilled.java index 7a0df06639..f7e893566c 100644 --- a/src/main/java/train/common/core/network/PacketSlotsFilled.java +++ b/src/main/java/train/common/core/network/PacketSlotsFilled.java @@ -13,47 +13,46 @@ */ public class PacketSlotsFilled implements IMessage { - /** The amount of slots filled. */ - int slotsFilled; - - /** The ID of the entity. */ - int entityID; - - public PacketSlotsFilled() {} - - public PacketSlotsFilled(Locomotive train, int slotsFilled) { - - this.slotsFilled = slotsFilled; - this.entityID = train.getEntityId(); - } - - @Override - public void fromBytes(ByteBuf bbuf) { - - this.slotsFilled = bbuf.readInt(); - this.entityID = bbuf.readInt(); - } - - @Override - public void toBytes(ByteBuf bbuf) { - - bbuf.writeInt(this.slotsFilled); - bbuf.writeInt(this.entityID); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketSlotsFilled message, MessageContext context) { - - Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityID); - - if (entity instanceof Locomotive) { - - ((Locomotive) entity).recieveSlotsFilled(message.slotsFilled); - } - - return null; - } - } + /** + * The amount of slots filled. + */ + int slotsFilled; + + /** + * The ID of the entity. + */ + int entityID; + + public PacketSlotsFilled() { + } + + public PacketSlotsFilled(Locomotive train, int slotsFilled) { + this.slotsFilled = slotsFilled; + this.entityID = train.getEntityId(); + } + + @Override + public void fromBytes(ByteBuf bbuf) { + this.slotsFilled = bbuf.readInt(); + this.entityID = bbuf.readInt(); + } + + @Override + public void toBytes(ByteBuf bbuf) { + bbuf.writeInt(this.slotsFilled); + bbuf.writeInt(this.entityID); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketSlotsFilled message, MessageContext context) { + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityID); + + if (entity instanceof Locomotive) { + ((Locomotive) entity).recieveSlotsFilled(message.slotsFilled); + } + + return null; + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/network/PacketTrackBuilderFollow.java b/src/main/java/train/common/core/network/PacketTrackBuilderFollow.java index f40400c590..8b587559e1 100644 --- a/src/main/java/train/common/core/network/PacketTrackBuilderFollow.java +++ b/src/main/java/train/common/core/network/PacketTrackBuilderFollow.java @@ -9,51 +9,47 @@ public class PacketTrackBuilderFollow implements IMessage { - /** The key that was pressed. */ - public int set; - public int id; - - public PacketTrackBuilderFollow() { - } - - public PacketTrackBuilderFollow(int set, int id) { - this.set = set; - this.id = id; - } - - @Override - public void fromBytes(ByteBuf bbuf) { - - this.set = bbuf.readInt(); - this.id = bbuf.readInt(); - } - - @Override - public void toBytes(ByteBuf bbuf) { - - bbuf.writeInt(this.set); - bbuf.writeInt(id); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketTrackBuilderFollow message, MessageContext context) { - Entity builderEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.id); - /* - * "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks - * for when the value is null anyways. - */ - if (builderEntity != null) { - - if (builderEntity instanceof EntityTracksBuilder) { - - ((EntityTracksBuilder) builderEntity).setFollowTracksFromPacket(message.set); - - } - } - - return null; - } - } + /** + * The key that was pressed. + */ + public int set; + public int id; + + public PacketTrackBuilderFollow() { + } + + public PacketTrackBuilderFollow(int set, int id) { + this.set = set; + this.id = id; + } + + @Override + public void fromBytes(ByteBuf bbuf) { + this.set = bbuf.readInt(); + this.id = bbuf.readInt(); + } + + @Override + public void toBytes(ByteBuf bbuf) { + bbuf.writeInt(this.set); + bbuf.writeInt(id); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketTrackBuilderFollow message, MessageContext context) { + Entity builderEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.id); + /* + * "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks + * for when the value is null anyways. + */ + if (builderEntity != null) { + if (builderEntity instanceof EntityTracksBuilder) { + ((EntityTracksBuilder) builderEntity).setFollowTracksFromPacket(message.set); + } + } + + return null; + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/network/PacketTrackBuilderHeight.java b/src/main/java/train/common/core/network/PacketTrackBuilderHeight.java index d34f7d387d..d037b16f0c 100644 --- a/src/main/java/train/common/core/network/PacketTrackBuilderHeight.java +++ b/src/main/java/train/common/core/network/PacketTrackBuilderHeight.java @@ -9,10 +9,14 @@ public class PacketTrackBuilderHeight implements IMessage { - /** The key that was pressed. */ + /** + * The key that was pressed. + */ public int set; public int id; - public PacketTrackBuilderHeight() {} + + public PacketTrackBuilderHeight() { + } public PacketTrackBuilderHeight(int set, int id) { this.set = set; @@ -21,30 +25,24 @@ public PacketTrackBuilderHeight(int set, int id) { @Override public void fromBytes(ByteBuf bbuf) { - this.set = bbuf.readInt(); this.id = bbuf.readInt(); } @Override public void toBytes(ByteBuf bbuf) { - bbuf.writeInt(this.set); bbuf.writeInt(id); } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketTrackBuilderHeight message, MessageContext context) { Entity builderEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.id); - /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ + /* "instanceof" is null-safe, but we check to avoid four unnecessary instanceof checks for when the value is null anyways. */ if (builderEntity != null) { - if (builderEntity instanceof EntityTracksBuilder) { - ((EntityTracksBuilder) builderEntity).setPlannedHeightFromPacket(message.set); - } } diff --git a/src/main/java/train/common/core/network/PacketUpdateTrainID.java b/src/main/java/train/common/core/network/PacketUpdateTrainID.java index e3a9d10908..ed9c1a88cd 100644 --- a/src/main/java/train/common/core/network/PacketUpdateTrainID.java +++ b/src/main/java/train/common/core/network/PacketUpdateTrainID.java @@ -12,14 +12,14 @@ public class PacketUpdateTrainID implements IMessage { public int entityID; public String trainID; - public PacketUpdateTrainID() {} + public PacketUpdateTrainID() { + } public PacketUpdateTrainID(Integer entityID, String trainID) { this.entityID = entityID; this.trainID = trainID; } - @Override public void fromBytes(ByteBuf buf) { this.entityID = buf.readInt(); @@ -33,10 +33,8 @@ public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler { - @Override public IMessage onMessage(PacketUpdateTrainID message, MessageContext context) { - Entity TrainEntity = context.getServerHandler().playerEntity.worldObj.getEntityByID(message.entityID); if (TrainEntity instanceof Locomotive) { ((Locomotive) TrainEntity).trainID = message.trainID; diff --git a/src/main/java/train/common/core/plugins/NEIAssemblyTableRecipePlugin.java b/src/main/java/train/common/core/plugins/NEIAssemblyTableRecipePlugin.java index bc549de347..152172ec96 100644 --- a/src/main/java/train/common/core/plugins/NEIAssemblyTableRecipePlugin.java +++ b/src/main/java/train/common/core/plugins/NEIAssemblyTableRecipePlugin.java @@ -23,70 +23,63 @@ import static codechicken.lib.gui.GuiDraw.*; public class NEIAssemblyTableRecipePlugin extends ShapedRecipeHandler { - private List recipeList = assemblyListCleaner(TierRecipeManager.getInstance().getRecipeList()); + private final List recipeList = assemblyListCleaner(TierRecipeManager.getInstance().getRecipeList()); private CachedShapedRecipe getShape(TierRecipe recipe) { CachedShapedRecipe shape = new CachedShapedRecipe(0, 0, null, recipe.getOutput()); - PositionedStack stack = null; + PositionedStack stack; if (recipe.getInput().get(0) != null) { stack = new PositionedStack(recipe.getInput().get(0), 20, 16); stack.setMaxSize(recipe.getInput().get(0).stackSize); shape.ingredients.add(stack); - stack = null; } + if (recipe.getInput().get(1) != null) { stack = new PositionedStack(recipe.getInput().get(1), 38, 82); stack.setMaxSize(recipe.getInput().get(1).stackSize); shape.ingredients.add(stack); - stack = null; } + if (recipe.getInput().get(2) != null) { stack = new PositionedStack(recipe.getInput().get(2), 74, 82); stack.setMaxSize(recipe.getInput().get(2).stackSize); shape.ingredients.add(stack); - stack = null; } + if (recipe.getInput().get(3) != null) { stack = new PositionedStack(recipe.getInput().get(3), 140, 82); stack.setMaxSize(recipe.getInput().get(3).stackSize); shape.ingredients.add(stack); - stack = null; } if (recipe.getInput().get(4) != null) { stack = new PositionedStack(recipe.getInput().get(4), 74, 16); stack.setMaxSize(recipe.getInput().get(4).stackSize); shape.ingredients.add(stack); - stack = null; } if (recipe.getInput().get(5) != null) { stack = new PositionedStack(recipe.getInput().get(5), 110, 16); stack.setMaxSize(recipe.getInput().get(5).stackSize); shape.ingredients.add(stack); - stack = null; } if (recipe.getInput().get(6) != null) { stack = new PositionedStack(recipe.getInput().get(6), 74, 50); stack.setMaxSize(recipe.getInput().get(6).stackSize); shape.ingredients.add(stack); - stack = null; } if (recipe.getInput().get(7) != null) { stack = new PositionedStack(recipe.getInput().get(7), 110, 50); stack.setMaxSize(recipe.getInput().get(7).stackSize); shape.ingredients.add(stack); - stack = null; } if (recipe.getInput().get(8) != null) { stack = new PositionedStack(recipe.getInput().get(8), 20, 50); stack.setMaxSize(recipe.getInput().get(8).stackSize); shape.ingredients.add(stack); - stack = null; } if (recipe.getInput().get(9) != null) { stack = new PositionedStack(recipe.getInput().get(9), 140, 16); stack.setMaxSize(recipe.getInput().get(9).stackSize); shape.ingredients.add(stack); - stack = null; } shape.result.relx = 87; @@ -145,7 +138,7 @@ public void computeVisuals() { /** * This will perform default cycling of ingredients, mulitItem capable * - * @return + * @return The cycled ingredients */ private int cycleTicks = 0; @@ -156,7 +149,7 @@ public List getCycledIngredients(int cycle, List list = OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(ingredients.get(itemIndex).item))); Random rand = new Random(cycle + System.currentTimeMillis()); if (cycleTicks % 15 == 0) { int stackSize = ingredients.get(itemIndex).item.stackSize; @@ -263,22 +256,17 @@ public void loadCraftingRecipes(String outputId, Object... results) { } } - public static List assemblyListCleaner(List recipeList) { - HashSet outputList = new HashSet(); - ArrayList cleanedList = new ArrayList(); - for (int i = 0; i < recipeList.size(); i++) { - //ItemStack output = ((TierRecipe) recipeList.get(i)).getOutput(); - int id=Item.getIdFromItem(((TierRecipe) recipeList.get(i)).getOutput().getItem()); - if (outputList != null) { - if (!outputList.contains(id)) { - cleanedList.add(recipeList.get(i)); - } - } - else { - cleanedList.add(recipeList.get(i)); - } - outputList.add(id); - } + public static List assemblyListCleaner(List recipeList) { + HashSet outputList = new HashSet<>(); + ArrayList cleanedList = new ArrayList<>(); + for (Object o : recipeList) { + //ItemStack output = ((TierRecipe) recipeList.get(i)).getOutput(); + int id = Item.getIdFromItem(((TierRecipe) o).getOutput().getItem()); + if (!outputList.contains(id)) { + cleanedList.add((TierRecipe) o); + } + outputList.add(id); + } return cleanedList; } } \ No newline at end of file diff --git a/src/main/java/train/common/core/plugins/NEIDistillationTowerRecipePlugin.java b/src/main/java/train/common/core/plugins/NEIDistillationTowerRecipePlugin.java index a5dfd3ddd4..a633847c73 100644 --- a/src/main/java/train/common/core/plugins/NEIDistillationTowerRecipePlugin.java +++ b/src/main/java/train/common/core/plugins/NEIDistillationTowerRecipePlugin.java @@ -28,220 +28,195 @@ import static codechicken.lib.gui.GuiDraw.changeTexture; import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; -public class NEIDistillationTowerRecipePlugin extends FurnaceRecipeHandler{ - public class SmeltingPair extends CachedRecipe - { - public SmeltingPair(ItemStack ingred, ItemStack result) - { +public class NEIDistillationTowerRecipePlugin extends FurnaceRecipeHandler { + public class SmeltingPair extends CachedRecipe { + public SmeltingPair(ItemStack ingred, ItemStack result) { ingred.stackSize = 1; this.ingred = new PositionedStack(ingred, 51, 13); this.result = null;//new PositionedStack(result, 118, 29); } + @Override - public PositionedStack getIngredient() - { - int cycle = cycleticks *(1/48); - if(ingred.item.getItemDamage() == -1) - { + public PositionedStack getIngredient() { + int cycle = cycleticks * (1 / 48); + if (ingred.item.getItemDamage() == -1) { PositionedStack stack = ingred.copy(); int maxDamage = 0; - do - { + do { maxDamage++; stack.item.setItemDamage(maxDamage); - } - while(stack.item != null); - + } while (stack.item != null); + stack.item.setItemDamage(cycle % maxDamage); return stack; } return ingred; } + @Override - public PositionedStack getResult() - { + public PositionedStack getResult() { return result; } + @Override - public PositionedStack getOtherStack() - { - return afuelsDistil.get((cycleticks*(1/48)) % afuelsDistil.size()).stack; + public PositionedStack getOtherStack() { + return afuelsDistil.get((cycleticks * (1 / 48)) % afuelsDistil.size()).stack; } + /** * Return extra items that are not directly involved in the ingredient->result relationship. Eg fuels. * Use this if you have more than one other stack + * * @return A list of positioned items. */ @Override - public List getOtherStacks() - { + public List getOtherStacks() { ArrayList stacks = new ArrayList(); - PositionedStack stack = afuelsDistil.get((cycleticks*(1/48)) % afuelsDistil.size()).stack; - PositionedStack stackPlastic = new PositionedStack(new ItemStack(ItemIDs.rawPlastic.item,1,-1), 111, 56); - if(stack != null) - stacks.add(stack); - if(stackPlastic != null) - stacks.add(stackPlastic); - + PositionedStack stack = afuelsDistil.get((cycleticks * (1 / 48)) % afuelsDistil.size()).stack; + PositionedStack stackPlastic = new PositionedStack(new ItemStack(ItemIDs.rawPlastic.item, 1, -1), 111, 56); + if (stack != null) stacks.add(stack); + stacks.add(stackPlastic); + return stacks; } - + PositionedStack ingred; PositionedStack result; } - @Override - public void loadTransferRects() - { + + @Override + public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 41), "tc distillation tower")); } - + @Override - public Class getGuiClass() - { + public Class getGuiClass() { return GuiDistil.class; } - + @Override - public String getRecipeName() - { + public String getRecipeName() { return "Distillation tower"; } @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals("tc distillation tower") && getClass() == NEIDistillationTowerRecipePlugin.class)//don't want subclasses getting a hold of this + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals("tc distillation tower") && getClass() == NEIDistillationTowerRecipePlugin.class)//don't want subclasses getting a hold of this { - HashMap recipes = (HashMap) DistilRecipes.smelting().getSmeltingList(); + HashMap recipes = (HashMap) DistilRecipes.smelting().getSmeltingList(); - for (Entry recipe : recipes.entrySet()) - { + for (Entry recipe : recipes.entrySet()) { ItemStack item = recipe.getValue(); - ItemStack ingredient = new ItemStack((recipe.getKey()), 1, -1); - if(ingredient!=null && ingredient.getItem() instanceof ItemBlockOreTC){ - ingredient.setItemDamage(1); - arecipes.add(new SmeltingPair(ingredient, item)); - ingredient.setItemDamage(2); - arecipes.add(new SmeltingPair(ingredient, item)); - }else{ - arecipes.add(new SmeltingPair(ingredient, item)); - } + ItemStack ingredient = new ItemStack((recipe.getKey()), 1, -1); + if (ingredient.getItem() instanceof ItemBlockOreTC) { + ingredient.setItemDamage(1); + arecipes.add(new SmeltingPair(ingredient, item)); + ingredient.setItemDamage(2); + arecipes.add(new SmeltingPair(ingredient, item)); + } else { + arecipes.add(new SmeltingPair(ingredient, item)); + } } - - } - else - { + + } else { super.loadCraftingRecipes(outputId, results); } } - + @Override - public void loadCraftingRecipes(ItemStack result) - { - HashMap recipes = (HashMap) DistilRecipes.smelting().getSmeltingList(); + public void loadCraftingRecipes(ItemStack result) { + HashMap recipes = (HashMap) DistilRecipes.smelting().getSmeltingList(); - for (Entry recipe : recipes.entrySet()) - { + for (Entry recipe : recipes.entrySet()) { ItemStack item = recipe.getValue(); - if(NEIServerUtils.areStacksSameType(item, result)) - { - ItemStack ingredient = new ItemStack((recipe.getKey()), 1, -1); - if(ingredient!=null && ingredient.getItem() instanceof ItemBlockOreTC){ - ingredient.setItemDamage(1); - arecipes.add(new SmeltingPair(ingredient, item)); - ingredient.setItemDamage(2); - arecipes.add(new SmeltingPair(ingredient, item)); - }else{ - arecipes.add(new SmeltingPair(ingredient, item)); - } + if (NEIServerUtils.areStacksSameType(item, result)) { + ItemStack ingredient = new ItemStack((recipe.getKey()), 1, -1); + if (ingredient.getItem() instanceof ItemBlockOreTC) { + ingredient.setItemDamage(1); + arecipes.add(new SmeltingPair(ingredient, item)); + ingredient.setItemDamage(2); + arecipes.add(new SmeltingPair(ingredient, item)); + } else { + arecipes.add(new SmeltingPair(ingredient, item)); + } } } - + } @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("fuel") && getClass() == NEIDistillationTowerRecipePlugin.class)//don't want subclasses getting a hold of this - { + public void loadUsageRecipes(String inputId, Object... ingredients) { + // Don't want subclasses getting a hold of this + if (inputId.equals("fuel") && getClass() == NEIDistillationTowerRecipePlugin.class){ loadCraftingRecipes("tc distillation tower"); - } - else - { + } else { super.loadUsageRecipes(inputId, ingredients); } } - + @Override - public void loadUsageRecipes(ItemStack ingredient) - { - HashMap recipes = (HashMap) DistilRecipes.smelting().getSmeltingList(); - - for (Entry recipe : recipes.entrySet()) - { + public void loadUsageRecipes(ItemStack ingredient) { + HashMap recipes = (HashMap) DistilRecipes.smelting().getSmeltingList(); + + for (Entry recipe : recipes.entrySet()) { ItemStack item = recipe.getValue(); - if (ingredient.getItem() == recipe.getKey()) - { - if(ingredient!=null && ingredient.getItem() instanceof ItemBlockOreTC){ - ingredient.setItemDamage(1); - arecipes.add(new SmeltingPair(ingredient, item)); - ingredient.setItemDamage(2); - arecipes.add(new SmeltingPair(ingredient, item)); - }else{ - arecipes.add(new SmeltingPair(ingredient, item)); - } + if (ingredient.getItem() == recipe.getKey()) { + if (ingredient.getItem() instanceof ItemBlockOreTC) { + ingredient.setItemDamage(1); + arecipes.add(new SmeltingPair(ingredient, item)); + ingredient.setItemDamage(2); + arecipes.add(new SmeltingPair(ingredient, item)); + } else { + arecipes.add(new SmeltingPair(ingredient, item)); + } } } - + } - + @Override - public String getGuiTexture() - { + public String getGuiTexture() { return "tc:textures/gui/gui_distillation_tower2.png"; } @Override - public void drawExtras(int recipe) - { + public void drawExtras(int recipe) { drawProgressBar(51, 32, 176, 0, 14, 14, 48, 7); drawProgressBar(74, 30, 176, 14, 31, 41, 48, 0); - if(recipe==5){//TODO this is very bad - drawProgressBar(140, 2, 197, 57, 18, 52, 70, 3); - }else{ - drawProgressBar(140, 2, 177, 57, 18, 52, 70, 3); + if (recipe == 5) {//TODO this is very bad + drawProgressBar(140, 2, 197, 57, 18, 52, 70, 3); + } else { + drawProgressBar(140, 2, 177, 57, 18, 52, 70, 3); } } - - public void drawBackground(int recipe) - { + + public void drawBackground(int recipe) { GL11.glColor4f(1, 1, 1, 1); changeTexture(getGuiTexture()); drawTexturedModalRect(0, 0, 5, 4, 166, 75); } - + @Override - public String getOverlayIdentifier() - { + public String getOverlayIdentifier() { return "tc distillation tower"; } + @Override - public int recipiesPerPage() - { - return 1; - } + public int recipiesPerPage() { + return 1; + } + public static ArrayList afuelsDistil; public static TreeSet efuelsDistil; + @Override - public TemplateRecipeHandler newInstance() - { - if(afuelsDistil == null) - findFuelsDistil(); + public TemplateRecipeHandler newInstance() { + if (afuelsDistil == null) findFuelsDistil(); return super.newInstance(); } - private static void removeFuelsDistil() - { - efuelsDistil = new TreeSet(); + + private static void removeFuelsDistil() { + efuelsDistil = new TreeSet<>(); efuelsDistil.add(Block.getIdFromBlock(Blocks.brown_mushroom)); efuelsDistil.add(Block.getIdFromBlock(Blocks.red_mushroom)); efuelsDistil.add(Block.getIdFromBlock(Blocks.standing_sign)); @@ -249,32 +224,27 @@ private static void removeFuelsDistil() efuelsDistil.add(Block.getIdFromBlock(Blocks.wooden_door)); efuelsDistil.add(Block.getIdFromBlock(Blocks.trapped_chest)); } - - private static void findFuelsDistil() - { - afuelsDistil = new ArrayList(); - for(ItemStack item : ItemList.items) - { - if(!efuelsDistil.contains(Item.getIdFromItem(item.getItem()))) - { + + private static void findFuelsDistil() { + afuelsDistil = new ArrayList<>(); + for (ItemStack item : ItemList.items) { + if (!efuelsDistil.contains(Item.getIdFromItem(item.getItem()))) { int burnTime = TileEntityFurnace.getItemBurnTime(item); - if(burnTime > 0) - afuelsDistil.add(new FuelPairDistil(item.copy(), burnTime)); + if (burnTime > 0) afuelsDistil.add(new FuelPairDistil(item.copy(), burnTime)); } } } - static - { + + static { removeFuelsDistil(); } - public static class FuelPairDistil - { - public FuelPairDistil(ItemStack ingred, int burnTime) - { + + public static class FuelPairDistil { + public FuelPairDistil(ItemStack ingred, int burnTime) { this.stack = new PositionedStack(ingred, 51, 49, false); this.burnTime = burnTime; } - + public PositionedStack stack; public int burnTime; } diff --git a/src/main/java/train/common/core/plugins/NEIOpenHearthFurnaceRecipePlugin.java b/src/main/java/train/common/core/plugins/NEIOpenHearthFurnaceRecipePlugin.java index a798082c9f..2f0941d556 100644 --- a/src/main/java/train/common/core/plugins/NEIOpenHearthFurnaceRecipePlugin.java +++ b/src/main/java/train/common/core/plugins/NEIOpenHearthFurnaceRecipePlugin.java @@ -18,188 +18,176 @@ import java.util.List; public class NEIOpenHearthFurnaceRecipePlugin extends ShapedRecipeHandler { - CachedShapedRecipe getShape(ItemStack ingredient1, ItemStack ingredient2, ItemStack result) { - CachedShapedRecipe shape = new CachedShapedRecipe(0, 0, null, result); - - if (ingredient1 != null) { - PositionedStack stack = new PositionedStack(ingredient1, 30, 6); - stack.setMaxSize(1); - shape.ingredients.add(stack); - stack = null; - } - if (ingredient2 != null) { - PositionedStack stack = new PositionedStack(ingredient2, 51, 6); - stack.setMaxSize(1); - shape.ingredients.add(stack); + CachedShapedRecipe getShape(ItemStack ingredient1, ItemStack ingredient2, ItemStack result) { + CachedShapedRecipe shape = new CachedShapedRecipe(0, 0, null, result); + + if (ingredient1 != null) { + PositionedStack stack = new PositionedStack(ingredient1, 30, 6); + stack.setMaxSize(1); + shape.ingredients.add(stack); } + if (ingredient2 != null) { + PositionedStack stack = new PositionedStack(ingredient2, 51, 6); + stack.setMaxSize(1); + shape.ingredients.add(stack); + } - shape.result.relx = 111; - shape.result.rely = 24; - return shape; - } - public class CachedShapedRecipe extends CachedRecipe - { + shape.result.relx = 111; + shape.result.rely = 24; + return shape; + } + + public class CachedShapedRecipe extends CachedRecipe { public ArrayList ingredients; public PositionedStack result; - - public CachedShapedRecipe(int width, int height, Object[] items, ItemStack out) - { + + public CachedShapedRecipe(int width, int height, Object[] items, ItemStack out) { result = new PositionedStack(out, 119, 24); ingredients = new ArrayList(); setIngredients(width, height, items); } - - public CachedShapedRecipe(ShapedRecipes recipe) - { + + public CachedShapedRecipe(ShapedRecipes recipe) { this(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems, recipe.getRecipeOutput()); } - + /** - * @param width - * @param height - * @param items an ItemStack[] or ItemStack[][] + * @param width of the recipe + * @param height of the recipe + * @param items an ItemStack[] or ItemStack[][] */ - public void setIngredients(int width, int height, Object[] items) - { - for(int x = 0; x < width; x++) - { - for(int y = 0; y < height; y++) - { - if(items[y*width+x] == null) + public void setIngredients(int width, int height, Object[] items) { + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + if (items[y * width + x] == null) continue; - - PositionedStack stack = new PositionedStack(items[y*width+x], 25+x*18, 6+y*18, false); + + PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false); stack.setMaxSize(1); ingredients.add(stack); } } } - + @Override - public List getIngredients() - { + public List getIngredients() { return getCycledIngredients(cycleticks / 20, ingredients); } - - public PositionedStack getResult() - { + + public PositionedStack getResult() { return result; } - - public void computeVisuals() - { - for(PositionedStack p : ingredients) + + public void computeVisuals() { + for (PositionedStack p : ingredients) p.generatePermutations(); - + result.generatePermutations(); } + @Override - public PositionedStack getOtherStack() { - return afuels.get((cycleticks / 48) % afuels.size()).stack; - } + public PositionedStack getOtherStack() { + return afuels.get((cycleticks / 48) % afuels.size()).stack; + } } - @Override - public Class getGuiClass() { - return GuiOpenHearthFurnace.class; - } - - @Override - public String getRecipeName() { - return "Open Hearth Furnace"; - } - - @Override - public void loadTransferRects() { - //transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "fuel")); - transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "open hearth furnace")); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("open hearth furnace") && getClass() == NEIOpenHearthFurnaceRecipePlugin.class) { - for (OpenHearthFurnaceRecipe recipe : TrainCraftingManager.instance.getHearthFurnaceRecipeList()) { - ItemStack[] items = recipe.getRecipe(); - ItemStack output = recipe.getCraftingResult(); - arecipes.add(getShape(items[0], items[1], output)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - for (OpenHearthFurnaceRecipe recipe : TrainCraftingManager.instance.getHearthFurnaceRecipeList()) { - ItemStack item = recipe.getCraftingResult(); - if (NEIServerUtils.areStacksSameType(item, result)) { - ItemStack[] items = recipe.getRecipe(); - arecipes.add(getShape(items[0], items[1], result)); - } - } - } + @Override + public Class getGuiClass() { + return GuiOpenHearthFurnace.class; + } - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) { - if (inputId.equals("fuel") && getClass() == NEIOpenHearthFurnaceRecipePlugin.class) { - loadCraftingRecipes("open hearth furnace"); - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - for (OpenHearthFurnaceRecipe recipe : TrainCraftingManager.instance.getHearthFurnaceRecipeList()) { - ItemStack item = recipe.getCraftingResult(); - ItemStack[] items = recipe.getRecipe(); - if (ingredient.getItem() == items[0].getItem() || ingredient.getItem() == items[1].getItem()) { - arecipes.add(getShape(items[0], items[1], item)); - } - } - } + @Override + public String getRecipeName() { + return "Open Hearth Furnace"; + } + + @Override + public void loadTransferRects() { + //transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "fuel")); + transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "open hearth furnace")); + } - @Override - public String getGuiTexture() { - return "tc:textures/gui/gui_open_hearth_furnace.png"; - } + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals("open hearth furnace") && getClass() == NEIOpenHearthFurnaceRecipePlugin.class) { + for (OpenHearthFurnaceRecipe recipe : TrainCraftingManager.instance.getHearthFurnaceRecipeList()) { + ItemStack[] items = recipe.getRecipe(); + ItemStack output = recipe.getCraftingResult(); + arecipes.add(getShape(items[0], items[1], output)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } - public static class FuelPair { - public FuelPair(ItemStack ingred, int burnTime) { - this.stack = new PositionedStack(ingred, 42, 42, false); - this.burnTime = burnTime; - } + @Override + public void loadCraftingRecipes(ItemStack result) { + for (OpenHearthFurnaceRecipe recipe : TrainCraftingManager.instance.getHearthFurnaceRecipeList()) { + ItemStack item = recipe.getCraftingResult(); + if (NEIServerUtils.areStacksSameType(item, result)) { + ItemStack[] items = recipe.getRecipe(); + arecipes.add(getShape(items[0], items[1], result)); + } + } - public PositionedStack stack; - public int burnTime; - } + } - public static ArrayList afuels; + @Override + public void loadUsageRecipes(String inputId, Object... ingredients) { + if (inputId.equals("fuel") && getClass() == NEIOpenHearthFurnaceRecipePlugin.class) { + loadCraftingRecipes("open hearth furnace"); + } else { + super.loadUsageRecipes(inputId, ingredients); + } + } - @Override - public TemplateRecipeHandler newInstance() { - if (afuels == null) findFuels(); - return super.newInstance(); - } + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (OpenHearthFurnaceRecipe recipe : TrainCraftingManager.instance.getHearthFurnaceRecipeList()) { + ItemStack item = recipe.getCraftingResult(); + ItemStack[] items = recipe.getRecipe(); + if (ingredient.getItem() == items[0].getItem() || ingredient.getItem() == items[1].getItem()) { + arecipes.add(getShape(items[0], items[1], item)); + } + } + } - @Override - public void drawExtras(int recipe) { - drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); - drawProgressBar(31, 25, 176, 0, 14, 14, 48, 7); - drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); - } + @Override + public String getGuiTexture() { + return "tc:textures/gui/gui_open_hearth_furnace.png"; + } + public static class FuelPair { + public FuelPair(ItemStack ingred, int burnTime) { + this.stack = new PositionedStack(ingred, 42, 42, false); + this.burnTime = burnTime; + } - private static void findFuels() { - afuels = new ArrayList(); - for (ItemStack item : ItemList.items) { - int burnTime = TileEntityFurnace.getItemBurnTime(item); - if (burnTime > 0) afuels.add(new FuelPair(item.copy(), burnTime)); - } - } + public PositionedStack stack; + public int burnTime; + } + + public static ArrayList afuels; + + @Override + public TemplateRecipeHandler newInstance() { + if (afuels == null) findFuels(); + return super.newInstance(); + } + + @Override + public void drawExtras(int recipe) { + drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); + drawProgressBar(31, 25, 176, 0, 14, 14, 48, 7); + drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); + } - static { - } + + private static void findFuels() { + afuels = new ArrayList<>(); + for (ItemStack item : ItemList.items) { + int burnTime = TileEntityFurnace.getItemBurnTime(item); + if (burnTime > 0) afuels.add(new FuelPair(item.copy(), burnTime)); + } + } } diff --git a/src/main/java/train/common/core/plugins/NEITraincraftConfig.java b/src/main/java/train/common/core/plugins/NEITraincraftConfig.java index d454713c64..4683cb5688 100644 --- a/src/main/java/train/common/core/plugins/NEITraincraftConfig.java +++ b/src/main/java/train/common/core/plugins/NEITraincraftConfig.java @@ -7,9 +7,9 @@ public class NEITraincraftConfig implements IConfigureNEI { - @Override - public void loadConfig() { - if (!ConfigHandler.DISABLE_NEI_RECIPES) { + @Override + public void loadConfig() { + if (!ConfigHandler.DISABLE_NEI_RECIPES) { API.registerRecipeHandler(new NEITraincraftWorkbenchRecipePlugin()); API.registerUsageHandler(new NEITraincraftWorkbenchRecipePlugin()); API.registerRecipeHandler(new NEIAssemblyTableRecipePlugin()); @@ -19,15 +19,15 @@ public void loadConfig() { API.registerRecipeHandler(new NEIDistillationTowerRecipePlugin()); API.registerUsageHandler(new NEIDistillationTowerRecipePlugin()); } - } + } - @Override + @Override public String getName() { - return Info.modName; + return Info.modName; } @Override public String getVersion() { - return Info.modVersion; - } + return Info.modVersion; + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/plugins/NEITraincraftWorkbenchRecipePlugin.java b/src/main/java/train/common/core/plugins/NEITraincraftWorkbenchRecipePlugin.java index 9cdba50137..7967f7ebe2 100644 --- a/src/main/java/train/common/core/plugins/NEITraincraftWorkbenchRecipePlugin.java +++ b/src/main/java/train/common/core/plugins/NEITraincraftWorkbenchRecipePlugin.java @@ -5,10 +5,12 @@ import codechicken.nei.recipe.ShapedRecipeHandler; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraftforge.oredict.OreDictionary; import train.client.gui.GuiTrainCraftingBlock; +import train.common.core.interfaces.ITCRecipe; import train.common.inventory.TrainCraftingManager; import train.common.recipes.ShapedTrainRecipes; import train.common.recipes.ShapelessTrainRecipe; @@ -19,190 +21,178 @@ import java.util.Random; public class NEITraincraftWorkbenchRecipePlugin extends ShapedRecipeHandler { - private List recipeListWB = workbenchListCleaner(TrainCraftingManager.getInstance().getShapedRecipes()); - - private CachedShapedRecipe getShape(ShapedTrainRecipes recipe) { - CachedShapedRecipe shape = new CachedShapedRecipe(0, 0, null, recipe.getRecipeOutput()); - for (int x = 0; x < 3; x++) { - for (int y = 0; y < 3; y++) { - if (recipe.recipeItems[y * 3 + x] == null) { - continue; - } - PositionedStack stack = new PositionedStack(recipe.recipeItems[y * 3 + x], 25 + x * 18, 6 + y * 18); - stack.setMaxSize(1); - shape.ingredients.add(stack); - } - } - shape.result.relx = 119; - shape.result.rely = 25; - return shape; - } - - public class CachedShapedRecipe extends CachedRecipe { - public ArrayList ingredients; - public PositionedStack result; - - public CachedShapedRecipe(int width, int height, Object[] items, ItemStack out) { - result = new PositionedStack(out, 119, 24); - ingredients = new ArrayList(); - setIngredients(width, height, items); - } - - public CachedShapedRecipe(ShapedRecipes recipe) { - this(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems, recipe.getRecipeOutput()); - } - - /** - * @param width - * @param height - * @param items - * an ItemStack[] or ItemStack[][] - */ - public void setIngredients(int width, int height, Object[] items) { - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - if (items[y * width + x] == null) continue; - - PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false); - stack.setMaxSize(1); - ingredients.add(stack); - } - } - } - - @Override - public List getIngredients() { - return getCycledIngredients(cycleticks / 20, ingredients); - } - - public PositionedStack getResult() { - return result; - } - - public void computeVisuals() { - for (PositionedStack p : ingredients) - p.generatePermutations(); - - result.generatePermutations(); - } - - /** - * This will perform default cycling of ingredients, mulitItem capable - * - * @return - */ - private int cycleTicks = 0; - - @Override - public List getCycledIngredients(int cycle, List ingredients) { - cycleTicks++; - for (int itemIndex = 0; itemIndex < ingredients.size(); itemIndex++) { - - String oreName = OreDictionary.getOreName(OreDictionary.getOreID(ingredients.get(itemIndex).item)); - if (oreName.equals("ingotSteel") || oreName.equals("ingotIron") || oreName.equals("ingotCopper") || oreName.equals("dustPlastic") || oreName.equals("dustCoal")) { - ArrayList list = OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(ingredients.get(itemIndex).item))); - Random rand = new Random(cycle + System.currentTimeMillis()); - if (cycleTicks % 15 == 0) { - int stackSize = ingredients.get(itemIndex).item.stackSize; - ingredients.get(itemIndex).item = (ItemStack) list.get(Math.abs(rand.nextInt()) % list.size()); - ingredients.get(itemIndex).item.stackSize = stackSize; - } - } - else { - randomRenderPermutation(ingredients.get(itemIndex), cycle + itemIndex); - } - } - - return ingredients; - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - for (ShapedTrainRecipes recipe : recipeListWB) { - if (NEIClientUtils.areStacksSameTypeCrafting(recipe.getRecipeOutput(), result)) { - this.arecipes.add(getShape(recipe)); - } - } - } - - @Override - public Class getGuiClass() { - return GuiTrainCraftingBlock.class; - } - - @Override - public String getRecipeName() { - return "Train Workbench"; - } - - @Override - public String getGuiTexture() { - return "tc:textures/gui/crafting_table.png"; - } - - @Override - public boolean hasOverlay(GuiContainer gui, Container container, int recipe) { - return false; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "train workbench")); - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - for (ShapedTrainRecipes recipe : recipeListWB) { - for (ItemStack source : recipe.recipeItems) { - if (NEIClientUtils.areStacksSameTypeCrafting(source, ingredient)) { - this.arecipes.add(getShape(recipe)); - break; - } - } - } - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("train workbench") && getClass() == NEITraincraftWorkbenchRecipePlugin.class) { - for (ShapedTrainRecipes recipe : recipeListWB) { - this.arecipes.add(getShape(recipe)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - public static List workbenchListCleaner(List recipeList) { - ArrayList outputList = new ArrayList(); - ArrayList cleanedList = new ArrayList(); - for (int i = 0; i < recipeList.size(); i++) { - if (recipeList.get(i) instanceof ShapedTrainRecipes) { - if (outputList != null) { - if (!outputList.contains(((ShapedTrainRecipes) recipeList.get(i)).getRecipeOutput().getItem())) { - cleanedList.add(recipeList.get(i)); - } - } - else { - cleanedList.add(recipeList.get(i)); - } - outputList.add(((ShapedTrainRecipes) recipeList.get(i)).getRecipeOutput().getItem()); - } - if (recipeList.get(i) instanceof ShapelessTrainRecipe) { - - if (outputList != null) { - if (!outputList.contains(((ShapelessTrainRecipe) recipeList.get(i)).getRecipeOutput().getItem())) { - cleanedList.add(recipeList.get(i)); - } - } - else { - cleanedList.add(recipeList.get(i)); - } - outputList.add(((ShapelessTrainRecipe) recipeList.get(i)).getRecipeOutput().getItem()); - } - } - return cleanedList; - } + private final List recipeListWB = workbenchListCleaner(TrainCraftingManager.getInstance().getShapedRecipes()); + + private CachedShapedRecipe getShape(ShapedTrainRecipes recipe) { + CachedShapedRecipe shape = new CachedShapedRecipe(0, 0, null, recipe.getRecipeOutput()); + for (int x = 0; x < 3; x++) { + for (int y = 0; y < 3; y++) { + if (recipe.recipeItems[y * 3 + x] == null) { + continue; + } + PositionedStack stack = new PositionedStack(recipe.recipeItems[y * 3 + x], 25 + x * 18, 6 + y * 18); + stack.setMaxSize(1); + shape.ingredients.add(stack); + } + } + shape.result.relx = 119; + shape.result.rely = 25; + return shape; + } + + public class CachedShapedRecipe extends CachedRecipe { + public ArrayList ingredients; + public PositionedStack result; + + public CachedShapedRecipe(int width, int height, Object[] items, ItemStack out) { + result = new PositionedStack(out, 119, 24); + ingredients = new ArrayList(); + setIngredients(width, height, items); + } + + public CachedShapedRecipe(ShapedRecipes recipe) { + this(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems, recipe.getRecipeOutput()); + } + + /** + * @param width + * @param height + * @param items an ItemStack[] or ItemStack[][] + */ + public void setIngredients(int width, int height, Object[] items) { + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + if (items[y * width + x] == null) continue; + + PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false); + stack.setMaxSize(1); + ingredients.add(stack); + } + } + } + + @Override + public List getIngredients() { + return getCycledIngredients(cycleticks / 20, ingredients); + } + + public PositionedStack getResult() { + return result; + } + + public void computeVisuals() { + for (PositionedStack p : ingredients) + p.generatePermutations(); + + result.generatePermutations(); + } + + /** + * This will perform default cycling of ingredients, mulitItem capable + * + * @return + */ + private int cycleTicks = 0; + + @Override + public List getCycledIngredients(int cycle, List ingredients) { + cycleTicks++; + for (int itemIndex = 0; itemIndex < ingredients.size(); itemIndex++) { + + String oreName = OreDictionary.getOreName(OreDictionary.getOreID(ingredients.get(itemIndex).item)); + if (oreName.equals("ingotSteel") || oreName.equals("ingotIron") || oreName.equals("ingotCopper") || oreName.equals("dustPlastic") || oreName.equals("dustCoal")) { + ArrayList list = OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(ingredients.get(itemIndex).item))); + Random rand = new Random(cycle + System.currentTimeMillis()); + if (cycleTicks % 15 == 0) { + int stackSize = ingredients.get(itemIndex).item.stackSize; + ingredients.get(itemIndex).item = (ItemStack) list.get(Math.abs(rand.nextInt()) % list.size()); + ingredients.get(itemIndex).item.stackSize = stackSize; + } + } else { + randomRenderPermutation(ingredients.get(itemIndex), cycle + itemIndex); + } + } + + return ingredients; + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (ITCRecipe recipe : recipeListWB) { + if (NEIClientUtils.areStacksSameTypeCrafting(recipe.getRecipeOutput(), result)) { + this.arecipes.add(getShape((ShapedTrainRecipes) recipe)); + } + } + } + + @Override + public Class getGuiClass() { + return GuiTrainCraftingBlock.class; + } + + @Override + public String getRecipeName() { + return "Train Workbench"; + } + + @Override + public String getGuiTexture() { + return "tc:textures/gui/crafting_table.png"; + } + + @Override + public boolean hasOverlay(GuiContainer gui, Container container, int recipe) { + return false; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "train workbench")); + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (ITCRecipe recipe : recipeListWB) { + for (ItemStack source : ((ShapedTrainRecipes) recipe).recipeItems) { + if (NEIClientUtils.areStacksSameTypeCrafting(source, ingredient)) { + this.arecipes.add(getShape((ShapedTrainRecipes) recipe)); + break; + } + } + } + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals("train workbench") && getClass() == NEITraincraftWorkbenchRecipePlugin.class) { + for (ITCRecipe recipe : recipeListWB) { + this.arecipes.add(getShape((ShapedTrainRecipes) recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public static List workbenchListCleaner(List recipeList) { + List outputList = new ArrayList<>(); + List cleanedList = new ArrayList<>(); + + for (Object o : recipeList) { + if (o instanceof ShapedTrainRecipes) { + if (!outputList.contains(((ShapedTrainRecipes) o).getRecipeOutput().getItem())) { + cleanedList.add((ShapedTrainRecipes) o); + } + outputList.add(((ShapedTrainRecipes) o).getRecipeOutput().getItem()); + } + if (o instanceof ShapelessTrainRecipe) { + + if (!outputList.contains(((ShapelessTrainRecipe) o).getRecipeOutput().getItem())) { + cleanedList.add((ShapelessTrainRecipe) o); + } + outputList.add(((ShapelessTrainRecipe) o).getRecipeOutput().getItem()); + } + } + return cleanedList; + } } \ No newline at end of file diff --git a/src/main/java/train/common/core/plugins/PluginRailcraft.java b/src/main/java/train/common/core/plugins/PluginRailcraft.java index 4358e7c0d7..1a4f3a6237 100644 --- a/src/main/java/train/common/core/plugins/PluginRailcraft.java +++ b/src/main/java/train/common/core/plugins/PluginRailcraft.java @@ -15,50 +15,52 @@ public class PluginRailcraft { - public static void init(){ - registerRecipes(); - } + public static void init() { + registerRecipes(); + } - private static void registerRecipes(){ - for(Tracks track : Tracks.values()){ - if(track.crafting != null){ - GameRegistry.addRecipe(new ShapedOreRecipe(track.getOutput(), track.crafting)); - } - } - GameRegistry.addShapelessRecipe(Tracks.SNOWY_STEEL_TRACK.getOutput(), Tracks.STEEL_TRACK.getTrackSpec().getItem(1), Items.snowball); - GameRegistry.addShapelessRecipe(Tracks.SNOWY_COPPER_TRACK.getOutput(), Tracks.COPPER_TRACK.getTrackSpec().getItem(1), Items.snowball); - GameRegistry.addShapelessRecipe(Tracks.VANILLA_SNOWY_TRACK.getOutput(), Blocks.rail, Items.snowball); - ArrayList copper = OreDictionary.getOres("ingotCopper"); - if (copper != null && copper.size() >= 0) { - for(ItemStack aCopper : copper){ - RailcraftCraftingManager.rollingMachine.addRecipe(new ItemStack(ItemIDs.copperRail.item, 8), "XXX", " ", "XXX", 'X', aCopper); - } - } - ArrayList steel = OreDictionary.getOres("ingotSteel"); - if (steel != null && steel.size() >= 0) { - for(ItemStack aSteel : steel){ - RailcraftCraftingManager.rollingMachine.addRecipe(new ItemStack(ItemIDs.steelRail.item, 16), "XXX", " ", "XXX", 'X', aSteel); - } - } - } + private static void registerRecipes() { + for (Tracks track : Tracks.values()) { + if (track.crafting != null) { + GameRegistry.addRecipe(new ShapedOreRecipe(track.getOutput(), track.crafting)); + } + } + GameRegistry.addShapelessRecipe(Tracks.SNOWY_STEEL_TRACK.getOutput(), Tracks.STEEL_TRACK.getTrackSpec().getItem(1), Items.snowball); + GameRegistry.addShapelessRecipe(Tracks.SNOWY_COPPER_TRACK.getOutput(), Tracks.COPPER_TRACK.getTrackSpec().getItem(1), Items.snowball); + GameRegistry.addShapelessRecipe(Tracks.VANILLA_SNOWY_TRACK.getOutput(), Blocks.rail, Items.snowball); + ArrayList copper = OreDictionary.getOres("ingotCopper"); + if (copper != null) { + for (ItemStack aCopper : copper) { + RailcraftCraftingManager.rollingMachine.addRecipe(new ItemStack(ItemIDs.copperRail.item, 8), "XXX", " ", "XXX", 'X', aCopper); + } + } - public enum RailcraftParts{ - COKE("fuel.coke", 0), - INGOT_STEEL("ingot", 0), - RAIL_STANDARD("part.rail", 0), - RAIL_ADVANCED("part.rail", 1), - RAIL_WOOD("part.rail", 2), - RAIL_SPEED("part.rail", 3), - RAIL_REINFORCED("part.rail", 4), - RAILBED_WOOD("part.railbed", 0), - RAILBED_STONE("part.railbed", 1); + ArrayList steel = OreDictionary.getOres("ingotSteel"); + if (steel != null) { + for (ItemStack aSteel : steel) { + RailcraftCraftingManager.rollingMachine.addRecipe(new ItemStack(ItemIDs.steelRail.item, 16), "XXX", " ", "XXX", 'X', aSteel); + } + } + } - public ItemStack stack; - RailcraftParts(String itemName, int meta){ - this.stack = TraincraftUtil.getItemFromUnlocalizedName("Railcraft:" + itemName, meta); - } - } + public enum RailcraftParts { + COKE("fuel.coke", 0), + INGOT_STEEL("ingot", 0), + RAIL_STANDARD("part.rail", 0), + RAIL_ADVANCED("part.rail", 1), + RAIL_WOOD("part.rail", 2), + RAIL_SPEED("part.rail", 3), + RAIL_REINFORCED("part.rail", 4), + RAILBED_WOOD("part.railbed", 0), + RAILBED_STONE("part.railbed", 1); - // "fuel.coke", "part.ingot.steel", "part.rail.advanced", "part.rail.reinforced", "part.rail.speed", "part.rail.standard", "part.rail.wood", "part.railbed.stone", "part.railbed.wood" + public final ItemStack stack; + + RailcraftParts(String itemName, int meta) { + this.stack = TraincraftUtil.getItemFromUnlocalizedName("Railcraft:" + itemName, meta); + } + } + + // "fuel.coke", "part.ingot.steel", "part.rail.advanced", "part.rail.reinforced", "part.rail.speed", "part.rail.standard", "part.rail.wood", "part.railbed.stone", "part.railbed.wood" } \ No newline at end of file diff --git a/src/main/java/train/common/core/util/Energy.java b/src/main/java/train/common/core/util/Energy.java index 8059a1cffa..eedcaef7f3 100644 --- a/src/main/java/train/common/core/util/Energy.java +++ b/src/main/java/train/common/core/util/Energy.java @@ -12,73 +12,71 @@ import java.util.Arrays; public class Energy extends TileTraincraft implements IEnergyProvider { - public EnergyStorage energy = new EnergyStorage(3000,80); //core energy value the first value is max storage and the second is transfer max. - private ForgeDirection[] sides = new ForgeDirection[]{}; //defines supported sides + public EnergyStorage energy = new EnergyStorage(3000, 80); //core energy value the first value is max storage and the second is transfer max. + private ForgeDirection[] sides = new ForgeDirection[]{}; //defines supported sides - public Energy(int inventorySlots, String name, int maxEnergy, int maxTransfer){ - super(inventorySlots, name); - this.energy.setCapacity(maxEnergy); - this.energy.setMaxTransfer(maxTransfer); - } - public Energy(){} + public Energy(int inventorySlots, String name, int maxEnergy, int maxTransfer) { + super(inventorySlots, name); + this.energy.setCapacity(maxEnergy); + this.energy.setMaxTransfer(maxTransfer); + } - public void pushEnergy(World world, int x, int y, int z, EnergyStorage storage){ - for (ForgeDirection side : getSides()) { - TileEntity tile = world.getTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ); - if (tile != null && tile instanceof IEnergyReceiver && storage.getEnergyStored() > 0) { - if (((IEnergyReceiver) tile).canConnectEnergy(side.getOpposite())) { - int receive = ((IEnergyReceiver) tile).receiveEnergy(side.getOpposite(), Math.min(storage.getMaxExtract(), storage.getEnergyStored()), false); - storage.extractEnergy(receive, false); - } - } - } - } + public Energy() { + } + public void pushEnergy(World world, int x, int y, int z, EnergyStorage storage) { + for (ForgeDirection side : getSides()) { + TileEntity tile = world.getTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ); + if (tile instanceof IEnergyReceiver && storage.getEnergyStored() > 0) { + if (((IEnergyReceiver) tile).canConnectEnergy(side.getOpposite())) { + int receive = ((IEnergyReceiver) tile).receiveEnergy(side.getOpposite(), Math.min(storage.getMaxExtract(), storage.getEnergyStored()), false); + storage.extractEnergy(receive, false); + } + } + } + } - //Implemented parts from the diesel generator - @Override - public void readFromNBT(NBTTagCompound nbtTag, boolean forSyncing) { - super.readFromNBT(nbtTag, forSyncing); - this.energy.readFromNBT(nbtTag); - } + //Implemented parts from the diesel generator + @Override + public void readFromNBT(NBTTagCompound nbtTag, boolean forSyncing) { + super.readFromNBT(nbtTag, forSyncing); + this.energy.readFromNBT(nbtTag); + } - @Override - public NBTTagCompound writeToNBT(NBTTagCompound nbtTag, boolean forSyncing) { - super.writeToNBT(nbtTag, forSyncing); - this.energy.writeToNBT(nbtTag); - return nbtTag; - } + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbtTag, boolean forSyncing) { + super.writeToNBT(nbtTag, forSyncing); + this.energy.writeToNBT(nbtTag); + return nbtTag; + } - public void setSides(ForgeDirection[] listOfSides){ - this.sides = listOfSides; - } - public ForgeDirection[] getSides(){ - return this.sides; - } + public void setSides(ForgeDirection[] listOfSides) { + this.sides = listOfSides; + } - //RF Overrides - @Override - public boolean canConnectEnergy(ForgeDirection dir) { - if(Arrays.asList(sides).contains(dir)) { - return true; - } else { - return false; - } - } - @Override - public int extractEnergy(ForgeDirection dir, int amount, boolean simulate) { - return energy.extractEnergy(amount, simulate); - } - @Override - public int getEnergyStored(ForgeDirection dir) { - return energy.getEnergyStored(); - } - @Override - public int getMaxEnergyStored(ForgeDirection dir) { - return this.energy.getMaxEnergyStored(); - } + public ForgeDirection[] getSides() { + return this.sides; + } + //RF Overrides + @Override + public boolean canConnectEnergy(ForgeDirection dir) { + return Arrays.asList(sides).contains(dir); + } + @Override + public int extractEnergy(ForgeDirection dir, int amount, boolean simulate) { + return energy.extractEnergy(amount, simulate); + } + @Override + public int getEnergyStored(ForgeDirection dir) { + return energy.getEnergyStored(); + } + + @Override + public int getMaxEnergyStored(ForgeDirection dir) { + return this.energy.getMaxEnergyStored(); + } } diff --git a/src/main/java/train/common/core/util/MP3Player.java b/src/main/java/train/common/core/util/MP3Player.java index 948a2a02bb..80b6d3e261 100644 --- a/src/main/java/train/common/core/util/MP3Player.java +++ b/src/main/java/train/common/core/util/MP3Player.java @@ -1,7 +1,6 @@ package train.common.core.util; import javazoom.jl.player.advanced.AdvancedPlayer; -import javazoom.jl.player.advanced.PlaybackEvent; import javazoom.jl.player.advanced.PlaybackListener; import net.minecraft.world.World; import train.common.Traincraft; @@ -9,63 +8,51 @@ import java.net.URL; public class MP3Player extends PlaybackListener implements Runnable { - private String streamURL; - private AdvancedPlayer player; - private Thread pThread; - private int id; - private World world; - - public MP3Player(String mp3url, World w, int id) { - try { - world = w; - this.id = id; - streamURL = mp3url; - pThread = new Thread(this); - pThread.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void run() { - try { - player = new AdvancedPlayer(new URL(streamURL).openStream()); - player.setPlayBackListener(this); - player.play(); - } catch (Exception e) {} - } - - public void stop() { - if ((player != null) && (isPlaying())) { - player.stop(); - } - } - - @Override - public void playbackStarted(PlaybackEvent evt) {} - - @Override - public void playbackFinished(PlaybackEvent evt) {} - - public boolean isPlaying() { - return pThread.isAlive(); - } - - public void setVolume(float f) - { - if (player != null) - { - player.setVolume(f * Traincraft.proxy.getJukeboxVolume()); - } - } - - public float getVolume() { - if (player != null) { - return player.getVolume(); - } - else { - return 0.0f; - } - } + private String streamURL; + private AdvancedPlayer player; + private Thread pThread; + + public MP3Player(String mp3url, World w, int id) { + try { + streamURL = mp3url; + pThread = new Thread(this); + pThread.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void run() { + try { + player = new AdvancedPlayer(new URL(streamURL).openStream()); + player.setPlayBackListener(this); + player.play(); + } catch (Exception ignored) { + } + } + + public void stop() { + if (player != null && isPlaying()) { + player.stop(); + } + } + + public boolean isPlaying() { + return pThread.isAlive(); + } + + public void setVolume(float f) { + if (player != null) { + player.setVolume(f * Traincraft.proxy.getJukeboxVolume()); + } + } + + public float getVolume() { + if (player != null) { + return player.getVolume(); + } else { + return 0.0f; + } + } } diff --git a/src/main/java/train/common/core/util/TraincraftUtil.java b/src/main/java/train/common/core/util/TraincraftUtil.java index 797e57ac5b..f03c783165 100644 --- a/src/main/java/train/common/core/util/TraincraftUtil.java +++ b/src/main/java/train/common/core/util/TraincraftUtil.java @@ -11,9 +11,9 @@ import train.common.api.Locomotive; -public class TraincraftUtil{ +public class TraincraftUtil { - public static boolean dev=false; + public static boolean dev = false; public static void println(Object... o) { if (dev) { @@ -26,137 +26,141 @@ public static void println(Object... o) { } } - public static Item getItemFromName(String name){ - if (Item.itemRegistry.containsKey(name)){ + public static Item getItemFromName(String name) { + if (Item.itemRegistry.containsKey(name)) { return (Item) Item.itemRegistry.getObject(name); } else { return null; } } - public static ItemStack getItemFromUnlocalizedName(String itemName, int meta){ + public static ItemStack getItemFromUnlocalizedName(String itemName, int meta) { Item item = getItemFromName(itemName); - if(item != null){ + if (item != null) { return new ItemStack(item, 1, meta); } return null; } - public static int getByteFromColor(String c){ - if(c.equals("Black")){ - return 0; - } else if (c.equals("Red")){ - return 1; - } else if(c.equals("Green")){ - return 2; - } else if(c.equals("Brown")){ - return 3; - } else if(c.equals("Blue")){ - return 4; - } else if(c.equals("Purple")){ - return 5; - } else if(c.equals("Cyan")){ - return 6; - } else if(c.equals("LightGrey")){ - return 7; - } else if(c.equals("Grey")){ - return 8; - } else if(c.equals("Magenta")){ - return 13; - } else if(c.equals("Lime")){ - return 10; - } else if(c.equals("Yellow")){ - return 11; - } else if(c.equals("LightBlue")){ - return 12; - } else if(c.equals("Pink")){ - return 9; - } else if(c.equals("Orange")){ - return 14; - } else if(c.equals("White")) { - return 15; - } else if (c.equals("Skin16")) { - return 16; - } else if (c.equals("Skin17")) { - return 17; - } else if (c.equals("Skin18")) { - return 18; - } else if (c.equals("Skin19")) { - return 19; - } else if (c.equals("Skin20")) { - return 20; - } else if (c.equals("Skin21")) { - return 21; - } else if (c.equals("Skin22")) { - return 22; - } else if (c.equals("Skin23")) { - return 23; - } else if (c.equals("Skin24")) { - return 24; - } else if (c.equals("Skin25")) { - return 25; - } else if (c.equals("Skin26")) { - return 26; - } else if (c.equals("Skin27")) { - return 27; - } else if (c.equals("Skin28")) { - return 28; - } else if (c.equals("Skin29")) { - return 29; - } else if (c.equals("Skin30")) { - return 30; - } else if(c.equals("Full")){ - return 101; - } else if (c.equals("Empty")){ - return 100; + public static int getByteFromColor(String c) { + switch (c) { + case "Black": + return 0; + case "Red": + return 1; + case "Green": + return 2; + case "Brown": + return 3; + case "Blue": + return 4; + case "Purple": + return 5; + case "Cyan": + return 6; + case "LightGrey": + return 7; + case "Grey": + return 8; + case "Magenta": + return 13; + case "Lime": + return 10; + case "Yellow": + return 11; + case "LightBlue": + return 12; + case "Pink": + return 9; + case "Orange": + return 14; + case "White": + return 15; + case "Skin16": + return 16; + case "Skin17": + return 17; + case "Skin18": + return 18; + case "Skin19": + return 19; + case "Skin20": + return 20; + case "Skin21": + return 21; + case "Skin22": + return 22; + case "Skin23": + return 23; + case "Skin24": + return 24; + case "Skin25": + return 25; + case "Skin26": + return 26; + case "Skin27": + return 27; + case "Skin28": + return 28; + case "Skin29": + return 29; + case "Skin30": + return 30; + case "Full": + return 101; + case "Empty": + return 100; } return 0; } - public static int[] getBytesFromColors(String[] c){ + public static int[] getBytesFromColors(String[] c) { int[] ret = new int[c.length]; - for(int i=0; i20 && rotationCos1 == 1){ - bogieX1-=pitchRads*2; - pitch-=pitchRads*1.2; + if (transport.anglePitchClient > 20 && rotationCos1 == 1) { + bogieX1 -= pitchRads * 2; + pitch -= (float) (pitchRads * 1.2); } - if(transport.anglePitchClient>20 && rotationSin1 == 1){ - bogieZ1-=pitchRads*2; - pitch-=pitchRads*1.2; + if (transport.anglePitchClient > 20 && rotationSin1 == 1) { + bogieZ1 -= pitchRads * 2; + pitch -= (float) (pitchRads * 1.2); } if (pitchRads == 0.0) { transport.riddenByEntity.setPosition(bogieX1, (transport.posY + transport.getMountedYOffset() + transport.riddenByEntity.getYOffset() + yOffset), bogieZ1); @@ -165,8 +169,9 @@ public static void updateRider(EntityRollingStock transport,double distance, dou transport.riddenByEntity.setPosition(bogieX1, pitch, bogieZ1); } } + public static float atan2f(double x, double z) { - float pi =-3.141592653f; + float pi = -3.141592653f; float multiplier = 1.0f; if (z < 0.0d) { @@ -187,16 +192,17 @@ public static float atan2f(double x, double z) { pi = 0.0f; } - double invDiv = 1.0D / (((z < x) ? x : z) * (1.0D / (ATAN2_SQRT - 1))); - return (atan2[(int)(x * invDiv) * ATAN2_SQRT + (int)(z * invDiv)] + pi) * multiplier; + double invDiv = 1.0D / ((Math.max(z, x)) * (1.0D / (ATAN2_SQRT - 1))); + return (atan2[(int) (x * invDiv) * ATAN2_SQRT + (int) (z * invDiv)] + pi) * multiplier; } - public static float atan2degreesf(double x, double y){ - return atan2f(x,y)*degreesF; + public static float atan2degreesf(double x, double y) { + return atan2f(x, y) * degreesF; } private static final int ATAN2_SQRT = (int) Math.sqrt(1024); private static final float[] atan2 = new float[1024]; + static { for (int i = 0; i < ATAN2_SQRT; i++) { for (int j = 0; j < ATAN2_SQRT; j++) { @@ -208,6 +214,6 @@ public static float atan2degreesf(double x, double y){ public static final float degreesF = (float) (180.0d / Math.PI); public static Vec3 func_514_g(double d, double d1, double d2) { - return Vec3.createVectorHelper(MathHelper.floor_double(d),MathHelper.floor_double(d1),MathHelper.floor_double(d2)); + return Vec3.createVectorHelper(MathHelper.floor_double(d), MathHelper.floor_double(d1), MathHelper.floor_double(d2)); } } diff --git a/src/main/java/train/common/entity/ai/EntityAIFearHorn.java b/src/main/java/train/common/entity/ai/EntityAIFearHorn.java index 5f5888beac..1d2be08e50 100644 --- a/src/main/java/train/common/entity/ai/EntityAIFearHorn.java +++ b/src/main/java/train/common/entity/ai/EntityAIFearHorn.java @@ -10,82 +10,73 @@ import net.minecraft.world.ChunkCache; import train.common.api.Locomotive; -public class EntityAIFearHorn extends EntityAIBase{ - - private EntityAnimal entity; +public class EntityAIFearHorn extends EntityAIBase { + private final EntityAnimal entity; private double randPosX; private double randPosY; private double randPosZ; - - public EntityAIFearHorn(EntityAnimal e) { - entity = e; + + public EntityAIFearHorn(EntityAnimal e) { + entity = e; this.setMutexBits(1); - } + } - @Override - public boolean shouldExecute() { - if(entity.getEntityToAttack() instanceof Locomotive) { - Entity loco = entity.getEntityToAttack(); - Vec3 posLoco = Vec3.createVectorHelper(loco.posX, loco.posY, loco.posZ); - entity.detachHome(); + @Override + public boolean shouldExecute() { + if (entity.getEntityToAttack() instanceof Locomotive) { + Entity loco = entity.getEntityToAttack(); + Vec3 posLoco = Vec3.createVectorHelper(loco.posX, loco.posY, loco.posZ); + entity.detachHome(); Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom(entity, 10, 8, posLoco); - if (vec3 == null) - { + if (vec3 == null) { return false; - } - else - { + } else { this.randPosX = vec3.xCoord; this.randPosY = vec3.yCoord; this.randPosZ = vec3.zCoord; - entity.setTarget(null); + entity.setTarget(null); return true; } - } - return false; - } - + } + return false; + } + /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { - tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, 2.0D); + public void startExecuting() { + tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, 2.0D); } /** * Returns whether an in-progress EntityAIBase should continue executing */ - public boolean continueExecuting() - { + public boolean continueExecuting() { return !this.entity.getNavigator().noPath(); } - + /** * Returns the path to the given coordinates */ - private PathEntity getPathToXYZ(double x, double y, double z) - { - return getEntityPathToXYZ(MathHelper.floor_double(x), (int)y, MathHelper.floor_double(z), - entity.getNavigator().getPathSearchRange(), false, false, false); + private PathEntity getPathToXYZ(double x, double y, double z) { + return getEntityPathToXYZ(MathHelper.floor_double(x), (int) y, MathHelper.floor_double(z), + entity.getNavigator().getPathSearchRange(), false, false, false); } /** * Try to find and set a path to XYZ. Returns true if successful. */ - private boolean tryMoveToXYZ(double x, double y, double z, double speed) - { - PathEntity pathentity = this.getPathToXYZ((double)MathHelper.floor_double(x), (double)((int)y), (double)MathHelper.floor_double(z)); + private boolean tryMoveToXYZ(double x, double y, double z, double speed) { + PathEntity pathentity = this.getPathToXYZ((double) MathHelper.floor_double(x), (double) ((int) y), (double) MathHelper.floor_double(z)); return entity.getNavigator().setPath(pathentity, speed); } - - private PathEntity getEntityPathToXYZ(int targetX, int targetY, int targetZ, float range, boolean canPassOpenDoor, boolean canPassClosedDoor, boolean canSwim) - { + + private PathEntity getEntityPathToXYZ(int targetX, int targetY, int targetZ, float range, boolean canPassOpenDoor, boolean canPassClosedDoor, boolean canSwim) { int x = MathHelper.floor_double(entity.posX); int y = MathHelper.floor_double(entity.posY); int z = MathHelper.floor_double(entity.posZ); - int r = (int)(range + 8.0F); + int r = (int) (range + 8.0F); int xmin = x - r; int ymin = y - r; int zmin = z - r; @@ -93,7 +84,6 @@ private PathEntity getEntityPathToXYZ(int targetX, int targetY, int targetZ, flo int ymax = y + r; int zmax = z + r; ChunkCache chunkcache = new ChunkCache(entity.worldObj, xmin, ymin, zmin, xmax, ymax, zmax, 0); - PathEntity pathentity = (new TCPathFinder(chunkcache, canPassOpenDoor, canPassClosedDoor, false, canSwim)).createEntityPathTo(entity, targetX, targetY, targetZ, range); - return pathentity; + return (new TCPathFinder(chunkcache, canPassOpenDoor, canPassClosedDoor, false, canSwim)).createEntityPathTo(entity, targetX, targetY, targetZ, range); } } diff --git a/src/main/java/train/common/entity/ai/TCPathFinder.java b/src/main/java/train/common/entity/ai/TCPathFinder.java index 196bf6536f..0e78a45a7e 100644 --- a/src/main/java/train/common/entity/ai/TCPathFinder.java +++ b/src/main/java/train/common/entity/ai/TCPathFinder.java @@ -11,55 +11,41 @@ import train.common.blocks.BlockTCRail; import train.common.blocks.BlockTCRailGag; -public class TCPathFinder extends PathFinder{ - - private boolean waterAllowed; - private boolean movementAllowed; - private boolean doorAllowed; - - public TCPathFinder(IBlockAccess worldMap, boolean isWoddenDoorAllowed, boolean isMovementBlockAllowed, - boolean isPathingInWater, boolean canEntityDrown) { - super(worldMap, isWoddenDoorAllowed, isMovementBlockAllowed, isPathingInWater, canEntityDrown); - waterAllowed = isPathingInWater; - movementAllowed = isMovementBlockAllowed; - doorAllowed = isWoddenDoorAllowed; - } +public class TCPathFinder extends PathFinder { + private final boolean waterAllowed; + private final boolean movementAllowed; + private final boolean doorAllowed; + + public TCPathFinder(IBlockAccess worldMap, boolean isWoddenDoorAllowed, boolean isMovementBlockAllowed, + boolean isPathingInWater, boolean canEntityDrown) { + super(worldMap, isWoddenDoorAllowed, isMovementBlockAllowed, isPathingInWater, canEntityDrown); + waterAllowed = isPathingInWater; + movementAllowed = isMovementBlockAllowed; + doorAllowed = isWoddenDoorAllowed; + } - @Override - public int getVerticalOffset(Entity entity, int x, int y, int z, PathPoint point) - { - return getVertical(entity, x, y, z, point, waterAllowed, movementAllowed, doorAllowed); + @Override + public int getVerticalOffset(Entity entity, int x, int y, int z, PathPoint point) { + return getVertical(entity, x, y, z, point, waterAllowed, movementAllowed, doorAllowed); } - public static int getVertical(Entity entity, int x, int y, int z, PathPoint point, boolean water, boolean movement, boolean door) - { + public static int getVertical(Entity entity, int x, int y, int z, PathPoint point, boolean water, boolean movement, boolean door) { boolean flag3 = false; - for (int i = x; i < x + point.xCoord; ++i) - { - for (int j = y; j < y + point.yCoord; ++j) - { - for (int k = z; k < z + point.zCoord; ++k) - { + for (int i = x; i < x + point.xCoord; ++i) { + for (int j = y; j < y + point.yCoord; ++j) { + for (int k = z; k < z + point.zCoord; ++k) { Block block = entity.worldObj.getBlock(i, j, k); - if (block.getMaterial() != Material.air && !(block instanceof BlockTCRail) && !(block instanceof BlockTCRailGag)) - { - if (block == Blocks.trapdoor) - { + if (block.getMaterial() != Material.air && !(block instanceof BlockTCRail) && !(block instanceof BlockTCRailGag)) { + if (block == Blocks.trapdoor) { flag3 = true; - } - else if (block != Blocks.flowing_water && block != Blocks.water) - { - if (!door && block == Blocks.wooden_door) - { + } else if (block != Blocks.flowing_water && block != Blocks.water) { + if (!door && block == Blocks.wooden_door) { return 0; } - } - else - { - if (water) - { + } else { + if (water) { return -1; } @@ -68,38 +54,30 @@ else if (block != Blocks.flowing_water && block != Blocks.water) int k1 = block.getRenderType(); - if (entity.worldObj.getBlock(i, j, k).getRenderType() == 9) - { + if (entity.worldObj.getBlock(i, j, k).getRenderType() == 9) { int j2 = MathHelper.floor_double(entity.posX); int l1 = MathHelper.floor_double(entity.posY); int i2 = MathHelper.floor_double(entity.posZ); - if (entity.worldObj.getBlock(j2, l1, i2).getRenderType() != 9 && entity.worldObj.getBlock(j2, l1 - 1, i2).getRenderType() != 9) - { + if (entity.worldObj.getBlock(j2, l1, i2).getRenderType() != 9 && entity.worldObj.getBlock(j2, l1 - 1, i2).getRenderType() != 9) { return -3; } - } - else if (!block.getBlocksMovement(entity.worldObj, i, j, k) && (!movement || block != Blocks.wooden_door)) - { - if (k1 == 11 || block == Blocks.fence_gate || k1 == 32) - { + } else if (!block.getBlocksMovement(entity.worldObj, i, j, k) && (!movement || block != Blocks.wooden_door)) { + if (k1 == 11 || block == Blocks.fence_gate || k1 == 32) { return -3; } - if (block == Blocks.trapdoor) - { + if (block == Blocks.trapdoor) { return -4; } Material material = block.getMaterial(); - if (material != Material.lava) - { + if (material != Material.lava) { return 0; } - if (!entity.handleLavaMovement()) - { + if (!entity.handleLavaMovement()) { return -2; } } @@ -107,7 +85,6 @@ else if (!block.getBlocksMovement(entity.worldObj, i, j, k) && (!movement || blo } } } - return flag3 ? 2 : 1; } } diff --git a/src/main/java/train/common/entity/digger/EntityRotativeDigger.java b/src/main/java/train/common/entity/digger/EntityRotativeDigger.java index 90b4ed4b2b..70addf869a 100644 --- a/src/main/java/train/common/entity/digger/EntityRotativeDigger.java +++ b/src/main/java/train/common/entity/digger/EntityRotativeDigger.java @@ -29,739 +29,739 @@ public class EntityRotativeDigger extends Entity implements IInventory { - public int start; - private ItemStack cargoItems[];// added - private ItemStack zeppInvent[]; - public int numCargoSlots; - public int numCargoSlots1; - public int numCargoSlots2; - public int inventorySize; - public int fuel; - public boolean idle; - public boolean altitude; - private static int KEY_ACC; - private static int KEY_DEC; - private static int KEY_TURNLEFT; - private static int KEY_TURNRIGHT; - private static int KEY_UP; - private static int KEY_DOWN; - private static int KEY_IDLE; - private static int KEY_INV; - private static int KEY_BOMB; - - public int boatCurrentDamage; - public int boatTimeSinceHit; - public int boatRockDirection; - private int field_9394_d; - private double field_9393_e; - private double field_9392_f; - private double field_9391_g; - private double field_9390_h; - private double field_9389_i; - private double field_9388_j; - private double field_9387_k; - private double field_9386_l; - - public float pitch = 0F; - public float roll = 0F; - public float pitchLimits = 0.75F; - /** passengers wheels */ - protected EntityRotativeWheel[] wheels; - - public EntityRotativeDigger(World world) { - super(world); - boatCurrentDamage = 0; - boatTimeSinceHit = 0; - boatRockDirection = 1; - preventEntitySpawning = true; - setSize(1.5F, 0.8F); - yOffset = height / 2.0F; - numCargoSlots = 3; - numCargoSlots1 = 3; - numCargoSlots2 = 3; - inventorySize = numCargoSlots + numCargoSlots2 + numCargoSlots1 + 5; - zeppInvent = new ItemStack[inventorySize]; - idle = false; - - /** - * Entities are always rendered even if out player's sight => no more flickering/disappearing - */ - if (ConfigHandler.FLICKERING) { - this.ignoreFrustumCheck = true; - } - stepHeight = 0.6F; - if (worldObj.isRemote) { - this.wheels = new EntityRotativeWheel[1]; - this.wheels[0] = new EntityRotativeWheel(this.worldObj, this, 0, 5.4D, 0, 0, 0.0D); - worldObj.spawnEntityInWorld(this.wheels[0]); - } - this.dataWatcher.addObject(20, new Integer(fuel)); - this.dataWatcher.addObject(21, new Integer(start)); - - } - - @Override - protected boolean canTriggerWalking() { - return false; - } - - @Override - protected void entityInit() {} - - @Override - public AxisAlignedBB getCollisionBox(Entity entity) { - return entity.boundingBox; - } - - @Override - public AxisAlignedBB getBoundingBox() { - return boundingBox; - } - - @Override - public boolean canBePushed() { - return false; - } - - @Override - public void applyEntityCollision(Entity entity) { - if ((entity instanceof EntityRotativeWheel)) - return; - if ((entity instanceof EntityPlayer)) - return; - - if (entity != entity.riddenByEntity) { - double var2 = entity.posX - this.posX; - double var4 = entity.posZ - this.posZ; - double var6 = MathHelper.abs_max(var2, var4); - - if (var6 >= 0.009999999776482582D) { - var6 = MathHelper.sqrt_double(var6); - var2 /= var6; - var4 /= var6; - double var8 = 1.0D / var6; - - if (var8 > 1.0D) { - var8 = 1.0D; - } - - var2 *= var8; - var4 *= var8; - var2 *= 0.05000000074505806D; - var4 *= 0.05000000074505806D; - var2 *= (1.0F - this.entityCollisionReduction); - var4 *= (1.0F - this.entityCollisionReduction); - this.addVelocity(-var2, 0.0D, -var4); - entity.addVelocity(var2, 0.0D, var4); - } - } - return; - } - - public EntityRotativeDigger(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - @Override - public double getMountedYOffset() { - return height * 0.0D - 0.30000001192092896D; - } - - @Override - public boolean attackEntityFrom(DamageSource damagesource, float i) { - if (worldObj.isRemote || isDead) { - return true; - } - boatRockDirection = -boatRockDirection; - boatTimeSinceHit = 10; - boatCurrentDamage += i * 10; - setBeenAttacked(); - if (boatCurrentDamage > 40) { - - //dropItemWithOffset(ItemIDs.minecartRotativeDigger.item.shiftedIndex, 1, 0.0F); - - setDead(); - } - return true; - } - - @Override - public void setDead() { - label0: for (int i = 0; i < getSizeInventory(); i++) { - ItemStack itemstack = getStackInSlot(i); - if (itemstack == null) { - continue; - } - float f = rand.nextFloat() * 0.8F + 0.1F; - float f1 = rand.nextFloat() * 0.8F + 0.1F; - float f2 = rand.nextFloat() * 0.8F + 0.1F; - do { - if (itemstack.stackSize <= 0) { - continue label0; - } - int k = rand.nextInt(21) + 10; - if (k > itemstack.stackSize) { - k = itemstack.stackSize; - } - - EntityItem entityitem = new EntityItem(worldObj, posX + f, posY + f1, posZ + f2, itemstack.splitStack(k)); - float f3 = 0.05F; - entityitem.motionX = (float) rand.nextGaussian() * f3; - entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float) rand.nextGaussian() * f3; - worldObj.spawnEntityInWorld(entityitem); - } while (true); - } - if (wheels != null && wheels.length > 0) { - - for (int i = 0; i < wheels.length; i++) { - wheels[i].setDead(); - } - } - super.setDead(); - } - - public void pressKeyClient(int i) { - - Traincraft.keyChannel.sendToServer(new PacketKeyPress(i)); - } - - public void pressKey(int i) { - - if (i == 7 && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) { - //TODO there is no GUI for it currently - //((EntityPlayer) riddenByEntity).openGui(Traincraft.instance, GuiIDs.DIGGER, worldObj, (int) this.posX, (int) this.posY, (int) this.posZ); - } - if (i == 9) { - if (start == 0) { - start = 1; - } - else { - start = 0; - } - - } - } - - @Override - @SideOnly(Side.CLIENT) - public void performHurtAnimation() { - boatRockDirection = -boatRockDirection; - boatTimeSinceHit = 10; - boatCurrentDamage += boatCurrentDamage * 10; - } - - @Override - public boolean canBeCollidedWith() { - return !isDead; - } - - @Override - @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double d, double d1, double d2, float f, float f1, int i) { - field_9393_e = d; - field_9392_f = d1; - field_9391_g = d2; - field_9390_h = f; - field_9389_i = f1; - field_9394_d = i + 4; - motionX = field_9388_j; - // motionY = field_9387_k; - motionZ = field_9386_l; - } - - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(double d, double d1, double d2) { - field_9388_j = motionX = d; - // field_9387_k = motionY = d1; - field_9386_l = motionZ = d2; - } - - /** - * Used to setup the wheel - * - * @param x - * @param y - * @param z - * @return - */ - public Vec3 rotate(double x, double y, double z) { - - double cosYaw = Math.cos(this.getYaw() * 3.141593F / 180.0F); - double sinYaw = Math.sin(this.getYaw() * 3.141593F / 180.0F); - double cosPitch = Math.cos((this.getPitch()) * 3.141593F / 180.0F); - double sinPitch = Math.sin((this.getPitch()) * 3.141593F / 180.0F); - double cosRoll = Math.cos(0 * 3.141593F / 180.0F);// 0.01745 - double sinRoll = Math.sin(0 * 3.141593F / 180.0F);// 0 - - double newX = (-x * cosRoll - y * sinRoll) * cosYaw + ((-x * sinRoll + y * cosRoll) * 0 + z * 0.01745) * sinYaw; - double newY = -(((cosPitch - x) * -sinPitch)); - double newZ = (y * sinRoll - x * cosRoll) * sinYaw + ((-x * sinRoll + y * cosRoll) * 0 + z * 0.01745) * cosYaw; - - return Vec3.createVectorHelper(newX, newY, newZ); - } - - public float getYaw() { - return this.rotationYaw; - } - - public float getPitch() { - return this.pitch; - } - - public double speedXFromPitch(EntityPlayer player, double var3) { - return (-MathHelper.sin((rotationYaw + 90) / 180.0F * (float) Math.PI) * var3 * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * var3); - } - - public double speedZFromPitch(EntityPlayer player, double var3) { - return (MathHelper.cos((rotationYaw + 90) / 180.0F * (float) Math.PI) * var3 * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * var3); - } - - @Override - public void onUpdate() { - super.onUpdate(); - if (fuel > 0 && riddenByEntity instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) riddenByEntity; - motionX = motionX + player.moveForward * speedXFromPitch(player, 0.2) * 0.1; - motionZ = motionZ + player.moveForward * speedZFromPitch(player, 0.2) * 0.1; - rotationYaw += player.moveStrafing * .5; - } - - if (riddenByEntity == null) { - pitch = 0F; - } - - /** - * Handle the wheels mouvements - */ - if (wheels != null) { - for (int seatNum = 0; seatNum < wheels.length; seatNum++) { - Vec3 posVec = this.rotate(wheels[seatNum].seatX, wheels[seatNum].seatY, wheels[seatNum].seatZ).addVector(this.posX, this.posY + 0.7, this.posZ); - //wheels[seatNum].setPosition(posVec.xCoord, posVec.yCoord, posVec.zCoord); - - wheels[seatNum].setPositionAndRotation(posVec.xCoord, posVec.yCoord, posVec.zCoord, this.rotationYaw, pitch); - } - } - - //It hasn't any GUI for now - /*if (fuel <= 0) { if (zeppInvent[0] != null && zeppInvent[0].itemID == ItemIDs.refinedFuel.item.shiftedIndex) { fuel = ConfigHandler2.ZeppelinCoal; this.dataWatcher.updateObject(20, fuel); decrStackSize(0, 1); } } */ - - if (boatTimeSinceHit > 0) { - boatTimeSinceHit--; - } - if (boatCurrentDamage > 0) { - boatCurrentDamage--; - } - - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - int i = 5; - double d = 0.0D; - for (int j = 0; j < i; j++) { - double d4 = (boundingBox.minY + ((boundingBox.maxY - boundingBox.minY) * (j + 0)) / i) - 0.125D; - double d8 = (boundingBox.minY + ((boundingBox.maxY - boundingBox.minY) * (j + 1)) / i) - 0.125D; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(boundingBox.minX, d4, boundingBox.minZ, boundingBox.maxX, d8, boundingBox.maxZ); - if (worldObj.isAABBInMaterial(axisalignedbb, Material.water)) { - d += 1.0D / i; - } - } - - double d11 = Math.sqrt(motionX * motionX + motionZ * motionZ); - if (getFuel() > 0) { - // if(d11 > 0.14999999999999999D) - // { - double d13 = Math.cos((rotationYaw * 3.1415926535897931D) / 180D); - double d15 = Math.sin((rotationYaw * 3.1415926535897931D) / 180D); - - double d18 = rand.nextFloat() * 2.0F - 1.0F; - double d20 = (rand.nextInt(2) * 2 - 1) * 0.69999999999999996D; - if (rand.nextBoolean()) { - double d21 = (posX - d13 * d18 * 0.80000000000000004D) + d15 * d20; - double d23 = posZ - d15 * d18 * 0.80000000000000004D - d13 * d20; - // worldObj.spawnParticle("splash", d21, posY - 0.125D, d23, motionX, motionY, motionZ); - worldObj.spawnParticle("largesmoke", d21, posY - 0.125D, d23, motionX, motionY, motionZ); - } - else { - double d22 = posX + d13 + d15 * d18 * 0.69999999999999996D; - double d24 = (posZ + d15) - d13 * d18 * 0.69999999999999996D; - // worldObj.spawnParticle("splash", d22, posY - 0.125D, d24, motionX, motionY, motionZ); - worldObj.spawnParticle("largesmoke", d22, posY - 0.125D, d24, motionX, motionY, motionZ); - } - } - if (worldObj.isRemote) { - if (field_9394_d > 0) { - double d1 = posX + (field_9393_e - posX) / field_9394_d; - double d5 = posY + (field_9392_f - posY) / field_9394_d; - double d9 = posZ + (field_9391_g - posZ) / field_9394_d; - double d12; - for (d12 = field_9390_h - rotationYaw; d12 < -180D; d12 += 360D) { - } - for (; d12 >= 180D; d12 -= 360D) { - } - rotationYaw += d12 / field_9394_d; - rotationPitch += (field_9389_i - rotationPitch) / field_9394_d; - field_9394_d--; - setPosition(d1, d5, d9); - setRotation(rotationYaw, rotationPitch); - } - else { - double d2 = posX + motionX; - double d6 = posY + motionY; - double d10 = posZ + motionZ; - setPosition(d2, d6, d10); - if (onGround) { - - } - motionX *= 0.99000000953674316D; - // motionY *= 0.94999998807907104D; - motionZ *= 0.99000000953674316D; - } - return; - } - double d7 = 0.20000000000000002D; - if (motionX < -d7) { - motionX = -d7; - } - if (motionX > d7) { - motionX = d7; - } - if (motionZ < -d7) { - motionZ = -d7; - } - if (motionZ > d7) { - motionZ = d7; - } - if (onGround) { - } - if (rand.nextInt(4) == 0 && fuel > 0) { - fuel--; - this.dataWatcher.updateObject(20, fuel); - } - if (fuel <= 0) { - motionX *= 0.3; - motionZ *= 0.3; - } - //TODO This is what allows the entity to climb any height, a better system should be created... - if (this.isCollidedHorizontally) { - - motionY = 0.051; - } - else { - double d3 = d * 2D - 1.0D; - motionY += 0.039999999105930328D * d3; - } - - motionX *= 0.7400000953674316D; - motionY *= 0.94999998807907104D; - motionZ *= 0.7400000953674316D; - - moveEntity(motionX, motionY, motionZ); - - /* This is how the entity rotates with the look of the player */ - if (getFuel() > 0 && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) { - Vec3 vecLook = ((EntityPlayer) riddenByEntity).getLook(2);// .addVector(posX, posY, posZ); - double da = rotationYaw; - double db = 0 - vecLook.xCoord; - double dc = 0 - vecLook.zCoord; - if (db * db + dc * dc > 0.0000001D) { - da = (float) ((Math.atan2(dc, db) * 180D) / 3.1415926535897931D); - } - - double d19; - for (d19 = da - (double) rotationYaw; d19 >= 180D; d19 -= 360D) { - } - for (; d19 < -180D; d19 += 360D) { - } - if (d19 > 20D) { - d19 = 20D; - } - if (d19 < 0 && d19 > 0) { - d19 = 0; - } - if (d19 > -0 && d19 < 0) { - d19 = 0; - } - if (d19 < -20D) { - d19 = -20D; - } - - double rot = rotationYaw; - - rot += d19 * 0.2; - - //deactivate this line for test purpose - setRotation((float) rot, rotationPitch); - } - - setRotation(rotationYaw, rotationPitch); - List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && list.size() > 0) { - for (int j1 = 0; j1 < list.size(); j1++) { - Entity entity = (Entity) list.get(j1); - if (entity != riddenByEntity && entity.canBePushed() && !(entity instanceof EntityRotativeWheel)) { - entity.applyEntityCollision(this); - } - } - - } - if (riddenByEntity != null && riddenByEntity.isDead) { - riddenByEntity = null; - } - - if (Math.sqrt((motionX * motionX) + (motionZ * motionZ)) > 0.01) { - Vec3 pos = Vec3.createVectorHelper(posX, posY - 1, posZ); - Block id = worldObj.getBlock((int) posX, (int) posY - 1, (int) posZ); - if (id != null) { - this.playMiningEffect(pos, Block.getIdFromBlock(id)); - } - } - } - - /** - * Spawn breaking particles for blockparticles - * - * @param pos position - * @param block_index index of the block in mining list - */ - - private void playMiningEffect(Vec3 pos, int block_index) { - Block id = worldObj.getBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); - Block block = id; - if (block != null) { - Minecraft.getMinecraft().effectRenderer.addBlockHitEffects((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, block_index < 4 ? getSideFromYaw() : (block_index < 6 ? 1 : 0)); - } - } - - /** - * Convert "rotation yaw" angle to block side index. - * - * @return block side for particles - */ - private int getSideFromYaw() { - if (rotationYaw == 0) { - return 5; - } - if (rotationYaw == 90) { - return 3; - } - if (rotationYaw == 180) { - return 4; - } - if (rotationYaw == 270) { - return 2; - } - return 1; - } - - @Override - public boolean shouldRiderSit() { - return false; - } - - @Override - public void updateRiderPosition() { - if (riddenByEntity == null) { - return; - } - else { - - riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset() + 1.1F, posZ); - if (riddenByEntity instanceof EntityLiving) { - pitch = ((EntityPlayer) riddenByEntity).rotationPitch; - if (pitch > Math.toDegrees(pitchLimits)) - pitch = (float) Math.toDegrees(pitchLimits); - if (pitch < Math.toDegrees(-pitchLimits)) - pitch = (float) Math.toDegrees(-pitchLimits); - } - - return; - } - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - nbttagcompound.setShort("Fuel", (short) fuel); - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < zeppInvent.length; i++) { - if (zeppInvent[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - zeppInvent[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - nbttagcompound.setTag("Items", nbttaglist); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - fuel = nbttagcompound.getShort("Fuel"); - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - zeppInvent = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < zeppInvent.length) { - zeppInvent[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - } - - @Override - public float getShadowSize() { - return 0.0F; - } - - @Override - public int getSizeInventory() { - return inventorySize; - } - - @Override - public ItemStack getStackInSlot(int i) { - return zeppInvent[i]; - } - - /** - * works exactly like getStackInSlot, is only used upon closing GUIs - */ - @Override - public ItemStack getStackInSlotOnClosing(int par1) { - if (this.zeppInvent[par1] != null) { - ItemStack var2 = this.zeppInvent[par1]; - this.zeppInvent[par1] = null; - return var2; - } - else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int i, int j) { - - if (zeppInvent[i] != null) { - if (zeppInvent[i].stackSize <= j) { - ItemStack itemstack = zeppInvent[i]; - zeppInvent[i] = null; - return itemstack; - } - ItemStack itemstack1 = zeppInvent[i].splitStack(j); - if (zeppInvent[i].stackSize == 0) { - zeppInvent[i] = null; - } - return itemstack1; - } - else { - return null; - } - - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - - zeppInvent[i] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - if (itemstack != null && itemstack.getItem() == Items.coal && i == 0 && riddenByEntity != null && (riddenByEntity instanceof EntityPlayer)) { - // ((EntityPlayer)riddenByEntity).func_25046_a(Train.field_27542_startTrain, 1); - } - - } - - @Override - public String getInventoryName() { - return "Rotative Digger"; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - public boolean isFuelled() { - return getFuel() > 0; - } - - public int c(int i) { - return (getFuel() * i) / 1000; - } - - @Override - public void markDirty() {} - - public int getFuel() { - return (this.dataWatcher.getWatchableObjectInt(20)); - } - - public int getStart() { - return (this.dataWatcher.getWatchableObjectInt(21)); - } - - boolean ImIn = false;// changed - ItemStack itemstack; - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - itemstack = entityplayer.inventory.getCurrentItem(); - - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { - - return true; - } - - /* This is a temporary fix for testing purpose Or maybe not. Does this thing really needs a GUI? */ - ItemStack var2 = entityplayer.inventory.getCurrentItem(); - - if (var2 != null && var2.getItem() == ItemIDs.refinedFuel.item) { - if (--var2.stackSize == 0) { - entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, (ItemStack) null); - } - - this.fuel += 3600; - this.dataWatcher.updateObject(20, fuel); - return true; - } - - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); - } - - return true; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - if (isDead) { - return false; - } - return entityplayer.getDistanceSqToEntity(this) <= 64D; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } + public int start; + private ItemStack[] cargoItems;// added + private ItemStack[] zeppInvent; + public int numCargoSlots; + public int numCargoSlots1; + public int numCargoSlots2; + public int inventorySize; + public int fuel; + public boolean idle; + public boolean altitude; + private static int KEY_ACC; + private static int KEY_DEC; + private static int KEY_TURNLEFT; + private static int KEY_TURNRIGHT; + private static int KEY_UP; + private static int KEY_DOWN; + private static int KEY_IDLE; + private static int KEY_INV; + private static int KEY_BOMB; + + public int boatCurrentDamage; + public int boatTimeSinceHit; + public int boatRockDirection; + private int field_9394_d; + private double field_9393_e; + private double field_9392_f; + private double field_9391_g; + private double field_9390_h; + private double field_9389_i; + private double field_9388_j; + private double field_9387_k; + private double field_9386_l; + + public float pitch = 0F; + public float roll = 0F; + public float pitchLimits = 0.75F; + /** + * passengers wheels + */ + protected EntityRotativeWheel[] wheels; + + public EntityRotativeDigger(World world) { + super(world); + boatCurrentDamage = 0; + boatTimeSinceHit = 0; + boatRockDirection = 1; + preventEntitySpawning = true; + setSize(1.5F, 0.8F); + yOffset = height / 2.0F; + numCargoSlots = 3; + numCargoSlots1 = 3; + numCargoSlots2 = 3; + inventorySize = numCargoSlots + numCargoSlots2 + numCargoSlots1 + 5; + zeppInvent = new ItemStack[inventorySize]; + idle = false; + + /** + * Entities are always rendered even if out player's sight => no more flickering/disappearing + */ + if (ConfigHandler.FLICKERING) { + this.ignoreFrustumCheck = true; + } + + stepHeight = 0.6F; + + if (worldObj.isRemote) { + this.wheels = new EntityRotativeWheel[1]; + this.wheels[0] = new EntityRotativeWheel(this.worldObj, this, 0, 5.4D, 0, 0, 0.0D); + worldObj.spawnEntityInWorld(this.wheels[0]); + } + + this.dataWatcher.addObject(20, fuel); + this.dataWatcher.addObject(21, start); + + } + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + protected void entityInit() { + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) { + return entity.boundingBox; + } + + @Override + public AxisAlignedBB getBoundingBox() { + return boundingBox; + } + + @Override + public void applyEntityCollision(Entity entity) { + if (entity instanceof EntityRotativeWheel) { + return; + } + + if (entity instanceof EntityPlayer) { + return; + } + + if (entity != entity.riddenByEntity) { + double var2 = entity.posX - this.posX; + double var4 = entity.posZ - this.posZ; + double var6 = MathHelper.abs_max(var2, var4); + + if (var6 >= 0.009999999776482582D) { + var6 = MathHelper.sqrt_double(var6); + var2 /= var6; + var4 /= var6; + double var8 = 1.0D / var6; + + if (var8 > 1.0D) { + var8 = 1.0D; + } + + var2 *= var8; + var4 *= var8; + var2 *= 0.05000000074505806D; + var4 *= 0.05000000074505806D; + var2 *= (1.0F - this.entityCollisionReduction); + var4 *= (1.0F - this.entityCollisionReduction); + this.addVelocity(-var2, 0.0D, -var4); + entity.addVelocity(var2, 0.0D, var4); + } + } + } + + public EntityRotativeDigger(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public double getMountedYOffset() { + return height * 0.0D - 0.30000001192092896D; + } + + @Override + public boolean attackEntityFrom(DamageSource damagesource, float i) { + if (worldObj.isRemote || isDead) { + return true; + } + + boatRockDirection = -boatRockDirection; + boatTimeSinceHit = 10; + boatCurrentDamage += (int) (i * 10); + setBeenAttacked(); + if (boatCurrentDamage > 40) { + setDead(); + } + + return true; + } + + @Override + public void setDead() { + label0: + for (int i = 0; i < getSizeInventory(); i++) { + ItemStack itemstack = getStackInSlot(i); + if (itemstack == null) { + continue; + } + + float f = rand.nextFloat() * 0.8F + 0.1F; + float f1 = rand.nextFloat() * 0.8F + 0.1F; + float f2 = rand.nextFloat() * 0.8F + 0.1F; + do { + if (itemstack.stackSize <= 0) { + continue label0; + } + + int k = rand.nextInt(21) + 10; + if (k > itemstack.stackSize) { + k = itemstack.stackSize; + } + + EntityItem entityitem = new EntityItem(worldObj, posX + f, posY + f1, posZ + f2, itemstack.splitStack(k)); + float f3 = 0.05F; + entityitem.motionX = (float) rand.nextGaussian() * f3; + entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) rand.nextGaussian() * f3; + worldObj.spawnEntityInWorld(entityitem); + } while (true); + } + if (wheels != null) { + for (EntityRotativeWheel wheel : wheels) { + wheel.setDead(); + } + } + super.setDead(); + } + + public void pressKeyClient(int i) { + Traincraft.keyChannel.sendToServer(new PacketKeyPress(i)); + } + + public void pressKey(int i) { + + if (i == 7 && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) { + //TODO there is no GUI for it currently + //((EntityPlayer) riddenByEntity).openGui(Traincraft.instance, GuiIDs.DIGGER, worldObj, (int) this.posX, (int) this.posY, (int) this.posZ); + } + + if (i == 9) { + if (start == 0) { + start = 1; + } else { + start = 0; + } + + } + } + + @Override + @SideOnly(Side.CLIENT) + public void performHurtAnimation() { + boatRockDirection = -boatRockDirection; + boatTimeSinceHit = 10; + boatCurrentDamage += boatCurrentDamage * 10; + } + + @Override + public boolean canBeCollidedWith() { + return !isDead; + } + + @Override + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double d, double d1, double d2, float f, float f1, int i) { + field_9393_e = d; + field_9392_f = d1; + field_9391_g = d2; + field_9390_h = f; + field_9389_i = f1; + field_9394_d = i + 4; + motionX = field_9388_j; + // motionY = field_9387_k; + motionZ = field_9386_l; + } + + @Override + @SideOnly(Side.CLIENT) + public void setVelocity(double d, double d1, double d2) { + field_9388_j = motionX = d; + // field_9387_k = motionY = d1; + field_9386_l = motionZ = d2; + } + + /** + * Used to setup the wheel + * + * @param x x position of the wheel + * @param y y position of the wheel + * @param z z position of the wheel + * @return Vec3 with the position of the wheel + */ + public Vec3 rotate(double x, double y, double z) { + + double cosYaw = Math.cos(this.getYaw() * 3.141593F / 180.0F); + double sinYaw = Math.sin(this.getYaw() * 3.141593F / 180.0F); + double cosPitch = Math.cos((this.getPitch()) * 3.141593F / 180.0F); + double sinPitch = Math.sin((this.getPitch()) * 3.141593F / 180.0F); + double cosRoll = Math.cos(0 * 3.141593F / 180.0F);// 0.01745 + double sinRoll = Math.sin(0 * 3.141593F / 180.0F);// 0 + + double v = (-x * sinRoll + y * cosRoll) * 0 + z * 0.01745; + double newX = (-x * cosRoll - y * sinRoll) * cosYaw + v * sinYaw; + double newY = -(((cosPitch - x) * -sinPitch)); + double newZ = (y * sinRoll - x * cosRoll) * sinYaw + v * cosYaw; + + return Vec3.createVectorHelper(newX, newY, newZ); + } + + public float getYaw() { + return this.rotationYaw; + } + + public float getPitch() { + return this.pitch; + } + + public double speedXFromPitch(EntityPlayer player, double var3) { + return (-MathHelper.sin((rotationYaw + 90) / 180.0F * (float) Math.PI) * var3 * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * var3); + } + + public double speedZFromPitch(EntityPlayer player, double var3) { + return (MathHelper.cos((rotationYaw + 90) / 180.0F * (float) Math.PI) * var3 * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * var3); + } + + @Override + public void onUpdate() { + super.onUpdate(); + if (fuel > 0 && riddenByEntity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) riddenByEntity; + motionX = motionX + player.moveForward * speedXFromPitch(player, 0.2) * 0.1; + motionZ = motionZ + player.moveForward * speedZFromPitch(player, 0.2) * 0.1; + rotationYaw += (float) (player.moveStrafing * .5); + } + + if (riddenByEntity == null) { + pitch = 0F; + } + + /** + * Handle the wheels mouvements + */ + if (wheels != null) { + for (EntityRotativeWheel wheel : wheels) { + Vec3 posVec = this.rotate(wheel.seatX, wheel.seatY, wheel.seatZ).addVector(this.posX, this.posY + 0.7, this.posZ); + //wheels[seatNum].setPosition(posVec.xCoord, posVec.yCoord, posVec.zCoord); + + wheel.setPositionAndRotation(posVec.xCoord, posVec.yCoord, posVec.zCoord, this.rotationYaw, pitch); + } + } + + //It hasn't any GUI for now + /*if (fuel <= 0) { if (zeppInvent[0] != null && zeppInvent[0].itemID == ItemIDs.refinedFuel.item.shiftedIndex) { fuel = ConfigHandler2.ZeppelinCoal; this.dataWatcher.updateObject(20, fuel); decrStackSize(0, 1); } } */ + + if (boatTimeSinceHit > 0) { + boatTimeSinceHit--; + } + + if (boatCurrentDamage > 0) { + boatCurrentDamage--; + } + + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + int i = 5; + double d = 0.0D; + for (int j = 0; j < i; j++) { + double d4 = (boundingBox.minY + ((boundingBox.maxY - boundingBox.minY) * (j)) / i) - 0.125D; + double d8 = (boundingBox.minY + ((boundingBox.maxY - boundingBox.minY) * (j + 1)) / i) - 0.125D; + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(boundingBox.minX, d4, boundingBox.minZ, boundingBox.maxX, d8, boundingBox.maxZ); + + if (worldObj.isAABBInMaterial(axisalignedbb, Material.water)) { + d += 1.0D / i; + } + } + + double d11 = Math.sqrt(motionX * motionX + motionZ * motionZ); + if (getFuel() > 0) { + // if(d11 > 0.14999999999999999D) + // { + double d13 = Math.cos((rotationYaw * 3.1415926535897931D) / 180D); + double d15 = Math.sin((rotationYaw * 3.1415926535897931D) / 180D); + + double d18 = rand.nextFloat() * 2.0F - 1.0F; + double d20 = (rand.nextInt(2) * 2 - 1) * 0.69999999999999996D; + + if (rand.nextBoolean()) { + double d21 = (posX - d13 * d18 * 0.80000000000000004D) + d15 * d20; + double d23 = posZ - d15 * d18 * 0.80000000000000004D - d13 * d20; + // worldObj.spawnParticle("splash", d21, posY - 0.125D, d23, motionX, motionY, motionZ); + worldObj.spawnParticle("largesmoke", d21, posY - 0.125D, d23, motionX, motionY, motionZ); + } else { + double d22 = posX + d13 + d15 * d18 * 0.69999999999999996D; + double d24 = (posZ + d15) - d13 * d18 * 0.69999999999999996D; + // worldObj.spawnParticle("splash", d22, posY - 0.125D, d24, motionX, motionY, motionZ); + worldObj.spawnParticle("largesmoke", d22, posY - 0.125D, d24, motionX, motionY, motionZ); + } + } + if (worldObj.isRemote) { + if (field_9394_d > 0) { + double d1 = posX + (field_9393_e - posX) / field_9394_d; + double d5 = posY + (field_9392_f - posY) / field_9394_d; + double d9 = posZ + (field_9391_g - posZ) / field_9394_d; + double d12; + for (d12 = field_9390_h - rotationYaw; d12 < -180D; d12 += 360D) { + } + for (; d12 >= 180D; d12 -= 360D) { + } + rotationYaw += (float) (d12 / field_9394_d); + rotationPitch += (float) ((field_9389_i - rotationPitch) / field_9394_d); + field_9394_d--; + setPosition(d1, d5, d9); + setRotation(rotationYaw, rotationPitch); + } else { + double d2 = posX + motionX; + double d6 = posY + motionY; + double d10 = posZ + motionZ; + setPosition(d2, d6, d10); + motionX *= 0.99000000953674316D; + // motionY *= 0.94999998807907104D; + motionZ *= 0.99000000953674316D; + } + return; + } + double d7 = 0.20000000000000002D; + if (motionX < -d7) { + motionX = -d7; + } + + if (motionX > d7) { + motionX = d7; + } + + if (motionZ < -d7) { + motionZ = -d7; + } + + if (motionZ > d7) { + motionZ = d7; + } + + if (rand.nextInt(4) == 0 && fuel > 0) { + fuel--; + this.dataWatcher.updateObject(20, fuel); + } + + if (fuel <= 0) { + motionX *= 0.3; + motionZ *= 0.3; + } + + //TODO This is what allows the entity to climb any height, a better system should be created... + if (this.isCollidedHorizontally) { + motionY = 0.051; + } else { + double d3 = d * 2D - 1.0D; + motionY += 0.039999999105930328D * d3; + } + + motionX *= 0.7400000953674316D; + motionY *= 0.94999998807907104D; + motionZ *= 0.7400000953674316D; + + moveEntity(motionX, motionY, motionZ); + + /* This is how the entity rotates with the look of the player */ + if (getFuel() > 0 && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) { + Vec3 vecLook = ((EntityPlayer) riddenByEntity).getLook(2);// .addVector(posX, posY, posZ); + double da = rotationYaw; + double db = 0 - vecLook.xCoord; + double dc = 0 - vecLook.zCoord; + if (db * db + dc * dc > 0.0000001D) { + da = (float) ((Math.atan2(dc, db) * 180D) / 3.1415926535897931D); + } + + double d19; + for (d19 = da - (double) rotationYaw; d19 >= 180D; d19 -= 360D) { + } + for (; d19 < -180D; d19 += 360D) { + } + + if (d19 > 20D) { + d19 = 20D; + } + + if (d19 < -20D) { + d19 = -20D; + } + + double rot = rotationYaw; + + rot += d19 * 0.2; + + //deactivate this line for test purpose + setRotation((float) rot, rotationPitch); + } + + setRotation(rotationYaw, rotationPitch); + List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + if (list != null && !list.isEmpty()) { + for (Object o : list) { + Entity entity = (Entity) o; + if (entity != riddenByEntity && entity.canBePushed() && !(entity instanceof EntityRotativeWheel)) { + entity.applyEntityCollision(this); + } + } + + } + if (riddenByEntity != null && riddenByEntity.isDead) { + riddenByEntity = null; + } + + if (Math.sqrt((motionX * motionX) + (motionZ * motionZ)) > 0.01) { + Vec3 pos = Vec3.createVectorHelper(posX, posY - 1, posZ); + Block id = worldObj.getBlock((int) posX, (int) posY - 1, (int) posZ); + + if (id != null) { + this.playMiningEffect(pos, Block.getIdFromBlock(id)); + } + } + } + + /** + * Spawn breaking particles for blockparticles + * + * @param pos position + * @param block_index index of the block in mining list + */ + + private void playMiningEffect(Vec3 pos, int block_index) { + Block id = worldObj.getBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); + if (id != null) { + Minecraft.getMinecraft().effectRenderer.addBlockHitEffects((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, block_index < 4 ? getSideFromYaw() : (block_index < 6 ? 1 : 0)); + } + } + + /** + * Convert "rotation yaw" angle to block side index. + * + * @return block side for particles + */ + private int getSideFromYaw() { + if (rotationYaw == 0) { + return 5; + } + + if (rotationYaw == 90) { + return 3; + } + + if (rotationYaw == 180) { + return 4; + } + + if (rotationYaw == 270) { + return 2; + } + + return 1; + } + + @Override + public boolean shouldRiderSit() { + return false; + } + + @Override + public void updateRiderPosition() { + if (riddenByEntity == null) { + return; + } + + riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset() + 1.1F, posZ); + if (riddenByEntity instanceof EntityLiving) { + pitch = riddenByEntity.rotationPitch; + if (pitch > Math.toDegrees(pitchLimits)) + pitch = (float) Math.toDegrees(pitchLimits); + if (pitch < Math.toDegrees(-pitchLimits)) + pitch = (float) Math.toDegrees(-pitchLimits); + } + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setShort("Fuel", (short) fuel); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < zeppInvent.length; i++) { + if (zeppInvent[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + zeppInvent[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + fuel = nbttagcompound.getShort("Fuel"); + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + zeppInvent = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < zeppInvent.length) { + zeppInvent[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + @Override + public float getShadowSize() { + return 0.0F; + } + + @Override + public int getSizeInventory() { + return inventorySize; + } + + @Override + public ItemStack getStackInSlot(int i) { + return zeppInvent[i]; + } + + /** + * works exactly like getStackInSlot, is only used upon closing GUIs + */ + @Override + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.zeppInvent[par1] != null) { + ItemStack var2 = this.zeppInvent[par1]; + this.zeppInvent[par1] = null; + return var2; + } else { + return null; + } + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if (zeppInvent[i] != null) { + if (zeppInvent[i].stackSize <= j) { + ItemStack itemstack = zeppInvent[i]; + zeppInvent[i] = null; + return itemstack; + } + ItemStack itemstack1 = zeppInvent[i].splitStack(j); + if (zeppInvent[i].stackSize == 0) { + zeppInvent[i] = null; + } + return itemstack1; + } else { + return null; + } + + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + + zeppInvent[i] = itemstack; + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { + itemstack.stackSize = getInventoryStackLimit(); + } + if (itemstack != null && itemstack.getItem() == Items.coal && i == 0 && riddenByEntity != null && (riddenByEntity instanceof EntityPlayer)) { + // ((EntityPlayer)riddenByEntity).func_25046_a(Train.field_27542_startTrain, 1); + } + + } + + @Override + public String getInventoryName() { + return "Rotative Digger"; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + public boolean isFuelled() { + return getFuel() > 0; + } + + public int c(int i) { + return (getFuel() * i) / 1000; + } + + @Override + public void markDirty() { + } + + public int getFuel() { + return (this.dataWatcher.getWatchableObjectInt(20)); + } + + public int getStart() { + return (this.dataWatcher.getWatchableObjectInt(21)); + } + + boolean ImIn = false;// changed + ItemStack itemstack; + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + itemstack = entityplayer.inventory.getCurrentItem(); + + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + + return true; + } + + /* This is a temporary fix for testing purpose Or maybe not. Does this thing really needs a GUI? */ + ItemStack var2 = entityplayer.inventory.getCurrentItem(); + + if (var2 != null && var2.getItem() == ItemIDs.refinedFuel.item) { + if (--var2.stackSize == 0) { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, (ItemStack) null); + } + + this.fuel += 3600; + this.dataWatcher.updateObject(20, fuel); + return true; + } + + if (!worldObj.isRemote) { + entityplayer.mountEntity(this); + } + + return true; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + if (isDead) { + return false; + } + return entityplayer.getDistanceSqToEntity(this) <= 64D; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } } diff --git a/src/main/java/train/common/entity/digger/EntityRotativeWheel.java b/src/main/java/train/common/entity/digger/EntityRotativeWheel.java index eb47ed3339..f1850cb136 100644 --- a/src/main/java/train/common/entity/digger/EntityRotativeWheel.java +++ b/src/main/java/train/common/entity/digger/EntityRotativeWheel.java @@ -18,279 +18,271 @@ public class EntityRotativeWheel extends Entity { - /** For the driver seat position */ - - public double seatX; - public double seatY; - public double seatZ; - public double riderOffset; - public int seatID; - public Entity entity; - /** Fake player instance used for block mining */ - private EntityPlayer fakePlayer; - public int startWheel; - private int field_9394_d; - - public EntityRotativeWheel(World world) { - super(world); - riderOffset = 0; - setSize(1F, 1F); - - // noClip=true; - preventEntitySpawning = false; - isImmuneToFire = true; - fakePlayer = new FakePlayer(world); - this.dataWatcher.addObject(21, new Integer(startWheel)); - } - - /** - * - * @param world - * @param entity - * @param numSeat - * @param x - * @param y - * @param z - * @param riderOffset - */ - public EntityRotativeWheel(World world, Entity entity, int numSeat, double x, double y, double z, double riderOffset) { - this(world); - this.entity = entity; - this.seatID = numSeat; - this.seatX = x; - this.seatY = y; - this.seatZ = z; - this.riderOffset = riderOffset; - - } - - @Override - protected void entityInit() { - // TODO Auto-generated method stub - - } - @Override - public boolean canBeCollidedWith() { - return !isDead; - } - @Override - public void onUpdate() { - - if (entity != null && entity instanceof EntityRotativeDigger) { - startWheel = ((EntityRotativeDigger) entity).getStart(); - this.dataWatcher.updateObject(21, startWheel); - - } - if (fakePlayer == null && worldObj != null) - fakePlayer = new FakePlayer(worldObj); - - List listLiving = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.4, 0.4, 0.4)); - if (listLiving != null && listLiving.size() > 0 && entity != null && entity instanceof EntityRotativeDigger && ((EntityRotativeDigger) entity).getFuel() > 0) {//&& ((EntityRotativeDigger) entity).start){ - - for (int j1 = 0; j1 < listLiving.size(); j1++) { - float f3 = 0.05F; - double X = (float) rand.nextGaussian() * f3; - double Y = (float) rand.nextGaussian() * f3 + 0.2F; - double Z = (float) rand.nextGaussian() * f3; - - Entity entity = (Entity) listLiving.get(j1); - if (entity instanceof EntityRotativeDigger) { - // do not affect - } - else if (entity instanceof EntityLiving) { - entity.attackEntityFrom(DamageSource.generic, 4); - entity.addVelocity(X, Y, Z); - - } - else { - entity.addVelocity(X, Y, Z);// for items on ground - } - - } - } - if (entity != null && entity instanceof EntityRotativeDigger && ((EntityRotativeDigger) entity).getFuel() > 0) {//TODO should only dig when rotative digger has fuel and dig mode is on, doesn't work yet - Vec3 vec = null; - - vec = Vec3.createVectorHelper(posX - 0.5, posY, posZ - 0.5); - - this.harvestBlock_do(vec); - //TODO how many blocks should be harvested? - /*for (int h = -1; h < 2; h++) { vec = Vec3.vec3dPool.getVecFromPool(posX, posY + h, posZ); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX + 1, posY + h, posZ); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX - 1, posY + h, posZ); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX, posY + h, posZ - 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX, posY + h, posZ + 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX + 1, posY + h, posZ - 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX - 1, posY + h, posZ + 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX - 1, posY + h, posZ - 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX + 1, posY + h, posZ + 1); this.harvestBlock_do(vec); - * - * } */ - - } - if (worldObj.isRemote) { - if (field_9394_d > 0) { - double d1 = posX + (field_9393_e - posX) / (double) field_9394_d; - double d5 = posY + (field_9392_f - posY) / (double) field_9394_d; - double d9 = posZ + (field_9391_g - posZ) / (double) field_9394_d; - double d12; - for (d12 = field_9390_h - (double) rotationYaw; d12 < -180D; d12 += 360D) { - } - for (; d12 >= 180D; d12 -= 360D) { - } - rotationYaw += d12 / (double) field_9394_d; - rotationPitch += (field_9389_i - (double) rotationPitch) / (double) field_9394_d; - field_9394_d--; - setPosition(d1, d5, d9); - setRotation(rotationYaw, rotationPitch); - } - else { - double d2 = posX + motionX; - double d6 = posY + motionY; - double d10 = posZ + motionZ; - setPosition(d2, d6, d10); - if (onGround) { - - } - motionX *= 0.99000000953674316D; - // motionY *= 0.94999998807907104D; - motionZ *= 0.99000000953674316D; - } - return; - } - } - - /** - * Perform block harvesting, drop the item, remove block and play sound. - * - * @param pos - */ - - private void harvestBlock_do(Vec3 pos) { - if (pos == null) - return; - - Block id = worldObj.getBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); - int meta = worldObj.getBlockMetadata((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); - if (id != null) { - this.playMiningEffect(pos, id); - } - - if (!shouldIgnoreBlockForHarvesting(pos, id)) { - - if (id != null) { - id.harvestBlock(worldObj, fakePlayer, (int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, meta); - worldObj.setBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, null); - - worldObj.playAuxSFX(2001, (int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, Block.getIdFromBlock(id) + (meta << 12)); - this.playMiningEffect(pos, id); - } - } - - } - - /** - * Check if block is unharvestable - * - * @param pos - * @param id block id - * @return is not harvested - */ - private boolean shouldIgnoreBlockForHarvesting(Vec3 pos, Block id) { - - if (id == null || id instanceof BlockTorch || id == Block.getBlockFromName("bedrock") || id == Block.getBlockFromName("fire") || id == Block.getBlockFromName("portal") || id == Block.getBlockFromName("endPortal") || id instanceof BlockLiquid || Block.getIdFromBlock(id) == 55 || Block.getIdFromBlock(id) == 70 || Block.getIdFromBlock(id) == 72) { - return true; - } - - boolean flag = false; - - if (flag && id.getCollisionBoundingBoxFromPool(worldObj, (int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord) == null) { - return true; - } - - return false; - - } - - public int getStartWheel() { - return (this.dataWatcher.getWatchableObjectInt(21)); - } - - /** - * Spawn breaking particles for blockparticles - * - * @param pos position - * @param block_index index of the block in mining list - */ - private int miningTickCounter = 0; - - @SideOnly(Side.CLIENT) - private void playMiningEffect(Vec3 pos, Block block_index) { - - miningTickCounter++; - Block id = worldObj.getBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); - Block block = id; - } - - /** - * Convert "rotation yaw" angle to block side index. - * - * @return block side for particles - */ - private int getSideFromYaw() { - if (rotationYaw == 0) { - return 5; - } - if (rotationYaw == 90) { - return 3; - } - if (rotationYaw == 180) { - return 4; - } - if (rotationYaw == 270) { - return 2; - } - return 1; - } - - @Override - public void applyEntityCollision(Entity entity) { - - } - - @Override - protected void readEntityFromNBT(NBTTagCompound var1) { - // TODO Auto-generated method stub - - } - - @Override - protected void writeEntityToNBT(NBTTagCompound var1) { - // TODO Auto-generated method stub - - } - - @SideOnly(Side.CLIENT) - @Override - public void setPositionAndRotation2(double d, double d1, double d2, float f, float f1, int i) { - field_9393_e = d; - field_9392_f = d1; - field_9391_g = d2; - field_9390_h = f; - field_9389_i = f1; - field_9394_d = i + 4; - motionX = field_9388_j; - // motionY = field_9387_k; - motionZ = field_9386_l; - } - - @SideOnly(Side.CLIENT) - @Override - public void setVelocity(double d, double d1, double d2) { - field_9388_j = motionX = d; - // field_9387_k = motionY = d1; - field_9386_l = motionZ = d2; - } - - private double field_9393_e; - private double field_9392_f; - private double field_9391_g; - private double field_9390_h; - private double field_9389_i; - private double field_9388_j; - private double field_9387_k; - private double field_9386_l; + /** + * For the driver seat position + */ + public double seatX; + public double seatY; + public double seatZ; + public double riderOffset; + public int seatID; + public Entity entity; + /** + * Fake player instance used for block mining + */ + private EntityPlayer fakePlayer; + public int startWheel; + private int field_9394_d; + + public EntityRotativeWheel(World world) { + super(world); + riderOffset = 0; + setSize(1F, 1F); + + // noClip=true; + preventEntitySpawning = false; + isImmuneToFire = true; + fakePlayer = new FakePlayer(world); + this.dataWatcher.addObject(21, startWheel); + } + + /** + * @param world world + * @param entity entity + * @param numSeat seat id + * @param x seat x + * @param y seat y + * @param z seat z + * @param riderOffset rider offset + */ + public EntityRotativeWheel(World world, Entity entity, int numSeat, double x, double y, double z, double riderOffset) { + this(world); + this.entity = entity; + this.seatID = numSeat; + this.seatX = x; + this.seatY = y; + this.seatZ = z; + this.riderOffset = riderOffset; + + } + + @Override + protected void entityInit() { + // TODO Auto-generated method stub + + } + + @Override + public boolean canBeCollidedWith() { + return !isDead; + } + + @Override + public void onUpdate() { + + if (entity != null && entity instanceof EntityRotativeDigger) { + startWheel = ((EntityRotativeDigger) entity).getStart(); + this.dataWatcher.updateObject(21, startWheel); + } + + if (fakePlayer == null && worldObj != null) { + fakePlayer = new FakePlayer(worldObj); + } + + assert worldObj != null; + List listLiving = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.4, 0.4, 0.4)); + if (listLiving != null && !listLiving.isEmpty() && entity != null && entity instanceof EntityRotativeDigger && ((EntityRotativeDigger) entity).getFuel() > 0) {//&& ((EntityRotativeDigger) entity).start){ + + for (Object o : listLiving) { + float f3 = 0.05F; + double X = (float) rand.nextGaussian() * f3; + double Y = (float) rand.nextGaussian() * f3 + 0.2F; + double Z = (float) rand.nextGaussian() * f3; + + Entity entity = (Entity) o; + if (entity instanceof EntityRotativeDigger) { + // do not affect + } else if (entity instanceof EntityLiving) { + entity.attackEntityFrom(DamageSource.generic, 4); + entity.addVelocity(X, Y, Z); + } else { + entity.addVelocity(X, Y, Z);// for items on ground + } + } + } + + if (entity != null && entity instanceof EntityRotativeDigger && ((EntityRotativeDigger) entity).getFuel() > 0) {//TODO should only dig when rotative digger has fuel and dig mode is on, doesn't work yet + Vec3 vec = Vec3.createVectorHelper(posX - 0.5, posY, posZ - 0.5); + + this.harvestBlock_do(vec); + //TODO how many blocks should be harvested? + /*for (int h = -1; h < 2; h++) { vec = Vec3.vec3dPool.getVecFromPool(posX, posY + h, posZ); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX + 1, posY + h, posZ); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX - 1, posY + h, posZ); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX, posY + h, posZ - 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX, posY + h, posZ + 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX + 1, posY + h, posZ - 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX - 1, posY + h, posZ + 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX - 1, posY + h, posZ - 1); this.harvestBlock_do(vec); vec = Vec3.vec3dPool.getVecFromPool(posX + 1, posY + h, posZ + 1); this.harvestBlock_do(vec); + * + * } */ + } + + if (worldObj.isRemote) { + if (field_9394_d > 0) { + double d1 = posX + (field_9393_e - posX) / (double) field_9394_d; + double d5 = posY + (field_9392_f - posY) / (double) field_9394_d; + double d9 = posZ + (field_9391_g - posZ) / (double) field_9394_d; + double d12; + for (d12 = field_9390_h - (double) rotationYaw; d12 < -180D; d12 += 360D) { + } + for (; d12 >= 180D; d12 -= 360D) { + } + rotationYaw += (float) (d12 / (double) field_9394_d); + rotationPitch += (float) ((field_9389_i - (double) rotationPitch) / (double) field_9394_d); + field_9394_d--; + setPosition(d1, d5, d9); + setRotation(rotationYaw, rotationPitch); + } else { + double d2 = posX + motionX; + double d6 = posY + motionY; + double d10 = posZ + motionZ; + setPosition(d2, d6, d10); + if (onGround) { + + } + motionX *= 0.99000000953674316D; + // motionY *= 0.94999998807907104D; + motionZ *= 0.99000000953674316D; + } + return; + } + } + + /** + * Perform block harvesting, drop the item, remove block and play sound. + * + * @param pos + */ + + private void harvestBlock_do(Vec3 pos) { + if (pos == null) { + return; + } + + Block id = worldObj.getBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); + int meta = worldObj.getBlockMetadata((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); + if (id != null) { + this.playMiningEffect(pos, id); + } + + if (!shouldIgnoreBlockForHarvesting(pos, id)) { + id.harvestBlock(worldObj, fakePlayer, (int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, meta); + worldObj.setBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, null); + + worldObj.playAuxSFX(2001, (int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord, Block.getIdFromBlock(id) + (meta << 12)); + this.playMiningEffect(pos, id); + } + + } + + /** + * Check if block is unharvestable + * + * @param pos + * @param id block id + * @return is not harvested + */ + private boolean shouldIgnoreBlockForHarvesting(Vec3 pos, Block id) { + if (id == null || id instanceof BlockTorch || id == Block.getBlockFromName("bedrock") || id == Block.getBlockFromName("fire") || id == Block.getBlockFromName("portal") || id == Block.getBlockFromName("endPortal") || id instanceof BlockLiquid || Block.getIdFromBlock(id) == 55 || Block.getIdFromBlock(id) == 70 || Block.getIdFromBlock(id) == 72) { + return true; + } + + return id.getCollisionBoundingBoxFromPool(worldObj, (int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord) == null; + } + + public int getStartWheel() { + return this.dataWatcher.getWatchableObjectInt(21); + } + + /** + * Spawn breaking particles for blockparticles + * + * @param pos position + * @param block_index index of the block in mining list + */ + private int miningTickCounter = 0; + + @SideOnly(Side.CLIENT) + private void playMiningEffect(Vec3 pos, Block block_index) { + miningTickCounter++; + Block id = worldObj.getBlock((int) pos.xCoord, (int) pos.yCoord, (int) pos.zCoord); + } + + /** + * Convert "rotation yaw" angle to block side index. + * + * @return block side for particles + */ + private int getSideFromYaw() { + if (rotationYaw == 0) { + return 5; + } + + if (rotationYaw == 90) { + return 3; + } + + if (rotationYaw == 180) { + return 4; + } + + if (rotationYaw == 270) { + return 2; + } + + return 1; + } + + @Override + public void applyEntityCollision(Entity entity) { + + } + + @Override + protected void readEntityFromNBT(NBTTagCompound var1) { + // TODO Auto-generated method stub + + } + + @Override + protected void writeEntityToNBT(NBTTagCompound var1) { + // TODO Auto-generated method stub + + } + + @SideOnly(Side.CLIENT) + @Override + public void setPositionAndRotation2(double d, double d1, double d2, float f, float f1, int i) { + field_9393_e = d; + field_9392_f = d1; + field_9391_g = d2; + field_9390_h = f; + field_9389_i = f1; + field_9394_d = i + 4; + motionX = field_9388_j; + // motionY = field_9387_k; + motionZ = field_9386_l; + } + + @SideOnly(Side.CLIENT) + @Override + public void setVelocity(double d, double d1, double d2) { + field_9388_j = motionX = d; + // field_9387_k = motionY = d1; + field_9386_l = motionZ = d2; + } + + private double field_9393_e; + private double field_9392_f; + private double field_9391_g; + private double field_9390_h; + private double field_9389_i; + private double field_9388_j; + private double field_9387_k; + private double field_9386_l; } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityBUnitDD35.java b/src/main/java/train/common/entity/rollingStock/EntityBUnitDD35.java index d9c0b2cd72..84c05ca81c 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBUnitDD35.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBUnitDD35.java @@ -16,249 +16,232 @@ import train.common.library.GuiIDs; public class EntityBUnitDD35 extends LiquidTank implements IFluidHandler { - public int freightInventorySize; - - private int update = 8; - private LiquidManager.StandardTank theTank; - - public EntityBUnitDD35(World world) { - super(world); - initFreightWater(); - this.theTank = LiquidManager.getInstance().new FilteredTank(getSpec().getTankCapacity(), LiquidManager.dieselFilter()); - } - - public EntityBUnitDD35(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - public void onUpdate() { - super.onUpdate(); - checkInvent(cargoItems[0]); - if (worldObj.isRemote) { - return; - } - - if (theTank != null && theTank.getFluid() != null) { - this.dataWatcher.updateObject(18, theTank.getFluidAmount()); - this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); - if (theTank.getFluid().amount <= 1) { - motionX *= 0.94; - motionZ *= 0.94; - } - } - else if (theTank != null && theTank.getFluid() == null) { - this.dataWatcher.updateObject(18, 0); - this.dataWatcher.updateObject(4, 0); - } - - if (getAmount() > 0) { - // setColor(getColorFromString("Full")); - setDefaultMass(-getSpec().getMass()); - if ((motionX>0.01 || motionZ>0.01) && ticksExisted % 40 == 0) { - drain(ForgeDirection.UNKNOWN, 8,true); - } - - } else if (getAmount() <= 0) { - // setColor(getColorFromString("Empty")); - setDefaultMass(getSpec().getMass()); - } - } - - public int getDiesel() { - return (this.dataWatcher.getWatchableObjectInt(18)); - } - - public int getLiquidItemID() { - return (this.dataWatcher.getWatchableObjectInt(4)); - } - - public LiquidManager.StandardTank getTank() { - return theTank; - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - - - nbttagcompound.setTag("Items", nbttaglist); - if (theTank !=null && theTank.getFluid() != null) { - new FluidStack(theTank.getFluid(), this.dataWatcher.getWatchableObjectInt(18)).writeToNBT(nbttagcompound); - } - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - if (nbttagcompound.hasKey("FluidName")) { - fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(nbttagcompound), true); - } - - } - - private void placeInInvent(ItemStack itemstack1) { - for (int i = 1; i < cargoItems.length; i++) { - if (cargoItems[i] == null) { - cargoItems[i] = itemstack1; - return; - } - else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { - int var9 = cargoItems[i].stackSize + itemstack1.stackSize; - if (var9 <= itemstack1.getMaxStackSize()) { - cargoItems[i].stackSize = var9; - - } - else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { - cargoItems[i].stackSize += 1; - } - return; - } - else if (i == cargoItems.length - 1) { - entityDropItem(itemstack1,1); - return; - } - } - } - - public void liquidInSlot(ItemStack itemstack) { - if (worldObj.isRemote) - return; - this.update += 1; - if (this.update % 8 == 0 && itemstack != null) { - ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - if (result != null) { - placeInInvent(result); - } - } - } - - public ItemStack checkInvent(ItemStack cargoItems0) { - - if (getDiesel() > 0) { - fuelTrain = (getDiesel()); - } - if (fuelTrain <= 0) { - motionX *= 0.88; - motionZ *= 0.88; - } - if (cargoItems0 != null) { - liquidInSlot(cargoItems0); - } - return cargoItems0; - } - - public void initFreightWater() { - freightInventorySize = 2; - cargoItems = new ItemStack[freightInventorySize]; - } - - @Override - public String getInventoryName() { - return "DD35 B-Unit"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!this.worldObj.isRemote) { - entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); - } - return true; - } - - @Override - public boolean isStorageCart() { - return true; - } - - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 3.1F; - } - - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return theTank.fill(resource, doFill); - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { - return null; - } - return theTank.drain(resource.amount, doDrain); - } - - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return theTank.drain(maxDrain, doDrain); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { theTank.getInfo() }; - } - - public FluidStack getFluid() { - return theTank.getFluid(); - } - - public int getFluidAmount() { - return dataWatcher.getWatchableObjectInt(18); - } - - @Override - public String getLiquidName(){ - return FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4))!=null?FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)).getUnlocalizedName():null; - } + public int freightInventorySize; + + private int update = 8; + private final LiquidManager.StandardTank theTank; + + public EntityBUnitDD35(World world) { + super(world); + initFreightWater(); + this.theTank = LiquidManager.getInstance().new FilteredTank(getSpec().getTankCapacity(), LiquidManager.dieselFilter()); + } + + public EntityBUnitDD35(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + checkInvent(cargoItems[0]); + if (worldObj.isRemote) { + return; + } + + if (theTank != null && theTank.getFluid() != null) { + this.dataWatcher.updateObject(18, theTank.getFluidAmount()); + this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); + if (theTank.getFluid().amount <= 1) { + motionX *= 0.94; + motionZ *= 0.94; + } + } else if (theTank != null && theTank.getFluid() == null) { + this.dataWatcher.updateObject(18, 0); + this.dataWatcher.updateObject(4, 0); + } + + if (getAmount() > 0) { + // setColor(getColorFromString("Full")); + setDefaultMass(-getSpec().getMass()); + if ((motionX > 0.01 || motionZ > 0.01) && ticksExisted % 40 == 0) { + drain(ForgeDirection.UNKNOWN, 8, true); + } + + } else if (getAmount() <= 0) { + // setColor(getColorFromString("Empty")); + setDefaultMass(getSpec().getMass()); + } + } + + public int getDiesel() { + return (this.dataWatcher.getWatchableObjectInt(18)); + } + + public LiquidManager.StandardTank getTank() { + return theTank; + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + + nbttagcompound.setTag("Items", nbttaglist); + if (theTank != null && theTank.getFluid() != null) { + new FluidStack(theTank.getFluid(), this.dataWatcher.getWatchableObjectInt(18)).writeToNBT(nbttagcompound); + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + if (nbttagcompound.hasKey("FluidName")) { + fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(nbttagcompound), true); + } + + } + + private void placeInInvent(ItemStack itemstack1) { + for (int i = 1; i < cargoItems.length; i++) { + if (cargoItems[i] == null) { + cargoItems[i] = itemstack1; + return; + } else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { + int var9 = cargoItems[i].stackSize + itemstack1.stackSize; + if (var9 <= itemstack1.getMaxStackSize()) { + cargoItems[i].stackSize = var9; + + } else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { + cargoItems[i].stackSize += 1; + } + return; + } else if (i == cargoItems.length - 1) { + entityDropItem(itemstack1, 1); + return; + } + } + } + + public void liquidInSlot(ItemStack itemstack) { + if (worldObj.isRemote) + return; + this.update += 1; + if (this.update % 8 == 0 && itemstack != null) { + ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + if (result != null) { + placeInInvent(result); + } + } + } + + public ItemStack checkInvent(ItemStack cargoItems0) { + if (getDiesel() > 0) { + fuelTrain = (getDiesel()); + } + + if (fuelTrain <= 0) { + motionX *= 0.88; + motionZ *= 0.88; + } + + if (cargoItems0 != null) { + liquidInSlot(cargoItems0); + } + return cargoItems0; + } + + public void initFreightWater() { + freightInventorySize = 2; + cargoItems = new ItemStack[freightInventorySize]; + } + + @Override + public String getInventoryName() { + return "DD35 B-Unit"; + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if ((super.interactFirst(entityplayer))) { + return false; + } + if (!this.worldObj.isRemote) { + entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); + } + return true; + } + + @Override + public boolean isStorageCart() { + return true; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 3.1F; + } + + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return theTank.fill(resource, doFill); + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { + return null; + } + return theTank.drain(resource.amount, doDrain); + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return theTank.drain(maxDrain, doDrain); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[]{theTank.getInfo()}; + } + + public FluidStack getFluid() { + return theTank.getFluid(); + } + + public int getFluidAmount() { + return dataWatcher.getWatchableObjectInt(18); + } + + @Override + public String getLiquidName() { + return FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)) != null ? FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)).getUnlocalizedName() : null; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF3.java b/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF3.java index 02bc6c686c..fa670bf754 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF3.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF3.java @@ -16,285 +16,280 @@ import train.common.library.GuiIDs; public class EntityBUnitEMDF3 extends LiquidTank implements IFluidHandler { - public int freightInventorySize; - - private int update = 8; - private LiquidManager.StandardTank theTank; - - public EntityBUnitEMDF3(World world) { - super(world); - initFreightWater(); - this.theTank = LiquidManager.getInstance().new FilteredTank(getSpec().getTankCapacity(), LiquidManager.dieselFilter()); - } - - public EntityBUnitEMDF3(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - - @Override - public void updateRiderPosition() { - if(riddenByEntity==null){return;} - double pitchRads = this.anglePitchClient * Math.PI / 180.0D; - double distance = 2.3; - double yOffset = 0.65; - float rotationCos1 = (float) Math.cos(Math.toRadians(this.renderYaw + 90)); - float rotationSin1 = (float) Math.sin(Math.toRadians((this.renderYaw + 90))); - if(side.isServer()){ - rotationCos1 = (float) Math.cos(Math.toRadians(this.serverRealRotation + 90)); - rotationSin1 = (float) Math.sin(Math.toRadians((this.serverRealRotation + 90))); - anglePitchClient = serverRealPitch*60; - } - float pitch = (float) (posY + ((Math.tan(pitchRads) * distance) + getMountedYOffset()) - + riddenByEntity.getYOffset() + yOffset); - float pitch1 = (float) (posY + getMountedYOffset() + riddenByEntity.getYOffset() + yOffset); - double bogieX1 = (this.posX + (rotationCos1 * distance)); - double bogieZ1 = (this.posZ + (rotationSin1* distance)); - // System.out.println(rotationCos1+" "+rotationSin1); - if (anglePitchClient > 20 && rotationCos1 == 1) { - bogieX1-=pitchRads*2; - pitch -= pitchRads * 1.2; - } - if (anglePitchClient > 20 && rotationSin1 == 1) { - bogieZ1-=pitchRads*2; - pitch -= pitchRads * 1.2; - } - if (pitchRads == 0.0) { - riddenByEntity.setPosition(bogieX1, pitch1, bogieZ1); - } - if (pitchRads > -1.01 && pitchRads < 1.01) { - riddenByEntity.setPosition(bogieX1, pitch, bogieZ1); - } - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - public void onUpdate() { - super.onUpdate(); - checkInvent(cargoItems[0]); - if (worldObj.isRemote) { - return; - } - - if (theTank != null && theTank.getFluid() != null) { - this.dataWatcher.updateObject(18, theTank.getFluidAmount()); - this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); - if (theTank.getFluid().amount <= 1) { - motionX *= 0.94; - motionZ *= 0.94; - } - } - else if (theTank != null && theTank.getFluid() == null) { - this.dataWatcher.updateObject(18, 0); - this.dataWatcher.updateObject(4, 0); - } - - if (getAmount() > 0) { - // setColor(getColorFromString("Full")); - setDefaultMass(-getSpec().getMass()); - if ((motionX>0.01 || motionZ>0.01) && ticksExisted % 40 == 0) { - drain(ForgeDirection.UNKNOWN, 6,true); - } - - } else if (getAmount() <= 0) { - // setColor(getColorFromString("Empty")); - setDefaultMass(getSpec().getMass()); - } - } - - public int getDiesel() { - return (this.dataWatcher.getWatchableObjectInt(18)); - } - - public int getLiquidItemID() { - return (this.dataWatcher.getWatchableObjectInt(4)); - } - - public LiquidManager.StandardTank getTank() { - return theTank; - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - - - nbttagcompound.setTag("Items", nbttaglist); - if (theTank !=null && theTank.getFluid() != null) { - new FluidStack(theTank.getFluid(), this.dataWatcher.getWatchableObjectInt(18)).writeToNBT(nbttagcompound); - } - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - if (nbttagcompound.hasKey("FluidName")) { - fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(nbttagcompound), true); - } - - } - - private void placeInInvent(ItemStack itemstack1) { - for (int i = 1; i < cargoItems.length; i++) { - if (cargoItems[i] == null) { - cargoItems[i] = itemstack1; - return; - } - else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { - int var9 = cargoItems[i].stackSize + itemstack1.stackSize; - if (var9 <= itemstack1.getMaxStackSize()) { - cargoItems[i].stackSize = var9; - - } - else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { - cargoItems[i].stackSize += 1; - } - return; - } - else if (i == cargoItems.length - 1) { - entityDropItem(itemstack1,1); - return; - } - } - } - - public void liquidInSlot(ItemStack itemstack) { - if (worldObj.isRemote) - return; - this.update += 1; - if (this.update % 8 == 0 && itemstack != null) { - ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - if (result != null) { - placeInInvent(result); - } - } - } - - public ItemStack checkInvent(ItemStack cargoItems0) { - - if (getDiesel() > 0) { - fuelTrain = (getDiesel()); - } - if (fuelTrain <= 0) { - motionX *= 0.88; - motionZ *= 0.88; - } - if (cargoItems0 != null) { - liquidInSlot(cargoItems0); - } - return cargoItems0; - } - - public void initFreightWater() { - freightInventorySize = 2; - cargoItems = new ItemStack[freightInventorySize]; - } - - @Override - public String getInventoryName() { - return "EMD F3 B-Unit"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!this.worldObj.isRemote) { - entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); - } - return true; - } - - @Override - public boolean isStorageCart() { - return true; - } - - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 2.2F; - } - - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return theTank.fill(resource, doFill); - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { - return null; - } - return theTank.drain(resource.amount, doDrain); - } - - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return theTank.drain(maxDrain, doDrain); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { theTank.getInfo() }; - } - - public FluidStack getFluid() { - return theTank.getFluid(); - } - - public int getFluidAmount() { - return dataWatcher.getWatchableObjectInt(18); - } - - @Override - public String getLiquidName(){ - return FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4))!=null?FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)).getName():null; - } + public int freightInventorySize; + + private int update = 8; + private final LiquidManager.StandardTank theTank; + + public EntityBUnitEMDF3(World world) { + super(world); + initFreightWater(); + this.theTank = LiquidManager.getInstance().new FilteredTank(getSpec().getTankCapacity(), LiquidManager.dieselFilter()); + } + + public EntityBUnitEMDF3(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + + @Override + public void updateRiderPosition() { + if (riddenByEntity == null) { + return; + } + + double pitchRads = this.anglePitchClient * Math.PI / 180.0D; + double distance = 2.3; + double yOffset = 0.65; + float rotationCos1 = (float) Math.cos(Math.toRadians(this.renderYaw + 90)); + float rotationSin1 = (float) Math.sin(Math.toRadians((this.renderYaw + 90))); + + if (side.isServer()) { + rotationCos1 = (float) Math.cos(Math.toRadians(this.serverRealRotation + 90)); + rotationSin1 = (float) Math.sin(Math.toRadians((this.serverRealRotation + 90))); + anglePitchClient = serverRealPitch * 60; + } + + float pitch = (float) (posY + ((Math.tan(pitchRads) * distance) + getMountedYOffset()) + + riddenByEntity.getYOffset() + yOffset); + float pitch1 = (float) (posY + getMountedYOffset() + riddenByEntity.getYOffset() + yOffset); + double bogieX1 = (this.posX + (rotationCos1 * distance)); + double bogieZ1 = (this.posZ + (rotationSin1 * distance)); + + // System.out.println(rotationCos1+" "+rotationSin1); + if (anglePitchClient > 20 && rotationCos1 == 1) { + bogieX1 -= pitchRads * 2; + pitch -= (float) (pitchRads * 1.2); + } + + if (anglePitchClient > 20 && rotationSin1 == 1) { + bogieZ1 -= pitchRads * 2; + pitch -= (float) (pitchRads * 1.2); + } + + if (pitchRads == 0.0) { + riddenByEntity.setPosition(bogieX1, pitch1, bogieZ1); + } + + if (pitchRads > -1.01 && pitchRads < 1.01) { + riddenByEntity.setPosition(bogieX1, pitch, bogieZ1); + } + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + checkInvent(cargoItems[0]); + if (worldObj.isRemote) { + return; + } + + if (theTank != null && theTank.getFluid() != null) { + this.dataWatcher.updateObject(18, theTank.getFluidAmount()); + this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); + if (theTank.getFluid().amount <= 1) { + motionX *= 0.94; + motionZ *= 0.94; + } + } else if (theTank != null && theTank.getFluid() == null) { + this.dataWatcher.updateObject(18, 0); + this.dataWatcher.updateObject(4, 0); + } + + if (getAmount() > 0) { + // setColor(getColorFromString("Full")); + setDefaultMass(-getSpec().getMass()); + if ((motionX > 0.01 || motionZ > 0.01) && ticksExisted % 40 == 0) { + drain(ForgeDirection.UNKNOWN, 6, true); + } + + } else if (getAmount() <= 0) { + // setColor(getColorFromString("Empty")); + setDefaultMass(getSpec().getMass()); + } + } + + public int getDiesel() { + return (this.dataWatcher.getWatchableObjectInt(18)); + } + + public LiquidManager.StandardTank getTank() { + return theTank; + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + + nbttagcompound.setTag("Items", nbttaglist); + if (theTank != null && theTank.getFluid() != null) { + new FluidStack(theTank.getFluid(), this.dataWatcher.getWatchableObjectInt(18)).writeToNBT(nbttagcompound); + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + if (nbttagcompound.hasKey("FluidName")) { + fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(nbttagcompound), true); + } + + } + + private void placeInInvent(ItemStack itemstack1) { + for (int i = 1; i < cargoItems.length; i++) { + if (cargoItems[i] == null) { + cargoItems[i] = itemstack1; + return; + } else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { + int var9 = cargoItems[i].stackSize + itemstack1.stackSize; + if (var9 <= itemstack1.getMaxStackSize()) { + cargoItems[i].stackSize = var9; + + } else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { + cargoItems[i].stackSize += 1; + } + return; + } else if (i == cargoItems.length - 1) { + entityDropItem(itemstack1, 1); + return; + } + } + } + + public void liquidInSlot(ItemStack itemstack) { + if (worldObj.isRemote) { + return; + } + + this.update += 1; + if (this.update % 8 == 0 && itemstack != null) { + ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + if (result != null) { + placeInInvent(result); + } + } + } + + public ItemStack checkInvent(ItemStack cargoItems0) { + if (getDiesel() > 0) { + fuelTrain = (getDiesel()); + } + + if (fuelTrain <= 0) { + motionX *= 0.88; + motionZ *= 0.88; + } + + if (cargoItems0 != null) { + liquidInSlot(cargoItems0); + } + + return cargoItems0; + } + + public void initFreightWater() { + freightInventorySize = 2; + cargoItems = new ItemStack[freightInventorySize]; + } + + @Override + public String getInventoryName() { + return "EMD F3 B-Unit"; + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if (super.interactFirst(entityplayer)) { + return false; + } + if (!this.worldObj.isRemote) { + entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); + } + return true; + } + + @Override + public boolean isStorageCart() { + return true; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 2.2F; + } + + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return theTank.fill(resource, doFill); + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { + return null; + } + return theTank.drain(resource.amount, doDrain); + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return theTank.drain(maxDrain, doDrain); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[]{theTank.getInfo()}; + } + + public FluidStack getFluid() { + return theTank.getFluid(); + } + + public int getFluidAmount() { + return dataWatcher.getWatchableObjectInt(18); + } + + @Override + public String getLiquidName() { + return FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)) != null ? FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)).getName() : null; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF7.java b/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF7.java index 2c018aa1df..3f260d2da8 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF7.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBUnitEMDF7.java @@ -15,250 +15,236 @@ import train.common.library.EnumTrains; import train.common.library.GuiIDs; -public class EntityBUnitEMDF7 extends LiquidTank implements IFluidHandler { - public int freightInventorySize; - - private int update = 8; - private LiquidManager.StandardTank theTank; - - public EntityBUnitEMDF7(World world) { - super(world); - initFreightWater(); - this.theTank = LiquidManager.getInstance().new FilteredTank(getSpec().getTankCapacity(), LiquidManager.dieselFilter()); - } - - public EntityBUnitEMDF7(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - public void onUpdate() { - super.onUpdate(); - checkInvent(cargoItems[0]); - if (worldObj.isRemote) { - return; - } - - if (theTank != null && theTank.getFluid() != null) { - this.dataWatcher.updateObject(18, theTank.getFluidAmount()); - this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); - if (theTank.getFluid().amount <= 1) { - motionX *= 0.94; - motionZ *= 0.94; - } - } - else if (theTank != null && theTank.getFluid() == null) { - this.dataWatcher.updateObject(18, 0); - this.dataWatcher.updateObject(4, 0); - } - - if (getAmount() > 0) { - // setColor(getColorFromString("Full")); - setDefaultMass(-getSpec().getMass()); - if ((motionX>0.01 || motionZ>0.01) && ticksExisted % 40 == 0) { - drain(ForgeDirection.UNKNOWN, 6,true); - } - - } else if (getAmount() <= 0) { - // setColor(getColorFromString("Empty")); - setDefaultMass(getSpec().getMass()); - } - } - - public int getDiesel() { - return (this.dataWatcher.getWatchableObjectInt(18)); - } - - public int getLiquidItemID() { - return (this.dataWatcher.getWatchableObjectInt(4)); - } - - public LiquidManager.StandardTank getTank() { - return theTank; - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - - - nbttagcompound.setTag("Items", nbttaglist); - if (theTank !=null && theTank.getFluid() != null) { - new FluidStack(theTank.getFluid(), this.dataWatcher.getWatchableObjectInt(18)).writeToNBT(nbttagcompound); - } - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - if (nbttagcompound.hasKey("FluidName")) { - fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(nbttagcompound), true); - } - - } - - private void placeInInvent(ItemStack itemstack1) { - for (int i = 1; i < cargoItems.length; i++) { - if (cargoItems[i] == null) { - cargoItems[i] = itemstack1; - return; - } - else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { - int var9 = cargoItems[i].stackSize + itemstack1.stackSize; - if (var9 <= itemstack1.getMaxStackSize()) { - cargoItems[i].stackSize = var9; - - } - else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { - cargoItems[i].stackSize += 1; - } - return; - } - else if (i == cargoItems.length - 1) { - entityDropItem(itemstack1,1); - return; - } - } - } - - public void liquidInSlot(ItemStack itemstack) { - if (worldObj.isRemote) - return; - this.update += 1; - if (this.update % 8 == 0 && itemstack != null) { - ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - if (result != null) { - placeInInvent(result); - } - } - } - - public ItemStack checkInvent(ItemStack cargoItems0) { - - if (getDiesel() > 0) { - fuelTrain = (getDiesel()); - } - if (fuelTrain <= 0) { - motionX *= 0.88; - motionZ *= 0.88; - } - if (cargoItems0 != null) { - liquidInSlot(cargoItems0); - } - return cargoItems0; - } - - public void initFreightWater() { - freightInventorySize = 2; - cargoItems = new ItemStack[freightInventorySize]; - } - - @Override - public String getInventoryName() { - return "EMD F7 B-Unit"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!this.worldObj.isRemote) { - entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); - } - return true; - } - - @Override - public boolean isStorageCart() { - return true; - } - - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 2.2F; - } - - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return theTank.fill(resource, doFill); - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { - return null; - } - return theTank.drain(resource.amount, doDrain); - } - - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return theTank.drain(maxDrain, doDrain); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { theTank.getInfo() }; - } - - public FluidStack getFluid() { - return theTank.getFluid(); - } - - public int getFluidAmount() { - return dataWatcher.getWatchableObjectInt(18); - } - - @Override - public String getLiquidName(){ - return FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4))!=null?FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)).getName():null; - } +public class EntityBUnitEMDF7 extends LiquidTank implements IFluidHandler { + public int freightInventorySize; + + private int update = 8; + private final LiquidManager.StandardTank theTank; + + public EntityBUnitEMDF7(World world) { + super(world); + initFreightWater(); + this.theTank = LiquidManager.getInstance().new FilteredTank(getSpec().getTankCapacity(), LiquidManager.dieselFilter()); + } + + public EntityBUnitEMDF7(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + checkInvent(cargoItems[0]); + if (worldObj.isRemote) { + return; + } + + if (theTank != null && theTank.getFluid() != null) { + this.dataWatcher.updateObject(18, theTank.getFluidAmount()); + this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); + if (theTank.getFluid().amount <= 1) { + motionX *= 0.94; + motionZ *= 0.94; + } + } else if (theTank != null && theTank.getFluid() == null) { + this.dataWatcher.updateObject(18, 0); + this.dataWatcher.updateObject(4, 0); + } + + if (getAmount() > 0) { + // setColor(getColorFromString("Full")); + setDefaultMass(-getSpec().getMass()); + if ((motionX > 0.01 || motionZ > 0.01) && ticksExisted % 40 == 0) { + drain(ForgeDirection.UNKNOWN, 6, true); + } + + } else if (getAmount() <= 0) { + // setColor(getColorFromString("Empty")); + setDefaultMass(getSpec().getMass()); + } + } + + public int getDiesel() { + return (this.dataWatcher.getWatchableObjectInt(18)); + } + + public LiquidManager.StandardTank getTank() { + return theTank; + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + + nbttagcompound.setTag("Items", nbttaglist); + if (theTank != null && theTank.getFluid() != null) { + new FluidStack(theTank.getFluid(), this.dataWatcher.getWatchableObjectInt(18)).writeToNBT(nbttagcompound); + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + + if (nbttagcompound.hasKey("FluidName")) { + fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(nbttagcompound), true); + } + } + + private void placeInInvent(ItemStack itemstack1) { + for (int i = 1; i < cargoItems.length; i++) { + if (cargoItems[i] == null) { + cargoItems[i] = itemstack1; + return; + } else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { + int var9 = cargoItems[i].stackSize + itemstack1.stackSize; + if (var9 <= itemstack1.getMaxStackSize()) { + cargoItems[i].stackSize = var9; + + } else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { + cargoItems[i].stackSize += 1; + } + return; + } else if (i == cargoItems.length - 1) { + entityDropItem(itemstack1, 1); + return; + } + } + } + + public void liquidInSlot(ItemStack itemstack) { + if (worldObj.isRemote) { + return; + } + + this.update += 1; + if (this.update % 8 == 0 && itemstack != null) { + ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + if (result != null) { + placeInInvent(result); + } + } + } + + public ItemStack checkInvent(ItemStack cargoItems0) { + if (getDiesel() > 0) { + fuelTrain = (getDiesel()); + } + + if (fuelTrain <= 0) { + motionX *= 0.88; + motionZ *= 0.88; + } + + if (cargoItems0 != null) { + liquidInSlot(cargoItems0); + } + return cargoItems0; + } + + public void initFreightWater() { + freightInventorySize = 2; + cargoItems = new ItemStack[freightInventorySize]; + } + + @Override + public String getInventoryName() { + return "EMD F7 B-Unit"; + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if ((super.interactFirst(entityplayer))) { + return false; + } + + if (!this.worldObj.isRemote) { + entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); + } + return true; + } + + @Override + public boolean isStorageCart() { + return true; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 2.2F; + } + + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return theTank.fill(resource, doFill); + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { + return null; + } + return theTank.drain(resource.amount, doDrain); + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return theTank.drain(maxDrain, doDrain); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[]{theTank.getInfo()}; + } + + public FluidStack getFluid() { + return theTank.getFluid(); + } + + public int getFluidAmount() { + return dataWatcher.getWatchableObjectInt(18); + } + + @Override + public String getLiquidName() { + return FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)) != null ? FluidRegistry.getFluid(this.dataWatcher.getWatchableObjectInt(4)).getName() : null; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityBoulderWagon.java b/src/main/java/train/common/entity/rollingStock/EntityBoulderWagon.java index 5d304e2e34..7993eadc30 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBoulderWagon.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBoulderWagon.java @@ -12,15 +12,16 @@ import train.common.api.Freight; import train.common.library.GuiIDs; -public class EntityBoulderWagon extends Freight implements IInventory { +public class EntityBoulderWagon extends Freight implements IInventory { public int freightInventorySize; public int numFreightSlots; + public EntityBoulderWagon(World world) { super(world); initFreightCart(); } - public EntityBoulderWagon(World world, double d, double d1, double d2){ + public EntityBoulderWagon(World world, double d, double d1, double d2) { this(world); setPosition(d, d1 + yOffset, d2); motionX = 0.0D; @@ -37,6 +38,7 @@ public void initFreightCart() { freightInventorySize = getSpec().getCargoCapacity(); cargoItems = new ItemStack[freightInventorySize]; } + @Override public void setDead() { super.setDead(); @@ -47,6 +49,7 @@ public void setDead() { protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { if (cargoItems[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); @@ -68,7 +71,7 @@ protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { + if (j < cargoItems.length) { cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } @@ -86,18 +89,13 @@ public int getSizeInventory() { @Override public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { + if (super.interactFirst(entityplayer)) { return false; } entityplayer.openGui(Traincraft.instance, GuiIDs.FREIGHT, worldObj, this.getEntityId(), -1, (int) this.posZ); return true; } - @Override - public boolean isStorageCart() { - return true; - } - @Override public float getOptimalDistance(EntityMinecart cart) { return 0.8F; @@ -107,9 +105,4 @@ public float getOptimalDistance(EntityMinecart cart) { public int getInventoryStackLimit() { return 1; } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } } diff --git a/src/main/java/train/common/entity/rollingStock/EntityBoxCartPRR.java b/src/main/java/train/common/entity/rollingStock/EntityBoxCartPRR.java index e18552227b..2b66311a9e 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBoxCartPRR.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBoxCartPRR.java @@ -74,7 +74,7 @@ protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { + if (j < cargoItems.length) { cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } @@ -92,30 +92,15 @@ public int getSizeInventory() { @Override public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { + if (super.interactFirst(entityplayer)) { return false; } entityplayer.openGui(Traincraft.instance, GuiIDs.FREIGHT, worldObj, this.getEntityId(), -1, (int) this.posZ); return true; } - @Override - public boolean isStorageCart() { - return true; - } - - @Override + @Override public float getOptimalDistance(EntityMinecart cart) { return 3.05F; } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityBoxCartUS.java b/src/main/java/train/common/entity/rollingStock/EntityBoxCartUS.java index e03c654463..cee0dd4e8f 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBoxCartUS.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBoxCartUS.java @@ -13,109 +13,90 @@ import train.common.library.GuiIDs; public class EntityBoxCartUS extends Freight implements IInventory { - public int freightInventorySize; - public int numFreightSlots; + public int freightInventorySize; + public int numFreightSlots; + + public EntityBoxCartUS(World world) { + super(world); + initFreightCart(); + } + + public void initFreightCart() { + numFreightSlots = 9; + freightInventorySize = 45; + cargoItems = new ItemStack[freightInventorySize]; + } + + public EntityBoxCartUS(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + (double) yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public double getMountedYOffset() { + return (double) height * 0.0D - 0.30000001192092896D; + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if ((super.interactFirst(entityplayer))) { + return false; + } + entityplayer.openGui(Traincraft.instance, GuiIDs.FREIGHT, worldObj, this.getEntityId(), -1, (int) this.posZ); + return true; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 1.65F; + } - public EntityBoxCartUS(World world) { - super(world); - initFreightCart(); - } - - public void initFreightCart() { - numFreightSlots = 9; - freightInventorySize = 45; - cargoItems = new ItemStack[freightInventorySize]; - } - - public EntityBoxCartUS(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + (double) yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - @Override - public double getMountedYOffset() { - return (double) height * 0.0D - 0.30000001192092896D; - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - - nbttagcompound.setTag("Items", nbttaglist); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - } - - @Override - public String getInventoryName() { - return "Freight cart"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { - return false; - } - entityplayer.openGui(Traincraft.instance, GuiIDs.FREIGHT, worldObj, this.getEntityId(), -1, (int) this.posZ); - return true; - } - - @Override - public boolean isStorageCart() { - return true; - } - - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 1.65F; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityBulkheadFlatCart.java b/src/main/java/train/common/entity/rollingStock/EntityBulkheadFlatCart.java index 93d6ebb7c3..af46290469 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityBulkheadFlatCart.java +++ b/src/main/java/train/common/entity/rollingStock/EntityBulkheadFlatCart.java @@ -14,108 +14,104 @@ public class EntityBulkheadFlatCart extends Freight implements IInventory { - public int freightInventorySize; - public int numFreightSlots; - - public EntityBulkheadFlatCart(World world) { - super(world); - initBulkheadFlat(); - } - - public void initBulkheadFlat() { - numFreightSlots = 9; - freightInventorySize = getSpec().getCargoCapacity(); - cargoItems = new ItemStack[freightInventorySize]; - } - - public EntityBulkheadFlatCart(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + (double) yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - - } - - @Override - public void onUpdate() { - super.onUpdate(); - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - nbttagcompound.setTag("Items", nbttaglist); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - } - - @Override - public String getInventoryName() { - return "Bulkhead Flat Cart"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!this.worldObj.isRemote) { - entityplayer.openGui(Traincraft.instance, GuiIDs.FREIGHT, worldObj, this.getEntityId(), -1, (int) this.posZ); - } - return true; - } - - @Override - public boolean canBeRidden() { - return false; - } - - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 2.3F; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } + public int freightInventorySize; + public int numFreightSlots; + + public EntityBulkheadFlatCart(World world) { + super(world); + initBulkheadFlat(); + } + + public void initBulkheadFlat() { + numFreightSlots = 9; + freightInventorySize = getSpec().getCargoCapacity(); + cargoItems = new ItemStack[freightInventorySize]; + } + + public EntityBulkheadFlatCart(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + (double) yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + + } + + @Override + public void onUpdate() { + super.onUpdate(); + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + @Override + public String getInventoryName() { + return "Bulkhead Flat Cart"; + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + playerEntity = entityplayer; + if (super.interactFirst(entityplayer)) { + return false; + } + + if (!this.worldObj.isRemote) { + entityplayer.openGui(Traincraft.instance, GuiIDs.FREIGHT, worldObj, this.getEntityId(), -1, (int) this.posZ); + } + return true; + } + + @Override + public boolean canBeRidden() { + return false; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 2.3F; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityCaboose.java b/src/main/java/train/common/entity/rollingStock/EntityCaboose.java index 3a37bede8e..74cb11db4e 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityCaboose.java +++ b/src/main/java/train/common/entity/rollingStock/EntityCaboose.java @@ -39,18 +39,21 @@ public void setDead() { @Override public boolean interactFirst(EntityPlayer entityplayer) { playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { + if (super.interactFirst(entityplayer)) { return false; } + if (!worldObj.isRemote) { ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if(lockThisCart(itemstack, entityplayer))return true; - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + if(lockThisCart(itemstack, entityplayer)) { return true; } - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); + + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + return true; } + + entityplayer.mountEntity(this); } return true; } diff --git a/src/main/java/train/common/entity/rollingStock/EntityCaboose3.java b/src/main/java/train/common/entity/rollingStock/EntityCaboose3.java index 91be722031..744d02d267 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityCaboose3.java +++ b/src/main/java/train/common/entity/rollingStock/EntityCaboose3.java @@ -9,66 +9,75 @@ public class EntityCaboose3 extends EntityRollingStock implements IPassenger { - public EntityCaboose3(World world) { - super(world); - } + public EntityCaboose3(World world) { + super(world); + } - public EntityCaboose3(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + (double) yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - @Override - public void updateRiderPosition() { - if(riddenByEntity==null){return;} - riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset(), posZ); - } - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!worldObj.isRemote) { - ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if(lockThisCart(itemstack, entityplayer))return true; - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { - return true; - } - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); - } - } - return true; - } + public EntityCaboose3(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + (double) yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } - @Override - public boolean canBeRidden() { - return true; - } + @Override + public void updateRiderPosition() { + if (riddenByEntity == null) { + return; + } - @Override - public boolean isStorageCart() { - return false; - } + riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset(), posZ); + } - @Override - public boolean isPoweredCart() { - return false; - } + @Override + public void setDead() { + super.setDead(); + isDead = true; + } - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 1.3F; - } + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + playerEntity = entityplayer; + if (super.interactFirst(entityplayer)) { + return false; + } + + if (!worldObj.isRemote) { + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + if (lockThisCart(itemstack, entityplayer)) { + return true; + } + + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + return true; + } + + entityplayer.mountEntity(this); + } + return true; + } + + @Override + public boolean canBeRidden() { + return true; + } + + @Override + public boolean isStorageCart() { + return false; + } + + @Override + public boolean isPoweredCart() { + return false; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 1.3F; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityCabooseBRBrakeVan.java b/src/main/java/train/common/entity/rollingStock/EntityCabooseBRBrakeVan.java index 8feab92374..ff1d72255c 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityCabooseBRBrakeVan.java +++ b/src/main/java/train/common/entity/rollingStock/EntityCabooseBRBrakeVan.java @@ -9,66 +9,75 @@ public class EntityCabooseBRBrakeVan extends EntityRollingStock implements IPassenger { - public EntityCabooseBRBrakeVan(World world) { - super(world); - } + public EntityCabooseBRBrakeVan(World world) { + super(world); + } - public EntityCabooseBRBrakeVan(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + (double) yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - @Override - public void updateRiderPosition() { - if(riddenByEntity==null){return;} - riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset(), posZ); - } - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!worldObj.isRemote) { - ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if(lockThisCart(itemstack, entityplayer))return true; - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + public EntityCabooseBRBrakeVan(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + (double) yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public void updateRiderPosition() { + if (riddenByEntity == null) { + return; + } + + riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset(), posZ); + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + playerEntity = entityplayer; + if (super.interactFirst(entityplayer)) { + return false; + } + + if (!worldObj.isRemote) { + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + if (lockThisCart(itemstack, entityplayer)) { return true; } - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); - } - } - return true; - } - @Override - public boolean canBeRidden() { - return true; - } + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + return true; + } + + entityplayer.mountEntity(this); + } + return true; + } + + @Override + public boolean canBeRidden() { + return true; + } - @Override - public boolean isStorageCart() { - return false; - } + @Override + public boolean isStorageCart() { + return false; + } - @Override - public boolean isPoweredCart() { - return false; - } + @Override + public boolean isPoweredCart() { + return false; + } - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 1.9F; - } + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 1.9F; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityCabooseBapDRGW.java b/src/main/java/train/common/entity/rollingStock/EntityCabooseBapDRGW.java index 10e065e0ef..43dcd293d1 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityCabooseBapDRGW.java +++ b/src/main/java/train/common/entity/rollingStock/EntityCabooseBapDRGW.java @@ -12,7 +12,7 @@ public EntityCabooseBapDRGW(World world) { super(world); } - public EntityCabooseBapDRGW(World world, double d, double d1, double d2){ + public EntityCabooseBapDRGW(World world, double d, double d1, double d2) { this(world); setPosition(d, d1 + yOffset, d2); motionX = 0.0D; @@ -25,7 +25,7 @@ public EntityCabooseBapDRGW(World world, double d, double d1, double d2){ @Override public void updateRiderPosition() { - if(riddenByEntity!=null) { + if (riddenByEntity != null) { riddenByEntity.setPosition(posX + 0.0f, posY + getMountedYOffset() + riddenByEntity.getYOffset() + -0.15, posZ + 0.0); } } @@ -39,18 +39,20 @@ public void setDead() { @Override public boolean interactFirst(EntityPlayer entityplayer) { playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { + if (super.interactFirst(entityplayer)) { return false; } if (!worldObj.isRemote) { ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if(lockThisCart(itemstack, entityplayer))return true; - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + if (lockThisCart(itemstack, entityplayer)) { return true; } - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); + + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + return true; } + + entityplayer.mountEntity(this); } return true; } diff --git a/src/main/java/train/common/entity/rollingStock/EntityCabooseBapHBC1C.java b/src/main/java/train/common/entity/rollingStock/EntityCabooseBapHBC1C.java index e28d033888..f55fd8e656 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityCabooseBapHBC1C.java +++ b/src/main/java/train/common/entity/rollingStock/EntityCabooseBapHBC1C.java @@ -12,7 +12,7 @@ public EntityCabooseBapHBC1C(World world) { super(world); } - public EntityCabooseBapHBC1C(World world, double d, double d1, double d2){ + public EntityCabooseBapHBC1C(World world, double d, double d1, double d2) { this(world); setPosition(d, d1 + yOffset, d2); motionX = 0.0D; @@ -25,7 +25,7 @@ public EntityCabooseBapHBC1C(World world, double d, double d1, double d2){ @Override public void updateRiderPosition() { - if(riddenByEntity!=null) { + if (riddenByEntity != null) { riddenByEntity.setPosition(posX + 0.0f, posY + getMountedYOffset() + riddenByEntity.getYOffset() + -0.1, posZ + 0.0); } } @@ -39,18 +39,21 @@ public void setDead() { @Override public boolean interactFirst(EntityPlayer entityplayer) { playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { + if (super.interactFirst(entityplayer)) { return false; } + if (!worldObj.isRemote) { ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if(lockThisCart(itemstack, entityplayer))return true; - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + if (lockThisCart(itemstack, entityplayer)) { return true; } - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); + + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + return true; } + + entityplayer.mountEntity(this); } return true; } diff --git a/src/main/java/train/common/entity/rollingStock/EntityCabooseBapWVcaboose.java b/src/main/java/train/common/entity/rollingStock/EntityCabooseBapWVcaboose.java index c111a39e6b..1b95fb85f6 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityCabooseBapWVcaboose.java +++ b/src/main/java/train/common/entity/rollingStock/EntityCabooseBapWVcaboose.java @@ -12,7 +12,7 @@ public EntityCabooseBapWVcaboose(World world) { super(world); } - public EntityCabooseBapWVcaboose(World world, double d, double d1, double d2){ + public EntityCabooseBapWVcaboose(World world, double d, double d1, double d2) { this(world); setPosition(d, d1 + yOffset, d2); motionX = 0.0D; @@ -25,43 +25,11 @@ public EntityCabooseBapWVcaboose(World world, double d, double d1, double d2){ @Override public void updateRiderPosition() { - if(riddenByEntity!=null) { + if (riddenByEntity != null) { riddenByEntity.setPosition(posX + 0.0f, posY + getMountedYOffset() + riddenByEntity.getYOffset() + 0.3125, posZ + 0.0); } } - /* @Override - public void updateRiderPosition() { - if (riddenByEntity == null) {return;} - double pitchRads = this.anglePitchClient * Math.PI / 180.0D; - double distance = -0.25; //efault 0 for center - double distance2 = 1.0; - double yOffset = 0.33; - float rotationCos1 = (float) Math.cos(Math.toRadians(this.renderYaw + 0));//these basically determine the rotation of the hitbox, default 90 each - float rotationSin1 = (float) Math.sin(Math.toRadians((this.renderYaw + 0)));// when 90 the rider position sticks to the side - if(side.isServer()){ - rotationCos1 = (float) Math.cos(Math.toRadians(this.serverRealRotation + 0));//same as above but server-based, needs testing tho - rotationSin1 = (float) Math.sin(Math.toRadians((this.serverRealRotation + 0))); - anglePitchClient = serverRealPitch*60; - } - float pitch = (float) (posY + ((Math.tan(pitchRads) * distance) + getMountedYOffset()) + riddenByEntity.getYOffset() + yOffset); - float pitch1 = (float) (posY + getMountedYOffset() + riddenByEntity.getYOffset() + yOffset); - double bogieX1 = (this.posX + (rotationCos1 * distance)); - double bogieZ1 = (this.posZ + (rotationSin1* distance)); - if(anglePitchClient>20 && rotationCos1 == 1){ - bogieX1-=pitchRads*2; - pitch-=pitchRads*1.2; - } - if(anglePitchClient>20 && rotationSin1 == 1){ - bogieZ1-=pitchRads*2 + 1; - pitch-=pitchRads*1.2; - } - if (pitchRads == 0.0) { - riddenByEntity.setPosition(bogieX1, pitch1, bogieZ1); - } - if (pitchRads > -1.01 && pitchRads < 1.01) { - riddenByEntity.setPosition(bogieX1, pitch, bogieZ1); - } - }*/ + @Override public void setDead() { super.setDead(); @@ -71,18 +39,21 @@ public void setDead() { @Override public boolean interactFirst(EntityPlayer entityplayer) { playerEntity = entityplayer; - if ((super.interactFirst(entityplayer))) { + if (super.interactFirst(entityplayer)) { return false; } + if (!worldObj.isRemote) { ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if(lockThisCart(itemstack, entityplayer))return true; - if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + if (lockThisCart(itemstack, entityplayer)) { return true; } - if (!worldObj.isRemote) { - entityplayer.mountEntity(this); + + if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) { + return true; } + + entityplayer.mountEntity(this); } return true; } diff --git a/src/main/java/train/common/inventory/TrainCraftingManager.java b/src/main/java/train/common/inventory/TrainCraftingManager.java index eff39f8a99..e200a10a9d 100644 --- a/src/main/java/train/common/inventory/TrainCraftingManager.java +++ b/src/main/java/train/common/inventory/TrainCraftingManager.java @@ -20,14 +20,14 @@ public class TrainCraftingManager { public static final TrainCraftingManager instance = new TrainCraftingManager(); /** A list of all the recipes added */ - private List recipes = new ArrayList(); + private final List recipes = new ArrayList<>(); - private final ArrayList shapedRecipes = new ArrayList(); + private final ArrayList shapedRecipes = new ArrayList<>(); /** Recipes for openHearthFurnace */ - private final HashMap> hearthFurnaceMap = new HashMap(); - private final ArrayList hearthFurnaceRecipes = new ArrayList(); - private final HashMap hearthFurnaceXpMap = new HashMap(); + private final HashMap> hearthFurnaceMap = new HashMap<>(); + private final ArrayList hearthFurnaceRecipes = new ArrayList<>(); + private final HashMap hearthFurnaceXpMap = new HashMap<>(); public static final TrainCraftingManager getInstance() { return instance; @@ -163,7 +163,7 @@ public ItemStack func_82787_a(IInventory inv, World world) { /** * returns the List<> of all recipes */ - public List getRecipeList() { + public List getRecipeList() { return this.recipes; } diff --git a/src/main/java/train/common/items/ItemRollingStock.java b/src/main/java/train/common/items/ItemRollingStock.java index a2e99cf52e..e85625e1f9 100644 --- a/src/main/java/train/common/items/ItemRollingStock.java +++ b/src/main/java/train/common/items/ItemRollingStock.java @@ -18,7 +18,6 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import sun.java2d.loops.DrawLine; import train.common.Traincraft; import train.common.api.*; import train.common.core.handlers.ConfigHandler; @@ -26,8 +25,6 @@ import train.common.entity.rollingStock.EntityTracksBuilder; import train.common.items.ItemTCRail.TrackTypes; import train.common.library.BlockIDs; -import train.common.library.EnumTrains; -import train.common.library.Info; import train.common.tile.TileTCRail; import train.common.tile.TileTCRailGag; @@ -37,9 +34,8 @@ public class ItemRollingStock extends ItemMinecart implements IMinecart, IMinecartItem { private String iconName = ""; - private String trainName; + private final String trainName; private String trainCreator; - private int trainColor = -1; public ItemRollingStock(String iconName) { super(1); @@ -88,7 +84,7 @@ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlaye trainCreator = var5.getString("trainCreator"); /*if (id > 0) par3List.add("\u00a77" + "ID: " + id);*/ - if (trainCreator.length() > 0) { + if (!trainCreator.isEmpty()) { par3List.add("\u00a77" + "Creator: " + trainCreator); } int color = var5.getInteger("trainColor"); @@ -101,7 +97,7 @@ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlaye int power = getMHP(); int maxSpeed = getMaxSpeed(); String additionnalInfo = getAdditionnalInfo(); - if (getTrainType().length() > 0) { + if (!getTrainType().isEmpty()) { par3List.add("\u00a77" + "Type: " + getTrainType()); } if (power > 0) { @@ -625,7 +621,7 @@ else if ((meta == 0 || meta == 2) && (world.getBlock(i, j, k + 1) == BlockIDs.tc if (uniID != -1) rollingStock.getEntityData().setInteger("uniqueID", uniID); trainCreator = var5.getString("trainCreator"); - trainColor = var5.getInteger("trainColor"); + int trainColor = var5.getInteger("trainColor"); if (var5.hasKey("trainColor")) rollingStock.setColor(trainColor); rollingStock.trainCreator = trainCreator; From d3f71e137b7de24328e0c56f2f13bf1f4c8f49c7 Mon Sep 17 00:00:00 2001 From: Paul19988 Date: Fri, 24 Nov 2023 03:15:18 +0000 Subject: [PATCH 2/2] more cleanup & fix for fluid tanks --- src/main/java/train/client/gui/GuiLiquid.java | 6 +- .../client/render/models/ModelTankWagon.java | 324 ++++---- .../java/train/common/api/LiquidTank.java | 729 +++++++++--------- .../java/train/common/api/Locomotive.java | 312 ++++---- src/main/java/train/common/api/Tender.java | 547 +++++++------ .../java/train/common/api/TrainRecord.java | 6 +- .../train/common/api/TrainSoundRecord.java | 6 +- .../java/train/common/api/TrainsItems.java | 98 +-- .../java/train/common/api/TrainsOnClick.java | 127 +-- .../java/train/common/api/TrainsSignal.java | 138 ++-- .../train/common/api/WirelessTransmitter.java | 3 +- .../common/core/handlers/EntityHandler.java | 4 +- .../entity/rollingStock/EntityTankWagon.java | 201 ++--- .../rollingStock/EntityTankWagonUS.java | 199 ++--- .../java/train/common/library/EnumSounds.java | 627 ++++++++------- 15 files changed, 1670 insertions(+), 1657 deletions(-) diff --git a/src/main/java/train/client/gui/GuiLiquid.java b/src/main/java/train/client/gui/GuiLiquid.java index 66c8c87f70..220a3b68f2 100644 --- a/src/main/java/train/client/gui/GuiLiquid.java +++ b/src/main/java/train/client/gui/GuiLiquid.java @@ -165,7 +165,11 @@ protected void drawGuiContainerBackgroundLayer(float f, int t, int g) { int k = (height - ySize) / 2; drawTexturedModalRect(j, k, 0, 0, xSize, ySize); - int l = (liquid.getAmount() * 50) / liquid.getCapacity(); + int l = 0; + + if (liquid.getAmount() > 0 && liquid.getCapacity() > 0) { + l = (liquid.getAmount() * 50) / liquid.getCapacity(); + } Fluid theLiquid = FluidRegistry.getFluid(liquid.getLiquidItemID()); // Don't render anything if the cart is empty. diff --git a/src/main/java/train/client/render/models/ModelTankWagon.java b/src/main/java/train/client/render/models/ModelTankWagon.java index 1ed292ee74..4d5170ae23 100644 --- a/src/main/java/train/client/render/models/ModelTankWagon.java +++ b/src/main/java/train/client/render/models/ModelTankWagon.java @@ -7,166 +7,168 @@ public class ModelTankWagon extends ModelBase { - public ModelTankWagon() { - - // constructor: - box = new CustomModelRenderer(this, 0, 20, 256, 256); - box.addBox(0F, 0F, 0F, 15, 4, 8); - box.setPosition(7F, 3F, -4F); - - box0 = new CustomModelRenderer(this, 105, 28, 256, 256); - box0.addBox(0F, 0F, 0F, 4, 2, 4); - box0.setPosition(-2F, 29F, -2F); - - box1 = new CustomModelRenderer(this, 0, 20, 256, 256); - box1.addBox(0F, 0F, 0F, 15, 4, 8); - box1.setPosition(-22F, 3F, -4F); - - box10 = new CustomModelRenderer(this, 156, 173, 256, 256); - box10.addBox(0F, 0F, 0F, 42, 4, 8); - box10.setPosition(21F, 15F, -10F); - box10.rotateAngleX = -1.5707963267948966F; - box10.rotateAngleY = -3.141592653589793F; - - box11 = new CustomModelRenderer(this, 55, 199, 256, 256); - box11.addBox(0F, 0F, 0F, 42, 4, 8); - box11.setPosition(-21F, 25F, -4F); - - box12 = new CustomModelRenderer(this, 0, 11, 256, 256); - box12.addBox(0F, 0F, 0F, 58, 3, 4); - box12.setPosition(-29F, 6F, -2F); - - box13 = new CustomModelRenderer(this, 0, 60, 256, 256); - box13.addBox(0F, 0F, 0F, 1, 16, 4); - box13.setPosition(-2F, 8F, -10F); - box13.rotateAngleY = -4.71238898038469F; - - box14 = new CustomModelRenderer(this, 36, 20, 256, 256); - box14.addBox(0F, 0F, 0F, 15, 3, 14); - box14.setPosition(-22F, 6F, -7F); - - box15 = new CustomModelRenderer(this, 3, 14, 256, 256); - box15.addBox(0F, 0F, 0F, 7, 3, 14); - box15.setPosition(11F, 2F, -7F); - - box16 = new CustomModelRenderer(this, 55, 160, 256, 256); - box16.addBox(0F, 0F, 0F, 42, 4, 8); - box16.setPosition(21F, 29F, 4F); - box16.rotateAngleX = -0.7853981633974483F; - box16.rotateAngleZ = -3.141592653589793F; - - box17 = new CustomModelRenderer(this, 156, 160, 256, 256); - box17.addBox(0F, 0F, 0F, 42, 4, 8); - box17.setPosition(-21F, 29F, -4F); - box17.rotateAngleX = -0.7853981633974483F; - box17.rotateAngleY = -3.141592653589793F; - box17.rotateAngleZ = -3.141592653589793F; - - box18 = new CustomModelRenderer(this, 3, 120, 256, 256); - box18.addBox(0F, 0F, 0F, 46, 8, 8); - box18.setPosition(-23F, 15F, -4F); - - box19 = new CustomModelRenderer(this, 156, 199, 256, 256); - box19.addBox(0F, 0F, 0F, 42, 4, 8); - box19.setPosition(-21F, 9F, -4F); - - box2 = new CustomModelRenderer(this, 132, 111, 256, 256); - box2.addBox(0F, 0F, 0F, 46, 8, 12); - box2.setPosition(-23F, -1F, -6F); - - box20 = new CustomModelRenderer(this, 1, 90, 256, 256); - box20.addBox(0F, 0F, 0F, 44, 12, 12); - box20.setPosition(-22F, 13F, -6F); - - box25 = new CustomModelRenderer(this, 134, 138, 256, 256); - box25.addBox(0F, 0F, 0F, 46, 7, 10); - box25.setPosition(-23F, 0F, -5F); - - box3 = new CustomModelRenderer(this, 10, 68, 256, 256); - box3.addBox(0F, 0F, 0F, 1, 7, 4); - box3.setPosition(2F, 24F, -11F); - box3.rotateAngleY = 1.5707963267948966F; - box3.rotateAngleZ = 0.7853981633974483F; - - box4 = new CustomModelRenderer(this, 3, 14, 256, 256); - box4.addBox(0F, 0F, 0F, 7, 3, 14); - box4.setPosition(-18F, 2F, -7F); - - box6 = new CustomModelRenderer(this, 55, 186, 256, 256); - box6.addBox(0F, 0F, 0F, 42, 4, 8); - box6.setPosition(-21F, 9F, 4F); - box6.rotateAngleX = -0.7853981633974483F; - - box7 = new CustomModelRenderer(this, 156, 186, 256, 256); - box7.addBox(0F, 0F, 0F, 42, 4, 8); - box7.setPosition(21F, 9F, -4F); - box7.rotateAngleX = -0.7853981633974483F; - box7.rotateAngleY = -3.141592653589793F; - - box8 = new CustomModelRenderer(this, 55, 173, 256, 256); - box8.addBox(0F, 0F, 0F, 42, 4, 8); - box8.setPosition(-21F, 15F, 10F); - box8.rotateAngleX = -1.5707963267948966F; - - box9 = new CustomModelRenderer(this, 36, 20, 256, 256); - box9.addBox(0F, 0F, 0F, 15, 3, 14); - box9.setPosition(7F, 6F, -7F); - - } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - if (ConfigHandler.FLICKERING) { - super.render(entity, f, f1, f2, f3, f4, f5); - } - // render: - box.render(f5); - box0.render(f5); - box1.render(f5); - box10.render(f5); - box11.render(f5); - box12.render(f5); - box13.render(f5); - box14.render(f5); - box15.render(f5); - box16.render(f5); - box17.render(f5); - box18.render(f5); - box19.render(f5); - box2.render(f5); - box20.render(f5); - box25.render(f5); - - box4.render(f5); - box6.render(f5); - box7.render(f5); - box8.render(f5); - box9.render(f5); - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) {} - - // variables init: - public CustomModelRenderer box; - public CustomModelRenderer box0; - public CustomModelRenderer box1; - public CustomModelRenderer box10; - public CustomModelRenderer box11; - public CustomModelRenderer box12; - public CustomModelRenderer box13; - public CustomModelRenderer box14; - public CustomModelRenderer box15; - public CustomModelRenderer box16; - public CustomModelRenderer box17; - public CustomModelRenderer box18; - public CustomModelRenderer box19; - public CustomModelRenderer box2; - public CustomModelRenderer box20; - public CustomModelRenderer box25; - public CustomModelRenderer box3; - public CustomModelRenderer box4; - public CustomModelRenderer box6; - public CustomModelRenderer box7; - public CustomModelRenderer box8; - public CustomModelRenderer box9; + public ModelTankWagon() { + + // constructor: + box = new CustomModelRenderer(this, 0, 20, 256, 256); + box.addBox(0F, 0F, 0F, 15, 4, 8); + box.setPosition(7F, 3F, -4F); + + box0 = new CustomModelRenderer(this, 105, 28, 256, 256); + box0.addBox(0F, 0F, 0F, 4, 2, 4); + box0.setPosition(-2F, 29F, -2F); + + box1 = new CustomModelRenderer(this, 0, 20, 256, 256); + box1.addBox(0F, 0F, 0F, 15, 4, 8); + box1.setPosition(-22F, 3F, -4F); + + box10 = new CustomModelRenderer(this, 156, 173, 256, 256); + box10.addBox(0F, 0F, 0F, 42, 4, 8); + box10.setPosition(21F, 15F, -10F); + box10.rotateAngleX = -1.5707963267948966F; + box10.rotateAngleY = -3.141592653589793F; + + box11 = new CustomModelRenderer(this, 55, 199, 256, 256); + box11.addBox(0F, 0F, 0F, 42, 4, 8); + box11.setPosition(-21F, 25F, -4F); + + box12 = new CustomModelRenderer(this, 0, 11, 256, 256); + box12.addBox(0F, 0F, 0F, 58, 3, 4); + box12.setPosition(-29F, 6F, -2F); + + box13 = new CustomModelRenderer(this, 0, 60, 256, 256); + box13.addBox(0F, 0F, 0F, 1, 16, 4); + box13.setPosition(-2F, 8F, -10F); + box13.rotateAngleY = -4.71238898038469F; + + box14 = new CustomModelRenderer(this, 36, 20, 256, 256); + box14.addBox(0F, 0F, 0F, 15, 3, 14); + box14.setPosition(-22F, 6F, -7F); + + box15 = new CustomModelRenderer(this, 3, 14, 256, 256); + box15.addBox(0F, 0F, 0F, 7, 3, 14); + box15.setPosition(11F, 2F, -7F); + + box16 = new CustomModelRenderer(this, 55, 160, 256, 256); + box16.addBox(0F, 0F, 0F, 42, 4, 8); + box16.setPosition(21F, 29F, 4F); + box16.rotateAngleX = -0.7853981633974483F; + box16.rotateAngleZ = -3.141592653589793F; + + box17 = new CustomModelRenderer(this, 156, 160, 256, 256); + box17.addBox(0F, 0F, 0F, 42, 4, 8); + box17.setPosition(-21F, 29F, -4F); + box17.rotateAngleX = -0.7853981633974483F; + box17.rotateAngleY = -3.141592653589793F; + box17.rotateAngleZ = -3.141592653589793F; + + box18 = new CustomModelRenderer(this, 3, 120, 256, 256); + box18.addBox(0F, 0F, 0F, 46, 8, 8); + box18.setPosition(-23F, 15F, -4F); + + box19 = new CustomModelRenderer(this, 156, 199, 256, 256); + box19.addBox(0F, 0F, 0F, 42, 4, 8); + box19.setPosition(-21F, 9F, -4F); + + box2 = new CustomModelRenderer(this, 132, 111, 256, 256); + box2.addBox(0F, 0F, 0F, 46, 8, 12); + box2.setPosition(-23F, -1F, -6F); + + box20 = new CustomModelRenderer(this, 1, 90, 256, 256); + box20.addBox(0F, 0F, 0F, 44, 12, 12); + box20.setPosition(-22F, 13F, -6F); + + box25 = new CustomModelRenderer(this, 134, 138, 256, 256); + box25.addBox(0F, 0F, 0F, 46, 7, 10); + box25.setPosition(-23F, 0F, -5F); + + box3 = new CustomModelRenderer(this, 10, 68, 256, 256); + box3.addBox(0F, 0F, 0F, 1, 7, 4); + box3.setPosition(2F, 24F, -11F); + box3.rotateAngleY = 1.5707963267948966F; + box3.rotateAngleZ = 0.7853981633974483F; + + box4 = new CustomModelRenderer(this, 3, 14, 256, 256); + box4.addBox(0F, 0F, 0F, 7, 3, 14); + box4.setPosition(-18F, 2F, -7F); + + box6 = new CustomModelRenderer(this, 55, 186, 256, 256); + box6.addBox(0F, 0F, 0F, 42, 4, 8); + box6.setPosition(-21F, 9F, 4F); + box6.rotateAngleX = -0.7853981633974483F; + + box7 = new CustomModelRenderer(this, 156, 186, 256, 256); + box7.addBox(0F, 0F, 0F, 42, 4, 8); + box7.setPosition(21F, 9F, -4F); + box7.rotateAngleX = -0.7853981633974483F; + box7.rotateAngleY = -3.141592653589793F; + + box8 = new CustomModelRenderer(this, 55, 173, 256, 256); + box8.addBox(0F, 0F, 0F, 42, 4, 8); + box8.setPosition(-21F, 15F, 10F); + box8.rotateAngleX = -1.5707963267948966F; + + box9 = new CustomModelRenderer(this, 36, 20, 256, 256); + box9.addBox(0F, 0F, 0F, 15, 3, 14); + box9.setPosition(7F, 6F, -7F); + + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + if (ConfigHandler.FLICKERING) { + super.render(entity, f, f1, f2, f3, f4, f5); + } + // render: + box.render(f5); + box0.render(f5); + box1.render(f5); + box10.render(f5); + box11.render(f5); + box12.render(f5); + box13.render(f5); + box14.render(f5); + box15.render(f5); + box16.render(f5); + box17.render(f5); + box18.render(f5); + box19.render(f5); + box2.render(f5); + box20.render(f5); + box25.render(f5); + + box4.render(f5); + box6.render(f5); + box7.render(f5); + box8.render(f5); + box9.render(f5); + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + } + + // variables init: + public CustomModelRenderer box; + public CustomModelRenderer box0; + public CustomModelRenderer box1; + public CustomModelRenderer box10; + public CustomModelRenderer box11; + public CustomModelRenderer box12; + public CustomModelRenderer box13; + public CustomModelRenderer box14; + public CustomModelRenderer box15; + public CustomModelRenderer box16; + public CustomModelRenderer box17; + public CustomModelRenderer box18; + public CustomModelRenderer box19; + public CustomModelRenderer box2; + public CustomModelRenderer box20; + public CustomModelRenderer box25; + public CustomModelRenderer box3; + public CustomModelRenderer box4; + public CustomModelRenderer box6; + public CustomModelRenderer box7; + public CustomModelRenderer box8; + public CustomModelRenderer box9; } diff --git a/src/main/java/train/common/api/LiquidTank.java b/src/main/java/train/common/api/LiquidTank.java index c3ba362268..0e556f0433 100644 --- a/src/main/java/train/common/api/LiquidTank.java +++ b/src/main/java/train/common/api/LiquidTank.java @@ -16,215 +16,216 @@ import javax.annotation.Nullable; public class LiquidTank extends EntityRollingStock implements IFluidHandler, ISidedInventory { - private int capacity; - protected ItemStack cargoItems[]; - private int update = 8; - private FluidTank theTank; - public TileEntity[] blocksToCheck; - - /** - * - * @param world - * @param fluid - * @param quantity - * @param capacity - */ - public LiquidTank(World world, Fluid fluid, int quantity) { - this(new FluidStack(fluid, quantity), world); - } - public LiquidTank(World world) { - this(null, world); - } - - private LiquidTank(@Nullable FluidStack liquid, World world) { - super(world); - this.capacity = capacity; - this.theTank = new FluidTank(liquid, capacity); - dataWatcher.addObject(4, 0); - dataWatcher.addObject(22, ""); - - } - - public int getAmount() { - return (this.dataWatcher.getWatchableObjectInt(18)); - } - - public int getLiquidItemID() { - return (this.dataWatcher.getWatchableObjectInt(4)); - } - - public String getLiquidName() { - return (this.dataWatcher.getWatchableObjectString(22)); - } - - public FluidTank getTank() { - return theTank; - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - this.theTank.writeToNBT(nbttagcompound); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - this.theTank.readFromNBT(nbttagcompound); - } - - @Override - public void onUpdate() { - super.onUpdate(); - if (worldObj.isRemote){ return;} - - if(ticksExisted%5==0 && fill(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER,100), false)==100) { - FluidStack drain = null; - blocksToCheck = new TileEntity[]{worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY - 1), MathHelper.floor_double(posZ)), - worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 2), MathHelper.floor_double(posZ)), - worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 3), MathHelper.floor_double(posZ)), - worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 4), MathHelper.floor_double(posZ)) - }; - - for (TileEntity block : blocksToCheck) { - if (drain == null && block instanceof IFluidHandler) { - for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { - if (((IFluidHandler) block).drain(direction, 100, false) != null && - ((IFluidHandler) block).drain(direction, 100, false).fluid == FluidRegistry.WATER && - ((IFluidHandler) block).drain(direction, 100, false).amount == 100 - ) { - drain = ((IFluidHandler) block).drain( - direction, 100, true); - } - } - } - } - - if (drain != null) { - fill(ForgeDirection.UNKNOWN, drain, true); - } - } - - - if (theTank != null && theTank.getFluid() != null) { - this.dataWatcher.updateObject(18, theTank.getFluid().amount); - this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); - if (theTank.getFluid().getFluid() != null) - this.dataWatcher.updateObject(22, theTank.getFluid().getFluid().getUnlocalizedName()); - handleMass(); - } - else if (theTank != null && theTank.getFluid() == null) { - this.dataWatcher.updateObject(18, 0); - this.dataWatcher.updateObject(4, 0); - this.dataWatcher.updateObject(22, ""); - } - } - - /** - * Handle mass depending on liquid amount - */ - protected void handleMass() { - if (this.updateTicks % 10 != 0 && theTank.getFluid().amount > 0) { - this.mass = this.getDefaultMass(); - double preciseAmount = theTank.getFluid().amount; - mass += (preciseAmount / 10000);//1 bucket = 1 kilo - } - } - - public ItemStack checkInvent(ItemStack itemstack) { - ItemStack result = null; - if (worldObj.isRemote) { - return itemstack; - } - this.update += 1; - if (this.update % 8 == 0 && itemstack != null) { - ItemStack emptyItem = itemstack.getItem().getContainerItem(itemstack); - if(cargoItems[1] == null) { - if (theTank.getFluidAmount() == 0) { - for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) { - if (LiquidManager.getInstance().containsFluid(itemstack, - FluidRegistry.getFluidStack(FluidRegistry.getFluidName(fluid), 0))) { - if (fluid.getTemperature() < 1000) { - if (!(this instanceof EntityTankLava)) { - result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - break; - } - } else { - if (this instanceof EntityTankLava) { - result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - break; - } - } - } - } - } else { - result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - } - } else if (emptyItem != null) { - if(emptyItem.getItem() == cargoItems[1].getItem()) { - if(cargoItems[1].stackSize+1 <= cargoItems[1].getMaxStackSize()) { - result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - } - } - } else { - if(itemstack.getItem() == cargoItems[1].getItem()) { - if(cargoItems[1].stackSize+1 <= cargoItems[1].getMaxStackSize()) { - result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - } - } - } - - if (result != null) { - if(cargoItems[1] == null) { - cargoItems[1] = result; - } - else if(cargoItems[1].getItem() == result.getItem()) { - cargoItems[1].stackSize += 1; - } - } - } - return itemstack; - } - - public void setLiquid(FluidTank liquid) { - this.theTank = liquid; - } - - public void setCapacity(int capacity) { - this.capacity = capacity; - } - - public int getCapacity() { - return this.capacity; - } - - // private int placeInSpecialInvent(ItemStack itemstack1, int i, boolean doAdd) { - // if (cargoItems[i] == null) { - // if (doAdd) - // cargoItems[i] = itemstack1; - // return itemstack1.stackSize; - // } - // else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && - // itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == - // itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { - // - // int var9 = cargoItems[i].stackSize + itemstack1.stackSize; - // if (var9 <= itemstack1.getMaxStackSize()) { - // if (doAdd) - // cargoItems[i].stackSize = var9; - // return var9; - // } - // else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { - // if (doAdd) - // cargoItems[i].stackSize = cargoItems[i].getMaxStackSize(); - // return Math.abs(cargoItems[i].getMaxStackSize() - cargoItems[i].stackSize - - // itemstack1.stackSize); - // } - // } - // return itemstack1.stackSize; - // } - - //TODO Fix ISided Inventory buildcraft support + private int capacity; + protected ItemStack[] cargoItems; + private int update = 8; + private FluidTank theTank; + public TileEntity[] blocksToCheck; + + /** + * + * @param world + * @param fluid + * @param quantity + * @param capacity + */ + public LiquidTank(World world, Fluid fluid, int quantity) { + this(new FluidStack(fluid, quantity), world); + } + + public LiquidTank(World world) { + this(null, world); + } + + private LiquidTank(@Nullable FluidStack liquid, World world) { + super(world); + this.capacity = this.getSpec().getTankCapacity(); + this.theTank = new FluidTank(liquid, capacity); + dataWatcher.addObject(4, 0); + dataWatcher.addObject(22, ""); + + } + + public int getAmount() { + return (this.dataWatcher.getWatchableObjectInt(18)); + } + + public int getLiquidItemID() { + return (this.dataWatcher.getWatchableObjectInt(4)); + } + + public String getLiquidName() { + return (this.dataWatcher.getWatchableObjectString(22)); + } + + public FluidTank getTank() { + return theTank; + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + this.theTank.writeToNBT(nbttagcompound); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + this.theTank.readFromNBT(nbttagcompound); + } + + @Override + public void onUpdate() { + super.onUpdate(); + if (worldObj.isRemote) { + return; + } + + if (ticksExisted % 5 == 0 && fill(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), false) == 100) { + FluidStack drain = null; + blocksToCheck = new TileEntity[]{worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY - 1), MathHelper.floor_double(posZ)), + worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 2), MathHelper.floor_double(posZ)), + worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 3), MathHelper.floor_double(posZ)), + worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 4), MathHelper.floor_double(posZ)) + }; + + for (TileEntity block : blocksToCheck) { + if (drain == null && block instanceof IFluidHandler) { + for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { + if (((IFluidHandler) block).drain(direction, 100, false) != null && + ((IFluidHandler) block).drain(direction, 100, false).fluid == FluidRegistry.WATER && + ((IFluidHandler) block).drain(direction, 100, false).amount == 100 + ) { + drain = ((IFluidHandler) block).drain( + direction, 100, true); + } + } + } + } + + if (drain != null) { + fill(ForgeDirection.UNKNOWN, drain, true); + } + } + + + if (theTank != null && theTank.getFluid() != null) { + this.dataWatcher.updateObject(18, theTank.getFluid().amount); + this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); + if (theTank.getFluid().getFluid() != null) + this.dataWatcher.updateObject(22, theTank.getFluid().getFluid().getUnlocalizedName()); + handleMass(); + } else if (theTank != null && theTank.getFluid() == null) { + this.dataWatcher.updateObject(18, 0); + this.dataWatcher.updateObject(4, 0); + this.dataWatcher.updateObject(22, ""); + } + } + + /** + * Handle mass depending on liquid amount + */ + protected void handleMass() { + if (this.updateTicks % 10 != 0 && theTank.getFluid().amount > 0) { + this.mass = this.getDefaultMass(); + double preciseAmount = theTank.getFluid().amount; + mass += (preciseAmount / 10000);//1 bucket = 1 kilo + } + } + + public ItemStack checkInvent(ItemStack itemstack) { + ItemStack result = null; + if (worldObj.isRemote) { + return itemstack; + } + this.update += 1; + if (this.update % 8 == 0 && itemstack != null) { + ItemStack emptyItem = itemstack.getItem().getContainerItem(itemstack); + if (cargoItems[1] == null) { + if (theTank.getFluidAmount() == 0) { + for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) { + if (LiquidManager.getInstance().containsFluid(itemstack, + FluidRegistry.getFluidStack(FluidRegistry.getFluidName(fluid), 0))) { + if (fluid.getTemperature() < 1000) { + if (!(this instanceof EntityTankLava)) { + result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + break; + } + } else { + if (this instanceof EntityTankLava) { + result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + break; + } + } + } + } + } else { + result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + } + } else if (emptyItem != null) { + if (emptyItem.getItem() == cargoItems[1].getItem()) { + if (cargoItems[1].stackSize + 1 <= cargoItems[1].getMaxStackSize()) { + result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + } + } + } else { + if (itemstack.getItem() == cargoItems[1].getItem()) { + if (cargoItems[1].stackSize + 1 <= cargoItems[1].getMaxStackSize()) { + result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + } + } + } + + if (result != null) { + if (cargoItems[1] == null) { + cargoItems[1] = result; + } else if (cargoItems[1].getItem() == result.getItem()) { + cargoItems[1].stackSize += 1; + } + } + } + return itemstack; + } + + public void setLiquid(FluidTank liquid) { + this.theTank = liquid; + } + + public void setCapacity(int capacity) { + this.capacity = capacity; + } + + public int getCapacity() { + return this.capacity; + } + + // private int placeInSpecialInvent(ItemStack itemstack1, int i, boolean doAdd) { + // if (cargoItems[i] == null) { + // if (doAdd) + // cargoItems[i] = itemstack1; + // return itemstack1.stackSize; + // } + // else if (cargoItems[i] != null && cargoItems[i].getItem() == itemstack1.getItem() && + // itemstack1.isStackable() && (!itemstack1.getHasSubtypes() || cargoItems[i].getItemDamage() == + // itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(cargoItems[i], itemstack1)) { + // + // int var9 = cargoItems[i].stackSize + itemstack1.stackSize; + // if (var9 <= itemstack1.getMaxStackSize()) { + // if (doAdd) + // cargoItems[i].stackSize = var9; + // return var9; + // } + // else if (cargoItems[i].stackSize < itemstack1.getMaxStackSize()) { + // if (doAdd) + // cargoItems[i].stackSize = cargoItems[i].getMaxStackSize(); + // return Math.abs(cargoItems[i].getMaxStackSize() - cargoItems[i].stackSize - + // itemstack1.stackSize); + // } + // } + // return itemstack1.stackSize; + // } + + //TODO Fix ISided Inventory buildcraft support /* /** * Offers an ItemStack for addition to the inventory. @@ -262,159 +263,159 @@ public ItemStack[] canExtractItem(boolean doRemove, ForgeDirection from, int max } */ - @Override - public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { - return false; - } - - @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) { - return new int[0]; - } - - @Override - public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { - return false; - } - - @Override - public ItemStack getStackInSlot(int i) { - return cargoItems[i]; - } - - @Override - public ItemStack getStackInSlotOnClosing(int par1) { - if (this.cargoItems[par1] != null) { - ItemStack var2 = this.cargoItems[par1]; - this.cargoItems[par1] = null; - return var2; - } - else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int i, int j) { - if (cargoItems[i] != null) { - if (cargoItems[i].stackSize <= j) { - ItemStack itemstack = cargoItems[i]; - cargoItems[i] = null; - return itemstack; - } - ItemStack itemstack1 = cargoItems[i].splitStack(j); - if (cargoItems[i].stackSize == 0) { - cargoItems[i] = null; - } - return itemstack1; - } - else { - return null; - } - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - cargoItems[i] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public void markDirty() { - - } - - @Override - public String getInventoryName() { - return null; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public int getSizeInventory() { - return cargoItems.length; - } - - @Override - public boolean attackEntityFrom(DamageSource damagesource, float i) { - if (worldObj.isRemote) { - return true; - } - if (canBeDestroyedByPlayer(damagesource)) - return true; - super.attackEntityFrom(damagesource, i); - setRollingDirection(-getRollingDirection()); - setRollingAmplitude(10); - setBeenAttacked(); - setDamage(getDamage() + i * 10); - if (getDamage() > 40) { - if (riddenByEntity != null) { - riddenByEntity.mountEntity(this); - } - this.setDead(); - ServerLogger.deleteWagon(this); - if (damagesource.getEntity() instanceof EntityPlayer) { - dropCartAsItem(((EntityPlayer)damagesource.getEntity()).capabilities.isCreativeMode); - } - } - return true; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } - - public FluidStack getFluid() { - return theTank.getFluid(); - } - - public int getFluidAmount() { - return theTank.getFluidAmount(); - } - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return theTank.fill(resource, doFill); - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { - return null; - } - return theTank.drain(resource.amount, doDrain); - } - - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return theTank.drain(maxDrain, doDrain); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { theTank.getInfo() }; - } + @Override + public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int p_94128_1_) { + return new int[0]; + } + + @Override + public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { + return false; + } + + @Override + public ItemStack getStackInSlot(int i) { + return cargoItems[i]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.cargoItems[par1] != null) { + ItemStack var2 = this.cargoItems[par1]; + this.cargoItems[par1] = null; + return var2; + } else { + return null; + } + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if (cargoItems[i] != null) { + if (cargoItems[i].stackSize <= j) { + ItemStack itemstack = cargoItems[i]; + cargoItems[i] = null; + return itemstack; + } + ItemStack itemstack1 = cargoItems[i].splitStack(j); + if (cargoItems[i].stackSize == 0) { + cargoItems[i] = null; + } + return itemstack1; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + cargoItems[i] = itemstack; + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { + itemstack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public void markDirty() { + + } + + @Override + public String getInventoryName() { + return null; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public int getSizeInventory() { + return cargoItems.length; + } + + @Override + public boolean attackEntityFrom(DamageSource damagesource, float i) { + if (worldObj.isRemote) { + return true; + } + if (canBeDestroyedByPlayer(damagesource)) + return true; + super.attackEntityFrom(damagesource, i); + setRollingDirection(-getRollingDirection()); + setRollingAmplitude(10); + setBeenAttacked(); + setDamage(getDamage() + i * 10); + if (getDamage() > 40) { + if (riddenByEntity != null) { + riddenByEntity.mountEntity(this); + } + this.setDead(); + ServerLogger.deleteWagon(this); + if (damagesource.getEntity() instanceof EntityPlayer) { + dropCartAsItem(((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode); + } + } + return true; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + public FluidStack getFluid() { + return theTank.getFluid(); + } + + public int getFluidAmount() { + return theTank.getFluidAmount(); + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return theTank.fill(resource, doFill); + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { + return null; + } + return theTank.drain(resource.amount, doDrain); + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return theTank.drain(maxDrain, doDrain); + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + return true; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + return true; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[]{theTank.getInfo()}; + } } diff --git a/src/main/java/train/common/api/Locomotive.java b/src/main/java/train/common/api/Locomotive.java index ad94ae6fd0..4e47aee76e 100644 --- a/src/main/java/train/common/api/Locomotive.java +++ b/src/main/java/train/common/api/Locomotive.java @@ -38,7 +38,7 @@ public abstract class Locomotive extends EntityRollingStock implements IInventory, WirelessTransmitter { public int inventorySize; - protected ItemStack locoInvent[]; + protected ItemStack[] locoInvent; private int soundPosition = 0; public boolean parkingBrake = false; private int whistleDelay = 0; @@ -138,12 +138,12 @@ public Locomotive(World world) { dataWatcher.addObject(29, castToString(currentAccelSlowDown)); dataWatcher.addObject(30, castToString(currentBrakeSlowDown)); dataWatcher.addObject(31, castToString(currentFuelConsumptionChange)); - dataWatcher.addObject(15, (float)Math.round((getCustomSpeed() * 3.6f))); + dataWatcher.addObject(15, (float) Math.round((getCustomSpeed() * 3.6f))); //dataWatcher.addObject(32, lineWaypoints); setAccel(0); setBrake(0); this.entityCollisionReduction = 0.99F; - if(this instanceof SteamTrain)isLocoTurnedOn = true; + if (this instanceof SteamTrain) isLocoTurnedOn = true; char[] chars = "abcdefghijklmnopqrstuvwxyz0123456789".toCharArray(); StringBuilder sb = new StringBuilder(5); Random random = new Random(); @@ -167,6 +167,7 @@ public void readSpawnData(ByteBuf additionalData) { isLocoTurnedOn = additionalData.readBoolean(); parkingBrake = additionalData.readBoolean(); } + @Override public void writeSpawnData(ByteBuf buffer) { super.writeSpawnData(buffer); @@ -243,7 +244,7 @@ public void setCustomSpeed(double m) { public float getMaxSpeed() { if (getSpec() != null) { if (currentMassPulled > 1) { - float power = (float) currentMassPulled / (((float) getSpec().getMHP())*0.37f); + float power = (float) currentMassPulled / (((float) getSpec().getMHP()) * 0.37f); if (power > 1) { return getSpec().getMaxSpeed() / (power); } @@ -281,15 +282,19 @@ public void limitSpeedOnTCRail() { //maxSpeed *= this.speedLimiter; adjustSpeed(maxSpeed, speedLimiter); } + if (motionX < -maxSpeed) { motionX = -maxSpeed; } + if (motionX > maxSpeed) { motionX = maxSpeed; } + if (motionZ < -maxSpeed) { motionZ = -maxSpeed; } + if (motionZ > maxSpeed) { motionZ = maxSpeed; } @@ -303,7 +308,9 @@ public void limitSpeedOnTCRail() { * @return */ public int setFuelConsumption(int c) { - if (c != 0) { return fuelRate = c; } + if (c != 0) { + return fuelRate = c; + } return fuelRate = getSpec().getFuelConsumption(); } @@ -314,7 +321,7 @@ public int setFuelConsumption(int c) { * @return int */ public int getFuelConsumption() { - return fuelRate==0?getSpec().getFuelConsumption():fuelRate; + return fuelRate == 0 ? getSpec().getFuelConsumption() : fuelRate; } /** @@ -334,9 +341,8 @@ public int getPower() { public double setAccel(double rate) { if (rate != 0) { return accelerate = rate; - } - else { - return accelerate = getSpec().getAccelerationRate(); + } else { + return accelerate = getSpec().getAccelerationRate(); } } @@ -348,8 +354,7 @@ public double setAccel(double rate) { public double setBrake(double rate) { if (rate != 0) { return brake = rate; - } - else { + } else { return brake = getSpec().getBrakeRate(); } } @@ -359,13 +364,15 @@ protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setBoolean("canBeAdjusted", canBeAdjusted); nbttagcompound.setBoolean("canBePulled", canBePulled); - nbttagcompound.setInteger("overheatLevel", getOverheatLevel()); + nbttagcompound.setInteger("overheatLevel", getOverheatLevel()); nbttagcompound.setString("lastRider", lastRider); nbttagcompound.setString("destination", destination); nbttagcompound.setBoolean("parkingBrake", parkingBrake); + if (!(this instanceof SteamTrain)) { nbttagcompound.setBoolean("isLocoTurnedOn", isLocoTurnedOn); } + nbttagcompound.setString("trainID", trainID); nbttagcompound.setInteger("speedLimit", speedLimit); nbttagcompound.setString("trainLevel", trainLevel); @@ -399,9 +406,11 @@ protected void readEntityFromNBT(NBTTagCompound ntc) { lastRider = ntc.getString("lastRider"); destination = ntc.getString("destination"); this.parkingBrake = ntc.getBoolean("parkingBrake"); + if (!(this instanceof SteamTrain)) { isLocoTurnedOn = ntc.getBoolean("isLocoTurnedOn"); } + trainID = ntc.getString("trainID"); speedLimit = ntc.getInteger("speedLimit"); trainLevel = ntc.getString("trainLevel"); @@ -448,36 +457,44 @@ public void setCanBeAdjusted(boolean canBeAdj) { public void keyHandlerFromPacket(int i) { if (this.getTrainLockedFromPacket()) { if (this.riddenByEntity instanceof EntityPlayer - && !((EntityPlayer) this.riddenByEntity).getDisplayName().toLowerCase() - .equals(this.getTrainOwner().toLowerCase())) { + && !((EntityPlayer) this.riddenByEntity).getDisplayName().equalsIgnoreCase(this.getTrainOwner())) { return; } } pressKey(i); + if (i == 8 && ConfigHandler.SOUNDS) { soundHorn(); } - if (i == 10){ + + if (i == 10) { soundWhistle(); } + if (i == 4) { forwardPressed = true; } + if (i == 5) { backwardPressed = true; } + if (i == 12) { brakePressed = true; } + if (i == 13) { forwardPressed = false; } + if (i == 14) { backwardPressed = false; } + if (i == 15) { brakePressed = false; } + if (i == 16) { if (mtcStatus != 0 && this.mtcType == 2) { if (!(this instanceof SteamTrain && !ConfigHandler.ALLOW_ATO_ON_STEAMERS)) { @@ -491,7 +508,6 @@ public void keyHandlerFromPacket(int i) { } if (i == 17) { - if (mtcOverridePressed) { mtcOverridePressed = false; } else { @@ -508,17 +524,11 @@ public void keyHandlerFromPacket(int i) { this.trainLevel = "0"; disconnectFromServer(); } - - - } + if (i == 18) { if (mtcStatus != 0) { - if (overspeedOveridePressed ) { - overspeedOveridePressed = false; - } else { - overspeedOveridePressed = true; - } + overspeedOveridePressed = !overspeedOveridePressed; } } } @@ -557,7 +567,9 @@ public Float getCustomSpeedGUI() { } public String getDestinationGUI() { - if (worldObj.isRemote) { return (this.dataWatcher.getWatchableObjectString(3)); } + if (worldObj.isRemote) { + return (this.dataWatcher.getWatchableObjectString(3)); + } return destination; } @@ -565,8 +577,7 @@ private double convertSpeed(double speed) { //System.out.println("X "+motionX +" Z "+motionZ); if (ConfigHandler.REAL_TRAIN_SPEED) { speed *= 2;// applying ratio - } - else { + } else { speed *= 6; } speed *= 36; @@ -578,16 +589,17 @@ private double convertSpeed(double speed) { public void soundHorn() { TrainSoundRecord sound = Traincraft.instance.traincraftRegistry.getTrainSoundRecord(this.getClass()); - if (sound != null && !sound.getHornString().equals("") && whistleDelay == 0) { + if (sound != null && !sound.getHornString().isEmpty() && whistleDelay == 0) { worldObj.playSoundAtEntity(this, sound.getHornString(), sound.getHornVolume(), 1.0F); whistleDelay = 65; } - List entities = worldObj.getEntitiesWithinAABB(EntityAnimal.class, AxisAlignedBB.getBoundingBox( - this.posX-20,this.posY-5,this.posZ-20, - this.posX+20,this.posY+5,this.posZ+20)); - for(Object e : entities) { - if(e instanceof EntityAnimal) { + List entities = worldObj.getEntitiesWithinAABB(EntityAnimal.class, AxisAlignedBB.getBoundingBox( + this.posX - 20, this.posY - 5, this.posZ - 20, + this.posX + 20, this.posY + 5, this.posZ + 20)); + + for (Object e : entities) { + if (e instanceof EntityAnimal) { ((EntityAnimal) e).setTarget(this); ((EntityAnimal) e).getNavigator().setPath(null, 0); } @@ -601,8 +613,7 @@ public void soundWhistle() { @Override public void onUpdate() { - - if (worldObj.isRemote && ticksExisted %2 ==0 && !Minecraft.getMinecraft().ingameGUI.getChatGUI().getChatOpen()){ + if (worldObj.isRemote && ticksExisted % 2 == 0 && !Minecraft.getMinecraft().ingameGUI.getChatGUI().getChatOpen()) { if (Keyboard.isKeyDown(FMLClientHandler.instance().getClient().gameSettings.keyBindForward.getKeyCode()) && !forwardPressed) { Traincraft.keyChannel.sendToServer(new PacketKeyPress(4)); @@ -613,6 +624,7 @@ public void onUpdate() { Traincraft.keyChannel.sendToServer(new PacketKeyPress(13)); forwardPressed = false; } + if (Keyboard.isKeyDown(FMLClientHandler.instance().getClient().gameSettings.keyBindBack.getKeyCode()) && !backwardPressed) { Traincraft.keyChannel.sendToServer(new PacketKeyPress(5)); @@ -623,6 +635,7 @@ public void onUpdate() { Traincraft.keyChannel.sendToServer(new PacketKeyPress(14)); backwardPressed = false; } + if (Keyboard.isKeyDown(FMLClientHandler.instance().getClient().gameSettings.keyBindJump.getKeyCode()) && !brakePressed) { Traincraft.keyChannel.sendToServer(new PacketKeyPress(12)); @@ -633,7 +646,6 @@ public void onUpdate() { Traincraft.keyChannel.sendToServer(new PacketKeyPress(15)); brakePressed = false; } - } // if (worldObj.isRemote) { @@ -650,32 +662,33 @@ public void onUpdate() { //EntityLivingBase entity = (EntityLivingBase) this.riddenByEntity; if (forwardPressed || backwardPressed) { if (getFuel() > 0 && this.isLocoTurnedOn() && rand.nextInt(4) == 0 && !worldObj.isRemote) { - if (this.getTrainLockedFromPacket() && !((EntityPlayer) this.riddenByEntity).getDisplayName() - .toLowerCase().equals(this.getTrainOwner().toLowerCase())) { + if (this.getTrainLockedFromPacket() && !((EntityPlayer) this.riddenByEntity).getDisplayName().equalsIgnoreCase(this.getTrainOwner())) { return; } + if (riddenByEntity instanceof EntityPlayer) { int dir = MathHelper - .floor_double((((EntityPlayer) riddenByEntity).rotationYaw * 4F) / 360F + 0.5D) & 3; - if (dir == 2){ + .floor_double((riddenByEntity.rotationYaw * 4F) / 360F + 0.5D) & 3; + + if (dir == 2) { if (forwardPressed) { motionZ -= 0.0075 * this.accelerate; } else { motionZ += 0.0075 * this.accelerate; } - } else if (dir == 0){ + } else if (dir == 0) { if (forwardPressed) { motionZ += 0.0075 * this.accelerate; } else { motionZ -= 0.0075 * this.accelerate; } - } else if (dir == 1){ + } else if (dir == 1) { if (forwardPressed) { motionX -= 0.0075 * this.accelerate; } else { motionX += 0.0075 * this.accelerate; } - } else if (dir == 3){ + } else { if (forwardPressed) { motionX += 0.0075 * this.accelerate; } else { @@ -691,7 +704,9 @@ public void onUpdate() { } - if (updateTicks % 20 == 0) HandleMaxAttachedCarts.PullPhysic(this); + if (updateTicks % 20 == 0) { + HandleMaxAttachedCarts.PullPhysic(this); + } /** * Can't use datawatcher here. Locomotives use them all already * Check inventory The packet never arrives if it is sent when the @@ -716,6 +731,7 @@ public void onUpdate() { fuelUpdateTicks = 0; updateFuelTrain(this.getFuelConsumption()); } + fuelUpdateTicks++; if (!this.isLocoTurnedOn()) { @@ -727,6 +743,7 @@ public void onUpdate() { if (whistleDelay > 0) { whistleDelay--; } + if (this.riddenByEntity instanceof EntityPlayer) { this.lastRider = ((EntityPlayer) this.riddenByEntity).getDisplayName(); this.lastEntityRider = (this.riddenByEntity); @@ -736,41 +753,42 @@ public void onUpdate() { motionX *= 0.0; motionZ *= 0.0; } + if (ConfigHandler.SOUNDS) { TrainSoundRecord sound = Traincraft.instance.traincraftRegistry.getTrainSoundRecord(this.getClass()); - if (sound != null && !sound.getHornString().equals("") && whistleDelay == 0) { + if (sound != null && !sound.getHornString().isEmpty() && whistleDelay == 0) { if (getFuel() > 0 && this.isLocoTurnedOn()) { double speed = Math.sqrt(motionX * motionX + motionZ * motionZ); if (speed > -0.001D && speed < 0.01D && soundPosition == 0) { worldObj.playSoundAtEntity(this, sound.getIdleString(), sound.getIdleVolume(), 0.001F); - soundPosition = sound.getIdleSoundLenght(); + soundPosition = sound.getIdleSoundLength(); } - if (sound.getSoundChangeWithSpeed() && !sound.getHornString().equals("") && whistleDelay == 0) { + + if (sound.getSoundChangeWithSpeed() && !sound.getHornString().isEmpty() && whistleDelay == 0) { if (speed > 0.01D && speed < 0.06D && soundPosition == 0) { worldObj.playSoundAtEntity(this, sound.getRunString(), sound.getRunVolume(), 0.1F); - soundPosition = sound.getRunSoundLenght(); - } - else if (speed > 0.06D && speed < 0.2D && soundPosition == 0) { + soundPosition = sound.getRunSoundLength(); + } else if (speed > 0.06D && speed < 0.2D && soundPosition == 0) { worldObj.playSoundAtEntity(this, sound.getRunString(), sound.getRunVolume(), 0.4F); - soundPosition = sound.getRunSoundLenght() / 2; - } - else if (speed > 0.2D && soundPosition == 0) { + soundPosition = sound.getRunSoundLength() / 2; + } else if (speed > 0.2D && soundPosition == 0) { worldObj.playSoundAtEntity(this, sound.getRunString(), sound.getRunVolume(), 0.5F); - soundPosition = sound.getRunSoundLenght() / 3; + soundPosition = sound.getRunSoundLength() / 3; } - } - else { + } else { if (speed > 0.01D && soundPosition == 0) { worldObj.playSoundAtEntity(this, sound.getRunString(), sound.getRunVolume(), 0.4F); - soundPosition = sound.getRunSoundLenght(); + soundPosition = sound.getRunSoundLength(); } } + if (soundPosition > 0) { soundPosition--; } } } } + if (getState().equals("cold")) { this.extinguish(); if (getCurrentMaxSpeed() >= (getMaxSpeed() * 0.6)) { @@ -778,6 +796,7 @@ else if (speed > 0.2D && soundPosition == 0) { motionZ *= 0.0; } } + if (getState().equals("warm")) { this.extinguish(); if (getCurrentMaxSpeed() >= (getMaxSpeed() * 0.7)) { @@ -785,15 +804,18 @@ else if (speed > 0.2D && soundPosition == 0) { motionZ *= 0.94; } } + if (getState().equals("hot")) { this.extinguish(); } + //if (getState().equals("very hot")) {} if (getState().equals("too hot")) { motionX *= 0.95; motionZ *= 0.95; worldObj.spawnParticle("largesmoke", posX, posY + 0.3, posZ, 0.0D, 0.0D, 0.0D); } + if (getState().equals("broken")) { setFire(8); this.setCustomSpeed(0);// set speed to normal @@ -804,18 +826,21 @@ else if (speed > 0.2D && soundPosition == 0) { worldObj.spawnParticle("largesmoke", posX, posY + 0.3, posZ, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle("largesmoke", posX, posY + 0.3, posZ, 0.0D, 0.0D, 0.0D); blowUpDelay++; + if (blowUpDelay > 80) { if (!worldObj.isRemote) { //worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.5F, true); worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.5F, false); this.setDead(); } + if (!worldObj.isRemote && FMLCommonHandler.instance().getMinecraftServerInstance() != null && this.lastEntityRider instanceof EntityPlayer) { FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendChatMsg(new ChatComponentText(((EntityPlayer) this.lastEntityRider).getDisplayName() + " blew " + this.getTrainOwner() + "'s locomotive")); FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendChatMsg(new ChatComponentText(((EntityPlayer) this.lastEntityRider).getDisplayName() + " blew " + this.getTrainOwner() + "'s locomotive")); } } } + //Minecraft Train Control things. if (!worldObj.isRemote) { if (mtcStatus == 1 | mtcStatus == 2) { @@ -830,16 +855,14 @@ else if (speed > 0.2D && soundPosition == 0) { sendMessage(new PDMMessage(this.trainID, this.serverUUID, sendingObj.toString(), 1)); } } - if (getSpeed() > speedLimit && speedLimit != 0) { - isDriverOverspeed = true; - } else { - isDriverOverspeed = false; - } + isDriverOverspeed = getSpeed() > speedLimit && speedLimit != 0; + if (isDriverOverspeed && ticksExisted % 120 == 0 && !overspeedBrakingInProgress && !overspeedOveridePressed && atoStatus != 1) { //Start braking because the driver is an idiot. overspeedBrakingInProgress = true; } + if (overspeedBrakingInProgress && atoStatus != 1) { if (getSpeed() < speedLimit) { //Stop overspeed braking. @@ -865,39 +888,29 @@ else if (speed > 0.2D && soundPosition == 0) { speedLimit = nextSpeedLimit; this.nextSpeedLimit = 0; Traincraft.itsChannel.sendToAllAround(new PacketSetSpeed(this.speedLimit, (int) this.posX, (int) this.posY, (int) this.posZ, getEntityId()), new TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); - Traincraft.itnsChannel.sendToAllAround(new PacketNextSpeed( nextSpeedLimit, 0,0,0, xSpeedLimitChange, ySpeedLimitChange, zSpeedLimitChange, this.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); - speedGoingDown = false; - speedGoingDown = false; - speedGoingDown = false; + Traincraft.itnsChannel.sendToAllAround(new PacketNextSpeed(nextSpeedLimit, 0, 0, 0, xSpeedLimitChange, ySpeedLimitChange, zSpeedLimitChange, this.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); speedGoingDown = false; } } - if (distanceFromStopPoint >= 40 && distanceFromStopPoint < this.speedLimit && !(xFromStopPoint == 0.0) && mtcType == 1){ - this.speedLimit = (int)Math.round(distanceFromStopPoint); + if (distanceFromStopPoint >= 40 && distanceFromStopPoint < this.speedLimit && !(xFromStopPoint == 0.0) && mtcType == 1) { + this.speedLimit = (int) Math.round(distanceFromStopPoint); Traincraft.itsChannel.sendToAllAround(new PacketSetSpeed(this.speedLimit, (int) this.posX, (int) this.posY, (int) this.posZ, getEntityId()), new TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); speedGoingDown = true; - } else { - } - if (distanceFromStopPoint >= 10 && distanceFromStopPoint < this.speedLimit && !(xFromStopPoint == 0.0) && mtcType == 2){ - this.speedLimit = (int)Math.round(distanceFromStopPoint); + + if (distanceFromStopPoint >= 10 && distanceFromStopPoint < this.speedLimit && !(xFromStopPoint == 0.0) && mtcType == 2) { + this.speedLimit = (int) Math.round(distanceFromStopPoint); Traincraft.itsChannel.sendToAllAround(new PacketSetSpeed(this.speedLimit, (int) this.posX, (int) this.posY, (int) this.posZ, getEntityId()), new TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); speedGoingDown = true; - } else { - } - /*if (distanceFromStopPoint < this.getSpeed() && !(distanceFromStopPoint < nextSpeedLimit) && !(this instanceof EntityLocoElectricPeachDriverlessMetro)) { speedLimit = (int) Math.round(distanceFromStopPoint); Traincraft.itsChannel.sendToAllAround(new PacketSetSpeed(this.speedLimit, (int) this.posX, (int) this.posY, (int) this.posZ, getEntityId()), new TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D) ); }*/ - - - //For Automatic Train Operation if (this.atoStatus == 1) { distanceFromStationStop = this.getDistance(this.xStationStop, this.yStationStop, this.zStationStop); @@ -905,6 +918,7 @@ else if (speed > 0.2D && soundPosition == 0) { this.parkingBrake = false; //Accelerate to the speed limit } + if (!(distanceFromStopPoint < this.getSpeed()) && (!(distanceFromSpeedChange < this.getSpeed()))) { accel(this.speedLimit); } @@ -913,8 +927,8 @@ else if (speed > 0.2D && soundPosition == 0) { if (distanceFromStopPoint < this.getSpeed()) { //Stop it at a certain point stop(Vec3.createVectorHelper(this.xFromStopPoint, this.yFromStopPoint, this.zFromStopPoint)); - } + if (distanceFromStationStop < this.getSpeed()) { stop(Vec3.createVectorHelper(this.xStationStop, this.yStationStop, this.zStationStop)); stationStopping = true; @@ -932,34 +946,33 @@ else if (speed > 0.2D && soundPosition == 0) { //The ATO system is speeding somehow, slow it down slow(this.speedLimit); } + if (this.distanceFromStopPoint < 2 || this.distanceFromStationStop < 2) { this.parkingBrake = true; this.isBraking = true; - if (this.distanceFromStopPoint < 2 ) { + + if (this.distanceFromStopPoint < 2) { this.xFromStopPoint = 0.0; this.yFromStopPoint = 0.0; this.zFromStopPoint = 0.0; - } else if (this.distanceFromStationStop < 2) { + } else { this.xStationStop = 0.0; this.yStationStop = 0.0; this.zStationStop = 0.0; } + this.atoStatus = 0; this.stationStop = true; - Traincraft.atoChannel.sendToAllAround(new PacketATO(this.getEntityId(), 0),new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); + Traincraft.atoChannel.sendToAllAround(new PacketATO(this.getEntityId(), 0), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); Traincraft.atoSetStopPoint.sendToAllAround(new PacketATOSetStopPoint(this.getEntityId(), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); Traincraft.brakeChannel.sendToAllAround(new PacketParkingBrake(true, this.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); JsonObject sendingObj = new JsonObject(); sendingObj.addProperty("funct", "stationstopcomplete"); sendMessage(new PDMMessage(this.trainID, serverUUID, sendingObj.toString(), 0)); - } - - } - } } @@ -984,6 +997,7 @@ else if (speed > 0.2D && soundPosition == 0) { FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendChatMsg(new ChatComponentText(((EntityPlayer) this.lastEntityRider).getDisplayName() + " drowned " + this.getTrainOwner() + "'s locomotive")); FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendChatMsg(new ChatComponentText(((EntityPlayer) this.lastEntityRider).getDisplayName() + " drowned " + this.getTrainOwner() + "'s locomotive")); } + //this.attackEntityFrom(DamageSource.generic, 100); this.setCustomSpeed(0);// set speed to normal this.setAccel(0.000001);// simulate a break down @@ -994,6 +1008,7 @@ else if (speed > 0.2D && soundPosition == 0) { this.hasDrowned = true; this.canCheckInvent = false; blowUpDelay++; + if (blowUpDelay > 20) { this.attackEntityFrom(DamageSource.drown, 100); } @@ -1084,7 +1099,9 @@ public void setState(String state) { * @return */ public int getFuel() { - if (worldObj.isRemote) { return (this.dataWatcher.getWatchableObjectInt(24)); } + if (worldObj.isRemote) { + return (this.dataWatcher.getWatchableObjectInt(24)); + } return fuelTrain; } @@ -1092,13 +1109,17 @@ public int getFuel() { * Is it fuelled? used in GUI */ public boolean getIsFuelled() { - if (worldObj.isRemote) { return (this.dataWatcher.getWatchableObjectInt(24)) > 0; } + if (worldObj.isRemote) { + return (this.dataWatcher.getWatchableObjectInt(24)) > 0; + } return (this.fuelTrain > 0); } /** Used for the gui */ public int getFuelDiv(int i) { - if (worldObj.isRemote) { return ((this.dataWatcher.getWatchableObjectInt(24) * i) / 1200); } + if (worldObj.isRemote) { + return ((this.dataWatcher.getWatchableObjectInt(24) * i) / 1200); + } return (this.fuelTrain * i) / 1200; } @@ -1110,14 +1131,17 @@ protected void updateFuelTrain(int consumption) { if (fuelTrain < 0) { motionX *= 0.8; motionZ *= 0.8; - } - else { + } else { if (this.isLocoTurnedOn()) { fuelTrain -= consumption; - if (fuelTrain < 0) fuelTrain = 0; + + if (fuelTrain < 0) { + fuelTrain = 0; + } } } } + public void setLocoTurnedOnFromPacket(boolean set) { isLocoTurnedOn = set; } @@ -1208,8 +1232,14 @@ public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) { @Override public boolean attackEntityFrom(DamageSource damagesource, float i) { - if (worldObj.isRemote) { return true; } - if (canBeDestroyedByPlayer(damagesource)) return true; + if (worldObj.isRemote) { + return true; + } + + if (canBeDestroyedByPlayer(damagesource)) { + return true; + } + super.attackEntityFrom(damagesource, i); setRollingDirection(-getRollingDirection()); setRollingAmplitude(10); @@ -1219,11 +1249,13 @@ public boolean attackEntityFrom(DamageSource damagesource, float i) { if (riddenByEntity != null) { riddenByEntity.mountEntity(this); } + this.setDead(); disconnectFromServer(); ServerLogger.deleteWagon(this); + if (damagesource.getEntity() instanceof EntityPlayer) { - dropCartAsItem(((EntityPlayer)damagesource.getEntity()).capabilities.isCreativeMode); + dropCartAsItem(((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode); } else { dropCartAsItem(false); } @@ -1232,8 +1264,8 @@ public boolean attackEntityFrom(DamageSource damagesource, float i) { } @Override - public void dropCartAsItem(boolean isCreative){ - if(!itemdropped) { + public void dropCartAsItem(boolean isCreative) { + if (!itemdropped) { super.dropCartAsItem(isCreative); for (ItemStack stack : locoInvent) { if (stack != null) { @@ -1265,8 +1297,7 @@ public ItemStack getStackInSlotOnClosing(int par1) { ItemStack var2 = this.locoInvent[par1]; this.locoInvent[par1] = null; return var2; - } - else { + } else { return null; } } @@ -1279,14 +1310,15 @@ public ItemStack decrStackSize(int i, int j) { locoInvent[i] = null; return itemstack; } + ItemStack itemstack1 = locoInvent[i].splitStack(j); + if (locoInvent[i].stackSize == 0) { locoInvent[i] = null; } return itemstack1; - } - else { + } else { return null; } } @@ -1300,24 +1332,22 @@ public void setInventorySlotContents(int i, ItemStack itemstack) { } @Override - public void openInventory() {} + public void openInventory() { + } @Override - public void closeInventory() {} + public void closeInventory() { + } @Override public void markDirty() { - if (!worldObj.isRemote) { - this.slotsFilled = 0; for (int i = 0; i < getSizeInventory(); i++) { - ItemStack itemstack = getStackInSlot(i); if (itemstack != null) { - slotsFilled++; } } @@ -1340,79 +1370,57 @@ public int getInventoryStackLimit() { } @Override - public ItemStack[] getInventory(){return locoInvent;} + public ItemStack[] getInventory() { + return locoInvent; + } /** For MTC's Automatic Train Operation system */ public void accel(Integer desiredSpeed) { if (this.worldObj != null) { - if (this.getSpeed() != desiredSpeed) { if ((int) this.getSpeed() <= this.speedLimit) { if (this.riddenByEntity == null) { - double rotation = this.serverRealRotation; if (rotation == 90.0) { - this.motionX -= 0.0020 * this.accelerate; - - } else if (rotation == -90.0) { - this.motionX += 0.0020 * this.accelerate; - } else if (rotation == 0.0) { - this.motionZ += 0.0020 * this.accelerate; - } else if (rotation == -180.0) { - this.motionZ -= 0.0020 * this.accelerate; - } else { - } - } else { - int dir = MathHelper - .floor_double((((EntityPlayer) riddenByEntity).rotationYaw * 4F) / 360F + 0.5D) & 3; + int dir = MathHelper.floor_double((riddenByEntity.rotationYaw * 4F) / 360F + 0.5D) & 3; if (dir == 2) { - this.motionZ -= 0.0020 * this.accelerate; - - } else if (dir == 0) { - this.motionZ += 0.0020 * this.accelerate; - } else if (dir == 1) { - this.motionX -= 0.0020 * this.accelerate; - - } else if (dir == 3) { - + } else { this.motionX += 0.0020 * this.accelerate; - } - } } - } } } public void slow(Integer desiredSpeed) { - if (this.getSpeed() >= desiredSpeed){ + if (this.getSpeed() >= desiredSpeed) { motionX *= brake; motionZ *= brake; } } + public void stop(Vec3 signalPosition) { double currentDistance = Math.copySign(Vec3.createVectorHelper(this.posX, this.posY, this.posZ).distanceTo(signalPosition), 1.0D); double originalDistance; - originalDistance=currentDistance; + originalDistance = currentDistance; double slowPercentage = 0.5D; - if(1.0D - currentDistance != 0.0D && originalDistance != 0.0D) { + if (1.0D - currentDistance != 0.0D && originalDistance != 0.0D) { slowPercentage = currentDistance / this.getSpeed(); } @@ -1420,18 +1428,19 @@ public void stop(Vec3 signalPosition) { this.motionZ *= slowPercentage; } + @Override public void receiveMessage(PDMMessage message) { JsonParser parser = new JsonParser(); - JsonObject thing = parser.parse(message.message.toString()).getAsJsonObject(); + JsonObject thing = parser.parse(PDMMessage.message.toString()).getAsJsonObject(); //System.out.println("Got one!"); if (message != null) { if (thing.get("funct").getAsString().equals("startlevel2")) { //That's actually really great, now let's get where it sent from owo // System.out.println("Connected!"); - serverUUID = message.UUIDFrom; + serverUUID = PDMMessage.UUIDFrom; mtcType = 2; mtcStatus = thing.get("mtcStatus").getAsInt(); isConnected = true; @@ -1454,11 +1463,12 @@ public void receiveMessage(PDMMessage message) { speedLimit = thing.get("speedLimit").getAsInt(); Traincraft.itsChannel.sendToAllAround(new PacketSetSpeed(speedLimit, 0, 0, 0, getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); } + if (thing.get("speedChange").getAsBoolean()) { xSpeedLimitChange = thing.get("nextSpeedLimitChangeX").getAsDouble(); ySpeedLimitChange = thing.get("nextSpeedLimitChangeY").getAsDouble(); zSpeedLimitChange = thing.get("nextSpeedLimitChangeZ").getAsDouble(); - Traincraft.itnsChannel.sendToAllAround(new PacketNextSpeed( nextSpeedLimit, 0,0,0, xSpeedLimitChange, ySpeedLimitChange, zSpeedLimitChange, this.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); + Traincraft.itnsChannel.sendToAllAround(new PacketNextSpeed(nextSpeedLimit, 0, 0, 0, xSpeedLimitChange, ySpeedLimitChange, zSpeedLimitChange, this.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); } if (thing.get("endSoon").getAsBoolean()) { @@ -1469,22 +1479,23 @@ public void receiveMessage(PDMMessage message) { Traincraft.atoSetStopPoint.sendToAllAround(new PacketATOSetStopPoint(this.getEntityId(), xFromStopPoint, yFromStopPoint, zFromStopPoint, xStationStop, yStationStop, zStationStop), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); } } + if (thing.get("stationStopSoon").getAsBoolean() && !stationStop) { xStationStop = thing.get("xStationStop").getAsDouble(); yStationStop = thing.get("yStationStop").getAsDouble(); zStationStop = thing.get("zStationStop").getAsDouble(); - Traincraft.atoSetStopPoint.sendToAllAround(new PacketATOSetStopPoint(this.getEntityId(), xFromStopPoint, yFromStopPoint, zFromStopPoint, xStationStop, yStationStop, zStationStop), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); - } if (thing.get("atoStatus") != null) { - this.atoStatus = thing.get("atoStatus").getAsInt(); - Traincraft.atoChannel.sendToAllAround(new PacketATO(this.getEntityId(), thing.get("atoStatus").getAsInt()),new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); } - + if (thing.get("atoStatus") != null) { + this.atoStatus = thing.get("atoStatus").getAsInt(); + Traincraft.atoChannel.sendToAllAround(new PacketATO(this.getEntityId(), thing.get("atoStatus").getAsInt()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 150.0D)); + } } } } + @Override public void sendMessage(PDMMessage message) { // System.out.println("Sendmessage.."); @@ -1494,18 +1505,15 @@ public void sendMessage(PDMMessage message) { if (te instanceof TilePDMInstructionRadio) { - TilePDMInstructionRadio teP = (TilePDMInstructionRadio)te; + TilePDMInstructionRadio teP = (TilePDMInstructionRadio) te; - if (teP.uniqueID.equals(message.UUIDTo)) { + if (teP.uniqueID.equals(PDMMessage.UUIDTo)) { //System.out.println(message.message); teP.receiveMessage(message); } - } } - - } public void attemptConnection(String theServerUUID) { @@ -1530,6 +1538,4 @@ public void disconnectFromServer() { isConnected = false; } } - - } diff --git a/src/main/java/train/common/api/Tender.java b/src/main/java/train/common/api/Tender.java index 6f0ca6b687..27d797bf7a 100644 --- a/src/main/java/train/common/api/Tender.java +++ b/src/main/java/train/common/api/Tender.java @@ -14,311 +14,302 @@ public abstract class Tender extends Freight implements IFluidHandler { - public ItemStack tenderItems[]; - private int maxTank; - private int update = 8; - private StandardTank theTank; - private IFluidTank[] tankArray = new IFluidTank[1]; - public TileEntity[] blocksToCheck; - /** - * - * @param world - * @param fluid - * @param quantity - * @param capacity - */ - public Tender(World world, Fluid fluid, int quantity) { - this(new FluidStack(fluid, quantity), world, null); - } - - public Tender(World world, Fluid fluid, int quantity, FluidStack filter) { - this(new FluidStack(fluid, quantity), world, filter); - } - - private Tender(FluidStack fluid, World world, FluidStack filter) { - super(world); - this.maxTank = getSpec().getTankCapacity(); - if (filter == null) - this.theTank = LiquidManager.getInstance().new StandardTank(maxTank); - if (filter != null) - this.theTank = LiquidManager.getInstance().new FilteredTank(maxTank, filter); - tankArray[0] = theTank; - dataWatcher.addObject(4, 0); - this.dataWatcher.addObject(23, 0); - } - @Override - public abstract int getSizeInventory(); - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - this.theTank.writeToNBT(nbttagcompound); - } - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - this.theTank.readFromNBT(nbttagcompound); - } - - @Override - public void onUpdate() { - super.onUpdate(); - if (worldObj.isRemote) - return; - if (theTank != null && theTank.getFluid() != null) { - this.dataWatcher.updateObject(23, theTank.getFluid().amount); - this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); - } - else if (theTank != null && theTank.getFluid() == null) { - this.dataWatcher.updateObject(23, 0); - this.dataWatcher.updateObject(4, 0); - } - } - /** - * handle mass depending on items and liquid - */ - @Override - protected void handleMass(){ - if(this.updateTicks%10!=0)return; - double preciseAmount=0; - this.mass=this.getDefaultMass(); - if(theTank != null && theTank.getFluid() != null && theTank.getFluid().amount>0){ - preciseAmount = theTank.getFluid().amount; - } - this.itemInsideCount=0; - for (int i = 0; i < getSizeInventory(); i++) { - ItemStack itemstack = getStackInSlot(i); - if (itemstack != null && itemstack.stackSize > 0) { - this.itemInsideCount+=itemstack.stackSize; - } - } - mass+=(this.itemInsideCount*0.0001);//1 item = 1 kilo - mass+=(preciseAmount/10000);//1 bucket = 1 kilo - } - - /** - * added for SMP, used by the HUD - * - * @return - */ - public int getWater() { - return (this.dataWatcher.getWatchableObjectInt(23)); - } - - /** - * used by the GUI - * - * @return int - */ - public int getLiquidItemID() { - return (this.dataWatcher.getWatchableObjectInt(4)); - } - - public int getCartTankCapacity() { - return maxTank; - } - - public StandardTank getTank() { - return theTank; - } - - private void placeInInvent(ItemStack itemstack1, Tender tender) { - for (int i = 1; i < tender.tenderItems.length; i++) { - if (tender.tenderItems[i] == null) { - tender.tenderItems[i] = itemstack1; - return; - } - else if (tender.tenderItems[i] != null && tender.tenderItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && - (!itemstack1.getHasSubtypes() || tender.tenderItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(tender.tenderItems[i], itemstack1)) { - int var9 = tender.tenderItems[i].stackSize + itemstack1.stackSize; - if (var9 <= tender.tenderItems[i].getMaxStackSize()) { - tender.tenderItems[i].stackSize = var9; - return; - } - else if (tender.tenderItems[i].stackSize < tender.tenderItems[i].getMaxStackSize()) { - tender.tenderItems[i].stackSize += 1; - return; - } - } - else if (i == tender.tenderItems.length - 1) { - entityDropItem(itemstack1,1); - return; - } - } - } - - public void liquidInSlot(ItemStack itemstack, Tender tender) { - if (worldObj.isRemote) - return; - this.update += 1; - if (this.update % 8 == 0 && itemstack != null) { - ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); - if (result != null) { - placeInInvent(result, tender); - decrStackSize(0, 1); - } - } - } - - protected void checkInvent(ItemStack tenderInvent, Tender loco) { - if (tenderInvent != null) { - liquidInSlot(tenderInvent, loco); - } - - if(ticksExisted%5==0 && fill(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER,100), false)==100) { - FluidStack drain =null; - blocksToCheck = new TileEntity[]{worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY - 1), MathHelper.floor_double(posZ)), - worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 2), MathHelper.floor_double(posZ)), - worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 3), MathHelper.floor_double(posZ)), - worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 4), MathHelper.floor_double(posZ)) - }; - - for (TileEntity block : blocksToCheck) { - if (drain == null && block instanceof IFluidHandler) { - for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { - if(((IFluidHandler) block).drain(direction,100,false)!=null && - ((IFluidHandler) block).drain(direction, 100, false).fluid==FluidRegistry.WATER && - ((IFluidHandler) block).drain(direction, 100, false).amount ==100 - ) { - drain = ((IFluidHandler) block).drain( - direction, 100, true); - } - } - } - } - if (drain ==null && cartLinked1 instanceof LiquidTank - && !(cartLinked1 instanceof EntityBUnitEMDF7) && !(cartLinked1 instanceof EntityBUnitEMDF3) && !(cartLinked1 instanceof EntityBUnitDD35)) { - if (getFluid() == null) { - drain = ((LiquidTank) cartLinked1).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); - } else if (getFluid().getFluid() == FluidRegistry.WATER) { - drain = ((LiquidTank) cartLinked1).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); - } - } else if (drain ==null && cartLinked2 instanceof LiquidTank - && !(cartLinked1 instanceof EntityBUnitEMDF7) && !(cartLinked1 instanceof EntityBUnitEMDF3) && !(cartLinked1 instanceof EntityBUnitDD35)) { - if (getFluid() == null) { - drain = ((LiquidTank) cartLinked2).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); - } else if (getFluid().getFluid() == FluidRegistry.WATER) { - drain = ((LiquidTank) cartLinked2).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); - } - } - if (drain != null) { - fill(ForgeDirection.UNKNOWN, drain, true); - } - } - } - /*IInventory implements*/ - @Override - public ItemStack getStackInSlot(int i) { - return tenderItems[i]; - } - - @Override - public ItemStack getStackInSlotOnClosing(int par1) { - if (this.tenderItems[par1] != null) { - ItemStack var2 = this.tenderItems[par1]; - this.tenderItems[par1] = null; - return var2; - } - else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int i, int j) { - if (tenderItems[i] != null) { - if (tenderItems[i].stackSize <= j) { - ItemStack itemstack = tenderItems[i]; - tenderItems[i] = null; - return itemstack; - } - ItemStack itemstack1 = tenderItems[i].splitStack(j); - if (tenderItems[i].stackSize == 0) { - tenderItems[i] = null; - } - return itemstack1; - } - else { - return null; - } - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - tenderItems[i] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - public void setLiquid(FluidStack liquid) { - } - - public void setCapacity(int capacity) { - this.maxTank = capacity; - } - - public int getCapacity() { - return this.maxTank; - } - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { + public ItemStack[] tenderItems; + private int maxTank; + private int update = 8; + private StandardTank theTank; + public TileEntity[] blocksToCheck; + + /** + * + * @param world world + * @param fluid fluid + * @param quantity quantity + */ + public Tender(World world, Fluid fluid, int quantity) { + this(new FluidStack(fluid, quantity), world, null); + } + + public Tender(World world, Fluid fluid, int quantity, FluidStack filter) { + this(new FluidStack(fluid, quantity), world, filter); + } + + private Tender(FluidStack fluid, World world, FluidStack filter) { + super(world); + this.maxTank = getSpec().getTankCapacity(); + if (filter == null) + this.theTank = LiquidManager.getInstance().new StandardTank(maxTank); + if (filter != null) + this.theTank = LiquidManager.getInstance().new FilteredTank(maxTank, filter); + IFluidTank[] tankArray = new IFluidTank[1]; + tankArray[0] = theTank; + dataWatcher.addObject(4, 0); + this.dataWatcher.addObject(23, 0); + } + + @Override + public abstract int getSizeInventory(); + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + this.theTank.writeToNBT(nbttagcompound); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + this.theTank.readFromNBT(nbttagcompound); + } + + @Override + public void onUpdate() { + super.onUpdate(); + if (worldObj.isRemote) + return; + if (theTank != null && theTank.getFluid() != null) { + this.dataWatcher.updateObject(23, theTank.getFluid().amount); + this.dataWatcher.updateObject(4, theTank.getFluid().getFluidID()); + } else if (theTank != null && theTank.getFluid() == null) { + this.dataWatcher.updateObject(23, 0); + this.dataWatcher.updateObject(4, 0); + } + } + + /** + * handle mass depending on items and liquid + */ + @Override + protected void handleMass() { + if (this.updateTicks % 10 != 0) return; + double preciseAmount = 0; + this.mass = this.getDefaultMass(); + if (theTank != null && theTank.getFluid() != null && theTank.getFluid().amount > 0) { + preciseAmount = theTank.getFluid().amount; + } + this.itemInsideCount = 0; + for (int i = 0; i < getSizeInventory(); i++) { + ItemStack itemstack = getStackInSlot(i); + if (itemstack != null && itemstack.stackSize > 0) { + this.itemInsideCount += itemstack.stackSize; + } + } + mass += (this.itemInsideCount * 0.0001);//1 item = 1 kilo + mass += (preciseAmount / 10000);//1 bucket = 1 kilo + } + + /** + * added for SMP, used by the HUD + * + * @return + */ + public int getWater() { + return (this.dataWatcher.getWatchableObjectInt(23)); + } + + /** + * used by the GUI + * + * @return int + */ + public int getLiquidItemID() { + return (this.dataWatcher.getWatchableObjectInt(4)); + } + + public int getCartTankCapacity() { + return maxTank; + } + + public StandardTank getTank() { + return theTank; + } + + private void placeInInvent(ItemStack itemstack1, Tender tender) { + for (int i = 1; i < tender.tenderItems.length; i++) { + if (tender.tenderItems[i] == null) { + tender.tenderItems[i] = itemstack1; + return; + } else if (tender.tenderItems[i] != null && tender.tenderItems[i].getItem() == itemstack1.getItem() && itemstack1.isStackable() && + (!itemstack1.getHasSubtypes() || tender.tenderItems[i].getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(tender.tenderItems[i], itemstack1)) { + int var9 = tender.tenderItems[i].stackSize + itemstack1.stackSize; + if (var9 <= tender.tenderItems[i].getMaxStackSize()) { + tender.tenderItems[i].stackSize = var9; + return; + } else if (tender.tenderItems[i].stackSize < tender.tenderItems[i].getMaxStackSize()) { + tender.tenderItems[i].stackSize += 1; + return; + } + } else if (i == tender.tenderItems.length - 1) { + entityDropItem(itemstack1, 1); + return; + } + } + } + + public void liquidInSlot(ItemStack itemstack, Tender tender) { + if (worldObj.isRemote) + return; + this.update += 1; + if (this.update % 8 == 0 && itemstack != null) { + ItemStack result = LiquidManager.getInstance().processContainer(this, 0, this, itemstack); + if (result != null) { + placeInInvent(result, tender); + decrStackSize(0, 1); + } + } + } + + protected void checkInvent(ItemStack tenderInvent, Tender loco) { + if (tenderInvent != null) { + liquidInSlot(tenderInvent, loco); + } + + if (ticksExisted % 5 == 0 && fill(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), false) == 100) { + FluidStack drain = null; + blocksToCheck = new TileEntity[]{worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY - 1), MathHelper.floor_double(posZ)), + worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 2), MathHelper.floor_double(posZ)), + worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 3), MathHelper.floor_double(posZ)), + worldObj.getTileEntity(MathHelper.floor_double(posX), MathHelper.floor_double(posY + 4), MathHelper.floor_double(posZ)) + }; + + for (TileEntity block : blocksToCheck) { + if (drain == null && block instanceof IFluidHandler) { + for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { + if (((IFluidHandler) block).drain(direction, 100, false) != null && + ((IFluidHandler) block).drain(direction, 100, false).fluid == FluidRegistry.WATER && + ((IFluidHandler) block).drain(direction, 100, false).amount == 100 + ) { + drain = ((IFluidHandler) block).drain( + direction, 100, true); + } + } + } + } + if (drain == null && cartLinked1 instanceof LiquidTank + && !(cartLinked1 instanceof EntityBUnitEMDF7) && !(cartLinked1 instanceof EntityBUnitEMDF3) && !(cartLinked1 instanceof EntityBUnitDD35)) { + if (getFluid() == null) { + drain = ((LiquidTank) cartLinked1).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); + } else if (getFluid().getFluid() == FluidRegistry.WATER) { + drain = ((LiquidTank) cartLinked1).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); + } + } else if (drain == null && cartLinked2 instanceof LiquidTank + && !(cartLinked1 instanceof EntityBUnitEMDF7) && !(cartLinked1 instanceof EntityBUnitEMDF3) && !(cartLinked1 instanceof EntityBUnitDD35)) { + if (getFluid() == null) { + drain = ((LiquidTank) cartLinked2).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); + } else if (getFluid().getFluid() == FluidRegistry.WATER) { + drain = ((LiquidTank) cartLinked2).drain(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 100), true); + } + } + if (drain != null) { + fill(ForgeDirection.UNKNOWN, drain, true); + } + } + } + + /*IInventory implements*/ + @Override + public ItemStack getStackInSlot(int i) { + return tenderItems[i]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.tenderItems[par1] != null) { + ItemStack var2 = this.tenderItems[par1]; + this.tenderItems[par1] = null; + return var2; + } else { + return null; + } + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if (tenderItems[i] != null) { + if (tenderItems[i].stackSize <= j) { + ItemStack itemstack = tenderItems[i]; + tenderItems[i] = null; + return itemstack; + } + ItemStack itemstack1 = tenderItems[i].splitStack(j); + if (tenderItems[i].stackSize == 0) { + tenderItems[i] = null; + } + return itemstack1; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + tenderItems[i] = itemstack; + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { + itemstack.stackSize = getInventoryStackLimit(); + } + } + + public void setLiquid(FluidStack liquid) { + } + + public void setCapacity(int capacity) { + this.maxTank = capacity; + } + + public int getCapacity() { + return this.maxTank; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { return theTank.fill(resource, doFill); } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - if (resource == null || !resource.isFluidEqual(theTank.getFluid())) - { + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (resource == null || !resource.isFluidEqual(theTank.getFluid())) { return null; } return theTank.drain(resource.amount, doDrain); } @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { return theTank.drain(maxDrain, doDrain); } @Override - public boolean canFill(ForgeDirection from, Fluid fluid) - { + public boolean canFill(ForgeDirection from, Fluid fluid) { return true; } @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) - { + public boolean canDrain(ForgeDirection from, Fluid fluid) { return true; } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { - return new FluidTankInfo[] { theTank.getInfo() }; + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[]{theTank.getInfo()}; } - - public FluidStack getFluid() - { + + public FluidStack getFluid() { return theTank.getFluid(); } - public int getFluidAmount() - { + public int getFluidAmount() { return theTank.getFluidAmount(); } - @Override - public void dropCartAsItem(boolean isCreative){ - if(!itemdropped) { - super.dropCartAsItem(isCreative); - for (ItemStack stack : tenderItems) { - if (stack != null) { - entityDropItem(stack, 0); - } - } - } - } + @Override + public void dropCartAsItem(boolean isCreative) { + if (!itemdropped) { + super.dropCartAsItem(isCreative); + for (ItemStack stack : tenderItems) { + if (stack != null) { + entityDropItem(stack, 0); + } + } + } + } } \ No newline at end of file diff --git a/src/main/java/train/common/api/TrainRecord.java b/src/main/java/train/common/api/TrainRecord.java index ff42ef1a2f..5682bfc011 100644 --- a/src/main/java/train/common/api/TrainRecord.java +++ b/src/main/java/train/common/api/TrainRecord.java @@ -1,5 +1,6 @@ package train.common.api; +import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.world.World; @@ -49,7 +50,7 @@ public List getLiveries() { public abstract double getBogieLocoPosition(); - public abstract Class getEntityClass(); + public abstract Class getEntityClass(); public abstract int getGuiRenderScale(); @@ -156,7 +157,7 @@ public double getBogieLocoPosition() { } @Override - public Class getEntityClass() { + public Class getEntityClass() { return entityClass; } @@ -202,5 +203,4 @@ public AbstractTrains getEntity(World world, double x, double y, double z) { } }; } - } diff --git a/src/main/java/train/common/api/TrainSoundRecord.java b/src/main/java/train/common/api/TrainSoundRecord.java index e14d75dd4e..11b5e505b3 100644 --- a/src/main/java/train/common/api/TrainSoundRecord.java +++ b/src/main/java/train/common/api/TrainSoundRecord.java @@ -2,7 +2,7 @@ public interface TrainSoundRecord { - Class getEntityClass(); + Class getEntityClass(); String getHornString(); @@ -16,9 +16,9 @@ public interface TrainSoundRecord { Float getIdleVolume(); - int getRunSoundLenght(); + int getRunSoundLength(); - int getIdleSoundLenght(); + int getIdleSoundLength(); boolean getSoundChangeWithSpeed(); } diff --git a/src/main/java/train/common/api/TrainsItems.java b/src/main/java/train/common/api/TrainsItems.java index d2bebd2c75..81b5175f80 100644 --- a/src/main/java/train/common/api/TrainsItems.java +++ b/src/main/java/train/common/api/TrainsItems.java @@ -7,62 +7,62 @@ /** * This class contains a registry of all currently active Trains mod items. Which items are registered depends on the user's settings in "TrainConfig.cfg", so the available items may vary from one installation to the next. - * + * * Initialization of the registry will occur during the BaseMod.load() function. It is strongly recommended you wait until the BaseMod.modsLoaded() function to reference the registry. - * + * * @author CovertJaguar - * + * * Modified by Spitfire4466 under authorization of CovertJaguar */ public class TrainsItems { - private static final Map registry = new TreeMap(); + private static final Map registry = new TreeMap(); - /** - * This function will return an ItemStack containing the item that corresponds to the provided tag. - * - * Generally item tags will correspond to the tags used in "TrainConfig.cfg", but there will be some exceptions. - * - * This function can and will return null for just about every item if the item is disabled via the configuration files. You must test the return value for safety. - * - * For list of available tags see the printItemTags() function. - * - * @param tag The item tag - * @param qty The stackSize of the returned item - * @return The ItemStack or null if no item exists for that tag - */ - public ItemStack getItem(String tag, int qty) { - ItemStack stack = registry.get(tag); - if (stack != null) { - stack = stack.copy(); - stack.stackSize = qty; - } - return stack; - } + /** + * This function will return an ItemStack containing the item that corresponds to the provided tag. + * + * Generally item tags will correspond to the tags used in "TrainConfig.cfg", but there will be some exceptions. + * + * This function can and will return null for just about every item if the item is disabled via the configuration files. You must test the return value for safety. + * + * For list of available tags see the printItemTags() function. + * + * @param tag The item tag + * @param qty The stackSize of the returned item + * @return The ItemStack or null if no item exists for that tag + */ + public ItemStack getItem(String tag, int qty) { + ItemStack stack = registry.get(tag); + if (stack != null) { + stack = stack.copy(); + stack.stackSize = qty; + } + return stack; + } - /** - * Registers a new item with the Registry. - * - * This should generally only be called by the mod itself while the mod is initializing during the Train.load() call. - * - * @param tag The tag name - * @param item The item - */ - public static void registerItem(String tag, ItemStack item) { - registry.put(tag, item); - } + /** + * Registers a new item with the Registry. + * + * This should generally only be called by the mod itself while the mod is initializing during the Train.load() call. + * + * @param tag The tag name + * @param item The item + */ + public static void registerItem(String tag, ItemStack item) { + registry.put(tag, item); + } - /** - * This function will print a list of all currently registered items to the console. - * - * Use this for development purposes. - */ - public static void printItemTags() { - System.out.println(); - System.out.println("Printing all registered Train mod items:"); - for (String tag : registry.keySet()) { - System.out.println(tag); - } - System.out.println(); - } + /** + * This function will print a list of all currently registered items to the console. + * + * Use this for development purposes. + */ + public static void printItemTags() { + System.out.println(); + System.out.println("Printing all registered Train mod items:"); + for (String tag : registry.keySet()) { + System.out.println(tag); + } + System.out.println(); + } } diff --git a/src/main/java/train/common/api/TrainsOnClick.java b/src/main/java/train/common/api/TrainsOnClick.java index 6e3b9985e8..23f6a72763 100644 --- a/src/main/java/train/common/api/TrainsOnClick.java +++ b/src/main/java/train/common/api/TrainsOnClick.java @@ -8,65 +8,82 @@ import train.common.library.ItemIDs; public class TrainsOnClick { - public boolean onClickWithStake(AbstractTrains train, ItemStack itemstack, EntityPlayer playerEntity, World world) { - if (itemstack != null && itemstack.getItem() == ItemIDs.stake.item && !world.isRemote && - (FMLCommonHandler.instance().getMinecraftServerInstance().isSinglePlayer() || !train.isLinked() || train.getTrainOwner().equals(playerEntity.getDisplayName()) || train.getTrainOwner().equals("") || train.getTrainOwner()==null)) { - if (playerEntity.isSneaking() && train instanceof Locomotive) { - if (!train.canBeAdjusted(train)) { - playerEntity.addChatMessage(new ChatComponentText(((EntityRollingStock) train).getTrainName() + " can be pulled, don't forget to fuel it!")); - playerEntity.addChatMessage(new ChatComponentText("Attach the BACK of this locomotive to the BACK of another locomotive. Otherwise you will encounter weird problems on turns")); - ((Locomotive) train).setCanBeAdjusted(true); - ((Locomotive) train).canBePulled = true; - ((Locomotive) train).disconnectFromServer(); + public boolean onClickWithStake(AbstractTrains train, ItemStack itemstack, EntityPlayer playerEntity, World world) { + if (itemstack != null && itemstack.getItem() == ItemIDs.stake.item && !world.isRemote && + (FMLCommonHandler.instance().getMinecraftServerInstance().isSinglePlayer() || !train.isLinked() || train.getTrainOwner().equals(playerEntity.getDisplayName()) || train.getTrainOwner().isEmpty() || train.getTrainOwner() == null)) { + if (playerEntity.isSneaking() && train instanceof Locomotive) { + if (!train.canBeAdjusted(train)) { + playerEntity.addChatMessage(new ChatComponentText(((EntityRollingStock) train).getTrainName() + " can be pulled, don't forget to fuel it!")); + playerEntity.addChatMessage(new ChatComponentText("Attach the BACK of this locomotive to the BACK of another locomotive. Otherwise you will encounter weird problems on turns")); + ((Locomotive) train).setCanBeAdjusted(true); + ((Locomotive) train).canBePulled = true; + ((Locomotive) train).disconnectFromServer(); + } else { + playerEntity.addChatMessage(new ChatComponentText(((EntityRollingStock) train).getTrainName() + " can pull")); + ((Locomotive) train).setCanBeAdjusted(false); + ((Locomotive) train).canBePulled = false; + } + return true; + } + + if (!train.isAttaching) { + train.isAttaching = true; + playerEntity.addChatMessage(new ChatComponentText("Attaching mode on for: " + ((EntityRollingStock) train).getTrainName())); + itemstack.damageItem(1, playerEntity); + } else { + playerEntity.addChatMessage(new ChatComponentText("Reset, click again to couple new cart to this one")); + train.Link1 = -1; + train.Link2 = -1; + if (train.cartLinked1 != null && train.cartLinked1.Link1 == train.getUniqueTrainID()) { + train.cartLinked1.Link1 = -1; } - else { - playerEntity.addChatMessage(new ChatComponentText(((EntityRollingStock) train).getTrainName() + " can pull")); - ((Locomotive) train).setCanBeAdjusted(false); - ((Locomotive) train).canBePulled = false; + + if (train.cartLinked1 != null && train.cartLinked1.Link2 == train.getUniqueTrainID()) { + train.cartLinked1.Link2 = -1; } - return true; - } - if (!train.isAttaching) { - train.isAttaching = true; - playerEntity.addChatMessage(new ChatComponentText("Attaching mode on for: " + ((EntityRollingStock) train).getTrainName())); - itemstack.damageItem(1, playerEntity); - } - else { - playerEntity.addChatMessage(new ChatComponentText("Reset, click again to couple new cart to this one")); - train.Link1 = -1; - train.Link2 = -1; - if(train.cartLinked1!=null && train.cartLinked1.Link1==train.getUniqueTrainID())train.cartLinked1.Link1=-1; - if(train.cartLinked1!=null && train.cartLinked1.Link2==train.getUniqueTrainID())train.cartLinked1.Link2=-1; - if(train.cartLinked2!=null && train.cartLinked2.Link1==train.getUniqueTrainID())train.cartLinked2.Link1=-1; - if(train.cartLinked2!=null && train.cartLinked2.Link2==train.getUniqueTrainID())train.cartLinked2.Link2=-1; - - if(train.cartLinked1!=null && train.cartLinked1.cartLinked1!=null &&train.cartLinked1.cartLinked1.equals(train))train.cartLinked1.cartLinked1=null; - if(train.cartLinked1!=null && train.cartLinked1.cartLinked2!=null &&train.cartLinked1.cartLinked2.equals(train))train.cartLinked1.cartLinked2=null; - if(train.cartLinked2!=null && train.cartLinked2.cartLinked2!=null &&train.cartLinked2.cartLinked2.equals(train))train.cartLinked2.cartLinked2=null; - if(train.cartLinked2!=null && train.cartLinked2.cartLinked1!=null &&train.cartLinked2.cartLinked1.equals(train))train.cartLinked2.cartLinked1=null; - - - train.cartLinked1 = null; - train.cartLinked2 = null; - train.isAttaching = false; - train.isAttached = false; + if (train.cartLinked2 != null && train.cartLinked2.Link1 == train.getUniqueTrainID()) { + train.cartLinked2.Link1 = -1; + } - if (((EntityRollingStock) train).train != null) { - ((EntityRollingStock) train).train.resetTrain(); + if (train.cartLinked2 != null && train.cartLinked2.Link2 == train.getUniqueTrainID()) { + train.cartLinked2.Link2 = -1; } - - - if (((EntityRollingStock) train).train != null && ((EntityRollingStock) train).train.getTrains().size() <= 1) { - /** no more @RollingStocks in the train then remove the train object from the global list */ - EntityRollingStock.allTrains.remove(((EntityRollingStock) train).train); - //System.out.println("Train is destroyed, remove it from the global array"); + + if (train.cartLinked1 != null && train.cartLinked1.cartLinked1 != null && train.cartLinked1.cartLinked1.equals(train)) { + train.cartLinked1.cartLinked1 = null; } - } - return true; - } - else { - return false; - } - } + + if (train.cartLinked1 != null && train.cartLinked1.cartLinked2 != null && train.cartLinked1.cartLinked2.equals(train)) { + train.cartLinked1.cartLinked2 = null; + } + + if (train.cartLinked2 != null && train.cartLinked2.cartLinked2 != null && train.cartLinked2.cartLinked2.equals(train)) { + train.cartLinked2.cartLinked2 = null; + } + + if (train.cartLinked2 != null && train.cartLinked2.cartLinked1 != null && train.cartLinked2.cartLinked1.equals(train)) { + train.cartLinked2.cartLinked1 = null; + } + + train.cartLinked1 = null; + train.cartLinked2 = null; + train.isAttaching = false; + train.isAttached = false; + + if (train.train != null) { + train.train.resetTrain(); + } + + if (train.train != null && train.train.getTrains().size() <= 1) { + /** no more @RollingStocks in the train then remove the train object from the global list */ + EntityRollingStock.allTrains.remove(train.train); + //System.out.println("Train is destroyed, remove it from the global array"); + } + } + return true; + } else { + return false; + } + } } diff --git a/src/main/java/train/common/api/TrainsSignal.java b/src/main/java/train/common/api/TrainsSignal.java index e6467e4343..42e748304a 100644 --- a/src/main/java/train/common/api/TrainsSignal.java +++ b/src/main/java/train/common/api/TrainsSignal.java @@ -4,81 +4,71 @@ import train.common.library.BlockIDs; public class TrainsSignal { - // ***Signal behavior***/ - public static int isSignal(double motionX, double motionZ, int i, int j, int k, World worldObj) { - int action = 0;// stupid name - // equals 1 if there is a signal near, carts slows down - // equals 2 if the signal is two blocks away, the carts can't move + // ***Signal behavior***/ + public static int isSignal(double motionX, double motionZ, int i, int j, int k, World worldObj) { + int action = 0;// stupid name + // equals 1 if there is a signal near, carts slows down + // equals 2 if the signal is two blocks away, the carts can't move - int l = 1;// no idea + int l = 1;// no idea - /* Basically checks if there is a signal somewhere in front of the cart, using the speed */ - /* t represents the distance to the signal */ - //@SuppressWarnings("unused") TileSignal te = (TileSignal) worldObj.getTileEntity(i, j, k); + /* Basically checks if there is a signal somewhere in front of the cart, using the speed */ + /* t represents the distance to the signal */ + //@SuppressWarnings("unused") TileSignal te = (TileSignal) worldObj.getTileEntity(i, j, k); - if ((motionX > 0) && motionZ == 0) { - for (int t = 0; t < 12; t++) { - if ((worldObj.getBlock(i + t, j, k + l) == BlockIDs.signal.block) || (worldObj.getBlock(i + t, j, k - l) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front - action = 1; - if (t == 2) { - action = 2; - } - t = 12; - } - else { - action = 0; - } - } - /* North */ - } - else if ((motionX < 0) && motionZ == 0) { - for (int t = 0; t < 12; t++) { - if ((worldObj.getBlock(i - t, j, k + l) == BlockIDs.signal.block) || (worldObj.getBlock(i - t, j, k - l) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front - action = 1; - if (t == 2) { - action = 2; - } - t = 12; - } - else { - action = 0; - } - } - /* EAST */ - } - else if ((motionZ > 0) && motionX == 0) { - // k - = front - for (int t = 0; t < 12; t++) { - if ((worldObj.getBlock(i + l, j, k + t) == BlockIDs.signal.block) || (worldObj.getBlock(i - l, j, k + t) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front - action = 1; - if (t == 2) { - action = 2; - } - t = 12; - } - else { - action = 0; - } - } - /* WEST */ - } - else if ((motionZ < 0) && motionX == 0) { - for (int t = 0; t < 12; t++) { - if ((worldObj.getBlock(i + l, j, k - t) == BlockIDs.signal.block) || (worldObj.getBlock(i - l, j, k - t) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front - action = 1; - if (t == 2) { - action = 2; - } - t = 12; - } - else { - action = 0; - } - } - } - else { - action = 0; - } - return action; - } + if ((motionX > 0) && motionZ == 0) { + for (int t = 0; t < 12; t++) { + if ((worldObj.getBlock(i + t, j, k + l) == BlockIDs.signal.block) || (worldObj.getBlock(i + t, j, k - l) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front + action = 1; + if (t == 2) { + action = 2; + } + t = 12; + } else { + action = 0; + } + } + /* North */ + } else if ((motionX < 0) && motionZ == 0) { + for (int t = 0; t < 12; t++) { + if ((worldObj.getBlock(i - t, j, k + l) == BlockIDs.signal.block) || (worldObj.getBlock(i - t, j, k - l) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front + action = 1; + if (t == 2) { + action = 2; + } + t = 12; + } else { + action = 0; + } + } + /* EAST */ + } else if ((motionZ > 0) && motionX == 0) { + // k - = front + for (int t = 0; t < 12; t++) { + if ((worldObj.getBlock(i + l, j, k + t) == BlockIDs.signal.block) || (worldObj.getBlock(i - l, j, k + t) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front + action = 1; + if (t == 2) { + action = 2; + } + t = 12; + } else { + action = 0; + } + } + /* WEST */ + } else if ((motionZ < 0) && motionX == 0) { + for (int t = 0; t < 12; t++) { + if ((worldObj.getBlock(i + l, j, k - t) == BlockIDs.signal.block) || (worldObj.getBlock(i - l, j, k - t) == BlockIDs.signal.block)) {// k = sides, j= heigh, i front + action = 1; + if (t == 2) { + action = 2; + } + t = 12; + } else { + action = 0; + } + } + } + return action; + } } \ No newline at end of file diff --git a/src/main/java/train/common/api/WirelessTransmitter.java b/src/main/java/train/common/api/WirelessTransmitter.java index ea4ee9fe59..c781534117 100644 --- a/src/main/java/train/common/api/WirelessTransmitter.java +++ b/src/main/java/train/common/api/WirelessTransmitter.java @@ -5,7 +5,6 @@ public interface WirelessTransmitter { void receiveMessage(PDMMessage message); - void sendMessage(PDMMessage message); - + void sendMessage(PDMMessage message); } diff --git a/src/main/java/train/common/core/handlers/EntityHandler.java b/src/main/java/train/common/core/handlers/EntityHandler.java index 4866777e79..a92fd861a6 100644 --- a/src/main/java/train/common/core/handlers/EntityHandler.java +++ b/src/main/java/train/common/core/handlers/EntityHandler.java @@ -35,8 +35,8 @@ public static void init() { } public static Entity getEntityServer(World world, int entityId) { - if ((world != null) && (world instanceof WorldServer)) { - return ((WorldServer) world).getEntityByID(entityId); + if ((world instanceof WorldServer)) { + return world.getEntityByID(entityId); } return null; } diff --git a/src/main/java/train/common/entity/rollingStock/EntityTankWagon.java b/src/main/java/train/common/entity/rollingStock/EntityTankWagon.java index 3d73960c50..11039b7c77 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityTankWagon.java +++ b/src/main/java/train/common/entity/rollingStock/EntityTankWagon.java @@ -9,106 +9,109 @@ import net.minecraftforge.common.util.Constants; import train.common.Traincraft; import train.common.api.LiquidTank; -import train.common.library.EnumTrains; import train.common.library.GuiIDs; public class EntityTankWagon extends LiquidTank { - public int freightInventorySize; - public EntityTankWagon(World world) { - super(world); - initFreightWater(); - } - - public void initFreightWater() { - freightInventorySize = 2; - cargoItems = new ItemStack[freightInventorySize]; - } - public EntityTankWagon(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + (double) yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - public void onUpdate() { - super.onUpdate(); - checkInvent(cargoItems[0]); - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - nbttagcompound.setTag("Items", nbttaglist); - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - } - - @Override - public String getInventoryName() { - return "Tank cart"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!this.worldObj.isRemote) { - entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); - } - return true; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return (!isDead && entityplayer.getDistanceSqToEntity(this) <= 64D); - } - @Override - public boolean isStorageCart() { - return true; - } - - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 1.7F; - } + public int freightInventorySize; + + public EntityTankWagon(World world) { + super(world); + initFreightWater(); + } + + public void initFreightWater() { + freightInventorySize = 2; + cargoItems = new ItemStack[freightInventorySize]; + } + + public EntityTankWagon(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + (double) yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + checkInvent(cargoItems[0]); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + @Override + public String getInventoryName() { + return "Tank cart"; + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if (super.interactFirst(entityplayer)) { + return false; + } + + if (!this.worldObj.isRemote) { + entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); + } + return true; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + return (!isDead && entityplayer.getDistanceSqToEntity(this) <= 64D); + } + + @Override + public boolean isStorageCart() { + return true; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 1.7F; + } } \ No newline at end of file diff --git a/src/main/java/train/common/entity/rollingStock/EntityTankWagonUS.java b/src/main/java/train/common/entity/rollingStock/EntityTankWagonUS.java index 27ed73e7f4..71bfad27ac 100644 --- a/src/main/java/train/common/entity/rollingStock/EntityTankWagonUS.java +++ b/src/main/java/train/common/entity/rollingStock/EntityTankWagonUS.java @@ -13,103 +13,104 @@ import train.common.library.GuiIDs; public class EntityTankWagonUS extends LiquidTank { - public int freightInventorySize; - - public EntityTankWagonUS(World world) { - super(world); - initFreightWater(); - } - - public void initFreightWater() { - freightInventorySize = 2; - cargoItems = new ItemStack[freightInventorySize]; - } - - public EntityTankWagonUS(World world, double d, double d1, double d2) { - this(world); - setPosition(d, d1 + (double) yOffset, d2); - motionX = 0.0D; - motionY = 0.0D; - motionZ = 0.0D; - prevPosX = d; - prevPosY = d1; - prevPosZ = d2; - } - - @Override - public void setDead() { - super.setDead(); - isDead = true; - } - - @Override - public void onUpdate() { - super.onUpdate(); - checkInvent(cargoItems[0]); - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - super.writeEntityToNBT(nbttagcompound); - - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < cargoItems.length; i++) { - if (cargoItems[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - cargoItems[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - super.readEntityFromNBT(nbttagcompound); - - NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); - cargoItems = new ItemStack[getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getByte("Slot") & 0xff; - if (j >= 0 && j < cargoItems.length) { - cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); - } - } - } - - @Override - public String getInventoryName() { - return "Tank cart"; - } - - @Override - public int getSizeInventory() { - return freightInventorySize; - } - - @Override - public boolean interactFirst(EntityPlayer entityplayer) { - if ((super.interactFirst(entityplayer))) { - return false; - } - if (!this.worldObj.isRemote) { - entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); - } - return true; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return !isDead && entityplayer.getDistanceSqToEntity(this) <= 64D; - } - - @Override - public boolean isStorageCart() { - return true; - } - @Override - public float getOptimalDistance(EntityMinecart cart) { - return 1.6F; - } + public int freightInventorySize; + + public EntityTankWagonUS(World world) { + super(world); + initFreightWater(); + } + + public void initFreightWater() { + freightInventorySize = 2; + cargoItems = new ItemStack[freightInventorySize]; + } + + public EntityTankWagonUS(World world, double d, double d1, double d2) { + this(world); + setPosition(d, d1 + (double) yOffset, d2); + motionX = 0.0D; + motionY = 0.0D; + motionZ = 0.0D; + prevPosX = d; + prevPosY = d1; + prevPosZ = d2; + } + + @Override + public void setDead() { + super.setDead(); + isDead = true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + checkInvent(cargoItems[0]); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < cargoItems.length; i++) { + if (cargoItems[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + cargoItems[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); + + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + cargoItems = new ItemStack[getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j < cargoItems.length) { + cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + @Override + public String getInventoryName() { + return "Tank cart"; + } + + @Override + public int getSizeInventory() { + return freightInventorySize; + } + + @Override + public boolean interactFirst(EntityPlayer entityplayer) { + if ((super.interactFirst(entityplayer))) { + return false; + } + if (!this.worldObj.isRemote) { + entityplayer.openGui(Traincraft.instance, GuiIDs.LIQUID, worldObj, this.getEntityId(), -1, (int) this.posZ); + } + return true; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + return !isDead && entityplayer.getDistanceSqToEntity(this) <= 64D; + } + + @Override + public boolean isStorageCart() { + return true; + } + + @Override + public float getOptimalDistance(EntityMinecart cart) { + return 1.6F; + } } \ No newline at end of file diff --git a/src/main/java/train/common/library/EnumSounds.java b/src/main/java/train/common/library/EnumSounds.java index 6eafaf7e83..e58c6e2e95 100644 --- a/src/main/java/train/common/library/EnumSounds.java +++ b/src/main/java/train/common/library/EnumSounds.java @@ -6,243 +6,243 @@ public enum EnumSounds implements TrainSoundRecord { - locoCherepanov(EntityLocoSteamCherepanov.class, "steam_horn", 0.6F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoHeavySteam(EntityLocoSteamHeavy.class, "hancock_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteam(EntityLocoSteam4_4_0.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoA4(EntityLocoSteamMallardA4.class, "a4_whistle", 0.6F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamBig(EntityLocoSteamHeavy.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamBR01_DB(EntityLocoSteamBR01_DB.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamBR80_DB(EntityLocoSteamBR80_DB.class, "german_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamEr_USSR(EntityLocoSteamEr_Ussr.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamPannier(EntityLocoSteamPannier.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamC41(EntityLocoSteamC41.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamBR_Black_5(EntityLocoSteamBR_Black_5.class, "StanierHooter", 1F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamBR_Britannia_Class(EntityLocoSteamBR_Britannia_Class.class, "BritanniaWhistle", 1F, "BritanniaMediumChuff", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamRWType3(EntityLocoSteamRWType3.class, "RW_type_3", 1.2F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamRWType2(EntityLocoSteamRWType2.class, "type_2", 1.4F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamGWR42xx(EntityLocoSteamGWR42xx.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamGWR72xx(EntityLocoSteamGWR72xx.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamGWR101Class(EntityLocoSteamGWR101Class.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamWWCPClass062T(EntityLocoSteamWWCPClass062T.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamC41080(EntityLocoSteamC41_080.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamfowler(EntityLocoSteamFowler.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamberk765(EntityLocoSteamBerk765.class, "class62_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamberk1225(EntityLocoSteamBerk1225.class, "class62_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamAlcoSC4(EntityLocoSteamAlcoSC4.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamS100UK(EntityLocoSteamUSATCUK.class, "german_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamS100US(EntityLocoSteamUSATCUS.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamHallClass(EntityLocoSteamHallClass.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamKingClass(EntityLocoSteamKingClass.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamSouthern1102(EntityLocoSteamSouthern1102.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamC41T(EntityLocoSteamC41T.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoSteamForney(EntityLocoSteamForneyRed.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamMogul(EntityLocoSteamMogulBlue.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamSmall(EntityLocoSteamSmall.class, "steam_horn", 0.5F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamShay(EntityLocoSteamShay.class, "shay_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamClass62(EntityLocoSteamC62Class.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamD51S(EntityLocoSteamD51.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamD51L(EntityLocoSteamD51Long.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamSnowPlow(EntityLocoSteamSnowPlow.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoSteamAdler(EntityLocoSteamAdler.class, "adler_whistle", 0.8F, "adler_run", 0.2F, 20, "adler_run", 0.2F, 20, - true), - GS4(EntityLocoSteamGS4.class, "american_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - MILWClassA(EntityLocoSteamMILWClassA.class, "american_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoAlice(EntityLocoSteamAlice0_4_0.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, - true), - locoElectricBR_MK2F_DBSO(EntityElectricBR_MK2F_DBSO.class, "british_two_tone", 0.8F, "", 0F, 0, "", 0F, 0, false), - locoElectricBR_MK3_DVT(EntityElectricBR_MK3_DVT.class, "mg_horn", 1F, "", 0F, 0, "", 0F, 0, false), - locoElectricBR_MK4_DVT(EntityElectricBR_MK4_DVT.class, "mg_horn", 1F, "", 0F, 0, "", 0F, 0, false), - locoGLYN(EntityLocoSteamGLYN042T.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, - true), - locovb(EntityLocoSteam040VB.class, "adler_whistle", 0.8F, "adler_run", 0.2F, 20, "adler_run", 0.2F, 20, true), - locosvbShay(EntityLocoSteamVBShay.class, "shay_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - loco262T(EntityLocoSteam262T.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - locoClimax(EntityLocoSteamClimax.class, "shay_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - locoCoranationClass(EntityLocoSteamCoranationClass.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", - 0.4F, 20, true), + locoCherepanov(EntityLocoSteamCherepanov.class, "steam_horn", 0.6F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoHeavySteam(EntityLocoSteamHeavy.class, "hancock_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteam(EntityLocoSteam4_4_0.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoA4(EntityLocoSteamMallardA4.class, "a4_whistle", 0.6F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamBig(EntityLocoSteamHeavy.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamBR01_DB(EntityLocoSteamBR01_DB.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamBR80_DB(EntityLocoSteamBR80_DB.class, "german_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamEr_USSR(EntityLocoSteamEr_Ussr.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamPannier(EntityLocoSteamPannier.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamC41(EntityLocoSteamC41.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamBR_Black_5(EntityLocoSteamBR_Black_5.class, "StanierHooter", 1F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamBR_Britannia_Class(EntityLocoSteamBR_Britannia_Class.class, "BritanniaWhistle", 1F, "BritanniaMediumChuff", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamRWType3(EntityLocoSteamRWType3.class, "RW_type_3", 1.2F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamRWType2(EntityLocoSteamRWType2.class, "type_2", 1.4F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamGWR42xx(EntityLocoSteamGWR42xx.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamGWR72xx(EntityLocoSteamGWR72xx.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamGWR101Class(EntityLocoSteamGWR101Class.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamWWCPClass062T(EntityLocoSteamWWCPClass062T.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamC41080(EntityLocoSteamC41_080.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamfowler(EntityLocoSteamFowler.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamberk765(EntityLocoSteamBerk765.class, "class62_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamberk1225(EntityLocoSteamBerk1225.class, "class62_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamAlcoSC4(EntityLocoSteamAlcoSC4.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamS100UK(EntityLocoSteamUSATCUK.class, "german_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamS100US(EntityLocoSteamUSATCUS.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamHallClass(EntityLocoSteamHallClass.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamKingClass(EntityLocoSteamKingClass.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamSouthern1102(EntityLocoSteamSouthern1102.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamC41T(EntityLocoSteamC41T.class, "american_steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoSteamForney(EntityLocoSteamForneyRed.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamMogul(EntityLocoSteamMogulBlue.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamSmall(EntityLocoSteamSmall.class, "steam_horn", 0.5F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamShay(EntityLocoSteamShay.class, "shay_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamClass62(EntityLocoSteamC62Class.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamD51S(EntityLocoSteamD51.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamD51L(EntityLocoSteamD51Long.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamSnowPlow(EntityLocoSteamSnowPlow.class, "class62_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoSteamAdler(EntityLocoSteamAdler.class, "adler_whistle", 0.8F, "adler_run", 0.2F, 20, "adler_run", 0.2F, 20, + true), + GS4(EntityLocoSteamGS4.class, "american_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + MILWClassA(EntityLocoSteamMILWClassA.class, "american_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoAlice(EntityLocoSteamAlice0_4_0.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, + true), + locoElectricBR_MK2F_DBSO(EntityElectricBR_MK2F_DBSO.class, "british_two_tone", 0.8F, "", 0F, 0, "", 0F, 0, false), + locoElectricBR_MK3_DVT(EntityElectricBR_MK3_DVT.class, "mg_horn", 1F, "", 0F, 0, "", 0F, 0, false), + locoElectricBR_MK4_DVT(EntityElectricBR_MK4_DVT.class, "mg_horn", 1F, "", 0F, 0, "", 0F, 0, false), + locoGLYN(EntityLocoSteamGLYN042T.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, + true), + locovb(EntityLocoSteam040VB.class, "adler_whistle", 0.8F, "adler_run", 0.2F, 20, "adler_run", 0.2F, 20, true), + locosvbShay(EntityLocoSteamVBShay.class, "shay_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + loco262T(EntityLocoSteam262T.class, "german_steam_horn", 0.8F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + locoClimax(EntityLocoSteamClimax.class, "shay_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + locoCoranationClass(EntityLocoSteamCoranationClass.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", + 0.4F, 20, true), - locoVL10(EntityLocoElectricVL10.class, "vl10_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoBR_E69(EntityLocoElectricBR_E69.class, "eu07_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoMineTrain(EntityLocoElectricMinetrain.class, "tram_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoHighSpeed(EntityLocoElectricHighSpeedZeroED.class, "high_speed_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoSubwayNY(EntityLocoElectricTramNY.class, "subway_horn", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoTramWood(EntityLocoElectricTramWood.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoElectricTW305(EntityLocoElectricTW305.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - locoIC4_DSB_MG(EntityLocoDieselIC4_DSB_MG.class, "mg_horn", 1F, "mg_run", 0.8F, 10, "mg_idle", 0.6F, 50, false), - locoSpeedGrey(EntityLocoElectricNewHighSpeed.class, "high_speed_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ICE1(EntityLocoElectricICE1.class, "mg_horn", 1F, "mg_run", 0.8F, 10, "mg_idle", 0.6F, 50, false), - E10(EntityLocoElectricE10_DB.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), - locoBR185(EntityLocoElectricBR185.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - nmbs_hle_18(EntityLocoElectricNMBS_HLE_18.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - locoClass85(EntityLocoElectricClass85.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - locoBNLRV_A(EntityLocoElectricBNLRV_A.class, "tram_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoCD742(EntityLocoDieselCD742.class, "742_horn", 0.8F, "742_motor_slow", 0.65F, 40, "742_motor", 0.65F, 40, false), - locoCD754(EntityLocoDieselCD754.class, "742_horn", 0.8F, "742_motor_slow", 0.65F, 40, "742_motor", 0.65F, 40, false), - locoChME3(EntityLocoDieselChME3.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoGP7Red(EntityLocoDieselGP7Red.class, "gp_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoBP4(EntityLocoElectricBP4.class, "nathan_k5La_3", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoFOLM1(EntityLocoDieselFOLM1.class, "nathan_p01235", 0.8F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Idle", 0.65F, 40, false), - locoKof_DB(EntityLocoDieselKof_DB.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoSD40(EntityLocoDieselSD40.class, "gp_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoWLs40(EntityLocoDieselWLs40.class, "vl10_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoBamboo(EntityLocoDieselBamboo.class, "gp_horn", 0F, "chme3_idle", 0.2F, 40, "chme3_idle", 0.1F, 40, false), - locoSD70(EntityLocoDieselSD70.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoDD35A(EntityLocoDieselDD35A.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - lococlass117(EntityLocoDieselClass117.class, "eu07_horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - lococlass121(EntityLocoDieselClass121.class, "eu07_horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - lococlass158(EntityLocoDieselClass158.class, "Class158Horn", 1.2F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - lococlass153(EntityLocoDieselClass153.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - lococlass175(EntityLocoDieselClass175.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - lococlass156(EntityLocoDieselClass156.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoClass47(EntityLocoDieselClass47.class, "Class47Horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoShunter(EntityLocoDieselShunter.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoV60_DB(EntityLocoDieselV60_DB.class, "v60_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - loco44tonSwitcher(EntityLocoDiesel44TonSwitcher.class, "v60_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoF7(EntityLocoDieselEMDF7.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - locoF3(EntityLocoDieselEMDF3.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - MILW_H1044(EntityLocoDieselMILW_H1044.class, "eu07_horn", 0.8F, "vl10_idle", 0.65F, 40, "vl10_idle", 0.65F, 40, false), - locoDeltic(EntityLocoDieselDeltic.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, - false), - locoClass66(EntityLocoDieselClass66.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, - false), - locoCD151(EntityLocoElectricCD151.class,"mg_horn", 1F, "mg_run", 0.8F, 10, "mg_idle", 0.6F, 50, false), - locoLSSP7(EntityLocoSteamLSSP7.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - E103(EntityLocoElectricE103.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), - locoElectricMetro2000(EntityElectricMetro2000Motor.class, "4300_horn", 1F,"metro2000_running", 1.5F, 70, "chme3_idle", 1F, 20, true), - //Community Port - //Not American Stuff - DieselCD810(EntityLocoDieselCD810.class, "tram_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, true), - DieselCD814(EntityLocoDieselCD814.class, "tram_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, true), - DieselClass44(EntityLocoDieselClass44.class, "british_two_tone", 0.8F, "vl10_idle", 0.65F, 40, "vl10_idle", 0.65F, 40, false), - DieselKOF_III(EntityLocoDieselKof_III.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - DieselKOF_III_M(EntityLocoDieselKof_III_M.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - DieselSM42(EntityLocoDieselSM42.class, "sm42_chime", 0.8F, "sm42_run", 0.65F, 40, "sm42_idle", 0.65F, 40, false), - ElectricClass345(EntityElectricClass345.class, "subway_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - Electric440R(EntityLocoElectric440RFront.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricBR155(EntityLocoElectricBR155.class, "br155_chime", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), - ElectricDB143(EntityLocoElectricDB143.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), - ElectricDStockEngine(EntityElectricDstockEngine.class, "dstock_whistle", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricClass230Engine(EntityElectricClass230.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricEU07(EntityLocoElectricEU07.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), - ElectricFeve3300(EntityLocoElectricFeve3300.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricILMA(EntityLocoElectricILMA.class, "subway_horn", 0.8F, "MILW_Notch8", 0.6F, 50, "MILW_Idle", 0.6F, 50, false), - ElectricILMB(EntityLocoElectricILMB.class, "subway_horn", 0.8F, "MILW_Notch8", 0.6F, 50, "MILW_Idle", 0.6F, 50, false), - ElectricLUEngine(EntityElectricLUengine.class, "dstock_whistle", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricPCH120(EntityLocoElectricPCH120.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricRenfe446Motor(EntityLocoElectricRenfe446Motor.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - ElectricRenfe450Motor(EntityLocoElectricRenfe450Motor.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - SteamC11(EntityLocoSteamC11.class, "class62_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - SteamStarClass(EntityLocoSteamStarClass.class, "adler_whistle", 0.8F, "adler_run", 0.2F, 20, "adler_run", 0.2F, 20, true), - Class43(EntityLocoDieselClass43.class, "HSTHorn", 1.2F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - Class90(EntityElectricClass90.class, "mg_horn", 1F, "Class868790Thrash", 0.8F, 10, "Class90Idle", 0.6F, 50, false), - Class91(EntityElectricClass91.class, "mg_horn", 1F, "Class868790Thrash", 0.8F, 10, "Class90Idle", 0.6F, 50, false), - Class321(EntityElectricClass321.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class389Front(EntityElectricClass389Front.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class387Front(EntityElectricClass387Front.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class378Front(EntityElectricClass378Front.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class319Engine(EntityElectricClass319.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class390Front(EntityElectricClass390.class, "PendolinoHorn", 1.4F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class374Front(EntityElectricClass374.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class442DTS(EntityElectricClass442DTS.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - asteri(EntityLocoSteamasteri.class, "asteri", 1F, "asteri", 0.2F, 212,"mg_idle", 0.6F, 50, false), - FGV4300(EntityLocoElectricFGV4300.class, "4300_horn", 1F, "vl10_idle", 0.65F, 10, "vl10_idle", 0.6F, 40, false), - Class162Engine(EntityElectricClass162.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), - Class34(EntityLocoDieselClass34.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - TW305(EntityLocoElectricTW305.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - MetalTram(EntityLocoElectricMetalTram.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - KVB_2300(EntityElectricKVB_2300.class, "tram_bell", 1F, "mg_run", 0.6F, 50, "mg_run", 0.6F, 50, false), - MA100(EntityElectricMA100_Loco.class, "4300_horn", 1F, "mg_run", 0.6F, 50, "mg_run", 0.6F, 50, false), - B80C_A(EntityElectricB80C_A.class, "tram_bell", 1F, "mg_run", 0.6F, 50, "mg_run", 0.6F, 50, false), - CQ310(EntityElectricCQ310Loco.class, "subway_horn", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - DuewagT4ER(EntityElectricDuewagT4ER.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - DuewagGT6ZRLoco(EntityElectricDuewagGT6ZRLoco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - M8CLoco(EntityElectricM8CLoco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - Class416Loco(EntityElectricClass416Loco.class, "british_two_tone", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, true), - DB420Loco(EntityElectricDB420Loco.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), - Class401Loco(EntityLocoElectricClass401.class, "mg_horn", 1F, "mg_run", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - DuewagGT6ERLoco(EntityElectricDuewagGT6ERLoco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - J50loco(EntityLocoSteamJ50.class, "a4_whistle", 1.25f, "steam_run", 0.5f, 25, "adler_run", 1f, 40, true), - SentinelY3(EntityLocoSteamSentinelY3.class, "adler_whistle", 1f, "steam_run", 0.75f, 10,"steam_run", 0.25f, 20, true), - Class142Front(EntityLocoDieselClass142.class, "british_two_tone", 1f, "chme3_idle", 0.75f, 10,"chme3_idle", 0.5f, 20, false), - Class143Front(EntityLocoDieselClass143.class, "british_two_tone", 1f, "FM_38D_6_Notch8", 0.6f, 10,"chme3_idle", 0.5f, 20, false), - Jacknail(EntitylocoSteamJacknail.class, "american_steam_horn", 1.5f, "steam_run", 0.6f, 25, "adler_run", 0.5f, 17, true), - MRcompound(EntitylocoSteamMRCompound.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), - Bagnall(EntityLocoDieselBagnall.class, "v60_horn", 1f, "chme3_idle", 0.8f, 10,"chme3_idle", 0.5f, 20, false), - Class205(EntityLocoDieselClass205loco.class, "eu07_horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), - M8DNF1Loco(EntityElectricM8DNF1Loco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoVL10(EntityLocoElectricVL10.class, "vl10_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoBR_E69(EntityLocoElectricBR_E69.class, "eu07_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoMineTrain(EntityLocoElectricMinetrain.class, "tram_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoHighSpeed(EntityLocoElectricHighSpeedZeroED.class, "high_speed_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoSubwayNY(EntityLocoElectricTramNY.class, "subway_horn", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoTramWood(EntityLocoElectricTramWood.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoElectricTW305(EntityLocoElectricTW305.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + locoIC4_DSB_MG(EntityLocoDieselIC4_DSB_MG.class, "mg_horn", 1F, "mg_run", 0.8F, 10, "mg_idle", 0.6F, 50, false), + locoSpeedGrey(EntityLocoElectricNewHighSpeed.class, "high_speed_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ICE1(EntityLocoElectricICE1.class, "mg_horn", 1F, "mg_run", 0.8F, 10, "mg_idle", 0.6F, 50, false), + E10(EntityLocoElectricE10_DB.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), + locoBR185(EntityLocoElectricBR185.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + nmbs_hle_18(EntityLocoElectricNMBS_HLE_18.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + locoClass85(EntityLocoElectricClass85.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + locoBNLRV_A(EntityLocoElectricBNLRV_A.class, "tram_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoCD742(EntityLocoDieselCD742.class, "742_horn", 0.8F, "742_motor_slow", 0.65F, 40, "742_motor", 0.65F, 40, false), + locoCD754(EntityLocoDieselCD754.class, "742_horn", 0.8F, "742_motor_slow", 0.65F, 40, "742_motor", 0.65F, 40, false), + locoChME3(EntityLocoDieselChME3.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoGP7Red(EntityLocoDieselGP7Red.class, "gp_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoBP4(EntityLocoElectricBP4.class, "nathan_k5La_3", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoFOLM1(EntityLocoDieselFOLM1.class, "nathan_p01235", 0.8F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Idle", 0.65F, 40, false), + locoKof_DB(EntityLocoDieselKof_DB.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoSD40(EntityLocoDieselSD40.class, "gp_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoWLs40(EntityLocoDieselWLs40.class, "vl10_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoBamboo(EntityLocoDieselBamboo.class, "gp_horn", 0F, "chme3_idle", 0.2F, 40, "chme3_idle", 0.1F, 40, false), + locoSD70(EntityLocoDieselSD70.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoDD35A(EntityLocoDieselDD35A.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + lococlass117(EntityLocoDieselClass117.class, "eu07_horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + lococlass121(EntityLocoDieselClass121.class, "eu07_horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + lococlass158(EntityLocoDieselClass158.class, "Class158Horn", 1.2F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + lococlass153(EntityLocoDieselClass153.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + lococlass175(EntityLocoDieselClass175.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + lococlass156(EntityLocoDieselClass156.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoClass47(EntityLocoDieselClass47.class, "Class47Horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoShunter(EntityLocoDieselShunter.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoV60_DB(EntityLocoDieselV60_DB.class, "v60_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + loco44tonSwitcher(EntityLocoDiesel44TonSwitcher.class, "v60_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoF7(EntityLocoDieselEMDF7.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + locoF3(EntityLocoDieselEMDF3.class, "sd70_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + MILW_H1044(EntityLocoDieselMILW_H1044.class, "eu07_horn", 0.8F, "vl10_idle", 0.65F, 40, "vl10_idle", 0.65F, 40, false), + locoDeltic(EntityLocoDieselDeltic.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, + false), + locoClass66(EntityLocoDieselClass66.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, + false), + locoCD151(EntityLocoElectricCD151.class, "mg_horn", 1F, "mg_run", 0.8F, 10, "mg_idle", 0.6F, 50, false), + locoLSSP7(EntityLocoSteamLSSP7.class, "american_steam_horn", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + E103(EntityLocoElectricE103.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), + locoElectricMetro2000(EntityElectricMetro2000Motor.class, "4300_horn", 1F, "metro2000_running", 1.5F, 70, "chme3_idle", 1F, 20, true), + //Community Port + //Not American Stuff + DieselCD810(EntityLocoDieselCD810.class, "tram_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, true), + DieselCD814(EntityLocoDieselCD814.class, "tram_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, true), + DieselClass44(EntityLocoDieselClass44.class, "british_two_tone", 0.8F, "vl10_idle", 0.65F, 40, "vl10_idle", 0.65F, 40, false), + DieselKOF_III(EntityLocoDieselKof_III.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + DieselKOF_III_M(EntityLocoDieselKof_III_M.class, "chme3_horn", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + DieselSM42(EntityLocoDieselSM42.class, "sm42_chime", 0.8F, "sm42_run", 0.65F, 40, "sm42_idle", 0.65F, 40, false), + ElectricClass345(EntityElectricClass345.class, "subway_horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + Electric440R(EntityLocoElectric440RFront.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricBR155(EntityLocoElectricBR155.class, "br155_chime", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), + ElectricDB143(EntityLocoElectricDB143.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), + ElectricDStockEngine(EntityElectricDstockEngine.class, "dstock_whistle", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricClass230Engine(EntityElectricClass230.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricEU07(EntityLocoElectricEU07.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), + ElectricFeve3300(EntityLocoElectricFeve3300.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricILMA(EntityLocoElectricILMA.class, "subway_horn", 0.8F, "MILW_Notch8", 0.6F, 50, "MILW_Idle", 0.6F, 50, false), + ElectricILMB(EntityLocoElectricILMB.class, "subway_horn", 0.8F, "MILW_Notch8", 0.6F, 50, "MILW_Idle", 0.6F, 50, false), + ElectricLUEngine(EntityElectricLUengine.class, "dstock_whistle", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricPCH120(EntityLocoElectricPCH120.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricRenfe446Motor(EntityLocoElectricRenfe446Motor.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + ElectricRenfe450Motor(EntityLocoElectricRenfe450Motor.class, "446Horn", 0.8F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + SteamC11(EntityLocoSteamC11.class, "class62_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + SteamStarClass(EntityLocoSteamStarClass.class, "adler_whistle", 0.8F, "adler_run", 0.2F, 20, "adler_run", 0.2F, 20, true), + Class43(EntityLocoDieselClass43.class, "HSTHorn", 1.2F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + Class90(EntityElectricClass90.class, "mg_horn", 1F, "Class868790Thrash", 0.8F, 10, "Class90Idle", 0.6F, 50, false), + Class91(EntityElectricClass91.class, "mg_horn", 1F, "Class868790Thrash", 0.8F, 10, "Class90Idle", 0.6F, 50, false), + Class321(EntityElectricClass321.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class389Front(EntityElectricClass389Front.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class387Front(EntityElectricClass387Front.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class378Front(EntityElectricClass378Front.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class319Engine(EntityElectricClass319.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class390Front(EntityElectricClass390.class, "PendolinoHorn", 1.4F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class374Front(EntityElectricClass374.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class442DTS(EntityElectricClass442DTS.class, "british_two_tone", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + asteri(EntityLocoSteamasteri.class, "asteri", 1F, "asteri", 0.2F, 212, "mg_idle", 0.6F, 50, false), + FGV4300(EntityLocoElectricFGV4300.class, "4300_horn", 1F, "vl10_idle", 0.65F, 10, "vl10_idle", 0.6F, 40, false), + Class162Engine(EntityElectricClass162.class, "mg_horn", 1F, "vl10_idle", 0.8F, 10, "vl10_idle", 0.6F, 50, false), + Class34(EntityLocoDieselClass34.class, "british_two_tone", 0.8F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + TW305(EntityLocoElectricTW305.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + MetalTram(EntityLocoElectricMetalTram.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + KVB_2300(EntityElectricKVB_2300.class, "tram_bell", 1F, "mg_run", 0.6F, 50, "mg_run", 0.6F, 50, false), + MA100(EntityElectricMA100_Loco.class, "4300_horn", 1F, "mg_run", 0.6F, 50, "mg_run", 0.6F, 50, false), + B80C_A(EntityElectricB80C_A.class, "tram_bell", 1F, "mg_run", 0.6F, 50, "mg_run", 0.6F, 50, false), + CQ310(EntityElectricCQ310Loco.class, "subway_horn", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + DuewagT4ER(EntityElectricDuewagT4ER.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + DuewagGT6ZRLoco(EntityElectricDuewagGT6ZRLoco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + M8CLoco(EntityElectricM8CLoco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + Class416Loco(EntityElectricClass416Loco.class, "british_two_tone", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, true), + DB420Loco(EntityElectricDB420Loco.class, "mg_horn", 1F, "mg_run", 0.6F, 8, "mg_idle", 0.4F, 50, false), + Class401Loco(EntityLocoElectricClass401.class, "mg_horn", 1F, "mg_run", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + DuewagGT6ERLoco(EntityElectricDuewagGT6ERLoco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), + J50loco(EntityLocoSteamJ50.class, "a4_whistle", 1.25f, "steam_run", 0.5f, 25, "adler_run", 1f, 40, true), + SentinelY3(EntityLocoSteamSentinelY3.class, "adler_whistle", 1f, "steam_run", 0.75f, 10, "steam_run", 0.25f, 20, true), + Class142Front(EntityLocoDieselClass142.class, "british_two_tone", 1f, "chme3_idle", 0.75f, 10, "chme3_idle", 0.5f, 20, false), + Class143Front(EntityLocoDieselClass143.class, "british_two_tone", 1f, "FM_38D_6_Notch8", 0.6f, 10, "chme3_idle", 0.5f, 20, false), + Jacknail(EntitylocoSteamJacknail.class, "american_steam_horn", 1.5f, "steam_run", 0.6f, 25, "adler_run", 0.5f, 17, true), + MRcompound(EntitylocoSteamMRCompound.class, "steam_horn", 0.6F, "steam_run", 0.4F, 20, "steam_run", 0.4F, 20, true), + Bagnall(EntityLocoDieselBagnall.class, "v60_horn", 1f, "chme3_idle", 0.8f, 10, "chme3_idle", 0.5f, 20, false), + Class205(EntityLocoDieselClass205loco.class, "eu07_horn", 1F, "chme3_idle", 0.65F, 40, "chme3_idle", 0.65F, 40, false), + M8DNF1Loco(EntityElectricM8DNF1Loco.class, "tram_bell", 1F, "vl10_idle", 0.6F, 50, "vl10_idle", 0.6F, 50, false), - //American Stuff - Diesel3GS21B(EntityLocoDieselBapNRE3gs21b.class, "nathan_k3ha", 2.5F, "QSK19C_Notch8", 0.65F, 40, "QSK19C_Idle", 0.65F, 50, true), - DieselB23(EntityLocoDieselBapB23.class, "nathan_m3h", 2.5F, "GE_7FDL_12_Notch8", 0.65F, 40, "GE_7FDL_12_Idle", 0.65F, 50, true), - DieselCF7Bap(EntityLocoDieselBapCF7.class, "nathan_k3la_4", 0.65F, "EMD_16_567BC_Notch8", 0.65F, 10, "EMD_16_567BC_Idle", 0.8F, 3, true), - DieselCF7(EntityLocoDieselCF7.class, "nathan_k3la", 0.65F, "EMD_16_567BC_Notch8", 0.65F, 10, "EMD_16_567BC_Idle", 0.8F, 3, true), - DieselCF7Round(EntityLocoDieselBapCF7round.class, "leslie_s3lr", 0.65F, "EMD_16_567BC_Notch8", 0.65F, 10, "EMD_16_567BC_Idle", 0.8F, 3, true), - DieselC424(EntityLocoDieselBapC424.class, "leslie_s3", 2.5F, "ALCO_16_251C_Notch8", 0.5F, 20, "ALCO_16_251C_Idle", 0.5F, 20, false), - DieselC425(EntityLocoDieselBapC425.class, "leslie_s3l", 2.5F, "ALCO_16_251C_Notch8", 0.5F, 20, "ALCO_16_251C_Idle", 0.5F, 20, false), - DieselDash840B(EntityLocoDieselBapDash840B.class, "nathan_k3la_4", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), - DieselDash840BB(EntityLocoDieselBapDash840BB.class, "Silence", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), - DieselDash840BW(EntityLocoDieselBapDash840BW.class, "leslie_s3lr", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), - DieselDash840C(EntityLocoDieselBapDash840C.class, "nathan_k5La", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), - DieselDash9C44W(EntityLocoDieselBapDash9_44CW.class, "nathan_k3la_4", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), - DieselDH643(EntityLocoDieselBapDH643.class, "nathan_p3_2", 2.5F, "ALCO_12_251C_Notch8", 0.5F, 20, "ALCO_12_251C_Idle", 0.5F, 20, false), - DieselES44(EntityLocoDieselBapES44.class, "nathan_k5hll", 1F, "GE_GEVO_12_Notch8", 0.65F, 20, "GE_GEVO_12_Idle", 0.75F, 50, true), - DieselF7A(EntityLocoDieselBapF7A.class, "leslie_a200_2", 1F, "EMD_16_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), - DieselF7B(EntityLocoDieselBapF7B.class, "Silence", 1F, "EMD_16_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), - DieselFOLM1B(EntityLocoDieselFOLM1B.class, "Silence", 0.0F,"FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Idle", 0.65F, 40, false), - DieselGP7(EntityLocoDieselBapGP7.class, "nathan_m5", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), - DieselGP7wccp(EntityLocoDieselWWCPGP7.class, "gp40_2_horn", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), - DieselGP7b(EntityLocoDieselBapGP7b.class, "leslie_a200", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), - DieselGP7u(EntityLocoDieselBapGP7u.class, "nathan_k3la_2", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), - DieselGP9(EntityLocoDieselBapGP9.class, "nathan_p5", 1F, "EMD_16_567C_Notch8", 0.9F, 8, "EMD_16_567C_Idle", 0.7F, 50, false), - DieselGP13(EntityLocoDieselGP13.class, "nathan_p6", 0.8F, "EMD_16_645E3_Notch8", 0.65F, 35, "EMD_16_645E3_Idle", 0.65F, 40, false), - DieselGP15(EntityLocoDieselGP15.class,"nathan_k3ha", 2.5F, "EMD_12_645E_Notch8", 1F, 8, "EMD_12_645E_Idle", 1F, 50, false ), - DieselGP15Bap(EntityLocoDieselBapGP15.class,"nathan_k3la", 2.5F, "EMD_12_645E_Notch8", 1F, 8, "EMD_12_645E_Idle", 1F, 50, false ), - DieselGP30(EntityLocoDieselBapGP30.class, "nathan_p5", 0.8F, "EMD_16_567D3_Notch8", 0.65F, 35, "EMD_16_567D3_Idle", 0.65F, 40, false), - DieselGP38dash2(EntityLocoDieselBapGP38dash2.class, "nathan_k3la_3", 0.8F, "EMD_16_645E_Notch8", 0.65F, 35, "EMD_16_645E_Idle", 0.65F, 40, false), - DieselGP38dash9W(EntityLocoDieselBapGP38dash9W.class, "nathan_k5la_5", 0.8F, "EMD_16_645E_Notch8", 0.65F, 35, "EMD_16_645E_Idle", 0.65F, 40, false), - DieselGP49(EntityLocoDieselBapGP49.class,"nathan_p3_3", 2.5F, "EMD_12_645E3_Notch8", 1F, 8, "EMD_12_645E3_Idle", 1F, 50, false ), - DieselGE44Ton(EntityLocoDieselGE44Ton.class, "leslie_a125", 1.0F, "CAT_8_D17000_Notch8", 0.65F, 40, "CAT_8_D17000_Idle", 0.65F, 40, false), - DieselHH600(EntityLocoDieselBapHH660.class,"leslie_a200", 2.5F, "ALCO_6_531_Notch8", 0.7F, 40, "ALCO_6_531_Notch8", 0.7F, 60, false ), - DieselH1044(EntityLocoDieselBapH1044.class, "wabco_e2", 10F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), - DieselML4000(EntityLocoDieselBapKrautt.class,"nathan_p3_2", 2.5F, "Maybach_MD870_16_Notch8", 0.7F, 40, "Maybach_MD870_16_Idle", 0.7F, 60, false ), - DieselRSD15(EntityLocoDieselBapRSD15.class, "leslie_rs5t", 1F, "ALCO_16_251C_Notch8", 0.50F, 40, "ALCO_16_251C_Idle", 0.65F, 40, true), - DieselS2(EntityLocoDieselBapAlcoS2.class, "leslie_a200", 1F, "ALCO_6_539T_Notch8", 0.50F, 40, "ALCO_6_539T_Idle", 0.65F, 40, true), - DieselSD9(EntityLocoDieselBapSD9.class, "nathan_m3", 1F, "EMD_16_567C_Notch8", 0.9F, 8, "EMD_16_567C_Idle", 0.7F, 50, false), - DieselSD40Dash2Bap(EntityLocoDieselBapSD40dash2.class, "leslie_rs3k_2", 2.5F, "EMD_16_645E3_Notch8", 0.65F, 10, "EMD_16_645E3_Idle", 0.8F, 5, true), - DieselSD70M(EntityLocoDieselBapSD70Mac.class, "nathan_k5la_4", 2F, "EMD_16_710G3B_Notch8", 0.5F, 40, "EMD_16_710G3B_Idle", 0.5F, 20, false), - DieselSWBLW(EntityLocoDieselBapBeep.class,"leslie_s3lr", 2.5F, "EMD_16_567BC_Idle", 0.7F, 40, "EMD_16_567BC_Notch8", 0.7F, 60, false ), - DieselSW1(EntityLocoDieselBapSW1.class, "leslie_a200", 0.9F, "EMD_6_567A_Notch8", 0.45F, 40, "EMD_6_567A_Idle", 0.75F, 40, false), - DieselSW8(EntityLocoDieselSW8.class, "leslie_a200", 0.9F, "EMD_8_567C_Notch8", 0.45F, 40, "EMD_8_567C_Idle", 0.75F, 40, false), - DieselSW1200(EntityLocoDieselBapSW1200.class, "nathan_p2", 0.65F, "EMD_12_567C_Notch8", 0.65F, 10, "EMD_12_567C_Idle", 0.8F, 3, true), - DieselSW1500(EntityLocoDieselBapSW1500.class, "nathan_p3", 0.65F, "EMD_12_645E_Notch8", 0.65F, 10, "EMD_12_645E_Idle", 0.8F, 3, true), - DieselU18B(EntityLocoDieselBapU18B.class, "leslie_s3", 2.5F, "GE_7FDL_8_Notch8", 0.65F, 40, "GE_7FDL_8_Idle", 0.65F, 50, true), - DieselU23B(EntityLocoDieselBapU23B.class, "leslie_s3l", 2.5F, "GE_7FDL_12_Notch8", 0.65F, 40, "GE_7FDL_12_Idle", 0.65F, 50, true), - DieselU36C(EntityLocoDieselBapU36C.class, "leslie_s3lr", 2.5F, "GE_FDL16_Notch8", 0.5F, 10, "GE_FDL16_Idle", 0.5F, 3, true), - ElectricGM6C(EntityLocoElectricBapGM6C.class, "nathan_p01235", 2.5F, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), - ElectricEF1(EntityLocoElectricBapEF1.class, "wabco_e2", 2.5F, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), - ElectricEF1B(EntityLocoElectricBapEF1B.class, "Silence", 0, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), - ElectricEP1A(EntityLocoElectricBapEP1A.class, "wabco_e2", 2.5F, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), - SteamClimax(EntityLocoSteamClimaxNew.class, "lukenhimer_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - SteamOnion(EntityLocoOnion.class, "hancock_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - SteamPE(EntityLocoSteamPELoco.class, "pe_chime", 0.8F, "pe_run", 0.2F, 20, "pe_idle", 0.2F, 20, true), - SteamVBShay(EntityLocoSteamVBShay2.class, "crosby_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - SteamSkookum(EntityLocoSteamSkook.class,"skookum_whistle", 1F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - SteamShay3Truck(EntityLocoSteamShay3Truck.class, "lukenhimer_3chime", 1F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), - DieselEMDE8A(EntityLocoDieselEMDE8A.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), - DieselEMDE8B(EntityLocoDieselEMDE8B.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), - DieselAlcoPA1(EntityLocoDieselAlcoPA1.class, "leslie_a200_2", 1F, "ALCO_16_244_Notch8", 0.25F, 40, "ALCO_16_244_Idle", 0.4F, 40, true), - DieselAlcoPB1(EntityLocoDieselAlcoPB1.class, "wabco_e2", 2.5F, "ALCO_16_244_Notch8", 0.25F, 40, "ALCO_16_244_Idle", 0.4F, 40, true), - DieselC415H(EntityLocoDieselC415H.class, "nathan_p14r2", 0.65F, "ALCO_8_251F_Notch8", 0.65F, 10, "ALCO_8_251F_Idle", 0.8F, 3, true), - DieselC415L(EntityLocoDieselC415L.class, "leslie_s3lr", 0.65F, "ALCO_8_251F_Notch8", 0.65F, 10, "ALCO_8_251F_Idle", 0.8F, 3, true), - DieselC415S(EntityLocoDieselC415S.class, "leslie_s3lr", 0.65F, "ALCO_8_251F_Notch8", 0.65F, 10, "ALCO_8_251F_Idle", 0.8F, 3, true), - DieselFMH24_66(EntityLocoDieselFMH24_66.class,"leslie_a200_2", 1F,"FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), - DieselFMH24_66L(EntityLocoDieselFMH24_66L.class,"leslie_a200_2", 1F,"FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), - DieselEMDE7A(EntityLocoDieselEMDE7A.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), - DieselEMDE7B(EntityLocoDieselEMDE7B.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), - DieselFMH16_66(EntityLocoDieselFMH16_66.class,"leslie_a200_2", 1F,"FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), + //American Stuff + Diesel3GS21B(EntityLocoDieselBapNRE3gs21b.class, "nathan_k3ha", 2.5F, "QSK19C_Notch8", 0.65F, 40, "QSK19C_Idle", 0.65F, 50, true), + DieselB23(EntityLocoDieselBapB23.class, "nathan_m3h", 2.5F, "GE_7FDL_12_Notch8", 0.65F, 40, "GE_7FDL_12_Idle", 0.65F, 50, true), + DieselCF7Bap(EntityLocoDieselBapCF7.class, "nathan_k3la_4", 0.65F, "EMD_16_567BC_Notch8", 0.65F, 10, "EMD_16_567BC_Idle", 0.8F, 3, true), + DieselCF7(EntityLocoDieselCF7.class, "nathan_k3la", 0.65F, "EMD_16_567BC_Notch8", 0.65F, 10, "EMD_16_567BC_Idle", 0.8F, 3, true), + DieselCF7Round(EntityLocoDieselBapCF7round.class, "leslie_s3lr", 0.65F, "EMD_16_567BC_Notch8", 0.65F, 10, "EMD_16_567BC_Idle", 0.8F, 3, true), + DieselC424(EntityLocoDieselBapC424.class, "leslie_s3", 2.5F, "ALCO_16_251C_Notch8", 0.5F, 20, "ALCO_16_251C_Idle", 0.5F, 20, false), + DieselC425(EntityLocoDieselBapC425.class, "leslie_s3l", 2.5F, "ALCO_16_251C_Notch8", 0.5F, 20, "ALCO_16_251C_Idle", 0.5F, 20, false), + DieselDash840B(EntityLocoDieselBapDash840B.class, "nathan_k3la_4", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), + DieselDash840BB(EntityLocoDieselBapDash840BB.class, "Silence", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), + DieselDash840BW(EntityLocoDieselBapDash840BW.class, "leslie_s3lr", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), + DieselDash840C(EntityLocoDieselBapDash840C.class, "nathan_k5La", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), + DieselDash9C44W(EntityLocoDieselBapDash9_44CW.class, "nathan_k3la_4", 2.5F, "GE_7FDL_16_Notch8", 0.65F, 40, "GE_7FDL_16_Idle", 0.65F, 50, true), + DieselDH643(EntityLocoDieselBapDH643.class, "nathan_p3_2", 2.5F, "ALCO_12_251C_Notch8", 0.5F, 20, "ALCO_12_251C_Idle", 0.5F, 20, false), + DieselES44(EntityLocoDieselBapES44.class, "nathan_k5hll", 1F, "GE_GEVO_12_Notch8", 0.65F, 20, "GE_GEVO_12_Idle", 0.75F, 50, true), + DieselF7A(EntityLocoDieselBapF7A.class, "leslie_a200_2", 1F, "EMD_16_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), + DieselF7B(EntityLocoDieselBapF7B.class, "Silence", 1F, "EMD_16_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), + DieselFOLM1B(EntityLocoDieselFOLM1B.class, "Silence", 0.0F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Idle", 0.65F, 40, false), + DieselGP7(EntityLocoDieselBapGP7.class, "nathan_m5", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), + DieselGP7wccp(EntityLocoDieselWWCPGP7.class, "gp40_2_horn", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), + DieselGP7b(EntityLocoDieselBapGP7b.class, "leslie_a200", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), + DieselGP7u(EntityLocoDieselBapGP7u.class, "nathan_k3la_2", 1F, "EMD_16_567B_Notch8", 0.9F, 8, "EMD_16_567B_Idle", 0.7F, 50, false), + DieselGP9(EntityLocoDieselBapGP9.class, "nathan_p5", 1F, "EMD_16_567C_Notch8", 0.9F, 8, "EMD_16_567C_Idle", 0.7F, 50, false), + DieselGP13(EntityLocoDieselGP13.class, "nathan_p6", 0.8F, "EMD_16_645E3_Notch8", 0.65F, 35, "EMD_16_645E3_Idle", 0.65F, 40, false), + DieselGP15(EntityLocoDieselGP15.class, "nathan_k3ha", 2.5F, "EMD_12_645E_Notch8", 1F, 8, "EMD_12_645E_Idle", 1F, 50, false), + DieselGP15Bap(EntityLocoDieselBapGP15.class, "nathan_k3la", 2.5F, "EMD_12_645E_Notch8", 1F, 8, "EMD_12_645E_Idle", 1F, 50, false), + DieselGP30(EntityLocoDieselBapGP30.class, "nathan_p5", 0.8F, "EMD_16_567D3_Notch8", 0.65F, 35, "EMD_16_567D3_Idle", 0.65F, 40, false), + DieselGP38dash2(EntityLocoDieselBapGP38dash2.class, "nathan_k3la_3", 0.8F, "EMD_16_645E_Notch8", 0.65F, 35, "EMD_16_645E_Idle", 0.65F, 40, false), + DieselGP38dash9W(EntityLocoDieselBapGP38dash9W.class, "nathan_k5la_5", 0.8F, "EMD_16_645E_Notch8", 0.65F, 35, "EMD_16_645E_Idle", 0.65F, 40, false), + DieselGP49(EntityLocoDieselBapGP49.class, "nathan_p3_3", 2.5F, "EMD_12_645E3_Notch8", 1F, 8, "EMD_12_645E3_Idle", 1F, 50, false), + DieselGE44Ton(EntityLocoDieselGE44Ton.class, "leslie_a125", 1.0F, "CAT_8_D17000_Notch8", 0.65F, 40, "CAT_8_D17000_Idle", 0.65F, 40, false), + DieselHH600(EntityLocoDieselBapHH660.class, "leslie_a200", 2.5F, "ALCO_6_531_Notch8", 0.7F, 40, "ALCO_6_531_Notch8", 0.7F, 60, false), + DieselH1044(EntityLocoDieselBapH1044.class, "wabco_e2", 10F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), + DieselML4000(EntityLocoDieselBapKrautt.class, "nathan_p3_2", 2.5F, "Maybach_MD870_16_Notch8", 0.7F, 40, "Maybach_MD870_16_Idle", 0.7F, 60, false), + DieselRSD15(EntityLocoDieselBapRSD15.class, "leslie_rs5t", 1F, "ALCO_16_251C_Notch8", 0.50F, 40, "ALCO_16_251C_Idle", 0.65F, 40, true), + DieselS2(EntityLocoDieselBapAlcoS2.class, "leslie_a200", 1F, "ALCO_6_539T_Notch8", 0.50F, 40, "ALCO_6_539T_Idle", 0.65F, 40, true), + DieselSD9(EntityLocoDieselBapSD9.class, "nathan_m3", 1F, "EMD_16_567C_Notch8", 0.9F, 8, "EMD_16_567C_Idle", 0.7F, 50, false), + DieselSD40Dash2Bap(EntityLocoDieselBapSD40dash2.class, "leslie_rs3k_2", 2.5F, "EMD_16_645E3_Notch8", 0.65F, 10, "EMD_16_645E3_Idle", 0.8F, 5, true), + DieselSD70M(EntityLocoDieselBapSD70Mac.class, "nathan_k5la_4", 2F, "EMD_16_710G3B_Notch8", 0.5F, 40, "EMD_16_710G3B_Idle", 0.5F, 20, false), + DieselSWBLW(EntityLocoDieselBapBeep.class, "leslie_s3lr", 2.5F, "EMD_16_567BC_Idle", 0.7F, 40, "EMD_16_567BC_Notch8", 0.7F, 60, false), + DieselSW1(EntityLocoDieselBapSW1.class, "leslie_a200", 0.9F, "EMD_6_567A_Notch8", 0.45F, 40, "EMD_6_567A_Idle", 0.75F, 40, false), + DieselSW8(EntityLocoDieselSW8.class, "leslie_a200", 0.9F, "EMD_8_567C_Notch8", 0.45F, 40, "EMD_8_567C_Idle", 0.75F, 40, false), + DieselSW1200(EntityLocoDieselBapSW1200.class, "nathan_p2", 0.65F, "EMD_12_567C_Notch8", 0.65F, 10, "EMD_12_567C_Idle", 0.8F, 3, true), + DieselSW1500(EntityLocoDieselBapSW1500.class, "nathan_p3", 0.65F, "EMD_12_645E_Notch8", 0.65F, 10, "EMD_12_645E_Idle", 0.8F, 3, true), + DieselU18B(EntityLocoDieselBapU18B.class, "leslie_s3", 2.5F, "GE_7FDL_8_Notch8", 0.65F, 40, "GE_7FDL_8_Idle", 0.65F, 50, true), + DieselU23B(EntityLocoDieselBapU23B.class, "leslie_s3l", 2.5F, "GE_7FDL_12_Notch8", 0.65F, 40, "GE_7FDL_12_Idle", 0.65F, 50, true), + DieselU36C(EntityLocoDieselBapU36C.class, "leslie_s3lr", 2.5F, "GE_FDL16_Notch8", 0.5F, 10, "GE_FDL16_Idle", 0.5F, 3, true), + ElectricGM6C(EntityLocoElectricBapGM6C.class, "nathan_p01235", 2.5F, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), + ElectricEF1(EntityLocoElectricBapEF1.class, "wabco_e2", 2.5F, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), + ElectricEF1B(EntityLocoElectricBapEF1B.class, "Silence", 0, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), + ElectricEP1A(EntityLocoElectricBapEP1A.class, "wabco_e2", 2.5F, "MILW_Notch8", 0.65F, 40, "MILW_Idle", 0.65F, 50, true), + SteamClimax(EntityLocoSteamClimaxNew.class, "lukenhimer_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + SteamOnion(EntityLocoOnion.class, "hancock_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + SteamPE(EntityLocoSteamPELoco.class, "pe_chime", 0.8F, "pe_run", 0.2F, 20, "pe_idle", 0.2F, 20, true), + SteamVBShay(EntityLocoSteamVBShay2.class, "crosby_3chime", 0.8F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + SteamSkookum(EntityLocoSteamSkook.class, "skookum_whistle", 1F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + SteamShay3Truck(EntityLocoSteamShay3Truck.class, "lukenhimer_3chime", 1F, "steam_run", 0.2F, 20, "steam_run", 0.2F, 20, true), + DieselEMDE8A(EntityLocoDieselEMDE8A.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), + DieselEMDE8B(EntityLocoDieselEMDE8B.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), + DieselAlcoPA1(EntityLocoDieselAlcoPA1.class, "leslie_a200_2", 1F, "ALCO_16_244_Notch8", 0.25F, 40, "ALCO_16_244_Idle", 0.4F, 40, true), + DieselAlcoPB1(EntityLocoDieselAlcoPB1.class, "wabco_e2", 2.5F, "ALCO_16_244_Notch8", 0.25F, 40, "ALCO_16_244_Idle", 0.4F, 40, true), + DieselC415H(EntityLocoDieselC415H.class, "nathan_p14r2", 0.65F, "ALCO_8_251F_Notch8", 0.65F, 10, "ALCO_8_251F_Idle", 0.8F, 3, true), + DieselC415L(EntityLocoDieselC415L.class, "leslie_s3lr", 0.65F, "ALCO_8_251F_Notch8", 0.65F, 10, "ALCO_8_251F_Idle", 0.8F, 3, true), + DieselC415S(EntityLocoDieselC415S.class, "leslie_s3lr", 0.65F, "ALCO_8_251F_Notch8", 0.65F, 10, "ALCO_8_251F_Idle", 0.8F, 3, true), + DieselFMH24_66(EntityLocoDieselFMH24_66.class, "leslie_a200_2", 1F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), + DieselFMH24_66L(EntityLocoDieselFMH24_66L.class, "leslie_a200_2", 1F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), + DieselEMDE7A(EntityLocoDieselEMDE7A.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), + DieselEMDE7B(EntityLocoDieselEMDE7B.class, "leslie_a200_2", 1F, "EMD_12_567B_Notch8", 0.45F, 15, "EMD_16_567B_Idle", 0.75F, 3, true), + DieselFMH16_66(EntityLocoDieselFMH16_66.class, "leslie_a200_2", 1F, "FM_38D_6_Notch8", 0.65F, 40, "FM_38D_6_Notch8", 0.45F, 40, false), - //Storage (Touch When Needed) + //Storage (Touch When Needed) /* DieselVO1000(com.jcirmodelsquad.tcjcir.vehicles.locomotives.DieselVO1000.class,"wabco_e2", 2.5F, "Baldwin_8VO_Notch8", 1F, 8, "Baldwin_8VO_Idle", 1F, 50, false ), DieselCF7R(com.jcirmodelsquad.tcjcir.vehicles.locomotives.DieselCF7R.class, "nathan_p012", 0.85F, "EMD_12_645E_Notch8", 0.65F, 10, "EMD_12_645E_Idle", 0.8F, 3, true), @@ -268,98 +268,97 @@ public enum EnumSounds implements TrainSoundRecord { DieselHHGregg(com.jcirmodelsquad.tcjcir.vehicles.locomotives.DieselHHgregg.class,"hhgregg600horn", 2.5F, "hhgregg600_run", 1F, 287, "hhgregg600_idle", 1F, 287, false ), Thanos(com.jcirmodelsquad.tcjcir.vehicles.locomotives.Thanos.class, "thanos_horn", 5, "thanos_run", 0.65F, 50, "thanos_idle", 0.65F, 50, false), BigMeme(com.jcirmodelsquad.tcjcir.vehicles.locomotives.BigMeme.class, "leslie_a425", 15, "aircompresser", 0.65F, 50, "aircompresser", 0.65F, 50, false), - */ - ; + */; - private Class entityClass; - private String horn; - private float hornVolume; - private String run; - private String idle; - private float runVolume; - private float idleVolume; - private int runSoundLenght; - private int idleSoundLenght; - private boolean soundChangeWithSpeed; + private Class entityClass; + private String horn; + private float hornVolume; + private String run; + private String idle; + private float runVolume; + private float idleVolume; + private int runSoundLength; + private int idleSoundLength; + private boolean soundChangeWithSpeed; - /** - * Defines the sounds for the locomotives Many locomotives have the same sound for run and idle - * - * @param entityClass - * @param horn - * @param hornVolume - * @param run - * @param runVolume - * @param runSoundLenght - * @param idle - * @param idleVolume - * @param idleSoundLenght - * @param soundChangeWithSpeed - */ - private EnumSounds(Class entityClass, String horn, float hornVolume, String run, float runVolume, int runSoundLenght, String idle, float idleVolume, int idleSoundLenght, boolean soundChangeWithSpeed) { - this.entityClass = entityClass; - this.horn = horn; - this.hornVolume = hornVolume; - this.run = run; - this.idle = idle; - this.runVolume = runVolume; - this.idleVolume = idleVolume; - this.runSoundLenght = runSoundLenght; - this.idleSoundLenght = idleSoundLenght; - this.soundChangeWithSpeed = soundChangeWithSpeed; - } + /** + * Defines the sounds for the locomotives Many locomotives have the same sound for run and idle + * + * @param entityClass + * @param horn + * @param hornVolume + * @param run + * @param runVolume + * @param runSoundLength + * @param idle + * @param idleVolume + * @param idleSoundLength + * @param soundChangeWithSpeed + */ + private EnumSounds(Class entityClass, String horn, float hornVolume, String run, float runVolume, int runSoundLength, String idle, float idleVolume, int idleSoundLength, boolean soundChangeWithSpeed) { + this.entityClass = entityClass; + this.horn = horn; + this.hornVolume = hornVolume; + this.run = run; + this.idle = idle; + this.runVolume = runVolume; + this.idleVolume = idleVolume; + this.runSoundLength = runSoundLength; + this.idleSoundLength = idleSoundLength; + this.soundChangeWithSpeed = soundChangeWithSpeed; + } - @Override - public Class getEntityClass() { - return entityClass; - } + @Override + public Class getEntityClass() { + return entityClass; + } - @Override - public String getHornString() { - if (horn == null || horn.isEmpty()) return horn; - return Info.resourceLocation + ":" + horn; - } + @Override + public String getHornString() { + if (horn == null || horn.isEmpty()) return horn; + return Info.resourceLocation + ":" + horn; + } - @Override - public String getRunString() { - if (run == null || run.isEmpty()) return run; - return Info.resourceLocation + ":" + run; - } + @Override + public String getRunString() { + if (run == null || run.isEmpty()) return run; + return Info.resourceLocation + ":" + run; + } - @Override - public String getIdleString() { - if (idle == null || idle.isEmpty()) return idle; - return Info.resourceLocation + ":" + idle; - } + @Override + public String getIdleString() { + if (idle == null || idle.isEmpty()) return idle; + return Info.resourceLocation + ":" + idle; + } - @Override - public Float getHornVolume() { - return hornVolume; - } + @Override + public Float getHornVolume() { + return hornVolume; + } - @Override - public Float getRunVolume() { - return runVolume; - } + @Override + public Float getRunVolume() { + return runVolume; + } - @Override - public Float getIdleVolume() { - return idleVolume; - } + @Override + public Float getIdleVolume() { + return idleVolume; + } - @Override - public int getRunSoundLenght() { - return runSoundLenght; - } + @Override + public int getRunSoundLength() { + return runSoundLength; + } - @Override - public int getIdleSoundLenght() { - return idleSoundLenght; - } + @Override + public int getIdleSoundLength() { + return idleSoundLength; + } - @Override - public boolean getSoundChangeWithSpeed() { - return soundChangeWithSpeed; - } + @Override + public boolean getSoundChangeWithSpeed() { + return soundChangeWithSpeed; + } }