skapa-season-3/kubejs/startup_scripts/embellishcraft.js
Steve McMaster da0b26d1a2
All checks were successful
continuous-integration/drone/push Build is passing
Prepare for season 3 reset. Update required!
2024-07-17 05:32:07 +00:00

241 lines
10 KiB
JavaScript

global.suspendedStairs = []
global.woodTypes.forEach((wood) => {
let planks_texture = null
let planks_item = null
if ('texture' in wood['planks']) {
planks_texture = ('mod' in wood['planks'] ? wood['planks']['mod'] : wood['mod']) + ':' + wood['planks']['texture']
planks_item = ('mod' in wood['planks'] ? wood['planks']['mod'] : wood['mod']) + ':' + wood['planks']['id']
} else {
// $mod:block/$id
planks_texture = wood['mod'] + ':block/' + wood['planks']['id']
planks_item = wood['mod'] + ':' + 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
let suspended_stairs = {
'id': 'embellishcraft:' + wood['id'] + '_suspended_stairs',
'name': wood['name'] + ' Suspended Stairs',
'isLarge': false,
'texture': planks_texture,
'ingredient': slab_item
}
global.suspendedStairs.push(suspended_stairs);
// console.log(suspended_stairs);
// Large suspended stairs
let large_suspended_stairs = {
'id': 'embellishcraft:' + wood['id'] + '_large_suspended_stairs',
'name': wood['name'] + ' Large Suspended Stairs',
'isLarge': true,
'texture': planks_texture,
'ingredient': planks_item
}
global.suspendedStairs.push(large_suspended_stairs);
// console.log(large_suspended_stairs);
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
}
}
let log_suspended_stairs = {
'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
}
global.suspendedStairs.push(log_suspended_stairs)
// console.log(log_suspended_stairs)
})
})
let embellishcraftCustomBlocks = {}
StartupEvents.registry('block', (event) => {
// Suspended stairs
global.suspendedStairs.forEach((suspendedStair) => {
let builder = event.create(suspendedStair['id'], 'cardinal')
.displayName(suspendedStair['name'])
.waterlogged()
.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
})
// private static final VoxelShape BAR1_N = Block.m_49796_(6.0D, -1.0D, 0.0D, 10.0D, 3.0D, 4.0D);
.box(6.0, -1.0, 0.0, 10.0, 3.0, 4.0)
// private static final VoxelShape BAR2_N = Block.m_49796_(6.0D, 3.0D, 4.0D, 10.0D, 7.0D, 8.0D);
.box(6.0, 3.0, 4.0, 10.0, 7.0, 8.0)
// private static final VoxelShape BAR3_N = Block.m_49796_(6.0D, 7.0D, 8.0D, 10.0D, 11.0D, 12.0D);
.box(6.0, 7.0, 8.0, 10.0, 11.0, 12.0)
// private static final VoxelShape BAR4_N = Block.m_49796_(6.0D, 11.0D, 12.0D, 10.0D, 15.0D, 16.0D);
.box(6.0, 11.0, 12.0, 10.0, 15.0, 16.0)
if (suspendedStair['isLarge']) {
builder
// private static final VoxelShape STEP1_LARGE_N = Block.m_49796_(0.0D, 6.0D, 0.0D, 16.0D, 8.0D, 8.0D);
.box(0.0, 6.0, 0.0, 16.0, 8.0, 8.0)
// private static final VoxelShape STEP2_LARGE_N = Block.m_49796_(0.0D, 14.0D, 8.0D, 16.0D, 16.0D, 16.0D);
.box(0.0, 14.0, 8.0, 16.0, 16.0, 16.0)
} else {
builder
// private static final VoxelShape STEP1_N = Block.m_49796_(0.0D, 3.0D, 0.0D, 16.0D, 4.0D, 4.0D);
.box(0.0, 3.0, 0.0, 16.0, 4.0, 4.0)
// private static final VoxelShape STEP2_N = Block.m_49796_(0.0D, 7.0D, 4.0D, 16.0D, 8.0D, 8.0D);
.box(0.0, 7.0, 4.0, 16.0, 8.0, 8.0)
// private static final VoxelShape STEP3_N = Block.m_49796_(0.0D, 11.0D, 8.0D, 16.0D, 12.0D, 12.0D);
.box(0.0, 11.0, 8.0, 16.0, 12.0, 12.0)
// private static final VoxelShape STEP4_N = Block.m_49796_(0.0D, 15.0D, 12.0D, 16.0D, 16.0D, 16.0D);
.box(0.0, 15.0, 12.0, 16.0, 16.0, 16.0)
}
})
// // Steel Rungs
// // public static final RegistryObject<CustomLadderBlock> STEEL_RUNGS = INDUSTRIAL_BLOCK_REGISTRY.register("steel_rungs", () -> new CustomLadderBlock(BlockBehaviour.Properties
// // .m_60944_(Material.f_76279_, MaterialColor.f_76404_)
// // .m_60978_(0.8F)
// // .m_60918_(SoundType.f_56762_)
// // .m_60955_(),
// // ToolTypes.PICKAXE));
// embellishcraftCustomBlocks['embellishcraft:steel_rungs'] = event.createCustom(
// 'embellishcraft:steel_rungs',
// () => new $MetalLadderBlock(
// $Properties.copy($Blocks.LADDER)
// .strength(0.8)
// .sound($SoundType.METAL)
// .noOcclusion()
// )
// )
// // Steel Wall Ladder
// // public static final RegistryObject<CustomLadderBlock> STEEL_WALL_LADDER = INDUSTRIAL_BLOCK_REGISTRY.register("steel_wall_ladder", () -> new CustomLadderBlock(BlockBehaviour.Properties
// // .m_60944_(Material.f_76279_, MaterialColor.f_76404_)
// // .m_60978_(0.8F)
// // .m_60918_(SoundType.f_56762_)
// // .m_60955_(),
// // ToolTypes.PICKAXE));
// embellishcraftCustomBlocks['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
// // public static final RegistryObject<CustomDoorBlock> STURDY_STEEL_DOOR = INDUSTRIAL_BLOCK_REGISTRY.register("sturdy_steel_door", () -> new CustomDoorBlock(BlockBehaviour.Properties
// // .m_60944_(Material.f_76279_, MaterialColor.f_76404_)
// // .m_60913_(5.0F, 1200.0F)
// // .m_60918_(SoundType.f_56762_)
// // .m_60999_(),
// // ToolTypes.PICKAXE));
// embellishcraftCustomBlocks['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
// // public static final RegistryObject<CustomDoorBlock> WARNING_STEEL_DOOR = INDUSTRIAL_BLOCK_REGISTRY.register("warning_steel_door", () -> new CustomDoorBlock(BlockBehaviour.Properties
// // .m_60944_(Material.f_76279_, MaterialColor.f_76404_)
// // .m_60978_(3.0F)
// // .m_60918_(SoundType.f_56762_)
// // .m_60999_(),
// // ToolTypes.PICKAXE));
// embellishcraftCustomBlocks['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(embellishcraftCustomBlocks).forEach((id) => {
// event.createCustom(id, () => new $BlockItem(embellishcraftCustomBlocks[id].get(), new $IProperties()))
// })
// })