All checks were successful
continuous-integration/drone/push Build is passing
275 lines
10 KiB
JavaScript
275 lines
10 KiB
JavaScript
global.embellishcraft = {
|
|
'CustomBlocks': {},
|
|
'suspendedStairs': [
|
|
{
|
|
'id': 'embellishcraft:iron_large_suspended_stairs',
|
|
'name': 'Iron Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'minecraft:block/iron_block',
|
|
'ingredient': 'minecraft:iron_block',
|
|
'tool': 'pickaxe'
|
|
},
|
|
{
|
|
'id': 'embellishcraft:copper_large_suspended_stairs',
|
|
'name': 'Copper Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'minecraft:block/copper_block',
|
|
'ingredient': 'minecraft:copper_block',
|
|
'tool': 'pickaxe'
|
|
},
|
|
{
|
|
'id': 'embellishcraft:gold_large_suspended_stairs',
|
|
'name': 'Gold Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'minecraft:block/gold_block',
|
|
'ingredient': 'minecraft:gold_block',
|
|
'tool': 'pickaxe'
|
|
},
|
|
{
|
|
'id': 'embellishcraft:diamond_large_suspended_stairs',
|
|
'name': 'Diamond Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'minecraft:block/diamond_block',
|
|
'ingredient': 'minecraft:diamond_block',
|
|
'tool': 'pickaxe'
|
|
},
|
|
{
|
|
'id': 'embellishcraft:netherite_large_suspended_stairs',
|
|
'name': 'Netherite Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'minecraft:block/netherite_block',
|
|
'ingredient': 'minecraft:netherite_block',
|
|
'tool': 'pickaxe'
|
|
},
|
|
{
|
|
'id': 'embellishcraft:emerald_large_suspended_stairs',
|
|
'name': 'Emerald Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'minecraft:block/emerald_block',
|
|
'ingredient': 'minecraft:emerald_block',
|
|
'tool': 'pickaxe'
|
|
}
|
|
]
|
|
}
|
|
|
|
if (Platform.isLoaded('create')) {
|
|
[
|
|
{
|
|
'id': 'embellishcraft:industrial_iron_large_suspended_stairs',
|
|
'name': 'Industrial Iron Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'create:block/industrial_iron_block',
|
|
'ingredient': 'create:industrial_iron_block'
|
|
},
|
|
{
|
|
'id': 'embellishcraft:brass_large_suspended_stairs',
|
|
'name': 'Industrial Brass Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': 'create:block/brass_block',
|
|
'ingredient': 'create:brass_block'
|
|
}
|
|
].forEach((stairType) => {
|
|
global.embellishcraft.suspendedStairs.push(stairType)
|
|
})
|
|
}
|
|
|
|
global.woodTypes.forEach((wood) => {
|
|
let planks_item = ('mod' in wood['planks'] ? wood['planks']['mod'] : wood['mod']) + ':' + wood['planks']['id']
|
|
|
|
let planks_texture = null
|
|
if ('texture' in wood['planks']) {
|
|
planks_texture = ('mod' in wood['planks'] ? wood['planks']['mod'] : wood['mod']) + ':' + wood['planks']['texture']
|
|
} else {
|
|
// $mod:block/$id
|
|
planks_texture = ('mod' in wood['planks'] ? wood['planks']['mod'] : wood['mod']) + ':block/' + wood['planks']['id']
|
|
}
|
|
|
|
let slab_item = planks_item.replace('_planks', '_slab')
|
|
if ('slab' in wood) {
|
|
if ('id' in wood['slab']) {
|
|
slab_item = ('mod' in wood['slab'] ? wood['slab']['mod'] : wood['mod']) + ':' + wood['slab']['id']
|
|
}
|
|
}
|
|
|
|
// Regular suspended stairs
|
|
global.embellishcraft.suspendedStairs.push({
|
|
'id': 'embellishcraft:' + wood['id'] + '_suspended_stairs',
|
|
'name': wood['name'] + ' Suspended Stairs',
|
|
'isLarge': false,
|
|
'texture': planks_texture,
|
|
'ingredient': slab_item,
|
|
'tool': 'axe'
|
|
});
|
|
|
|
// Large suspended stairs
|
|
global.embellishcraft.suspendedStairs.push({
|
|
'id': 'embellishcraft:' + wood['id'] + '_large_suspended_stairs',
|
|
'name': wood['name'] + ' Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': planks_texture,
|
|
'ingredient': planks_item,
|
|
'tool': 'axe'
|
|
});
|
|
|
|
let logVariants = []
|
|
if (!('log' in wood && wood['log'] == null)) {
|
|
logVariants.push(false)
|
|
}
|
|
if (!('stripped_log' in wood && wood['stripped_log'] == null)) {
|
|
logVariants.push(true)
|
|
}
|
|
|
|
// Large suspended stairs - logs
|
|
logVariants.forEach((isStripped) => {
|
|
let log_name = 'Log'
|
|
if ('log' in wood) {
|
|
if ('name' in wood['log']) {
|
|
log_name = wood['log']['name']
|
|
}
|
|
}
|
|
|
|
let log_item = planks_item.replace('_planks', '_' + log_name.toLowerCase())
|
|
if ('log' in wood) {
|
|
if ('id' in wood['log']) {
|
|
log_item = ('mod' in wood['log'] ? wood['log']['mod'] : wood['mod']) + ':' + wood['log']['id']
|
|
}
|
|
}
|
|
|
|
let log_id = log_item.split(':')[1]
|
|
|
|
if ('log' in wood) {
|
|
if ('id' in wood['log']) {
|
|
log_id = wood['log']['id']
|
|
}
|
|
}
|
|
|
|
let log_texture = null
|
|
if ('log' in wood) {
|
|
if ('texture' in wood['log']) {
|
|
log_texture = ('mod' in wood['log'] ? wood['log']['mod'] : wood['mod']) + ':' + wood['log']['texture']
|
|
} else {
|
|
// $mod:block/$id
|
|
log_texture = ('mod' in wood['log'] ? wood['log']['mod'] : wood['mod']) + ':block/' + log_id
|
|
}
|
|
} else {
|
|
// $mod:block/$id
|
|
log_texture = wood['mod'] + ':block/' + log_id
|
|
}
|
|
|
|
if (isStripped) {
|
|
if ('stripped_log' in wood) {
|
|
if ('id' in wood['stripped_log']) {
|
|
log_id = wood['stripped_log']['id']
|
|
log_item = ('mod' in wood['stripped_log'] ? wood['stripped_log']['mod'] : wood['mod']) + ':' + wood['stripped_log']['id']
|
|
} else {
|
|
log_id = 'stripped_' + log_id
|
|
log_item = log_item.split(':')[0] + ':stripped_' + log_item.split(':')[1]
|
|
}
|
|
|
|
if ('texture' in wood['stripped_log']) {
|
|
log_texture = ('mod' in wood['stripped_log'] ? wood['stripped_log']['mod'] : wood['mod']) + ':' + wood['stripped_log']['texture']
|
|
} else {
|
|
// $mod:block/$id
|
|
log_texture = ('mod' in wood['stripped_log'] ? wood['stripped_log']['mod'] : wood['mod']) + ':block/' + log_id
|
|
}
|
|
} else {
|
|
log_id = 'stripped_' + log_id
|
|
log_item = log_item.split(':')[0] + ':stripped_' + log_item.split(':')[1]
|
|
log_texture = wood['mod'] + ':block/' + log_id
|
|
}
|
|
}
|
|
|
|
global.embellishcraft.suspendedStairs.push({
|
|
'id': 'embellishcraft:' + (isStripped ? 'stripped_' : '') + wood['id'] + '_' + log_name.toLowerCase() + '_large_suspended_stairs',
|
|
'name': (isStripped ? 'Stripped ' : '') + wood['name'] + ' ' + log_name + ' Large Suspended Stairs',
|
|
'isLarge': true,
|
|
'texture': log_texture,
|
|
'ingredient': log_item
|
|
})
|
|
// console.log(log_suspended_stairs)
|
|
})
|
|
})
|
|
|
|
StartupEvents.registry('block', (event) => {
|
|
// Suspended stairs
|
|
global.embellishcraft.suspendedStairs.forEach((suspendedStair) => {
|
|
let builder = event.create(suspendedStair['id'], 'cardinal')
|
|
.displayName(suspendedStair['name'])
|
|
.waterlogged()
|
|
.tagBlock('minecraft:mineable/' + suspendedStair['tool'])
|
|
.placementState((cb) => {
|
|
let blockstate = cb.getBlockStateToModify(this.AudioContext, this.block)
|
|
blockstate.setValue(BlockProperties.FACING, cb.getClickedFace())
|
|
blockstate.setValue(BlockProperties.WATERLOGGED, cb.getFluidStateAtClickedPos().getType() == $Fluids.WATER)
|
|
return blockstate
|
|
})
|
|
.box(6.0, -1.0, 0.0, 10.0, 3.0, 4.0)
|
|
.box(6.0, 3.0, 4.0, 10.0, 7.0, 8.0)
|
|
.box(6.0, 7.0, 8.0, 10.0, 11.0, 12.0)
|
|
.box(6.0, 11.0, 12.0, 10.0, 15.0, 16.0)
|
|
|
|
if (suspendedStair['isLarge']) {
|
|
builder
|
|
.box(0.0, 6.0, 0.0, 16.0, 8.0, 8.0)
|
|
.box(0.0, 14.0, 8.0, 16.0, 16.0, 16.0)
|
|
} else {
|
|
builder
|
|
.box(0.0, 3.0, 0.0, 16.0, 4.0, 4.0)
|
|
.box(0.0, 7.0, 4.0, 16.0, 8.0, 8.0)
|
|
.box(0.0, 11.0, 8.0, 16.0, 12.0, 12.0)
|
|
.box(0.0, 15.0, 12.0, 16.0, 16.0, 16.0)
|
|
}
|
|
})
|
|
|
|
// Steel Rungs
|
|
global.embellishcraft.CustomBlocks['embellishcraft:steel_rungs'] = event.createCustom(
|
|
'embellishcraft:steel_rungs',
|
|
() => new $MetalLadderBlock(
|
|
$Properties.copy($Blocks.LADDER)
|
|
.strength(0.8)
|
|
.sound($SoundType.METAL)
|
|
.noOcclusion()
|
|
)
|
|
)
|
|
|
|
// Steel Wall Ladder
|
|
global.embellishcraft.CustomBlocks['embellishcraft:steel_wall_ladder'] = event.createCustom(
|
|
'embellishcraft:steel_wall_ladder',
|
|
() => new $MetalLadderBlock(
|
|
$Properties.copy($Blocks.LADDER)
|
|
.strength(0.8)
|
|
.sound($SoundType.METAL)
|
|
.noOcclusion()
|
|
)
|
|
)
|
|
|
|
// Sturdy Steel Door
|
|
global.embellishcraft.CustomBlocks['embellishcraft:sturdy_steel_door'] = event.createCustom(
|
|
'embellishcraft:sturdy_steel_door',
|
|
() => new $DoorBlock(
|
|
$Properties.copy($Blocks.IRON_DOOR)
|
|
.strength(5.0)
|
|
.sound($SoundType.METAL)
|
|
.requiresCorrectToolForDrops(),
|
|
$BlockSetType.GOLD
|
|
)
|
|
)
|
|
|
|
// Warning Steel Door
|
|
global.embellishcraft.CustomBlocks['embellishcraft:warning_steel_door'] = event.createCustom(
|
|
'embellishcraft:warning_steel_door',
|
|
() => new $DoorBlock(
|
|
$Properties.copy($Blocks.IRON_DOOR)
|
|
.strength(3.0)
|
|
.sound($SoundType.METAL)
|
|
.requiresCorrectToolForDrops(),
|
|
$BlockSetType.GOLD
|
|
)
|
|
)
|
|
})
|
|
|
|
StartupEvents.registry('item', (event) => {
|
|
Object.keys(global.embellishcraft.CustomBlocks).forEach((id) => {
|
|
event.createCustom(id, () => new $BlockItem(global.embellishcraft.CustomBlocks[id].get(), new $IProperties()))
|
|
})
|
|
}) |