mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
the black mesa rail network
This commit is contained in:
parent
dd2f929821
commit
ec63136436
@ -34,6 +34,16 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
@Override protected void entityInit() { }
|
||||
@Override protected void readEntityFromNBT(NBTTagCompound nbt) { }
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@ -67,10 +77,11 @@ public abstract class EntityRailCarBase extends Entity {
|
||||
Vec3 frontPos = getRelPosAlongRail(anchor, this.getLengthSpan());
|
||||
Vec3 backPos = getRelPosAlongRail(anchor, -this.getLengthSpan());
|
||||
|
||||
if(frontPos == null) this.derail();
|
||||
if(backPos == null) this.derail();
|
||||
|
||||
if(frontPos != null && backPos != null) this.rotationYaw = generateYaw(frontPos, backPos);
|
||||
if(frontPos == null || backPos == null) {
|
||||
this.derail();
|
||||
} else {
|
||||
this.rotationYaw = generateYaw(frontPos, backPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
43
src/main/java/com/hbm/entity/train/EntityRailCarRidable.java
Normal file
43
src/main/java/com/hbm/entity/train/EntityRailCarRidable.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.hbm.entity.train;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityRailCarRidable extends EntityRailCarBase {
|
||||
|
||||
public EntityRailCarRidable(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean interactFirst(EntityPlayer player) {
|
||||
if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != player) {
|
||||
return true;
|
||||
} else {
|
||||
if(!this.worldObj.isRemote) {
|
||||
player.mountEntity(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRiderPosition() {
|
||||
|
||||
Vec3 offset = getRiderSeatPosition();
|
||||
offset.rotateAroundY(this.rotationYaw);
|
||||
|
||||
if(this.riddenByEntity != null) {
|
||||
this.riddenByEntity.setPosition(this.posX + offset.xCoord, this.posY + offset.yCoord, this.posZ + offset.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns a Vec3 showing the relative position from the driver to the core */
|
||||
public abstract Vec3 getRiderSeatPosition();
|
||||
}
|
||||
46
src/main/java/com/hbm/entity/train/TrainCargoTram.java
Normal file
46
src/main/java/com/hbm/entity/train/TrainCargoTram.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.hbm.entity.train;
|
||||
|
||||
import com.hbm.blocks.rail.IRailNTM.TrackGauge;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TrainCargoTram extends EntityRailCarRidable {
|
||||
|
||||
/*
|
||||
*
|
||||
* _________
|
||||
* | | \ <--
|
||||
* | | |___
|
||||
* | | | | |
|
||||
* _O\|_|_______|__|_____________________________|/O_
|
||||
* |____| |____|
|
||||
* \__________________________________________/
|
||||
* '( + )' '( + )'
|
||||
*
|
||||
*/
|
||||
|
||||
public TrainCargoTram(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackGauge getGauge() {
|
||||
return TrackGauge.STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLengthSpan() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getRiderSeatPosition() {
|
||||
return Vec3.createVectorHelper(1, 1, 0);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user