Jump to content

Recommended Posts

Posted

Well, that video is not really helpful in spotting what the issue could be, since that crash could have happened for various reasons. I can already make a guess and ask if you did remember to register the entity renderer for your entity, but to say something for sure i will need to see your code

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted
package com.relaxingleg.tellytubbiemod.entities;

import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World;

public class TinkyWinkyEntity extends CreatureEntity {

    public TinkyWinkyEntity(EntityType<? extends CreatureEntity> type, World worldIn) {
        super(type, worldIn);
    }

    @Override
    protected void registerGoals() {
        super.registerGoals();
        this.goalSelector.addGoal(0, new SwimGoal(this));
        this.goalSelector.addGoal(1, new PanicGoal(this, 1.25d));
        this.goalSelector.addGoal(2, new LookAtGoal(this, PlayerEntity.class, 6.0f));
        this.goalSelector.addGoal(3, new WaterAvoidingRandomWalkingGoal(this, 1.0d));
        this.goalSelector.addGoal(4, new LookRandomlyGoal(this));
    }

    @Override
    protected void registerAttributes() {
        super.registerAttributes();
        this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20);
        this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.23d);
    }
}

/\/\/\ the entity class

 

package com.relaxingleg.tellytubbiemod.client.model;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.relaxingleg.tellytubbiemod.entities.TinkyWinkyEntity;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class TinkyWinkyModel<T extends TinkyWinkyEntity> extends EntityModel<T> {
    private final ModelRenderer lowerleg;
    private final ModelRenderer left;
    private final ModelRenderer right2;
    private final ModelRenderer upperleg;
    private final ModelRenderer left2;
    private final ModelRenderer right;
    private final ModelRenderer body;
    private final ModelRenderer head;
    private final ModelRenderer arms;
    private final ModelRenderer left3;
    private final ModelRenderer right3;
    private final ModelRenderer ears;
    private final ModelRenderer left4;
    private final ModelRenderer right4;

    public TinkyWinkyModel() {
        textureWidth = 128;
        textureHeight = 128;

        lowerleg = new ModelRenderer(this);
        lowerleg.setRotationPoint(0.0F, 24.0F, 0.0F);


        left = new ModelRenderer(this);
        left.setRotationPoint(-1.0F, 0.0F, 0.0F);
        lowerleg.addChild(left);
        left.setTextureOffset(85, 12).addBox(-6.0F, -1.0F, -4.0F, 4.0F, 1.0F, 5.0F, 0.0F, false);
        left.setTextureOffset(86, 18).addBox(-6.0F, -4.0F, -3.0F, 4.0F, 3.0F, 4.0F, 0.0F, false);
        left.setTextureOffset(38, 32).addBox(-5.0F, -1.0F, -5.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
        left.setTextureOffset(8, 15).addBox(-5.0F, -4.0F, -4.0F, 2.0F, 3.0F, 1.0F, 0.0F, false);

        right2 = new ModelRenderer(this);
        right2.setRotationPoint(1.0F, 0.0F, 0.0F);
        lowerleg.addChild(right2);
        right2.setTextureOffset(8, 0).addBox(3.0F, -4.0F, -4.0F, 2.0F, 3.0F, 1.0F, 0.0F, false);
        right2.setTextureOffset(46, 37).addBox(2.0F, -1.0F, -4.0F, 4.0F, 1.0F, 5.0F, 0.0F, false);
        right2.setTextureOffset(34, 30).addBox(3.0F, -1.0F, -5.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
        right2.setTextureOffset(86, 0).addBox(2.0F, -4.0F, -3.0F, 4.0F, 3.0F, 4.0F, 0.0F, false);

        upperleg = new ModelRenderer(this);
        upperleg.setRotationPoint(0.0F, 24.0F, 0.0F);


        left2 = new ModelRenderer(this);
        left2.setRotationPoint(-1.0F, 0.0F, 0.0F);
        upperleg.addChild(left2);
        left2.setTextureOffset(48, 86).addBox(-6.0F, -9.0F, -3.0F, 4.0F, 5.0F, 4.0F, 0.0F, false);

        right = new ModelRenderer(this);
        right.setRotationPoint(1.0F, 0.0F, 0.0F);
        upperleg.addChild(right);
        right.setTextureOffset(76, 36).addBox(2.0F, -9.0F, -3.0F, 4.0F, 5.0F, 4.0F, 0.0F, false);

        body = new ModelRenderer(this);
        body.setRotationPoint(0.0F, 24.0F, 0.0F);
        body.setTextureOffset(55, 55).addBox(-7.0F, -25.0F, -3.0F, 14.0F, 16.0F, 5.0F, 0.0F, false);
        body.setTextureOffset(61, 76).addBox(-7.0F, -25.0F, 2.0F, 14.0F, 13.0F, 1.0F, 0.0F, false);
        body.setTextureOffset(0, 76).addBox(-7.0F, -25.0F, 3.0F, 14.0F, 11.0F, 2.0F, 0.0F, false);

        head = new ModelRenderer(this);
        head.setRotationPoint(0.0F, 24.0F, 0.0F);
        head.setTextureOffset(0, 15).addBox(-7.0F, -26.0F, -7.0F, 14.0F, 1.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(76, 34).addBox(-7.0F, -26.0F, -8.0F, 14.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(32, 62).addBox(-8.0F, -26.0F, -7.0F, 1.0F, 1.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(60, 53).addBox(-7.0F, -26.0F, 7.0F, 14.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(16, 61).addBox(7.0F, -26.0F, -7.0F, 1.0F, 1.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(0, 25).addBox(7.0F, -27.0F, -8.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(56, 17).addBox(-7.0F, -42.0F, -9.0F, 14.0F, 16.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 23).addBox(-8.0F, -27.0F, -8.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 17).addBox(-8.0F, -27.0F, 7.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(56, 0).addBox(-7.0F, -42.0F, 8.0F, 14.0F, 16.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 15).addBox(7.0F, -27.0F, 7.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(30, 30).addBox(-9.0F, -42.0F, -7.0F, 1.0F, 16.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(0, 30).addBox(8.0F, -42.0F, -7.0F, 1.0F, 16.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(8, 89).addBox(-9.0F, -41.0F, -8.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(4, 89).addBox(-8.0F, -41.0F, -9.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 89).addBox(7.0F, -41.0F, -9.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(48, 60).addBox(7.0F, -41.0F, 8.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(40, 60).addBox(-8.0F, -41.0F, 8.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(36, 60).addBox(-9.0F, -41.0F, 7.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(46, 15).addBox(-9.0F, -40.0F, -9.0F, 1.0F, 12.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(46, 0).addBox(8.0F, -40.0F, -9.0F, 1.0F, 12.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(42, 15).addBox(-9.0F, -40.0F, 8.0F, 1.0F, 12.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(42, 0).addBox(8.0F, -40.0F, 8.0F, 1.0F, 12.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(10, 12).addBox(8.0F, -41.0F, -8.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 30).addBox(8.0F, -40.0F, -8.0F, 1.0F, 13.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(32, 60).addBox(8.0F, -41.0F, 7.0F, 1.0F, 14.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 10).addBox(-8.0F, -42.0F, -8.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 8).addBox(7.0F, -42.0F, -8.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 2).addBox(-8.0F, -42.0F, 7.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 0).addBox(7.0F, -42.0F, 7.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(60, 34).addBox(-8.0F, -43.0F, -7.0F, 1.0F, 1.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(60, 51).addBox(-7.0F, -43.0F, 7.0F, 14.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 60).addBox(7.0F, -43.0F, -7.0F, 1.0F, 1.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(60, 49).addBox(-7.0F, -43.0F, -8.0F, 14.0F, 1.0F, 1.0F, 0.0F, false);
        head.setTextureOffset(0, 0).addBox(-7.0F, -44.0F, -7.0F, 14.0F, 1.0F, 14.0F, 0.0F, false);
        head.setTextureOffset(6, 8).addBox(-1.0F, -46.0F, -1.0F, 2.0F, 2.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(16, 60).addBox(2.0F, -49.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(0, 60).addBox(-3.0F, -48.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(59, 37).addBox(-4.0F, -49.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(48, 26).addBox(0.0F, -47.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(48, 11).addBox(1.0F, -48.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(46, 30).addBox(-2.0F, -47.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(28, 30).addBox(3.0F, -50.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(6, 23).addBox(-5.0F, -50.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        head.setTextureOffset(46, 34).addBox(-5.0F, -51.0F, -1.0F, 10.0F, 1.0F, 2.0F, 0.0F, false);

        arms = new ModelRenderer(this);
        arms.setRotationPoint(0.0F, 24.0F, 0.0F);


        left3 = new ModelRenderer(this);
        left3.setRotationPoint(-24.0F, 0.0F, 0.0F);
        arms.addChild(left3);
        left3.setTextureOffset(16, 30).addBox(12.0F, -19.0F, -2.0F, 4.0F, 10.0F, 4.0F, 0.0F, false);
        left3.setTextureOffset(0, 0).addBox(15.0F, -23.0F, -2.0F, 2.0F, 4.0F, 4.0F, 0.0F, false);
        left3.setTextureOffset(4, 30).addBox(14.0F, -22.0F, -2.0F, 1.0F, 3.0F, 4.0F, 0.0F, false);
        left3.setTextureOffset(0, 8).addBox(13.0F, -21.0F, -2.0F, 1.0F, 2.0F, 4.0F, 0.0F, false);
        left3.setTextureOffset(4, 37).addBox(12.0F, -20.0F, -2.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);

        right3 = new ModelRenderer(this);
        right3.setRotationPoint(0.0F, 0.0F, 0.0F);
        arms.addChild(right3);
        right3.setTextureOffset(0, 15).addBox(7.0F, -23.0F, -2.0F, 2.0F, 4.0F, 4.0F, 0.0F, false);
        right3.setTextureOffset(32, 32).addBox(9.0F, -22.0F, -2.0F, 1.0F, 3.0F, 4.0F, 0.0F, false);
        right3.setTextureOffset(0, 23).addBox(10.0F, -21.0F, -2.0F, 1.0F, 2.0F, 4.0F, 0.0F, false);
        right3.setTextureOffset(32, 39).addBox(11.0F, -20.0F, -2.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
        right3.setTextureOffset(32, 77).addBox(8.0F, -19.0F, -2.0F, 4.0F, 10.0F, 4.0F, 0.0F, false);

        ears = new ModelRenderer(this);
        ears.setRotationPoint(0.0F, 24.0F, 0.0F);


        left4 = new ModelRenderer(this);
        left4.setRotationPoint(0.0F, 0.0F, 0.0F);
        ears.addChild(left4);


        right4 = new ModelRenderer(this);
        right4.setRotationPoint(0.0F, 0.0F, 0.0F);
        ears.addChild(right4);
    }

    @Override
    public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
        lowerleg.render(matrixStack, buffer, packedLight, packedOverlay);
        upperleg.render(matrixStack, buffer, packedLight, packedOverlay);
        body.render(matrixStack, buffer, packedLight, packedOverlay);
        head.render(matrixStack, buffer, packedLight, packedOverlay);
        arms.render(matrixStack, buffer, packedLight, packedOverlay);
        ears.render(matrixStack, buffer, packedLight, packedOverlay);
    }

    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }

    @Override
    public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {

    }
}

/\/\/\ the model class

package com.relaxingleg.tellytubbiemod.client.render;

import com.relaxingleg.tellytubbiemod.TellyTubbieMod;
import com.relaxingleg.tellytubbiemod.client.model.TinkyWinkyModel;
import com.relaxingleg.tellytubbiemod.entities.TinkyWinkyEntity;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.util.ResourceLocation;

public class TinkyWinkyRender extends MobRenderer<TinkyWinkyEntity, TinkyWinkyModel<TinkyWinkyEntity>> {

    protected static final ResourceLocation TEXTURE = new ResourceLocation(TellyTubbieMod.MOD_ID, "textures/entity/tinkywinky.png");

    public TinkyWinkyRender(EntityRendererManager renderManagerIn) {
        super(renderManagerIn, new TinkyWinkyModel<>(), 1.0f);
    }

    @Override
    public ResourceLocation getEntityTexture(TinkyWinkyEntity entity) {
        return null;
    }
}

/\/\/\ the render class

    @SubscribeEvent
    public static void onClientSetup(FMLClientSetupEvent event) {
        RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.TINKYWINKY.get(), TinkyWinkyRender::new);
    }
}

/\/\/\ Where i registered the entity renderer

Posted

[15:51:52] [Render thread/FATAL] [minecraft/Minecraft]: Reported exception thrown!
net.minecraft.crash.ReportedException: Rendering entity in world
    at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:274) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.WorldRenderer.renderEntity(WorldRenderer.java:1116) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:970) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:612) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:434) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:961) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_272] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_272] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_272] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_272] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.2.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
Caused by: java.lang.NullPointerException
    at java.util.Objects.requireNonNull(Objects.java:203) ~[?:1.8.0_272] {}
    at java.util.Optional.<init>(Optional.java:96) ~[?:1.8.0_272] {}
    at java.util.Optional.of(Optional.java:108) ~[?:1.8.0_272] {}
    at net.minecraft.client.renderer.RenderState$TextureState.<init>(RenderState.java:542) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.RenderType.func_230167_a_(RenderType.java:73) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.RenderType.getEntityCutoutNoCull(RenderType.java:78) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.model.Model.getRenderType(Model.java:26) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.LivingRenderer.func_230042_a_(LivingRenderer.java:138) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.LivingRenderer.render(LivingRenderer.java:114) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.MobRenderer.render(MobRenderer.java:40) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.MobRenderer.render(MobRenderer.java:20) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:246) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    ... 18 more
[15:51:52] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:110]: ---- Minecraft Crash Report ----
// I feel sad now :(

Time: 28/11/20 15:51
Description: Rendering entity in world

java.lang.NullPointerException: Rendering entity in world
    at java.util.Objects.requireNonNull(Objects.java:203) ~[?:1.8.0_272] {}
    at java.util.Optional.<init>(Optional.java:96) ~[?:1.8.0_272] {}
    at java.util.Optional.of(Optional.java:108) ~[?:1.8.0_272] {}
    at net.minecraft.client.renderer.RenderState$TextureState.<init>(RenderState.java:542) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.RenderType.func_230167_a_(RenderType.java:73) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.RenderType.getEntityCutoutNoCull(RenderType.java:78) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.model.Model.getRenderType(Model.java:26) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.LivingRenderer.func_230042_a_(LivingRenderer.java:138) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.LivingRenderer.render(LivingRenderer.java:114) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.MobRenderer.render(MobRenderer.java:40) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.MobRenderer.render(MobRenderer.java:20) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:246) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.WorldRenderer.renderEntity(WorldRenderer.java:1116) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:970) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:612) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:434) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:961) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_272] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_272] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_272] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_272] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.2.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.2.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at java.util.Objects.requireNonNull(Objects.java:203)
    at java.util.Optional.<init>(Optional.java:96)
    at java.util.Optional.of(Optional.java:108)
    at net.minecraft.client.renderer.RenderState$TextureState.<init>(RenderState.java:542)
    at net.minecraft.client.renderer.RenderType.func_230167_a_(RenderType.java:73)
    at net.minecraft.client.renderer.RenderType.getEntityCutoutNoCull(RenderType.java:78)
    at net.minecraft.client.renderer.model.Model.getRenderType(Model.java:26)
    at net.minecraft.client.renderer.entity.LivingRenderer.func_230042_a_(LivingRenderer.java:138)
    at net.minecraft.client.renderer.entity.LivingRenderer.render(LivingRenderer.java:114)
    at net.minecraft.client.renderer.entity.MobRenderer.render(MobRenderer.java:40)
    at net.minecraft.client.renderer.entity.MobRenderer.render(MobRenderer.java:20)

-- Entity being rendered --
Details:
    Entity Type: telly:tinkywinky (com.relaxingleg.tellytubbiemod.entities.TinkyWinkyEntity)
    Entity ID: 1
    Entity Name: Tinky Winky
    Entity's Exact location: 14.63, 4.00, 18.63
    Entity's Block location: World: (14,4,18), Chunk: (at 14,0,2 in 0,1; contains blocks 0,0,16 to 15,255,31), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Entity's Momentum: 0.00, -0.03, 0.00
    Entity's Passengers: []
    Entity's Vehicle: ~~ERROR~~ NullPointerException: null

-- Renderer details --
Details:
    Assigned renderer: com.relaxingleg.tellytubbiemod.client.render.TinkyWinkyRender@1734b1a
    Location: 7.98,-1.62,8.55 - World: (7,-2,8), Chunk: (at 7,-1,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Rotation: -45.0
    Delta: 0.72000295
Stacktrace:
    at net.minecraft.client.renderer.entity.EntityRendererManager.renderEntityStatic(EntityRendererManager.java:246)
    at net.minecraft.client.renderer.WorldRenderer.renderEntity(WorldRenderer.java:1116)
    at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:970)
    at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:612)

-- Affected level --
Details:
    All players: 1 total; [ClientPlayerEntity['Dev'/2, l='MpServer', x=6.65, y=4.00, z=10.08]]
    Chunk stats: Client Chunk Cache: 2025, 1474
    Level dimension: DimensionType{minecraft:overworld}
    Level name: MpServer
    Level seed: -2247890859412442820
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options: {}
    Level spawn location: World: (0,4,0), Chunk: (at 0,0,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 12155 game time, 12155 day time
    Known server brands: 
    Level was modded: false
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Server brand: forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.world.ClientWorld.fillCrashReport(ClientWorld.java:457)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:1839)
    at net.minecraft.client.Minecraft.run(Minecraft.java:572)
    at net.minecraft.client.main.Main.main(Main.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102)

-- System Details --
Details:
    Minecraft Version: 1.15.2
    Minecraft Version ID: 1.15.2
    Operating System: Linux (amd64) version 4.15.0-111-generic
    Java Version: 1.8.0_272, Amazon.com Inc.
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Amazon.com Inc.
    Memory: 173353632 bytes (165 MB) / 673710080 bytes (642 MB) up to 921174016 bytes (878 MB)
    CPUs: 4
    JVM Flags: 0 total; 
    ModLauncher: 5.1.2+70+master.2845bb9
    ModLauncher launch target: fmluserdevclient
    ModLauncher naming: mcp
    ModLauncher services: 
        /eventbus-2.2.0-service.jar eventbus PLUGINSERVICE 
        /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar object_holder_definalize PLUGINSERVICE 
        /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtime_enum_extender PLUGINSERVICE 
        /accesstransformers-2.1.1-shadowed.jar accesstransformer PLUGINSERVICE 
        /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar capability_inject_definalize PLUGINSERVICE 
        /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtimedistcleaner PLUGINSERVICE 
        /forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar fml TRANSFORMATIONSERVICE 
    FML: 31.2
    Forge: net.minecraftforge:31.2.0
    FML Language Providers: 
        [email protected]
        minecraft@1
    Mod List: 
        client-extra.jar Minecraft {[email protected] DONE}
        forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar Forge {[email protected] DONE}
        main TellyTubbie Mod {[email protected] DONE}
    Launched Version: MOD_DEV
    Backend library: LWJGL version 3.2.2 build 10
    Backend API: GeForce GT 730/PCIe/SSE2 GL version 4.6.0 NVIDIA 440.100, NVIDIA Corporation
    GL Caps: Using framebuffer using OpenGL 3.0
    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'forge'
    Type: Client (map_client.txt)
    Resource Packs: replaymod_lang (incompatible), vanilla, fabric/autoconfig1u, fabric/cloth-config2, fabric/fabric, fabric/fabric-api-base, fabric/fabric-biome-api-v1, fabric/fabric-blockrenderlayer-v1, fabric/fabric-containers-v0, fabric/fabric-content-registries-v0, fabric/fabric-crash-report-info-v1, fabric/fabric-events-interaction-v0, fabric/fabric-events-lifecycle-v0, fabric/fabric-game-rule-api-v1, fabric/fabric-item-api-v1, fabric/fabric-item-groups-v0, fabric/fabric-key-binding-api-v1, fabric/fabric-keybindings-v0, fabric/fabric-lifecycle-events-v1, fabric/fabric-loot-tables-v1, fabric/fabric-mining-levels-v0, fabric/fabric-models-v0, fabric/fabric-networking-blockentity-v0, fabric/fabric-networking-v0, fabric/fabric-object-builder-api-v1, fabric/fabric-object-builders-v0, fabric/fabric-registry-sync-v0, fabric/fabric-renderer-api-v1, fabric/fabric-renderer-indigo, fabric/fabric-renderer-registries-v1, fabric/fabric-rendering-data-attachment-v1, fabric/fabric-rendering-fluids-v1, fabric/fabric-rendering-v0, fabric/fabric-rendering-v1, fabric/fabric-resource-loader-v0, fabric/fabric-screen-handler-api-v1, fabric/fabric-tag-extensions-v0, fabric/fabric-textures-v0, fabric/fabric-tool-attribute-api-v1, fabric/fabricloader, fabric/litematica (incompatible), fabric/malilib (incompatible), fabric/minihud (incompatible), fabric/modmenu, fabric/replaymod (incompatible), fabric/shulkerboxtooltip, file/My Texture Pack
    Current Language: English (US)
    CPU: 4x AMD Phenom(tm) II X4 955 Processor
[15:51:52] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:110]: #@!@# Game crashed! Crash report saved to: #@!@# /home/matthew/Desktop/minecraft modding/forge/1.15/TellyTubbieMod/run/./crash-reports/crash-2020-11-28_15.51.52-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed

Process finished with exit code 255
 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
  • Topics

×
×
  • Create New...

Important Information

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