Jump to content

Recommended Posts

Posted (edited)

I followed the 1.16 tutorial to create and register my sign. However, the code doesn't work for 1.19.2 and I cannot find out how to render it properly. I cannot figure the new way of doing this:

ClientRegistry.bindTileEntityRenderer(CUSTOM_SIGN.get(), SignTileEntityRenderer::new);

Atlases.addWoodType(TEST_WOOD_TYPE);

 

My sign is created in-game with no errors, but it appears as the flat texture in inventory and in my hand instead of being wrapped around the model, and when I try to place it, it appears as an invisible sign and the game crashes.

 

Edited by DinoPawz
  • DinoPawz changed the title to [1.19.2] Custom sign not rendering
Posted

Subscribe to EntityRenderersEvent.RegisterRenderers

 

I have no idea what Atlases.addWoodType() did in older versions.

I would guess that since atlases are related to images, what you really want is to put your texture in assets/minecraft/entity/signs/yourwoodtype.png

 

If you want to find out how to port methods from older versions, look at how vanilla used that method in the older game.

Then find the same process in the modern game to see the new way of doing it.

 

If you want further help, you are going to need post more than 2 lines of code. So we can see what you are doing with some context.

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

public static final WoodType CHERRY_WOOD_TYPE = WoodType.create(new ResourceLocation(MODID, "cherry").toString()); public static final RegistryObject<ModStandingSignBlock> CHERRY_STANDING_SIGN = BLOCKS.register("cherry_sign", () -> new ModStandingSignBlock(BlockBehaviour.Properties.of(Material.WOOD, MaterialColor.COLOR_PINK).noCollission().strength(1.0F).sound(SoundType.WOOD), CHERRY_WOOD_TYPE)); public static final RegistryObject<ModWallSignBlock> CHERRY_WALL_SIGN = BLOCKS.register("cherry_wall_sign", () -> new ModWallSignBlock(BlockBehaviour.Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CHERRY_WOOD_TYPE)); public static final RegistryObject<SignItem> CHERRY_SIGN = ITEMS.register("cherry_sign", () -> new SignItem((new Item.Properties()).stacksTo(16).tab(CreativeModeTab.TAB_DECORATIONS), CHERRY_STANDING_SIGN.get(), CHERRY_WALL_SIGN.get())); private static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); public static final RegistryObject<BlockEntityType<SignBlockEntity>> CHERRY_SIGN_BLOCK_ENTITY = BLOCK_ENTITIES.register("cherry_sign_block_entity", () -> BlockEntityType.Builder.of(SignBlockEntity::new, CHERRY_WALL_SIGN.get(), CHERRY_STANDING_SIGN.get()).build(null)); public EpicTrees() { final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); // Register the Deferred Register to the mod event bus so blocks get registered BLOCKS.register(modEventBus); // Register the Deferred Register to the mod event bus so items get registered ITEMS.register(modEventBus); BLOCK_ENTITIES.register(modEventBus); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); //ModEntities.ENTITIES.register(modEventBus); ModFeatures.register(modEventBus); //MinecraftForge.EVENT_BUS.register(WanderingArboristSpawner.class); //modEventBus.addListener(this::clientSetup); // Register the commonSetup method for modloading modEventBus.addListener(this::commonSetup); } private void commonSetup(@NotNull final FMLCommonSetupEvent event) { // Some common setup code //LOGGER.info("HELLO FROM COMMON SETUP"); //LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); event.enqueueWork(() -> WoodType.register(CHERRY_WOOD_TYPE)); } // You can use SubscribeEvent and let the Event Bus discover methods to call // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public static class ClientModEvents { @SubscribeEvent public static void onClientSetup(@NotNull FMLClientSetupEvent event) { // Some client setup code //LOGGER.info("HELLO FROM CLIENT SETUP"); //LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); /* event.enqueueWork(() -> { Atlases.addWoodType(CHERRY_WOOD_TYPE); */ } @SubscribeEvent public void onEntityRenderersEvent(@NotNull EntityRenderersEvent.RegisterRenderers event) { event.registerBlockEntityRenderer(CHERRY_SIGN_BLOCK_ENTITY.get(), SignRenderer::new); } }

 

public class ModWallSignBlock extends WallSignBlock { public ModWallSignBlock(Properties p_58068_, WoodType p_58069_) { super(p_58068_, p_58069_); } }

public class ModStandingSignBlock extends StandingSignBlock { public ModStandingSignBlock(Properties p_56990_, WoodType p_56991_) { super(p_56990_, p_56991_); } }

 

---- Minecraft Crash Report ----
// Don't be sad, have a hug! ❤️

