Jump to content

WindRunner7

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by WindRunner7

  1. I don't think regular spawn eggs work with deferred register. The item registration happens before entities so when registering the spawn egg the entity registry object is no present.

    Try taking out the spawn egg code and it should work fine. 

     

    Here is an additional thread on registering entities with deferred register. It also goes over what needs to be done to make spawn eggs work. It is for 1.15.1 but should work pretty well with 1.16.5 as well.

     

     

     

     

    • Thanks 1
  2. You will need to override the travel method. There is a good example of this in the AbstractHorseEntity class.

    public void travel(Vector3d travelVector) {
          if (this.isAlive()) {
             if (this.isBeingRidden() && this.canBeSteered() && this.isHorseSaddled()) {
                LivingEntity livingentity = (LivingEntity)this.getControllingPassenger();
                this.rotationYaw = livingentity.rotationYaw;
                this.prevRotationYaw = this.rotationYaw;
                this.rotationPitch = livingentity.rotationPitch * 0.5F;
                this.setRotation(this.rotationYaw, this.rotationPitch);
                this.renderYawOffset = this.rotationYaw;
                this.rotationYawHead = this.renderYawOffset;
                float f = livingentity.moveStrafing * 0.5F;
                float f1 = livingentity.moveForward;
                if (f1 <= 0.0F) {
                   f1 *= 0.25F;
                   this.gallopTime = 0;
                }
    
                if (this.onGround && this.jumpPower == 0.0F && this.isRearing() && !this.allowStandSliding) {
                   f = 0.0F;
                   f1 = 0.0F;
                }
    
                if (this.jumpPower > 0.0F && !this.isHorseJumping() && this.onGround) {
                   double d0 = this.getHorseJumpStrength() * (double)this.jumpPower * (double)this.getJumpFactor();
                   double d1;
                   if (this.isPotionActive(Effects.JUMP_BOOST)) {
                      d1 = d0 + (double)((float)(this.getActivePotionEffect(Effects.JUMP_BOOST).getAmplifier() + 1) * 0.1F);
                   } else {
                      d1 = d0;
                   }
    
                   Vector3d vector3d = this.getMotion();
                   this.setMotion(vector3d.x, d1, vector3d.z);
                   this.setHorseJumping(true);
                   this.isAirBorne = true;
                   net.minecraftforge.common.ForgeHooks.onLivingJump(this);
                   if (f1 > 0.0F) {
                      float f2 = MathHelper.sin(this.rotationYaw * ((float)Math.PI / 180F));
                      float f3 = MathHelper.cos(this.rotationYaw * ((float)Math.PI / 180F));
                      this.setMotion(this.getMotion().add((double)(-0.4F * f2 * this.jumpPower), 0.0D, (double)(0.4F * f3 * this.jumpPower)));
                   }
    
                   this.jumpPower = 0.0F;
                }
    
                this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;
                if (this.canPassengerSteer()) {
                   this.setAIMoveSpeed((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED));
                   super.travel(new Vector3d((double)f, travelVector.y, (double)f1));
                } else if (livingentity instanceof PlayerEntity) {
                   this.setMotion(Vector3d.ZERO);
                }
    
                if (this.onGround) {
                   this.jumpPower = 0.0F;
                   this.setHorseJumping(false);
                }
    
                this.func_233629_a_(this, false);
             } else {
                this.jumpMovementFactor = 0.02F;
                super.travel(travelVector);
             }
          }
       }

     

    Since your entity doesn't move on it's own and doesn't jump you can remove a good chunk of this but it should get you started. 

  3. I believe you are missing the rotate/mirror functions. I believe that these are called when the structure is generated and is being rotated. I got these from the StairsBlock.java class.

     

    public BlockState rotate(BlockState state, Rotation rot) {
          return state.with(FACING, rot.rotate(state.get(FACING)));
       }
    
      
       public BlockState mirror(BlockState state, Mirror mirrorIn) {
          Direction direction = state.get(FACING);
          StairsShape stairsshape = state.get(SHAPE);
          switch(mirrorIn) {
          case LEFT_RIGHT:
             if (direction.getAxis() == Direction.Axis.Z) {
                switch(stairsshape) {
                case INNER_LEFT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.INNER_RIGHT);
                case INNER_RIGHT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.INNER_LEFT);
                case OUTER_LEFT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.OUTER_RIGHT);
                case OUTER_RIGHT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.OUTER_LEFT);
                default:
                   return state.rotate(Rotation.CLOCKWISE_180);
                }
             }
             break;
          case FRONT_BACK:
             if (direction.getAxis() == Direction.Axis.X) {
                switch(stairsshape) {
                case INNER_LEFT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.INNER_LEFT);
                case INNER_RIGHT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.INNER_RIGHT);
                case OUTER_LEFT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.OUTER_RIGHT);
                case OUTER_RIGHT:
                   return state.rotate(Rotation.CLOCKWISE_180).with(SHAPE, StairsShape.OUTER_LEFT);
                case STRAIGHT:
                   return state.rotate(Rotation.CLOCKWISE_180);
                }
             }
          }
    
          return super.mirror(state, mirrorIn);
       }

     

    You will obviously need to change up the mirror function with the shapes you have defined instead. I believe that the rotate function would probably work as is. 

     

    I would recommend looking into the StairsBlock.java class if it is still having issues.

    • Thanks 2
  4. Is there any more info you can give on what you are trying to do? Also, do you have a repo? Being able to see your code would be helpful. At a minimum can you post your custom block code?

     

    Someone can correct me if I am wrong but I don't believe there is any way to generate structures without *.nbt data. Why are the *.nbt files an issue?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.