forked from EternalBlueFlame/Traincraft-5
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We will miss you Eternal. Added the J50 Changed something that said 5 plank to mineral wagon in the entity class file for the mineral wagon
- Loading branch information
1 parent
07f8bd6
commit d8b1e38
Showing
25 changed files
with
2,810 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,629 changes: 2,629 additions & 0 deletions
2,629
src/main/java/train/client/render/models/ModelJ50.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
src/main/java/train/common/entity/rollingStock/EntityLocoSteamJ50.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
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.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.LiquidManager; | ||
import train.common.api.SteamTrain; | ||
import train.common.library.EnumTrains; | ||
import train.common.library.GuiIDs; | ||
|
||
public class EntityLocoSteamJ50 extends SteamTrain { | ||
public EntityLocoSteamJ50(World world) { | ||
super(world, EnumTrains.locosteamHallClass.getTankCapacity(), LiquidManager.WATER_FILTER); | ||
initLocoSteam(); | ||
} | ||
|
||
public void initLocoSteam() { | ||
fuelTrain = 0; | ||
locoInvent = new ItemStack[inventorySize]; | ||
} | ||
|
||
public EntityLocoSteamJ50(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 = 0.05; | ||
double yOffset = 0.2; | ||
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 instanceof EntityPlayer) { | ||
((EntityPlayer) riddenByEntity).openGui(Traincraft.instance, GuiIDs.LOCO, worldObj, (int) this.posX, (int) this.posY, (int) this.posZ); | ||
} | ||
} | ||
|
||
@Override | ||
public void onUpdate() { | ||
super.onUpdate(); | ||
if (worldObj.isRemote) { | ||
return; | ||
} | ||
checkInvent(locoInvent[0], locoInvent[1], this); | ||
} | ||
|
||
@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 "J50"; | ||
} | ||
|
||
@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 1.025F; | ||
} | ||
|
||
|
||
@Override | ||
public boolean canBeAdjusted(EntityMinecart cart) { return canBeAdjusted; } | ||
|
||
@Override | ||
public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.