Test adding thermoelectric generator and cobble gens
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Steve McMaster 2024-08-10 06:00:34 +00:00
parent 86a1c29baf
commit 4946774469
14 changed files with 588 additions and 240 deletions

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "skapa:block/thermoelectric_generator"
}
}
}

View File

@ -0,0 +1,89 @@
{
"parent": "minecraft:block/block",
"textures": {
"particle": "minecraft:block/cobblestone",
"glass": "minecraft:block/glass",
"water": "minecraft:block/water_still",
"lava": "minecraft:block/lava_still"
},
"render_type": "cutout",
"elements": [
{
"from": [0, 0, 0],
"to": [16, 4, 16],
"faces": {
"down": { "texture": "#material", "cullface": "down" },
"up": { "texture": "#material" },
"north": { "texture": "#material", "cullface": "north" },
"south": { "texture": "#material", "cullface": "south" },
"west": { "texture": "#material", "cullface": "west" },
"east": { "texture": "#material", "cullface": "east" }
}
},
{
"from": [0, 12, 0],
"to": [16, 16, 16],
"faces": {
"down": { "texture": "#material" },
"up": { "texture": "#material", "cullface": "up" },
"north": { "texture": "#material", "cullface": "north" },
"south": { "texture": "#material", "cullface": "south" },
"west": { "texture": "#material", "cullface": "west" },
"east": { "texture": "#material", "cullface": "east" }
}
},
{
"from": [0, 4, 0],
"to": [16, 12, 16],
"faces": {
"north": { "texture": "#glass", "cullface": "north" },
"south": { "texture": "#glass", "cullface": "south" },
"west": { "texture": "#glass", "cullface": "west" },
"east": { "texture": "#glass", "cullface": "east" }
}
},
{
"from": [15, 4, 15],
"to": [1, 12, 1],
"faces": {
"north": { "texture": "#glass", "cullface": "north" },
"south": { "texture": "#glass", "cullface": "south" },
"west": { "texture": "#glass", "cullface": "west" },
"east": { "texture": "#glass", "cullface": "east" }
}
},
{
"from": [1, 4, 1],
"to": [15, 9, 5],
"shade": false,
"faces": {
"up": { "texture": "#water", "tintindex": 1 },
"north": { "texture": "#water", "tintindex": 1 },
"west": { "texture": "#water", "tintindex": 1 },
"east": { "texture": "#water", "tintindex": 1 }
}
},
{
"from": [1, 4, 11],
"to": [15, 9, 15],
"shade": false,
"faces": {
"up": { "texture": "#lava" },
"south": { "texture": "#lava" },
"west": { "texture": "#lava" },
"east": { "texture": "#lava" }
}
},
{
"from": [1, 4, 5],
"to": [15, 9, 11],
"faces": {
"up": { "texture": "#particle" },
"north": { "texture": "#particle" },
"south": { "texture": "#particle" },
"west": { "texture": "#particle" },
"east": { "texture": "#particle" }
}
}
]
}

View File