Time: 2022-09-12 13:12:25
Description: Rendering screen

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.resources.model.Material.m_119194_(net.minecraft.client.renderer.MultiBufferSource, java.util.function.Function)" because "$$10" is null
    at net.minecraft.client.gui.screens.inventory.SignEditScreen.m_6305_(SignEditScreen.java:159) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading}
    at net.minecraftforge.client.ForgeHooksClient.drawScreenInternal(ForgeHooksClient.java:438) ~[forge-1.19.2-43.1.1-universal.jar%23151!/:?] {re:classloading}
    at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:431) ~[forge-1.19.2-43.1.1-universal.jar%23151!/:?] {re:classloading}
    at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:896) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1115) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.2-43.1.1.jar%2395!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


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

-- Head --
Thread: Render thread
Stacktrace:
    at net.minecraft.client.gui.screens.inventory.SignEditScreen.m_6305_(SignEditScreen.java:159) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading}
    at net.minecraftforge.client.ForgeHooksClient.drawScreenInternal(ForgeHooksClient.java:438) ~[forge-1.19.2-43.1.1-universal.jar%23151!/:?] {re:classloading}
    at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:431) ~[forge-1.19.2-43.1.1-universal.jar%23151!/:?] {re:classloading}
-- Screen render details --
Details:
    Screen name: net.minecraft.client.gui.screens.inventory.SignEditScreen
    Mouse location: Scaled: (213, 120). Absolute: (427.000000, 240.000000)
    Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2.000000
Stacktrace:
    at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:896) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1115) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.2-43.1.1.jar%2395!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


-- Affected level --
Details:
    All players: 1 total; [LocalPlayer['InstantMilo'/201, l='ClientLevel', x=-2.76, y=80.00, z=34.46]]
    Chunk stats: 961, 576
    Level dimension: minecraft:overworld
    Level spawn location: World: (0,86,32), Section: (at 0,6,0 in 0,5,2; chunk contains blocks 0,-64,32 to 15,319,47), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
    Level time: 465 game time, 465 day time
    Server brand: forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.ClientLevel.m_6026_(ClientLevel.java:450) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91354_(Minecraft.java:2278) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:717) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23146!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.2-43.1.1.jar%2395!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%2382!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


-- Last reload --
Details:
    Reload number: 1
    Reload reason: initial
    Finished: Yes
    Packs: Default, Mod Resources

-- System Details --
Details:
    Minecraft Version: 1.19.2
    Minecraft Version ID: 1.19.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 17.0.3, Microsoft
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft
    Memory: 797535704 bytes (760 MiB) / 1811939328 bytes (1728 MiB) up to 4294967296 bytes (4096 MiB)
    CPUs: 8
    Processor Vendor: AuthenticAMD
    Processor Name: AMD Ryzen 5 2400G with Radeon Vega Graphics    
    Identifier: AuthenticAMD Family 23 Model 17 Stepping 0
    Microarchitecture: Zen
    Frequency (GHz): 3.59
    Number of physical packages: 1
    Number of physical CPUs: 4
    Number of logical CPUs: 8
    Graphics card #0 name: NVIDIA GeForce GTX 1050 Ti
    Graphics card #0 vendor: NVIDIA (0x10de)
    Graphics card #0 VRAM (MB): 4095.00
    Graphics card #0 deviceId: 0x1c82
    Graphics card #0 versionInfo: DriverVersion=31.0.15.1659
    Graphics card #1 name: AMD Radeon(TM) RX Vega 11 Graphics
    Graphics card #1 vendor: Advanced Micro Devices, Inc. (0x1002)
    Graphics card #1 VRAM (MB): 2048.00
    Graphics card #1 deviceId: 0x15dd
    Graphics card #1 versionInfo: DriverVersion=30.0.13014.8
    Memory slot #0 capacity (MB): 8192.00
    Memory slot #0 clockSpeed (GHz): 2.67
    Memory slot #0 type: DDR4
    Memory slot #1 capacity (MB): 8192.00
    Memory slot #1 clockSpeed (GHz): 2.67
    Memory slot #1 type: DDR4
    Virtual memory max (MB): 29060.46
    Virtual memory used (MB): 21966.76
    Swap memory total (MB): 14792.35
    Swap memory used (MB): 1293.00
    JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx4G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
    Launched Version: 1.19.2-forge-43.1.1
    Backend library: LWJGL version 3.3.1 build 7
    Backend API: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2 GL version 3.2.0 NVIDIA 516.59, NVIDIA Corporation
    Window size: 854x480
    GL Caps: Using framebuffer using OpenGL 3.2
    GL debug messages: 
    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge'
    Type: Integrated Server (map_client.txt)
    Graphics mode: fancy
    Resource Packs: vanilla, mod_resources
    Current Language: English (US)
    CPU: 8x AMD Ryzen 5 2400G with Radeon Vega Graphics 
    Server Running: true
    Player Count: 1 / 8; [ServerPlayer['InstantMilo'/201, l='ServerLevel[New World]', x=-2.76, y=80.00, z=34.46]]
    Data Packs: vanilla, mod:forge, mod:epictrees
    World Generation: Stable
    ModLauncher: 10.0.8+10.0.8+main.0ef7e830
    ModLauncher launch target: forgeclient
    ModLauncher naming: srg
    ModLauncher services: 
        mixin-0.8.5.jar mixin PLUGINSERVICE 
        eventbus-6.0.3.jar eventbus PLUGINSERVICE 
        fmlloader-1.19.2-43.1.1.jar slf4jfixer PLUGINSERVICE 
        fmlloader-1.19.2-43.1.1.jar object_holder_definalize PLUGINSERVICE 
        fmlloader-1.19.2-43.1.1.jar runtime_enum_extender PLUGINSERVICE 
        fmlloader-1.19.2-43.1.1.jar capability_token_subclass PLUGINSERVICE 
        accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE 
        fmlloader-1.19.2-43.1.1.jar runtimedistcleaner PLUGINSERVICE 
        modlauncher-10.0.8.jar mixin TRANSFORMATIONSERVICE 
        modlauncher-10.0.8.jar fml TRANSFORMATIONSERVICE 
    FML Language Providers: 
        [email protected]
        lowcodefml@null
        javafml@null
    Mod List: 
        client-1.19.2-20220805.130853-srg.jar             |Minecraft                     |minecraft                     |1.19.2              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
        forge-1.19.2-43.1.1-universal.jar                 |Forge                         |forge                         |43.1.1              |DONE      |Manifest: 84:ce:76:e8:45:35:e4:0e:63:86:df:47:59:80:0f:67:6c:c1:5f:6e:5f:4d:b3:54:47:1a:9f:7f:ed:5e:f2:90
        epictrees-1.0.0.jar                               |Epic Trees                    |epictrees                     |1.0.0               |DONE      |Manifest: NOSIGNATURE
    Crash Report UUID: d69f839f-9cf9-4d20-9cca-c9548a290efb
    FML: 43.1
    Forge: net.minecraftforge:43.1.1

