Jump to content

Recommended Posts

Posted (edited)

I'm trying to make the various soil block pannable, so far I've been able to get the textures, blocks and loot table functioning correctly. However, everytime I attempt to use the pan on one of the stages of the soil it crashes and I'm not sure what exactly is going wrong. My assumption is that the game is trying to generate a block that doesn't exist instead of the ones made using this code. I based it off the existing code for gravel with a few changes to accommodate the different types of soil. The code is listed here:

Spoiler

{
    code: "soil",
    class: "BlockSoil",
    attributes: {
        mapColorCode: "land",
        pannable: true,
        allowUnstablePlacement: true
    },
    behaviors: [{name: "UnstableFalling"}],
    variantgroups: [
        { loadFromProperties: "abstract/fertility", code: "fertility" },
        { code: "grasscoverage", states: ["none"] },
        { code: "layer", states: ["1", "2", "3", "4", "5", "6", "7"] }
    ],
    creativeinventory: { "general": ["*"], "terrain": [""] },
    shapebytype: {
        "*-1": { base: "block/basic/layers/2voxel" },
        "*-2": { base: "block/basic/layers/4voxel" },
        "*-3": { base: "block/basic/layers/6voxel" },
        "*-4": { base: "block/basic/layers/8voxel" },
        "*-5": { base: "block/basic/layers/10voxel" },
        "*-6": { base: "block/basic/layers/12voxel" },
        "*-7": { base: "block/basic/layers/14voxel" },
    },
    blockmaterial: "Soil",
    textures: {
        all: {base: "block/soil/fert{fertility}"},
    },
    sidesolid: { all: false, down: true},
    sideopaque: { all: false, down: true},
    emitSideAoByType: {
        "*-7": { all: true, up: false },
        "*": { all: false, down: true },
    },
    replaceable: 2000,
    fertility: 10,
    resistance: 1.5,
    drops: [],
    sounds: {
        place: "block/dirt",
        break: "block/dirt",
        hit: "block/dirt",
        walk: "walk/grass"
    },
    heldTpIdleAnimation: "holdbothhandslarge", heldRightReadyAnimation: "heldblockready", heldTpUseAnimation: "twohandplaceblock",
    tpHandTransform: {
        translation: { x: -1.23, y: -0.91, z: -0.8 },
        rotation: { x: -2, y: 25, z: -78 },
        scale: 0.4
    },
    collisionselectionboxbytype: {
        "*-1": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.125, z2: 1 },
        "*-2": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.25, z2: 1 },
        "*-3": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.375, z2: 1 },
        "*-4": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.5, z2: 1 },
        "*-5": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.625, z2: 1 },
        "*-6": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.75, z2: 1 },
        "*-7": { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.875, z2: 1 },
    },    
}

Also here's the crash log that generates:

Spoiler

4/27/2025 4:48:15 PM: Critical error occurred
Loaded Mods: b@1.4.4, game@1.20.9, creative@1.20.9, survival@1.20.9
System.NullReferenceException: Object reference not set to an instance of an object.
   at Vintagestory.GameContent.BlockPan.SetMaterial(ItemSlot slot, Block block) in VSSurvivalMod\Block\BlockPan.cs:line 143
   at Vintagestory.GameContent.BlockPan.TryTakeMaterial(ItemSlot slot, EntityAgent byEntity, BlockPos position) in VSSurvivalMod\Block\BlockPan.cs:line 412
   at Vintagestory.GameContent.BlockPan.OnHeldInteractStart(ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, Boolean firstEvent, EnumHandHandling& handling) in VSSurvivalMod\Block\BlockPan.cs:line 202
   at Vintagestory.API.Common.CollectibleObject.OnHeldUseStart(ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, EnumHandInteract useType, Boolean firstEvent, EnumHandHandling& handling) in VintagestoryApi\Common\Collectible\Collectible.cs:line 1127
   at Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.TryBeginUseActiveSlotItem(BlockSelection blockSel, EntitySelection entitySel, EnumHandInteract useType, EnumHandHandling& handling) in VintagestoryLib\Client\Systems\Player\MouseInWorldInteractions.cs:line 844
   at Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.TryBeginUseActiveSlotItem(BlockSelection blockSel, EntitySelection entitySel) in VintagestoryLib\Client\Systems\Player\MouseInWorldInteractions.cs:line 820
   at Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.HandleMouseInteractionsBlockSelected(Single dt) in VintagestoryLib\Client\Systems\Player\MouseInWorldInteractions.cs:line 617
   at Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.OnFinalizeFrame(Single dt) in VintagestoryLib\Client\Systems\Player\MouseInWorldInteractions.cs:line 85
   at Vintagestory.Client.NoObf.ClientEventManager.TriggerRenderStage(EnumRenderStage stage, Single dt) in VintagestoryLib\Client\Util\ClientEventManager.cs:line 188
   at Vintagestory.Client.NoObf.ClientMain.RenderToDefaultFramebuffer(Single dt) in VintagestoryLib\Client\ClientMain.cs:line 992
   at Vintagestory.Client.GuiScreenRunningGame.RenderToDefaultFramebuffer(Single dt) in VintagestoryLib\Client\MainMenu\Screens\GuiScreenRunningGame.cs:line 242
   at Vintagestory.Client.ScreenManager.Render(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 695
   at Vintagestory.Client.ScreenManager.OnNewFrame(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 670
   at Vintagestory.Client.NoObf.ClientPlatformWindows.window_RenderFrame(FrameEventArgs e) in VintagestoryLib\Client\ClientPlatform\GameWindow.cs:line 88
   at OpenTK.Windowing.Desktop.GameWindow.Run()
   at Vintagestory.Client.ClientProgram.Start(ClientProgramArgs args, String[] rawArgs) in VintagestoryLib\Client\ClientProgram.cs:line 334
   at Vintagestory.Client.ClientProgram.<>c__DisplayClass10_0.<.ctor>b__1() in VintagestoryLib\Client\ClientProgram.cs:line 130
   at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93
Crash written to file at "C:\Users\tryingtolookatmynameareyou:)\AppData\Roaming\VintagestoryData\Logs\client-crash.log"

If anyone has any insight as to what I'm missing please let me know!

Edited by SevenIndex
Added Possible Reason for Crash
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.