@ -0,0 +1,8 @@
{
"parent": "minecraft:block/cube_bottom_top",
"textures": {
"side": "skapa:block/thermoelectric_gen_side",
"bottom": "skapa:block/thermoelectric_gen_bottom",
"top": "skapa:block/thermoelectric_gen_top"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

View File

@ -0,0 +1,22 @@
ClientEvents.highPriorityAssets((event) => {
global.cobblegen.tiers.forEach((tier) => {
if (tier == 'andesite_alloy') {
tier = 'andesite'
}
event.addBlockState('skapa:' + tier + '_cobblestone_generator', (gen) => {
gen.variant('', (variant) => {
variant.model('skapa:block/' + tier + '_cobblestone_generator')
})
})
event.addModel('block', 'skapa:' + tier + '_cobblestone_generator', (gen) => {
gen.parent('skapa:block/cobblestone_generator')
gen.texture('material', 'create:block/' + tier + '_block')
})
event.addModel('item', 'skapa:' + tier + '_cobblestone_generator', (gen) => {
gen.parent('skapa:block/' + tier + '_cobblestone_generator')
})
})
})

View File

@ -0,0 +1,26 @@
// ServerEvents.recipes(event => {
// event.forEachRecipe({type:'minecraft:crafting_shapeless'}, recipe => {
// let ingredients = recipe.originalRecipeIngredients
// let output = recipe.originalRecipeResult
// if (output.isEmpty() || ingredients.isEmpty()) return;
// let cookingPot = false;
// let fryingPan = false;
// let foodPress = false;
// ingredients.forEach((ingredient) => {
// ingredient.itemIds.forEach((itemId) => {
// cookingPot = itemId == 'croptopia:cooking_pot' ? true : cookingPot
// fryingPan = itemId == 'croptopia:frying_pan' ? true : fryingPan
// foodPress = itemId == 'croptopia:food_press' ? true : foodPress
// })
// })
// if (cookingPot || fryingPan) {
// // Add a farmersdelight cooking recipe
// } else if (foodPress) {
// // Add a create pressing recipe
// }
// })
// })

View File

@ -1,6 +1,6 @@
ServerEvents.recipes((event) => {
// Suspended stairs
global.suspendedStairs.forEach((suspendedStair) => {
global.embellishcraft.suspendedStairs.forEach((suspendedStair) => {
event
.shaped(
Item.of(suspendedStair['id'], 1),
@ -14,31 +14,43 @@ ServerEvents.recipes((event) => {
'S': { 'tag': 'forge:rods/wooden' }
}
)
.id(suspendedStair['id'])
})
})
.id(suspendedStair['id']);
});
});
ServerEvents.tags('block', (event) => {
[
let pickaxe_mineable_blocks = [
'embellishcraft:steel_wall_ladder',
'embellishcraft:steel_rungs',
'embellishcraft:sturdy_steel_door',
'embellishcraft:warning_steel_door'
].forEach((block) => {
event.add('minecraft:mineable/pickaxe', block)
});
];
[
pickaxe_mineable_blocks.forEach((block) => {
if (Object.keys(global.embellishcraft.CustomBlocks).includes(block)) {
event.add('minecraft:mineable/pickaxe', block);
}
})
let door_blocks = [
'embellishcraft:sturdy_steel_door',
'embellishcraft:warning_steel_door'
].forEach((block) => {
event.add('minecraft:doors', block)
});
];
[
door_blocks.forEach((block) => {
if (Object.keys(global.embellishcraft.CustomBlocks).includes(block)) {
event.add('minecraft:doors', block);
}
})
let ladder_blocks = [
'embellishcraft:steel_wall_ladder',
'embellishcraft:steel_rungs'
].forEach((block) => {
event.add('minecraft:climbable', block)
});
];
ladder_blocks.forEach((block) => {
if (Object.keys(global.embellishcraft.CustomBlocks).includes(block)) {
event.add('minecraft:climbable', block);
}
})
})

View File

@ -13,4 +13,28 @@ ServerEvents.recipes((event) => {
'D': { 'item': 'minecraft:black_dye' }
}
)
global.cobblegen.tiers.forEach((tier) => {
let item_id = 'skapa:' + tier + '_cobblestone_generator'
if (tier == 'andesite_alloy') {
item_id = 'skapa:andesite_cobblestone_generator'
}
event
.shaped(
Item.of(item_id, 1),
[
'RRR',
'WGL',
'RRR',
],
{
'R': { 'item': 'forge:ingots/' + tier },
'W': { 'item': 'minecraft:water_bucket' },
'L': { 'item': 'minecraft:lava_bucket' },
'G': { 'tag': 'forge:glass' }
}
)
})
})

View File

