Skip to content

Commit

Permalink
hotfix A
Browse files Browse the repository at this point in the history
- fixed trains and stock not spawning on server due to forge wanting a client only variable to exist on server when server doesn't use it.
- fixed some render bugs with certain stock
- fixed a weight calculation issue
  • Loading branch information
EternalBlueFlame committed Jan 31, 2024
1 parent c36a09f commit de26dd1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/main/java/fexcraft/tmt/slim/ModelBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,7 @@ public ModelRendererTurbo[] initList(ModelRendererTurbo[] list){
}
return null;
}

public float[] getTrans(){return null;}
public float[] getRotate(){return null;}
}
8 changes: 8 additions & 0 deletions src/main/java/train/client/render/RenderRollingStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,19 @@ public static void renderTheMinecart(EntityRollingStock cart, double x, double y
if(cart.modelOffsets()[m]!=null) {
GL11.glTranslatef(cart.modelOffsets()[m][0], cart.modelOffsets()[m][1], cart.modelOffsets()[m][2]);
}
if(cart.getModel()[m].getTrans()!=null){
GL11.glTranslatef(cart.getModel()[m].getTrans()[0],cart.getModel()[m].getTrans()[1],cart.getModel()[m].getTrans()[2]);
}
if(cart.modelRotations()[m]!=null) {
GL11.glRotatef(cart.modelRotations()[m][0], 1,0,0);
GL11.glRotatef(cart.modelRotations()[m][1], 0,1,0);
GL11.glRotatef(cart.modelRotations()[m][2], 0,0,1);
}
if(cart.getModel()[m].getRotate()!=null){
GL11.glRotatef(cart.getModel()[m].getRotate()[0], 1,0,0);
GL11.glRotatef(cart.getModel()[m].getRotate()[1], 0,1,0);
GL11.glRotatef(cart.getModel()[m].getRotate()[2], 0,0,1);
}
if(cart.getRenderScale()[m]!=null) {
GL11.glScalef(cart.getRenderScale()[m][0], cart.getRenderScale()[m][1], cart.getRenderScale()[m][2]);
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/train/common/api/AbstractTrains.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public abstract class AbstractTrains extends EntityMinecart implements IMinecart
*/
private TrainRecord trainSpec = null;

@SideOnly(Side.CLIENT)
private TrainRenderRecord render = null;

public TrainRecord getSpec() {
Expand Down Expand Up @@ -178,7 +177,7 @@ public AbstractTrains(World world) {


if (getSpec() != null) {
this.setDefaultMass(weightKg());
this.setDefaultMass(weightKg()*0.1);
this.setSize(0.98f, 1.98f);
this.setMinecartName(transportName());
}
Expand Down Expand Up @@ -698,7 +697,7 @@ public String transportFuelType(){
/**defines the size of the inventory row by row, not counting any special slots like for fuel.
* end result number of slots is this times 9. plus any crafting/fuel slots
* may not return null*/
public int getInventoryRows(){return (int)(getSpec().getCargoCapacity()*1.1111111111112);}
public int getInventoryRows(){return (int)(getSpec().getCargoCapacity()*0.1111111111112);}

/**defines the capacity of the fluidTank tank.
* each value defibes another tank.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static void PullPhysic(Locomotive cart1) {
if ((cart1).train != null && !(cart1).train.getTrains().isEmpty()) {

for (int j1 = 0; j1 < (cart1).train.getTrains().size(); j1++) {
totalMass += (cart1).train.getTrains().get(j1).weightKg();
totalMass += ((cart1).train.getTrains().get(j1).weightKg()*0.1);
}
(cart1).currentNumCartsPulled = (cart1).train.getTrains().size() - 1;
(cart1).currentMassPulled = Math.round(totalMass * 10);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/train/common/items/ItemRollingStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ else if ((meta == 0 || meta == 2) && (world.getBlock(i, j, k + 1) == BlockIDs.tc
if (player != null) {
rollingStock.trainOwner = player.getDisplayName();
}
rollingStock.mass = rollingStock.weightKg();
rollingStock.mass = rollingStock.weightKg()*0.1;

int uniID = -1;
if (itemstack.hasTagCompound()) {
Expand Down

0 comments on commit de26dd1

Please sign in to comment.