Jump to content

1.12.2 issue with custom rideable entity.


salvestrom

Recommended Posts

Here's the top few lines of the crash log I was supplied with. This never happened while testing in the development environment. This may only be occurring on servers.

Spoiler
  1. Time: 2019-08-08 17:45:02 CEST
  2. Description: Ticking entity
  3.  
  4. java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
  5.     at com.salvestrom.w2theJungle.mobs.entity.EntityRhinopter.updatePassenger(EntityRhinopter.java:1689)
  6.     at net.minecraft.entity.Entity.updateRidden(Entity.java:2020)
  7.     at net.minecraft.entity.EntityLivingBase.updateRidden(EntityLivingBase.java:2489)
  8.     at com.salvestrom.w2theJungle.mobs.entity.EntityLizardmanBase.updateRidden(EntityLizardmanBase.java:157)
  9.     at com.salvestrom.w2theJungle.mobs.entity.EntityLizardmanSticker.updateRidden(EntityLizardmanSticker.java:179)
  10.     at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1988)

And here is the method from the entity file. This was an attempt to give a rider a bobbing effect while mounted. It was mostly successful. Am I doing something wrong with the Minecraft.get Minecraft() call?The line specified by the crash log corresponds to the first usage of Minecraft.getMinecraft. Again this never happens while in the development environment.

Spoiler

    public void updatePassenger(Entity passenger)
    {    	
        if (this.isPassenger(passenger))
        {
        	float f5 = this.prevLimbSwingAmount + (this.limbSwingAmount - this.prevLimbSwingAmount) * 
        			Minecraft.getMinecraft().getRenderPartialTicks();
        	//"Time" in the model file
        	float f6 = this.limbSwing - this.limbSwingAmount * 
        			(1.0F - Minecraft.getMinecraft().getRenderPartialTicks());
        	
        	if (f5 > 1.0F)
            {
                f5 = 1.0F;
            }
        	
        	float f0 = MathHelper.sin(((1.0995574287564276334619251841478f) 
        			+ (f6*1.226612f)) )
        			* (f5);

        	passenger.setPosition(this.posX + 0,
            		this.posY + this.getMountedYOffset() + passenger.getYOffset() 
            		+ (this.isRaptorJumping() ? 0 : f0 * 0.0625),
            		this.posZ - 0);
        }
        
        if (passenger instanceof EntityLiving)
        {
        	EntityLiving entityliving = (EntityLiving)passenger;
        	this.renderYawOffset = entityliving.renderYawOffset;
        }
       
    }

 

 

Link to comment
Share on other sites

Spoiler

    public void updatePassenger(Entity passenger)
    {    	
        float f5 = 0;
    	float f6 = 0;

    	if (this.world.isRemote && this.isPassenger(passenger))
        {
    		f5 = this.prevLimbSwingAmount + (this.limbSwingAmount - this.prevLimbSwingAmount) * 
        			Minecraft.getMinecraft().getRenderPartialTicks();
        	//"Time" in the model file
    		f6 = this.limbSwing - this.limbSwingAmount * 
        			(1.0F - Minecraft.getMinecraft().getRenderPartialTicks());
        	
        	if (f5 > 1.0F)
            {
                f5 = 1.0F;
            }
        }
        	float f0 = MathHelper.sin(((1.0995574287564276334619251841478f) 
        			+ (f6*1.226612f)) )
        			* (f5);

        	passenger.setPosition(this.posX + 0,
            		this.posY + this.getMountedYOffset() + passenger.getYOffset() 
            		+ (this.isRaptorJumping() ? 0 : f0 * 0.0625),
            		this.posZ - 0);
        
        
        if (passenger instanceof EntityLiving)
        {
        	EntityLiving entityliving = (EntityLiving)passenger;
        	this.renderYawOffset = entityliving.renderYawOffset;
        }
       
    }

 

This is what I currently have. I had to move the passenger.setPosition outside of the isRemote check because the player was immediately warping back to the position they mounted the entity at on dismounting. I have no idea if this will actually cure the original problem on a server, or if there is some other way around this.

Edited by salvestrom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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