Skip to content

Commit

Permalink
Added Class 374 Eurostar
Browse files Browse the repository at this point in the history
Added:
Class 374 Front
Class 374 Premier Panto
Class 374 Standard Panto
Class 374 Buffet

Horn and ICE skin probably to come later
  • Loading branch information
chazi898 committed Aug 15, 2023
1 parent 2c25340 commit 515a8ca
Show file tree
Hide file tree
Showing 31 changed files with 7,382 additions and 1 deletion.
Binary file added raw_models/Class_374_Buffet.mtb
Binary file not shown.
Binary file added raw_models/Class_374_Front.mtb
Binary file not shown.
Binary file added raw_models/Class_374_Premier_Panto.mtb
Binary file not shown.
Binary file added raw_models/Class_374_Standard_Panto.mtb
Binary file not shown.
4 changes: 4 additions & 0 deletions src/main/java/train/client/render/RenderEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,10 @@ public enum RenderEnum {
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),

;

Expand Down
1,455 changes: 1,455 additions & 0 deletions src/main/java/train/client/render/models/ModelClass374Buffet.java

Large diffs are not rendered by default.

1,843 changes: 1,843 additions & 0 deletions src/main/java/train/client/render/models/ModelClass374Front.java

Large diffs are not rendered by default.

1,815 changes: 1,815 additions & 0 deletions src/main/java/train/client/render/models/ModelClass374PremierPanto.java

Large diffs are not rendered by default.

1,855 changes: 1,855 additions & 0 deletions src/main/java/train/client/render/models/ModelClass374StandardPanto.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package train.client.render.models;


import tmt.ModelConverter;
import tmt.ModelRendererTurbo;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package train.common.entity.rollingStock;

//import com.jcirmodelsquad.tcjcir.features.TiltingHandler;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import train.common.Traincraft;
import train.common.api.ElectricTrain;
import train.common.library.GuiIDs;

public class EntityElectricClass374 extends ElectricTrain {
//public TiltingHandler tiltingHandler = new TiltingHandler(7);

public EntityElectricClass374(World world) {
super(world);

}

public EntityElectricClass374(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;}
double pitchRads = this.anglePitchClient * Math.PI / 180.0D;
double distance = 5.24;
double yOffset = -0.28;
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 + 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();
isDead = true;
}

@Override
public void pressKey(int i) {
if (i == 7 && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) {
((EntityPlayer) riddenByEntity).openGui(Traincraft.instance, GuiIDs.LOCO, worldObj, (int) this.posX + 2, (int) this.posY, (int) this.posZ);
}
}

@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
super.writeEntityToNBT(nbttagcompound);

nbttagcompound.setShort("fuelTrain", (short) fuelTrain);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < locoInvent.length; i++) {
if (locoInvent[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i);
locoInvent[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
}
nbttagcompound.setTag("Items", nbttaglist);
}

@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);

fuelTrain = nbttagcompound.getShort("fuelTrain");
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
locoInvent = 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 < locoInvent.length) {
locoInvent[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
}

@Override
public int getSizeInventory() {
return inventorySize;
}

@Override
public String getInventoryName() {
return "Class 374 Eurostar Front";
}

@Override
public boolean interactFirst(EntityPlayer entityplayer) {
playerEntity = entityplayer;
if ((super.interactFirst(entityplayer))) {
return false;
}
if (!worldObj.isRemote) {
if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer) {
return true;
}
entityplayer.mountEntity(this);
}
return true;
}
@Override
public float getOptimalDistance(EntityMinecart cart) {
return 0.85F;
}

@Override
public boolean canBeAdjusted(EntityMinecart cart) {
return canBeAdjusted;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package train.common.entity.rollingStock;

import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import train.common.api.EntityRollingStock;
import train.common.api.IPassenger;

public class EntityPassengerClass374Buffet extends EntityRollingStock implements IPassenger {
//public TiltingHandler tiltingHandler = new TiltingHandler(7);

public EntityPassengerClass374Buffet(World world) {
super(world);
}

public EntityPassengerClass374Buffet(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) {
riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset() - 0.3, posZ );
}//ew yucky rider position code, good thing its a passenger car so it doesnt matter! Wheeze.png
}

@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;
}

@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 3.45F;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package train.common.entity.rollingStock;

import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import train.common.api.EntityRollingStock;
import train.common.api.IPassenger;

public class EntityPassengerClass374PremierPanto extends EntityRollingStock implements IPassenger {
//public TiltingHandler tiltingHandler = new TiltingHandler(7);

public EntityPassengerClass374PremierPanto(World world) {
super(world);
}

public EntityPassengerClass374PremierPanto(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) {
riddenByEntity.setPosition(posX, posY + getMountedYOffset() + riddenByEntity.getYOffset() - 0.2, posZ);
}//ew yucky rider position code, good thing its a passenger car so it doesnt matter! Wheeze.png
}

@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;
}

@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 3.45F;
}
}
Loading

0 comments on commit 515a8ca

Please sign in to comment.