Posted (edited)

The problem might be that the build function below is passing a null value. I tried entering a Type there but it wants and expression which goes beyond trial and error debugging. I don't know what I should put there, if anything.

public static final RegistryObject<BlockEntityType<SignBlockEntity>> CHERRY_SIGN_BLOCK_ENTITY = BLOCK_ENTITIES.register("cherry_sign_block_entity", () -> BlockEntityType.Builder.of(SignBlockEntity::new, CHERRY_WALL_SIGN.get(), CHERRY_STANDING_SIGN.get()).build(null));

Edited by DinoPawz
Posted (edited)

Please in future when you post code use the <> button.

From your error message, it looks like your Atlases.addWoodType() is now called Sheets.addWoodType()

That is the method that creates and registers sign Materials.

It is this registration being missing in the call to Sheets.getSignMaterial() that is causing your NPE. 

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

My sign block entity still not rendering. I have put the pngs in the minecraft:textures directory and added the signs to the block tags. And yes, I needed another texture for the item sign.

Mc loads and runs without any errors at all, even when I fail to place my sign. When I try to place it, the sign correctly built(texture applied to correct model), appears for a split second before it disappears, where ever I try to place it.

Posted

Show the relevant code, preferably on github, we have no psychic powers.

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

We need to see source code, so we can identify what you are not doing correctly.

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

I got a log error.

java.lang.IllegalArgumentException: No model for layer signexample:sign/jade#main

10:05:16.047

game

at net.minecraft.client.renderer.blockentity.SignRenderer.m_173646_(SignRenderer.java:172) ~[client-1.19.2-20220805.130853-srg.jar%23147!/:?] {re:classloading}

Posted

Looks like I am supposed to register it somehow in

