Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.vincentmet.modelrailroad.entities.TEST2;
- import net.minecraft.entity.passive.EntityAmbientCreature;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.world.World;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class TestEntity extends EntityAmbientCreature{
- public boolean stationary;
- public TestEntity(World world) {
- super(world);
- }
- public TestEntity(World world, int x, int y, int z) {
- super(world);
- }
- protected boolean canDespawn(){
- return false;
- }
- public boolean interact(EntityPlayer entityplayer){
- if (riddenByEntity == null || riddenByEntity == entityplayer){
- entityplayer.mountEntity(this);
- return true;
- }else{
- return false;
- }
- }
- public void moveEntity(double d, double d1, double d2){
- if (riddenByEntity != null){
- this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
- this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
- this.setRotation(this.rotationYaw, this.rotationPitch);
- this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
- stationary = true;
- motionX += riddenByEntity.motionX * 10;
- motionZ += riddenByEntity.motionZ * 10;
- if (isCollidedHorizontally){
- isJumping = true;
- }else{
- isJumping = false;
- }
- super.moveEntity(motionX, motionY, motionZ);
- }else{
- stationary = false;
- super.moveEntity(d, d1, d2);
- }
- }
- public void onUpdate(){
- super.onUpdate();
- if (riddenByEntity != null){
- this.randomYawVelocity = 0;
- this.rotationYaw = riddenByEntity.rotationYaw;
- }
- }
- protected boolean isAIEnabled(){
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement