#How to make it so a custom block is able to face towards the player on placement?
54 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Paste version of startup.log from @stray aurora
version 1.20.1?
Yeah
could i see a copy of the file?
event.create("warden_trophy")
.displayName("Warden Trophy")
.material("wood")
.hardness(2)
.resistance(3)
.tagBlock('minecraft:mineable/axe')
.noCollision()
.notSolid()
.renderType('cutout')
.property(BlockProperty.facing)
})
Paste version of Test.js from @placid shore
if that doesn't work, i'll look for a workaround but you'd probably have to set it up as a condition like holding shift
might need this as well
// Assuming BlockEvents is a valid object
BlockEvents.placed('warden_trophy', event => {
const player = event.player;
if (player) {
const playerFacing = player.getHorizontalFacing();
event.blockState = event.blockState.with('facing', playerFacing);
}
});
Paste version of startup.log from @stray aurora
// Assuming StartupEvents is a valid object
StartupEvents.registry('block', event => {
event.create('warden_trophy')
.displayName('Warden Trophy')
.soundType(SoundType.WOOD) // Replace SoundType.WOOD with the appropriate sound type
.mapColor(MapColor.WOOD_BROWN) // Replace MapColor.WOOD_BROWN with the appropriate map color
.hardness(2)
.resistance(3)
.tagBlock('minecraft:mineable/axe')
.noCollision()
.notSolid()
.renderType('cutout')
.property('facing') // Make the block face the player
});
this might work
Paste version of startup.log from @stray aurora
this seems to be the problem "dev.latvian.mods.kubejs.block.BlockBuilder.property(string)."
but what can I do to solve it
are you on version 6.4 of kube?
Yeah
I'm heading off to bed tho
Feel free to post anymore possible solutions and I'll check in the morning
alright
event.create('my_block', 'cardinal')
Wait what does that do? Does it handle the blockstate and the property of facing automatically or does it only do the property?
Didn't know something Like that exsisted
it does blockstate, jsons, models and placment facing
it just doesnt exist in 1.18, which is why theres also the manual blockstate thing exists and is used for this
Ooh, cool. Does it do horizontal facing in the 4 horizontal directions or normal facing in all six directions?
One of the officials appointed by the pope in the Roman Catholic Church, ranking only below the pope and the patriarchs, constituting the special college which elects the pope. (See Wikipedia article on Catholic cardinals.)
Any of a genus of songbirds of the finch family, Cardinalis.
Any of various related passerine birds of the family Cardinalidae (See Wikipedia article on cardinals) and other similar birds that were once considered to be related.
(color) A deep red color, somewhat less vivid than scarlet, the traditional colour of a Catholic cardinal's cassock. (same as cardinal red)
Short for cardinal number, a number indicating quantity, or the size of a set (e.g., zero, one, two, three). (See Wikipedia article on Cardinal number.)
(grammar) Short for cardinal numeral, a word used to represent a cardinal number.
Short for cardinal flower (Lobelia cardinalis), a flowering plant.
Short for cardinal tetra (Paracheirodon axelrodi), a freshwater fish.
(bow) A woman's short cloak with a hood, originally made of scarlet cloth.
Mulled red wine.
Of fundamental importance; crucial, pivotal.
"A cardinal rule"
Of or relating to the cardinal directions (north, south, east and west).
"A cardinal mark"
Describing a "natural" number used to indicate quantity (e.g., zero, one, two, three), as opposed to an ordinal number indicating relative position.
Having a bright red color (from the color of a Catholic cardinal's cassock).
Ok, so the four horizontal directions, funny enough If you Look at Definition 5 IT seems Like it's all six
i had a very hard time naming it
vanilla calls them horizontal directional
which is a bit of a mourhful
but just facing or directional doesnt work cause theres 6 directions
(also i tried making a variant that does all 6 directions but doing shape rotation for that is basically impossible)
Yeah can Imagine that
So this should be the Code then
StartupEvents.registry('block', event => {
event.create('warden_trophy', 'cardinal')
.woodSoundType()
.mapColor("wood")
.hardness(2)
.resistance(3)
.tagBlock('minecraft:mineable/axe')
.noCollision()
.notSolid()
.renderType('cutout')
})
Or something Like that
And you can remove your blockstates If you had one
display name is unneeded, thats the default one for that id
fancy
Yeahh
Ticket re-opened!
Right, I'm back since this is relevant to my current project, how would I allow a block to be placed in 12 directions like a mob head?
@wise urchin