#Custom Create Cogwheel

12 messages · Page 1 of 1 (latest)

flat zealot
#

There was a support ticket closed about the same topic, I was trying to implement and came to this code;

const $CogWheelBlock = Java.loadClass('com.simibubi.create.content.kinetics.simpleRelays.CogWheelBlock')
const $CogWheelBlockItem = Java.loadClass('com.simibubi.create.content.kinetics.simpleRelays.CogwheelBlockItem')
const $CreateBlocks = Java.loadClass('com.simibubi.create.AllBlocks')
const $Properties = Java.loadClass('net.minecraft.world.level.block.state.BlockBehaviour$Properties')
const $IProperties = Java.loadClass('net.minecraft.world.item.Item$Properties')
const $BlockItem = Java.loadClass('net.minecraft.world.item.BlockItem')

let metalCogwheel
StartupEvents.registry('block', e => {
    metalCogwheel = e.custom(
        'bronze_cogwheel',
        new $CogWheelBlock($Properties.copy($CreateBlocks.COGWHEEL.get()))
    )
})```

however I am prompted with the error:

Error occurred while handling event 'StartupEvents.registry': java.lang.NullPointerException: Registry entry not present: create:cogwheel


which leads me to believe create is loading after kube?
runic rock
#

change

    metalCogwheel = e.custom(
        'bronze_cogwheel',
        new $CogWheelBlock($Properties.copy($CreateBlocks.COGWHEEL.get()))
    )

to

    metalCogwheel = e.createCustom(
        'bronze_cogwheel',
        () => new $CogWheelBlock($Properties.copy($CreateBlocks.COGWHEEL.get()))
    )
flat zealot
#

yay now I get a different error!

dev.latvian.mods.rhino.EvaluatorException: Java constructor for "com.simibubi.create.content.kinetics.simpleRelays.CogWheelBlock" with arguments "net.minecraft.world.level.block.state.BlockBehaviour$Properties" not found. (startup_scripts:metal_cogwheel.js#12)
runic rock
#

it probably doesn't accept block properties as a parameter

flat zealot
#

ohh no it does, but it also takes a true or false before properties for if it's a large or small wheel

#
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small)
        .initialProperties(SharedProperties::stone)
        .properties(p -> p.sound(SoundType.WOOD).color(MaterialColor.DIRT))
        .transform(BlockStressDefaults.setNoImpact())
        .transform(axeOrPickaxe())
        .blockstate(BlockStateGen.axisBlockProvider(false))
        .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new))
        .item(CogwheelBlockItem::new)
        .build()
        .register();```
#
protected CogWheelBlock(boolean large, Properties properties) {
        super(properties);
        isLarge = large;
    }

    public static CogWheelBlock small(Properties properties) {
        return new CogWheelBlock(false, properties);
    }```
#

just changed it to new cogwheel.small(properties) and testing

#

now I just need a block model

#

I'm going to leave this open for the time being because I can already see a potential issue, being that having two models, the one that rotates, and the one that isn't. But I will borrow the cogwheel model and see what happens

flat zealot
#

ok couple of issues (Im using the creates texture for the time being)

the left is a wood cogwheel, right is mine, it renders the block model, and creates custom render on top

second issue, if I place it on existing rotation, it doesn't "attach" and start rotating, unless I stop and restart rotation