Jump to content

Recommended Posts

Posted (edited)

I creates an entity, its render and model(in Blockbench), but soon as I want spawn it, minecraft crashes.

 

please help fix this.

 

P.S English is not my native language.

 

Edited by toad132
Posted (edited)
10 hours ago, toad132 said:

 

crash log

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.EntityRenderer.shouldRender(net.minecraft.entity.Entity, net.minecraft.client.renderer.culling.ClippingHelper, double, double, double)" because "entityrenderer" is null
    at net.minecraft.client.renderer.entity.EntityRendererManager.shouldRender(EntityRendererManager.java:239) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.WorldRenderer.updateCameraAndRender(WorldRenderer.java:1009) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:620) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:437) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1003) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:38) ~[forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:94) [forge-1.16.5-36.2.35_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
 

my entity render

public class CrowRender extends MobRenderer<CrowEntity, CrowModel<CrowEntity>> {

protected static final ResourceLocation TEXTURE = new ResourceLocation(ue.MODID, "textures/entity/Crow/Crow1.png");

public CrowRender(EntityRendererManager renderManagerIn) { super(renderManagerIn, new CrowModel(), 0.3F); }

@Override public ResourceLocation getEntityTexture(CrowEntity entity) { return TEXTURE; }

 

please help fix this.

 

P.S English is not my native language.

 

 

Edited by toad132
Posted (edited)

Have you registered your renderer? Something like the following in your FMLClientSetupEvent

Quote

RenderingRegistry.registerEntityRenderingHandler(YourCrowEntityType, CrowRender::new);

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)
10 hours ago, warjort said:

Have you registered your renderer? Something like the following in your FMLClientSetupEvent

 

Yes, im registered

 

Edited by toad132
Posted
4 hours ago, diesieben07 said:

main class

private static final Logger LOGGER = LogManager.getLogger();

public static final String MODID = "ue";

public ue() {

ModEntityTypes.register(eventBus);

private void doClientStuff(final FMLClientSetupEvent event){

RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.CROW.get(), CrowRender::new);

 

 

4 hours ago, diesieben07 said:
4 hours ago, diesieben07 said:

 

Entity

public class CrowEntity extends ParrotEntity implements IFlyingAnimal

{

public CrowEntity(EntityType<? extends ParrotEntity> type, World worldIn) { super(type, worldIn); } public static AttributeModifierMap.MutableAttribute setCustomAttributes(){ return MobEntity.func_233666_p_() .

createMutableAttribute(Attributes.MAX_HEALTH, 10.00)

.createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.7D)

.createMutableAttribute(Attributes.ATTACK_DAMAGE, 0.00)

.createMutableAttribute(Attributes.FLYING_SPEED, 0.5D); }

@Override protected int getExperiencePoints(PlayerEntity player){ return 1 + this.world.rand.nextInt(1);}

@Override public SoundEvent getAmbientSound (){return ModSoundEvents.CrowAmbient.get();}

@Override public SoundEvent getDeathSound (){return ModSoundEvents.CrowDeath.get();}

@Override public SoundEvent getHurtSound (DamageSource damageSourceIn){return ModSoundEvents.CrowHurt.get();}

@Override protected void playStepSound(BlockPos pos, BlockState state){ this.playSound(SoundEvents.ENTITY_PARROT_STEP, 0.15F, 1.0F); }

@Override protected float playFlySound(float volume){ this.playSound(SoundEvents.ENTITY_PARROT_FLY, 0.15F, 1.0F); return volume + this.flapSpeed / 2.0F; } public float flap;

 

EntityTypes

public class ModEntityTypes {

public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, ue.MODID);

public static final RegistryObject<EntityType<CrowEntity>> CROW = ENTITY_TYPES.register("crow",()-> EntityType.Builder.create(CrowEntity::new, EntityClassification.AMBIENT).size(3f,3f) .build(new ResourceLocation(ue.MODID, "crow").toString()));

 

public static void register(IEventBus eventBus){ENTITY_TYPES.register(eventBus);} }

}

 

Posted (edited)

first of all please show the full code not only a part (main class),
then please use the code feature of the forum or use a paste side

is your doClientStuff EventHandler called, use debugger to check?

Edited by Luis_ST
Posted

main class

19 minutes ago, Luis_ST said:
mport com.mr_toad.ue.block.ModBlocks;
import com.mr_toad.ue.block.ModWoodTypes;
import com.mr_toad.ue.entity.ModEntityTypes;
import com.mr_toad.ue.entity.render.CrowRender;
import com.mr_toad.ue.item.ModItems;
import com.mr_toad.ue.util.ModSoundEvents;
import net.minecraft.block.Block;
import net.minecraft.block.ComposterBlock;
import net.minecraft.block.WoodType;
import net.minecraft.client.renderer.Atlases;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.item.AxeItem;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.stream.Collectors;




@Mod(ue.MODID)
public class ue
{
    private static final Logger LOGGER = LogManager.getLogger();
    public static final String MODID = "ue";
    public ue() {

        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
        ModEntityTypes.register(eventBus);
        ModBlocks.register(eventBus);
        ModItems.register(eventBus);
        ModSoundEvents.register(eventBus);
        eventBus.addListener(this::setup);
        eventBus.addListener(this::enqueueIMC);
        eventBus.addListener(this::processIMC);
        eventBus.addListener(this::doClientStuff);


        MinecraftForge.EVENT_BUS.register(this);


    }






    private void setup(final FMLCommonSetupEvent event) {
        event.enqueueWork(()->{
            AxeItem.BLOCK_STRIPPING_MAP = new ImmutableMap.Builder<Block, Block>().putAll(AxeItem.BLOCK_STRIPPING_MAP)

                    .put(ModBlocks.ashwood_wood.get(), ModBlocks.ashwood_wood_stripped.get())
                    .put(ModBlocks.ashwood_log.get(), ModBlocks.ashwood_log_stripped.get()).build();

        });
        event.enqueueWork(() -> {

            ComposterBlock.CHANCES.put(ModItems.ash_leaves.get(), 0.35f);
        });
        WoodType.register(ModWoodTypes.ashwood);
        WoodType.register(ModWoodTypes.oak_log_variants);
        WoodType.register(ModWoodTypes.birch_log_variants);



    }
    private void doClientStuff(final FMLClientSetupEvent event){
        RenderTypeLookup.setRenderLayer(ModBlocks.ash_leaves.get(), RenderType.getCutout());
        RenderTypeLookup.setRenderLayer(ModBlocks.ash_trapdoor.get(), RenderType.getCutout());
        RenderTypeLookup.setRenderLayer(ModBlocks.ash_door.get(), RenderType.getCutout());

        RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.CROW.get(), CrowRender::new);

        Atlases.addWoodType(ModWoodTypes.ashwood);
        Atlases.addWoodType(ModWoodTypes.oak_log_variants);
        Atlases.addWoodType(ModWoodTypes.birch_log_variants);



    }



    private void enqueueIMC ( final InterModEnqueueEvent event)
        {
            InterModComms.sendTo("examplemod", "helloworld", () -> {
                LOGGER.info("Hello world from the MDK");
                return "Hello world";
            });
        }

        private void processIMC ( final InterModProcessEvent event)
        {
            LOGGER.info("Got IMC {}", event.getIMCStream().
                    map(m -> m.getMessageSupplier().get()).
                    collect(Collectors.toList()));
        }






        @SubscribeEvent
        public void onServerStarting (FMLServerStartingEvent event){
            LOGGER.info("HELLO from server starting");
        }

        @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
        public static class RegistryEvents {
            @SubscribeEvent
            public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {

    }

}}

 

 

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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