@ -35,6 +35,7 @@ StartupEvents.registry('block', (event) => {
.lightLevel(0)
.notSolid()
.hardness(3.0)
.tagBlock('minecraft:mineable/pickaxe')
.defaultCutout()
.renderType('cutout_mipped')
.soundType('metal')

View File

@ -9,7 +9,7 @@ const SpiritSoundType = new $ForgeSoundType(
);
const createDD = {
'blocks': {},
'blocks': [],
'items': {},
'blockSetTypes': {},
'woodTypes': [
@ -111,121 +111,116 @@ createDD.woodTypes.forEach((wood) => {
)
})
function properties(wood, copyFrom) {
return $Properties
.copy(wood[copyFrom])
.sound(wood['soundType'])
}
// TODO: Make them flammable
// TODO: Map colors
StartupEvents.registry('block', (event) => {
createDD.woodTypes.forEach((wood) => {
let item_id = null
let block_id = null
let block = null
// Button
item_id = 'create_dd:' + wood['id'] + '_button'
createDD.blocks[item_id] = event.create(item_id, 'button')
['behaviour(net.minecraft.world.level.block.state.properties.BlockSetType)'](createDD.blockSetTypes[wood['id']])
block_id = 'create_dd:' + wood['id'] + '_button'
block = event.create(block_id, 'button')
['behaviour(net.minecraft.world.level.block.state.properties.BlockSetType)'](createDD.blockSetTypes[wood['id']])
.noItem()
.soundType(wood['soundType'])
// .mapColor(wood['mapColor'])
.tagBlock('minecraft:wooden_buttons')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:wooden_buttons'] })
// Door
item_id = 'create_dd:' + wood['id'] + '_door'
createDD.blocks[item_id] = event.createCustom(
item_id,
() => new $DoorBlock(
$Properties
.copy(wood['baseDoor'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
.noOcclusion(),
createDD.blockSetTypes[wood['id']]
)
)
block_id = 'create_dd:' + wood['id'] + '_door'
block = event.createCustom(block_id, () => new $DoorBlock(properties(wood, 'baseDoor').noOcclusion(), createDD.blockSetTypes[wood['id']]))
.tag('minecraft:wooden_doors')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:wooden_doors'] })
// Fence
item_id = 'create_dd:' + wood['id'] + '_fence'
createDD.blocks[item_id] = event.create(item_id, 'fence')
block_id = 'create_dd:' + wood['id'] + '_fence'
block = event.create(block_id, 'fence')
.noItem()
.soundType(wood['soundType'])
// .mapColor(wood['mapColor'])
.tagBlock('minecraft:wooden_fences')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:wooden_fences'] })
// Fence Gate
item_id = 'create_dd:' + wood['id'] + '_fence_gate'
createDD.blocks[item_id] = event.create(item_id, 'fence_gate')
['behaviour(net.minecraft.world.level.block.state.properties.WoodType)'](wood['woodType'])
block_id = 'create_dd:' + wood['id'] + '_fence_gate'
block = event.create(block_id, 'fence_gate')
['behaviour(net.minecraft.world.level.block.state.properties.WoodType)'](wood['woodType'])
.noItem()
.soundType(wood['soundType'])
// .mapColor(wood['mapColor'])
.tagBlock('minecraft:fence_gates')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:fence_gates'] })
// Log
item_id = 'create_dd:' + wood['id'] + '_log'
createDD.blocks[item_id] = event.createCustom(item_id, () => new $RotatedPillarBlock(
$Properties
.copy(wood['baseLog'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
))
block_id = 'create_dd:' + wood['id'] + '_log'
block = event.createCustom(block_id, () => new $RotatedPillarBlock(properties(wood, 'baseLog')))
.tag('minecraft:logs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:logs'] })
// Planks
item_id = 'create_dd:' + wood['id'] + '_planks'
createDD.blocks[item_id] = event.createCustom(item_id, () => new $Block(
$Properties
.copy(wood['basePlanks'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
))
block_id = 'create_dd:' + wood['id'] + '_planks'
block = event.createCustom(block_id, () => new $Block(properties(wood, 'basePlanks')))
.tag('minecraft:planks')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:planks'] })
// Pressure Plate
item_id = 'create_dd:' + wood['id'] + '_pressure_plate'
createDD.blocks[item_id] = event.create(item_id, 'pressure_plate')
['behaviour(net.minecraft.world.level.block.state.properties.BlockSetType)'](createDD.blockSetTypes[wood['id']])
block_id = 'create_dd:' + wood['id'] + '_pressure_plate'
block = event.create(block_id, 'pressure_plate')
['behaviour(net.minecraft.world.level.block.state.properties.BlockSetType)'](createDD.blockSetTypes[wood['id']])
.noItem()
.soundType(wood['soundType'])
// .mapColor(wood['mapColor'])
.tagBlock('minecraft:wooden_pressure_plates')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:wooden_pressure_plates'] })
// Sign
// item_id = 'create_dd:' + wood['id'] + '_sign'
// createDD.blocks[item_id] = event.createCustom(item_id, () => new $SignBlock($Properties.copy($Blocks.OAK_SIGN), wood['woodType']))
// Slab
item_id = 'create_dd:' + wood['id'] + '_slab'
createDD.blocks[item_id] = event.create(item_id, 'slab')
.noItem()
.soundType(wood['soundType'])
// .mapColor(wood['mapColor'])
// Stairs
item_id = 'create_dd:' + wood['id'] + '_stairs'
createDD.blocks[item_id] = event.create(item_id, 'stairs')
.noItem()
.soundType(wood['soundType'])
// .mapColor(wood['mapColor'])
// Stripped Log
item_id = 'create_dd:stripped_' + wood['id'] + '_log'
createDD.blocks[item_id] = event.createCustom(item_id, () => new $RotatedPillarBlock(
$Properties
.copy(wood['baseStrippedLog'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
))
// Stripped Wood
item_id = 'create_dd:stripped_' + wood['id'] + '_wood'
createDD.blocks[item_id] = event.createCustom(item_id, () => new $RotatedPillarBlock(
$Properties
.copy(wood['baseStrippedWood'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
))
// Trapdoor
item_id = 'create_dd:' + wood['id'] + '_trapdoor'
createDD.blocks[item_id] = event.createCustom(
item_id,
() => new $TrapDoorBlock(
$Properties
.copy(wood['baseTrapDoor'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
.noOcclusion(),
createDD.blockSetTypes[wood['id']]
)
)
// Wood
item_id = 'create_dd:' + wood['id'] + '_wood'
createDD.blocks[item_id] = event.createCustom(item_id, () => new $RotatedPillarBlock(
$Properties
.copy(wood['baseWood'])
.sound(wood['soundType'])
// .mapColor(wood['mapColor'])
))
// Slab
block_id = 'create_dd:' + wood['id'] + '_slab'
block = event.create(block_id, 'slab')
.noItem()
.soundType(wood['soundType'])
.tagBlock('minecraft:wooden_slabs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:wooden_slabs'] })
// Stairs
block_id = 'create_dd:' + wood['id'] + '_stairs'
block = event.create(block_id, 'stairs')
.noItem()
.soundType(wood['soundType'])
.tagBlock('minecraft:wooden_stairs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:wooden_stairs'] })
// Stripped Log
block_id = 'create_dd:stripped_' + wood['id'] + '_log'
block = event.createCustom(block_id, () => new $RotatedPillarBlock(properties(wood, 'baseStrippedLog')))
.tag('minecraft:logs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:logs'] })
// Stripped Wood
block_id = 'create_dd:stripped_' + wood['id'] + '_wood'
block = event.createCustom(block_id, () => new $RotatedPillarBlock(properties(wood, 'baseStrippedWood')))
.tag('minecraft:logs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:logs'] })
// Trapdoor
block_id = 'create_dd:' + wood['id'] + '_trapdoor'
block = event.createCustom(block_id, () => new $TrapDoorBlock(properties(wood, 'baseTrapDoor').noOcclusion(), createDD.blockSetTypes[wood['id']]))
.tag('minecraft:logs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:logs'] })
// Wood
block_id = 'create_dd:' + wood['id'] + '_wood'
block = event.createCustom(block_id, () => new $RotatedPillarBlock(properties(wood, 'baseWood')))
.tag('minecraft:logs')
createDD.blocks.push({ 'id': block_id, 'block': block, 'tags': ['minecraft:logs'] })
})
})
@ -237,8 +232,12 @@ StartupEvents.registry('block', (event) => {
// })
StartupEvents.registry('item', event => {
Object.keys(createDD.blocks).forEach((block_id) => {
createDD.items[block_id] = event.createCustom(block_id, () => new $BlockItem(createDD.blocks[block_id].get(), new $IProperties()))
Object.keys(createDD.blocks).forEach((block) => {
let item = event.createCustom(block['id'], () => new $BlockItem(block['block'].get(), new $IProperties()))
block['tags'].forEach((tag) => {
item.tag(tag)
})
})

View File

@ -1,61 +1,77 @@
global.suspendedStairs = [
{
'id': 'embellishcraft:iron_large_suspended_stairs',
'name': 'Iron Large Suspended Stairs',
'isLarge': true,
'texture': 'minecraft:block/iron_block',
'ingredient': 'minecraft:iron_block'
},
{
'id': 'embellishcraft:copper_large_suspended_stairs',
'name': 'Copper Large Suspended Stairs',
'isLarge': true,
'texture': 'minecraft:block/copper_block',
'ingredient': 'minecraft:copper_block'
},
{
'id': 'embellishcraft:gold_large_suspended_stairs',
'name': 'Gold Large Suspended Stairs',
'isLarge': true,
'texture': 'minecraft:block/gold_block',
'ingredient': 'minecraft:gold_block'
},
{
'id': 'embellishcraft:diamond_large_suspended_stairs',
'name': 'Diamond Large Suspended Stairs',
'isLarge': true,
'texture': 'minecraft:block/diamond_block',
'ingredient': 'minecraft:diamond_block'
},
{
'id': 'embellishcraft:netherite_large_suspended_stairs',
'name': 'Netherite Large Suspended Stairs',
'isLarge': true,
'texture': 'minecraft:block/netherite_block',
'ingredient': 'minecraft:netherite_block'
},
{
'id': 'embellishcraft:emerald_large_suspended_stairs',
'name': 'Emerald Large Suspended Stairs',
'isLarge': true,
'texture': 'minecraft:block/emerald_block',
'ingredient': 'minecraft:emerald_block'
},
{
'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'
}
]
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']
@ -76,26 +92,24 @@ global.woodTypes.forEach((wood) => {
}
// Regular suspended stairs
let 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
}
global.suspendedStairs.push(suspended_stairs);
// console.log(suspended_stairs);
'ingredient': slab_item,
'tool': 'axe'
});
// Large suspended stairs
let 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
}
global.suspendedStairs.push(large_suspended_stairs);
// console.log(large_suspended_stairs);
'ingredient': planks_item,
'tool': 'axe'
});
let logVariants = []
if (!('log' in wood && wood['log'] == null)) {
@ -165,68 +179,50 @@ global.woodTypes.forEach((wood) => {
}
}
let log_suspended_stairs = {
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
}
global.suspendedStairs.push(log_suspended_stairs)
})
// console.log(log_suspended_stairs)
})
})
let embellishcraftCustomBlocks = {}
StartupEvents.registry('block', (event) => {
// Suspended stairs
global.suspendedStairs.forEach((suspendedStair) => {
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
})
// 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(
// Steel Rungs
global.embellishcraft.CustomBlocks['embellishcraft:steel_rungs'] = event.createCustom(
'embellishcraft:steel_rungs',
() => new $MetalLadderBlock(
$Properties.copy($Blocks.LADDER)
@ -236,14 +232,8 @@ StartupEvents.registry('block', (event) => {
)
)
// // 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(
// Steel Wall Ladder
global.embellishcraft.CustomBlocks['embellishcraft:steel_wall_ladder'] = event.createCustom(
'embellishcraft:steel_wall_ladder',
() => new $MetalLadderBlock(
$Properties.copy($Blocks.LADDER)
@ -253,14 +243,8 @@ StartupEvents.registry('block', (event) => {
)
)
// // 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(
// Sturdy Steel Door
global.embellishcraft.CustomBlocks['embellishcraft:sturdy_steel_door'] = event.createCustom(
'embellishcraft:sturdy_steel_door',
() => new $DoorBlock(
$Properties.copy($Blocks.IRON_DOOR)
@ -271,14 +255,8 @@ StartupEvents.registry('block', (event) => {
)
)
// // 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(
// Warning Steel Door
global.embellishcraft.CustomBlocks['embellishcraft:warning_steel_door'] = event.createCustom(
'embellishcraft:warning_steel_door',
() => new $DoorBlock(
$Properties.copy($Blocks.IRON_DOOR)
@ -291,7 +269,7 @@ StartupEvents.registry('block', (event) => {
})
StartupEvents.registry('item', (event) => {
Object.keys(embellishcraftCustomBlocks).forEach((id) => {
event.createCustom(id, () => new $BlockItem(embellishcraftCustomBlocks[id].get(), new $IProperties()))
Object.keys(global.embellishcraft.CustomBlocks).forEach((id) => {
event.createCustom(id, () => new $BlockItem(global.embellishcraft.CustomBlocks[id].get(), new $IProperties()))
})
})

View File

@ -1,3 +1,124 @@
global.temperatures = {
'minecraft:blue_ice': 200,
'minecraft:ice': 260,
'minecraft:magma_block': 1300,
'minecraft:packed_ice': 240,
'minecraft:snow': 273,
}
global.cobblegen = {
'getSlots': (be) => {
let iih = be.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.NORTH).orElse(null);
return iih.getSlots();
},
'serverTick': (quantity) => (be) => {
let count = be.persistentData.getInt('count')
be.persistentData.putInt('count', Math.min(count + quantity, global.cobblegen.getSlots(be) * 64))
},
'tiers': ['andesite_alloy', 'brass'],
'getStackInSlot': (be, slot) => {
if (slot > global.cobblegen.getSlots(be)) return Item.getEmpty();
let count = be.persistentData.getInt('count');
let offset = (slot - 1) * 64;
if (count <= offset) return Item.getEmpty();
return Item.of('minecraft:cobblestone').withCount(Math.min(count - offset, 64))
},
'insertItem': (be, slot, stack, simulate) => {
return false;
},
'extractItem': (be, slot, amount, simulate) => {
if (slot > global.cobblegen.getSlots(be)) return Item.getEmpty();
let count = be.persistentData.getInt('count');
let offset = (slot - 1) * 64;
if (count <= offset) return Item.getEmpty();
let result = Item.of('minecraft:cobblestone').withCount(Math.min(64, amount, count - offset));
if (!simulate) {
be.persistentData.putInt('count', count - result.getCount())
}
return result;
},
'isItemValid': (be, slot, stack) => {
return ((slot <= global.cobblegen.getSlots(be)) && (stack.areItemsEqual(Item.of('minecraft:cobblestone'))))
},
}
global.thermoelectricgen = {
'calculateEnergyOutput': (be) => {
let energy = 0;
let directions = [Direction.DOWN, Direction.NORTH, Direction.WEST];
directions.forEach((fd) => {
let block0 = be.getBlock().offset(fd);
let block1 = be.getBlock().offset(fd, -1);
if (block0.equals('minecraft:air') || block1.equals('minecraft:air')) return;
let temp0 = global.thermoelectricgen.getTemperature(block0);
let temp1 = global.thermoelectricgen.getTemperature(block1);
if (temp0 < 0 || temp1 < 0) return;
let diff = Math.abs(temp0 - temp1);
energy += Math.floor(Math.sqrt(diff) / 2.0);
})
return energy;
},
'generateEnergy': (be) => {
let energy = be.persistentData.getInt('energy');
energy += global.thermoelectricgen.calculateEnergyOutput(be);
energy = Math.min(energy, 5000);
be.persistentData.putInt('energy', energy);
return energy;
},
'getTemperature': (block) => {
let block_id = block.getId();
if (Object.keys(global.temperatures).includes(block_id)) {
return global.temperatures[block_id]
}
let f = block.getBlockState().getFluidState();
if (!(f.isEmpty())) {
return f.getFluidType().getTemperature(f, block.getLevel(), block.getPos());
}
return -1;
},
'extractEnergy': (be, amount, simulate) => {
let energy = be.persistentData.getInt('energy');
let extracted = Math.min(energy, amount)
if (!simulate) {
be.persistentData.putInt('energy', energy - extracted)
}
return extracted
},
'serverTick': (be) => {
let energy = global.thermoelectricgen.generateEnergy(be);
Object.values(Direction.ALL).forEach((side) => {
let te = be.getBlock().offset(side).getEntity();
if (te == null) return;
let ies = te.getCapability(ForgeCapabilities.ENERGY, side.getOpposite()).orElse(null);
if (ies == null) return;
let amount = ies.receiveEnergy(energy, false);
energy -= amount;
})
be.persistentData.putInt('energy', energy);
},
}
StartupEvents.registry('block', (event) => {
event.create('skapa:sturdy_metal_block')
.displayName('Sturdy Metal Block')
@ -5,7 +126,68 @@ StartupEvents.registry('block', (event) => {
.soundType('anvil')
.tagBlock('minecraft:mineable/pickaxe')
.tagBlock('minecraft:needs_iron_tool')
.tagBlock('create:wrench_pickup')
.requiresTool(true)
.lightLevel(0)
.textureAll('minecraft:block/smithing_table_top')
event.create('skapa:andesite_cobblestone_generator')
.displayName('Andesite Cobblestone Generator')
.tagBlock('minecraft:mineable/pickaxe')
.tagBlock('minecraft:needs_iron_tool')
.tagBlock('create:wrench_pickup')
.blockEntity((info) => {
info.serverTick(20, 0, global.cobblegen.serverTick(4))
info.attachCapability(
CapabilityBuilder.ITEM.blockEntity()
.getSlots((be) => 8)
.getStackInSlot(global.cobblegen.getStackInSlot)
.insertItem(global.cobblegen.insertItem)
.extractItem(global.cobblegen.extractItem)
.getSlotLimit((be) => 64)
.isItemValid(global.cobblegen.isItemValid)
)
})
event.create('skapa:brass_cobblestone_generator')
.displayName('Brass Cobblestone Generator')
.tagBlock('minecraft:mineable/pickaxe')
.tagBlock('minecraft:needs_iron_tool')
.tagBlock('create:wrench_pickup')
.blockEntity((info) => {
info.serverTick(20, 0, global.cobblegen.serverTick(64))
info.attachCapability(
CapabilityBuilder.ITEM.blockEntity()
.getSlots((be) => 32)
.getStackInSlot(global.cobblegen.getStackInSlot)
.insertItem(global.cobblegen.insertItem)
.extractItem(global.cobblegen.extractItem)
.getSlotLimit((be) => 64)
.isItemValid(global.cobblegen.isItemValid)
)
})
event.create('skapa:thermoelectric_generator')
.displayName('Thermoelectric Generator')
.hardness(30.0)
.soundType('metal')
.tagBlock('minecraft:mineable/pickaxe')
.tagBlock('minecraft:needs_iron_tool')
.requiresTool(true)
.lightLevel(0)
.blockEntity((info) => {
info.serverTick(global.thermoelectricgen.serverTick);
info.attachCapability(CapabilityBuilder.ENERGY.customBlockEntity()
.canExtract(() => true)
.canReceive(() => false)
.extractEnergy(global.thermoelectricgen.extractEnergy)
.getEnergyStored((be) => {
return be.persistentData.getInt('energy')
})
.getMaxEnergyStored(() => 5000)
);
})
})