finish terrain generation
This commit is contained in:
166
scripts/ore_manager/block_gen.py
Normal file
166
scripts/ore_manager/block_gen.py
Normal file
@ -0,0 +1,166 @@
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def ReadListFromFile(filename, listInstance):
|
||||
f = open(filename, 'r', encoding='utf-8')
|
||||
while True:
|
||||
cache = f.readline()
|
||||
if cache == '':
|
||||
break;
|
||||
cache = cache.strip()
|
||||
if cache == '':
|
||||
listInstance.append('')
|
||||
continue
|
||||
if cache.startswith('//'):
|
||||
continue
|
||||
listInstance.append(cache)
|
||||
f.close()
|
||||
|
||||
def GetUnderlineName(strl):
|
||||
return strl.lower().replace(',', '').replace('& ', '').replace('é', 'e').replace('-', '_').replace("'", '').replace('"', '').replace(' ', '_')
|
||||
|
||||
# folder creation
|
||||
if not os.path.isdir('data/teyvatcraft/loot_tables/blocks'):
|
||||
os.makedirs('data/teyvatcraft/loot_tables/blocks')
|
||||
if not os.path.isdir('assets/teyvatcraft/models/block'):
|
||||
os.makedirs('assets/teyvatcraft/models/block')
|
||||
if not os.path.isdir('assets/teyvatcraft/models/item'):
|
||||
os.makedirs('assets/teyvatcraft/models/item')
|
||||
if not os.path.isdir('assets/teyvatcraft/blockstates'):
|
||||
os.makedirs('assets/teyvatcraft/blockstates')
|
||||
if not os.path.isdir('assets/teyvatcraft/textures/block'):
|
||||
os.makedirs('assets/teyvatcraft/textures/block')
|
||||
|
||||
|
||||
# read file
|
||||
enList = []
|
||||
zhList = []
|
||||
|
||||
ReadListFromFile('zh.txt', zhList)
|
||||
ReadListFromFile('en.txt', enList)
|
||||
|
||||
if len(zhList) != len(enList):
|
||||
print('2 files item is not matched')
|
||||
sys.exit(0)
|
||||
|
||||
javaDeclareFile = open('declare.block.java', 'w', encoding='utf-8')
|
||||
javaRegisterFile = open('register.block.java', 'w', encoding='utf-8')
|
||||
langZhFile = open('zh_cn.block.json', 'w', encoding='utf-8')
|
||||
langEnFile = open('en_us.block.json', 'w', encoding='utf-8')
|
||||
for index in range(len(enList)):
|
||||
if enList[index] == '':
|
||||
# keep blank line in register & declare
|
||||
javaDeclareFile.write('\n')
|
||||
javaRegisterFile.write('\n')
|
||||
langZhFile.write('\n')
|
||||
langEnFile.write('\n')
|
||||
continue
|
||||
|
||||
(droppedName, oreName) = enList[index].split('#')
|
||||
dropped_underlineName = GetUnderlineName(droppedName)
|
||||
ore_underlineName = GetUnderlineName(oreName)
|
||||
ore_upperName = ore_underlineName.upper()
|
||||
|
||||
flootTables = open('data/teyvatcraft/loot_tables/blocks/' + ore_underlineName + '.json', 'w', encoding='utf-8')
|
||||
fblockstates = open('assets/teyvatcraft/blockstates/' + ore_underlineName + '.json', 'w', encoding='utf-8')
|
||||
fmodel = open('assets/teyvatcraft/models/block/{}.json'.format(ore_underlineName), 'w', encoding='utf-8')
|
||||
fmodelItem = open('assets/teyvatcraft/models/item/{}.json'.format(ore_underlineName), 'w', encoding='utf-8')
|
||||
|
||||
flootTables.write('''{{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {{
|
||||
"enchantments": [
|
||||
{{
|
||||
"enchantment": "minecraft:silk_touch",
|
||||
"levels": {{
|
||||
"min": 1
|
||||
}}
|
||||
}}
|
||||
]
|
||||
}}
|
||||
}}
|
||||
],
|
||||
"name": "teyvatcraft:{}"
|
||||
}},
|
||||
{{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{{
|
||||
"function": "minecraft:set_count",
|
||||
"count": {{
|
||||
"min": 1.0,
|
||||
"max": 2.0,
|
||||
"type": "minecraft:uniform"
|
||||
}}
|
||||
}},
|
||||
{{
|
||||
"function": "minecraft:apply_bonus",
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:uniform_bonus_count",
|
||||
"parameters": {{
|
||||
"bonusMultiplier": 1
|
||||
}}
|
||||
}},
|
||||
{{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}}
|
||||
],
|
||||
"name": "teyvatcraft:{}"
|
||||
}}
|
||||
]
|
||||
}}
|
||||
]
|
||||
}}
|
||||
]
|
||||
}}'''.format(ore_underlineName, dropped_underlineName))
|
||||
|
||||
fblockstates.write('''{{
|
||||
"variants": {{
|
||||
"": {{
|
||||
"model": "teyvatcraft:block/{}"
|
||||
}}
|
||||
}}
|
||||
}}'''.format(ore_underlineName))
|
||||
|
||||
fmodel.write('''{{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": {{
|
||||
"all": "teyvatcraft:block/{}"
|
||||
}}
|
||||
}}'''.format(ore_underlineName))
|
||||
|
||||
fmodelItem.write('''{{
|
||||
"parent": "teyvatcraft:block/{}"
|
||||
}}'''.format(ore_underlineName))
|
||||
|
||||
flootTables.close()
|
||||
fblockstates.close()
|
||||
fmodel.close()
|
||||
fmodelItem.close()
|
||||
|
||||
javaDeclareFile.write('public static final Block {} = new OreBlock(getOreBlockSettings(1, 3.0f));\n'.format(ore_upperName))
|
||||
javaRegisterFile.write('Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "{}"), {});\n'.format(ore_underlineName, ore_upperName))
|
||||
|
||||
langZhFile.write('"block.teyvatcraft.{}": "{}",\n'.format(ore_underlineName, zhList[index].split('#')[1]))
|
||||
langEnFile.write('"block.teyvatcraft.{}": "{}",\n'.format(ore_underlineName, enList[index].split('#')[1].replace('"', '')))
|
||||
|
||||
shutil.copyfile('stone.png', 'assets/teyvatcraft/textures/block/{}.png'.format(ore_underlineName))
|
||||
|
||||
|
||||
javaDeclareFile.close()
|
||||
javaRegisterFile.close()
|
||||
langZhFile.close()
|
||||
langEnFile.close()
|
7
scripts/ore_manager/en.txt
Normal file
7
scripts/ore_manager/en.txt
Normal file
@ -0,0 +1,7 @@
|
||||
//Magical Crystal Chunk#Magical Crystal Chunk Ore
|
||||
//Crystal Chunk#Crystal Chunk Ore
|
||||
//White Iron Chunk#White Iron Chunk Ore
|
||||
//Iron Chunk#Iron Chunk Ore
|
||||
//Starsilver#Starsilver Ore
|
||||
Cor Lapis#Cor Lapis Ore
|
||||
Noctilucous Jade#Noctilucous Jade Ore
|
BIN
scripts/ore_manager/stone.png
Normal file
BIN
scripts/ore_manager/stone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 215 B |
7
scripts/ore_manager/zh.txt
Normal file
7
scripts/ore_manager/zh.txt
Normal file
@ -0,0 +1,7 @@
|
||||
//魔晶块#魔晶块原矿
|
||||
//水晶块#水晶块原矿
|
||||
//白铁块#白铁块原矿
|
||||
//铁块#铁块原矿
|
||||
//星银矿石#星银矿石原矿
|
||||
石珀#石珀原矿
|
||||
夜泊石#夜泊石原矿
|
239
scripts/plant_manager/block_gen.py
Normal file
239
scripts/plant_manager/block_gen.py
Normal file
@ -0,0 +1,239 @@
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def ReadListFromFile(filename, listInstance):
|
||||
f = open(filename, 'r', encoding='utf-8')
|
||||
while True:
|
||||
cache = f.readline()
|
||||
if cache == '':
|
||||
break;
|
||||
cache = cache.strip()
|
||||
if cache == '':
|
||||
listInstance.append('')
|
||||
continue
|
||||
if cache.startswith('//'):
|
||||
continue
|
||||
listInstance.append(cache)
|
||||
f.close()
|
||||
|
||||
def GenerateSweetBerryBushStageModel(name, stage):
|
||||
f = open('assets/teyvatcraft/models/block/{}_stage{}.json'.format(name, stage), 'w', encoding='utf-8')
|
||||
f.write('''{{
|
||||
"parent": "minecraft:block/cross",
|
||||
"textures": {{
|
||||
"cross": "teyvatcraft:block/{}_stage{}"
|
||||
}}
|
||||
}}'''.format(name, stage))
|
||||
f.close()
|
||||
|
||||
# folder creation
|
||||
if not os.path.isdir('data/teyvatcraft/loot_tables/blocks'):
|
||||
os.makedirs('data/teyvatcraft/loot_tables/blocks')
|
||||
if not os.path.isdir('assets/teyvatcraft/models/block'):
|
||||
os.makedirs('assets/teyvatcraft/models/block')
|
||||
if not os.path.isdir('assets/teyvatcraft/blockstates'):
|
||||
os.makedirs('assets/teyvatcraft/blockstates')
|
||||
if not os.path.isdir('assets/teyvatcraft/textures/block'):
|
||||
os.makedirs('assets/teyvatcraft/textures/block')
|
||||
|
||||
|
||||
# read file
|
||||
enList = []
|
||||
zhList = []
|
||||
propList = []
|
||||
|
||||
ReadListFromFile('zh.txt', zhList)
|
||||
ReadListFromFile('en.txt', enList)
|
||||
ReadListFromFile('prop.txt', propList)
|
||||
|
||||
if len(zhList) != len(enList) or len(propList) != len(enList):
|
||||
print('3 files item is not matched')
|
||||
sys.exit(0)
|
||||
|
||||
javaDeclareFile = open('declare.block.java', 'w', encoding='utf-8')
|
||||
javaRegisterFile = open('register.block.java', 'w', encoding='utf-8')
|
||||
langZhFile = open('zh_cn.block.json', 'w', encoding='utf-8')
|
||||
langEnFile = open('en_us.block.json', 'w', encoding='utf-8')
|
||||
for index in range(len(enList)):
|
||||
underlineName = enList[index].lower().replace(',', '').replace('& ', '').replace('é', 'e').replace('-', '_').replace("'", '').replace('"', '').replace(' ', '_')
|
||||
upperName = underlineName.upper()
|
||||
|
||||
if propList[index] == '':
|
||||
# keep blank line in register & declare
|
||||
javaDeclareFile.write('\n')
|
||||
javaRegisterFile.write('\n')
|
||||
langZhFile.write('\n')
|
||||
langEnFile.write('\n')
|
||||
continue
|
||||
|
||||
flootTables = open('data/teyvatcraft/loot_tables/blocks/' + underlineName + '.json', 'w', encoding='utf-8')
|
||||
fblockstates = open('assets/teyvatcraft/blockstates/' + underlineName + '.json', 'w', encoding='utf-8')
|
||||
if propList[index] == 'sweet_berry_bush':
|
||||
javaDeclareFile.write('public static final Block {} = new TeyvatSweetBerryBushLikePlantBlock(ItemsManager.{});\n'.format(upperName, upperName))
|
||||
|
||||
flootTables.write('''{{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{{
|
||||
"rolls": 1.0,
|
||||
"entries": [
|
||||
{{
|
||||
"type": "minecraft:item",
|
||||
"name": "teyvatcraft:{}"
|
||||
}}
|
||||
],
|
||||
"conditions": [
|
||||
{{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "teyvatcraft:{}",
|
||||
"properties": {{
|
||||
"age": "3"
|
||||
}}
|
||||
}}
|
||||
],
|
||||
"functions": [
|
||||
{{
|
||||
"function": "minecraft:set_count",
|
||||
"count": {{
|
||||
"min": 2.0,
|
||||
"max": 3.0,
|
||||
"type": "minecraft:uniform"
|
||||
}}
|
||||
}},
|
||||
{{
|
||||
"function": "minecraft:apply_bonus",
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:uniform_bonus_count",
|
||||
"parameters": {{
|
||||
"bonusMultiplier": 1
|
||||
}}
|
||||
}}
|
||||
]
|
||||
}},
|
||||
{{
|
||||
"rolls": 1.0,
|
||||
"entries": [
|
||||
{{
|
||||
"type": "minecraft:item",
|
||||
"name": "teyvatcraft:{}"
|
||||
}}
|
||||
],
|
||||
"conditions": [
|
||||
{{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "teyvatcraft:{}",
|
||||
"properties": {{
|
||||
"age": "2"
|
||||
}}
|
||||
}}
|
||||
],
|
||||
"functions": [
|
||||
{{
|
||||
"function": "minecraft:set_count",
|
||||
"count": {{
|
||||
"min": 1.0,
|
||||
"max": 2.0,
|
||||
"type": "minecraft:uniform"
|
||||
}}
|
||||
}},
|
||||
{{
|
||||
"function": "minecraft:apply_bonus",
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:uniform_bonus_count",
|
||||
"parameters": {{
|
||||
"bonusMultiplier": 1
|
||||
}}
|
||||
}}
|
||||
]
|
||||
}}
|
||||
],
|
||||
"functions": [
|
||||
{{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}}
|
||||
]
|
||||
}}'''.format(*([underlineName, ]*4)))
|
||||
|
||||
fblockstates.write('''{{
|
||||
"variants": {{
|
||||
"age=0": {{
|
||||
"model": "teyvatcraft:block/{}_stage0"
|
||||
}},
|
||||
"age=1": {{
|
||||
"model": "teyvatcraft:block/{}_stage1"
|
||||
}},
|
||||
"age=2": {{
|
||||
"model": "teyvatcraft:block/{}_stage2"
|
||||
}},
|
||||
"age=3": {{
|
||||
"model": "teyvatcraft:block/{}_stage3"
|
||||
}}
|
||||
}}
|
||||
}}'''.format(*([underlineName, ]*4)))
|
||||
|
||||
GenerateSweetBerryBushStageModel(underlineName, 0)
|
||||
GenerateSweetBerryBushStageModel(underlineName, 1)
|
||||
GenerateSweetBerryBushStageModel(underlineName, 2)
|
||||
GenerateSweetBerryBushStageModel(underlineName, 3)
|
||||
|
||||
#shutil.copyfile('sweet_berry_bush_stage0.png', 'assets/teyvatcraft/textures/block/{}_stage0.png'.format(underlineName))
|
||||
#shutil.copyfile('sweet_berry_bush_stage1.png', 'assets/teyvatcraft/textures/block/{}_stage1.png'.format(underlineName))
|
||||
#shutil.copyfile('sweet_berry_bush_stage2.png', 'assets/teyvatcraft/textures/block/{}_stage2.png'.format(underlineName))
|
||||
#shutil.copyfile('sweet_berry_bush_stage3.png', 'assets/teyvatcraft/textures/block/{}_stage3.png'.format(underlineName))
|
||||
|
||||
elif propList[index] == 'flower':
|
||||
fmodel = open('assets/teyvatcraft/models/block/{}.json'.format(underlineName), 'w', encoding='utf-8')
|
||||
javaDeclareFile.write('public static final Block {} = new TeyvatFlowerLikePlantBlock();\n'.format(upperName))
|
||||
|
||||
flootTables.write('''{{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{{
|
||||
"type": "minecraft:item",
|
||||
"name": "teyvatcraft:{}"
|
||||
}}
|
||||
],
|
||||
"conditions": [
|
||||
{{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}}
|
||||
]
|
||||
}}
|
||||
]
|
||||
}}'''.format(underlineName))
|
||||
|
||||
fblockstates.write('''{{
|
||||
"variants": {{
|
||||
"": {{
|
||||
"model": "teyvatcraft:block/{}"
|
||||
}}
|
||||
}}
|
||||
}}'''.format(underlineName))
|
||||
|
||||
fmodel.write('''{{
|
||||
"parent": "minecraft:block/cross",
|
||||
"textures": {{
|
||||
"cross": "teyvatcraft:block/{}"
|
||||
}}
|
||||
}}'''.format(underlineName))
|
||||
fmodel.close()
|
||||
|
||||
#shutil.copyfile('flower.png', 'assets/teyvatcraft/textures/block/{}.png'.format(underlineName))
|
||||
|
||||
flootTables.close()
|
||||
fblockstates.close()
|
||||
|
||||
javaRegisterFile.write('registerTeyvatPlant({}, "{}");\n'.format(upperName, underlineName))
|
||||
|
||||
langZhFile.write('"block.teyvatcraft.{}": "{}",\n'.format(underlineName, zhList[index]))
|
||||
langEnFile.write('"block.teyvatcraft.{}": "{}",\n'.format(underlineName, enList[index].replace('"', '')))
|
||||
|
||||
|
||||
javaDeclareFile.close()
|
||||
javaRegisterFile.close()
|
||||
langZhFile.close()
|
||||
langEnFile.close()
|
18
scripts/plant_manager/en.txt
Normal file
18
scripts/plant_manager/en.txt
Normal file
@ -0,0 +1,18 @@
|
||||
Calla Lily
|
||||
Dandelion Seed
|
||||
Jueyun Chili
|
||||
Small Lamp Grass
|
||||
Mint
|
||||
Sweet Flower
|
||||
Berry
|
||||
Snapdragon
|
||||
Matsutake
|
||||
Horsetail
|
||||
Cecilia
|
||||
Glaze Lily
|
||||
Philanemo Mushroom
|
||||
Silk Flower
|
||||
Valberry
|
||||
Windwheel Aster
|
||||
Wolfhook
|
||||
Qingxin
|
BIN
scripts/plant_manager/flower.png
Normal file
BIN
scripts/plant_manager/flower.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 B |
18
scripts/plant_manager/prop.txt
Normal file
18
scripts/plant_manager/prop.txt
Normal file
@ -0,0 +1,18 @@
|
||||
flower
|
||||
flower
|
||||
sweet_berry_bush
|
||||
flower
|
||||
flower
|
||||
flower
|
||||
sweet_berry_bush
|
||||
flower
|
||||
flower
|
||||
flower
|
||||
flower
|
||||
flower
|
||||
flower
|
||||
sweet_berry_bush
|
||||
sweet_berry_bush
|
||||
flower
|
||||
sweet_berry_bush
|
||||
flower
|
BIN
scripts/plant_manager/sweet_berry_bush_stage0.png
Normal file
BIN
scripts/plant_manager/sweet_berry_bush_stage0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 B |
BIN
scripts/plant_manager/sweet_berry_bush_stage1.png
Normal file
BIN
scripts/plant_manager/sweet_berry_bush_stage1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 255 B |
BIN
scripts/plant_manager/sweet_berry_bush_stage2.png
Normal file
BIN
scripts/plant_manager/sweet_berry_bush_stage2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 280 B |
BIN
scripts/plant_manager/sweet_berry_bush_stage3.png
Normal file
BIN
scripts/plant_manager/sweet_berry_bush_stage3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
18
scripts/plant_manager/zh.txt
Normal file
18
scripts/plant_manager/zh.txt
Normal file
@ -0,0 +1,18 @@
|
||||
嘟嘟莲
|
||||
蒲公英籽
|
||||
绝云椒椒
|
||||
小灯草
|
||||
薄荷
|
||||
甜甜花
|
||||
树莓
|
||||
金鱼草
|
||||
松茸
|
||||
马尾
|
||||
塞西莉亚花
|
||||
琉璃百合
|
||||
慕风蘑菇
|
||||
霓裳花
|
||||
落落莓
|
||||
风车菊
|
||||
钩钩果
|
||||
清心
|
Reference in New Issue
Block a user