@SubscribeEvent public static void registerLayerDefinition(@NotNull EntityRenderersEvent.RegisterLayerDefinitions event) {}

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

    • I know that this may be a basic question, but I am very new to modding. I am trying to have it so that I can create modified Vanilla loot tables that use a custom enchantment as a condition (i.e. enchantment present = item). However, I am having trouble trying to implement this; the LootItemRandomChanceWithEnchantedBonusCondition constructor needs a Holder<Enchantment> and I am unable to use the getOrThrow() method on the custom enchantment declared in my mod's enchantments class. Here is what I have so far in the GLM:   protected void start(HolderLookup.Provider registries) { HolderLookup.RegistryLookup<Enchantment> registrylookup = registries.lookupOrThrow(Registries.ENCHANTMENT); LootItemRandomChanceWithEnchantedBonusCondition lootItemRandomChanceWithEnchantedBonusCondition = new LootItemRandomChanceWithEnchantedBonusCondition(0.0f, LevelBasedValue.perLevel(0.07f), registrylookup.getOrThrow(*enchantment here*)); this.add("nebu_from_deepslate", new AddItemModifier(new LootItemCondition[]{ LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.DEEPSLATE).build(), LootItemRandomChanceCondition.randomChance(0.25f).build(), lootItemRandomChanceWithEnchantedBonusCondition }, OrichalcumItems.NEBU.get())); }   Inserting Enchantments.[vanilla enchantment here] actually works but trying to declare an enchantment from my custom enchantments class as [mod enchantment class].[custom enchantment] does not work even though they are both a ResourceKey and are registered in Registries.ENCHANTMENT. Basically, how would I go about making it so that a custom enchantment declared as a ResourceKey<Enchantment> of value ResourceKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath([modid], [name])), declared in a seperate enchantments class, can be used in the LootItemRandomChanceWithEnchantedBonusCondition constructor as a Holder? I can't use getOrThrow() because there is no level or block entity/entity in the start() method and it is running as datagen. It's driving me nuts.
    • Hi here is an update. I was able to fix the code so my mod does not crash Minecraft. Please understand that I am new to modding but I honestly am having a hard time understanding how anyone can get this to work without having extensive programming and debugging experience as well as searching across the Internet, multiple gen AI bots (claude, grok, openai), and examining source code hidden in the gradle directory and in various github repositories. I guess I am wrong because clearly there are thousands of mods so maybe I am just a newbie. Ok, rant over, here is a step by step summary so others can save the 3 days it took me to figure this out.   1. First, I am using forge 54.1.0 and Minecraft 1.21.4 2. I am creating a mod to add a shotgun to Minecraft 3. After creating the mod and compiling it, I installed the .jar file to the proper directory in Minecraft and used 1.21.4-forge-54.1.0 4. The mod immediately crashed with the error: Caused by: java.lang.NullPointerException: Item id not set 5. Using the stack trace, I determined that the Exception was being thrown from the net.minecraft.world.item.Item.Properties class 6. It seems that there are no javadocs for this class, so I used IntelliJ which was able to provide a decompiled version of the class, which I then examined to see the source of the error. Side question: Are there javadocs? 7. This method, specifically, was the culprit: protected String effectiveDescriptionId() {      return this.descriptionId.get(Objects.requireNonNull(this.id, "Item id not set"));  } 8. Now my quest was to determine how to set this.id. Looking at the same source file, I determined there was another method:  public Item.Properties setId(ResourceKey<Item> pId) {             this.id = pId;             return this;   } 9. So now, I need to figure out how to call setId(). This required working backwards a bit. Starting from the constructor, I stubbed out the variable p which is of type Item.Properties public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); Rather than putting this all on one line, I split it up for readability like this: private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); Here is was the missing function, setId(), which takes a type of ResourceKey<Item>. My next problem is that due to the apparent lack of documentation (I tried searching the docs on this site) I could not determine the full import path to ResourceKey. I did some random searching on the Internet and stumbled across a Github repository which gave two clues: import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; Then I created the rk variable like this: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); And now putting it all together in order: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); This compiled and the mod no longer crashes. I still have more to do on it, but hopefully this will save someone hours. I welcome any feedback and if I missed some obvious modding resource or tutorial that has this information. If not, I might suggest we add it somewhere for people trying to write a mod that doesn't crash. Thank you !!!  
    • I will keep adding to this thread with more information in case anyone can help, or at the very least I can keep my troubleshooting organized. I decided to downgrade to 54.1.0 in the hopes that this would fix the issue but it didn't. At least now I am on a "recommended" version. The crash report did confirm my earlier post that the Exception is coming from effectiveDescriptionId(). I'll continue to see if I can find a way to set the ID manually.   Caused by: java.lang.NullPointerException: Item id not set         at java.base/java.util.Objects.requireNonNull(Objects.java:259) ~[?:?]         at TRANSFORMER/[email protected]/net.minecraft.world.item.Item$Properties.effectiveDescriptionId(Item.java:465) ~[forge-1.21.4-54.1.0-client.jar!/:?]         at TRANSFORMER/[email protected]/net.minecraft.world.item.Item.<init>(Item.java:111) ~[forge-1.21.4-54.1.0-client.jar!/:?]         at TRANSFORMER/[email protected]/com.example.shotgunmod.ShotgunItem.<init>(ShotgunItem.java:19) ~[shotgunmod-1.0.0.jar!/:1.0.0]         at TRANSFORMER/[email protected]/com.example.shotgunmod.ModItems.lambda$static$0(ModItems.java:15) ~[shotgunmod-1.0.0.jar!/:1.0.0]         at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister$EventDispatcher.lambda$handleEvent      
    • It just randomly stop working after a rebooted my dedicated server PLEASE HELP!   com.google.gson   Failed to start the minecraft server com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive; at path $  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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