mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
44 lines
1.0 KiB
Java
44 lines
1.0 KiB
Java
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();
|
|
}
|