feat: Initial commit
This commit is contained in:
10
examples/VARIABLES.md
Normal file
10
examples/VARIABLES.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# VARIABLES
|
||||
|
||||
示例中的变量替换
|
||||
|
||||
## 变量列表
|
||||
|
||||
|变量名|描述|
|
||||
|:----|:----|
|
||||
|`__mod_name__`|项目名|
|
||||
|`__mod_name_lower__`|项目名小写驼峰|
|
||||
4
examples/default/.gitignore
vendored
Normal file
4
examples/default/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.idea/
|
||||
studio.json
|
||||
.mcs/editorSave.json
|
||||
.mcs/images/
|
||||
0
examples/default/behavior_pack/BoxData/.gitkeep
Normal file
0
examples/default/behavior_pack/BoxData/.gitkeep
Normal file
0
examples/default/behavior_pack/Parts/.gitkeep
Normal file
0
examples/default/behavior_pack/Parts/.gitkeep
Normal file
0
examples/default/behavior_pack/Presets/.gitkeep
Normal file
0
examples/default/behavior_pack/Presets/.gitkeep
Normal file
0
examples/default/behavior_pack/entities/.gitkeep
Normal file
0
examples/default/behavior_pack/entities/.gitkeep
Normal file
@@ -0,0 +1,3 @@
|
||||
class ServerEvents(object):
|
||||
BlockRandomTickServerEvent = "BlockRandomTickServerEvent"
|
||||
ServerBlockEntityTickEvent = "ServerBlockEntityTickEvent"
|
||||
@@ -0,0 +1,25 @@
|
||||
from mod.common.system.baseSystem import BaseSystem
|
||||
|
||||
|
||||
def listen(event, namespace=None, system_name=None):
|
||||
def decorator(func):
|
||||
func._annotation_listen = event
|
||||
func._listen_namespace = namespace
|
||||
func._listen_system_name = system_name
|
||||
return func
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def inject_listener(instance, system, namespace, system_name): # type: (object, BaseSystem, str, str) -> None
|
||||
for name, method in instance.__class__.__dict__.items():
|
||||
if (callable(method) and hasattr(method, '_annotation_listen')
|
||||
and hasattr(method, '_listen_namespace')
|
||||
and hasattr(method, '_listen_system_name')):
|
||||
event = method._annotation_listen
|
||||
anno_namespace = method._listen_namespace
|
||||
anno_system_name = method._listen_system_name
|
||||
final_namespace = anno_namespace if anno_system_name is not None else namespace
|
||||
final_system_name = anno_system_name if anno_system_name is not None else system_name
|
||||
system.ListenForEvent(final_namespace, final_system_name, event, instance, method)
|
||||
print(event)
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import mod.server.extraServerApi as serverApi
|
||||
import mod.client.extraClientApi as clientApi
|
||||
|
||||
from mod.common.system.baseSystem import BaseSystem
|
||||
|
||||
from __mod_name_lower__Scripts.listen.listen import inject_listener
|
||||
|
||||
|
||||
class EasyModBaseSystem(serverApi.GetServerSystemCls()):
|
||||
|
||||
def __init__(self, namespace, system_name, engine_namespace, engine_system_name):
|
||||
super(EasyModBaseSystem, self).__init__(namespace, system_name)
|
||||
inject_listener(self.__class__, self, engine_namespace, engine_system_name)
|
||||
|
||||
class EasyModServerSystem(EasyModBaseSystem, ServerSystem):
|
||||
|
||||
def __init__(self, namespace, system_name, engine_namespace, engine_system_name):
|
||||
super(EasyModServerSystem, self).__init__(namespace, system_name, engine_namespace, engine_system_name)
|
||||
|
||||
class EasyModClientSystem(EasyModBaseSystem):
|
||||
@@ -0,0 +1,7 @@
|
||||
ProjectName = "Circus"
|
||||
|
||||
ServerSystemName = "CircusServerSystem"
|
||||
ServerSystemPath = "circusScripts.modServer.serverSystem.CircusServerSystem"
|
||||
|
||||
ClientSystemName = "CircusClientSystem"
|
||||
ClientSystemPath = "circusScripts.modClient.clientSystem.CircusClientSystem"
|
||||
28
examples/default/behavior_pack/exampleScripts/modMain.py
Normal file
28
examples/default/behavior_pack/exampleScripts/modMain.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from mod.common.mod import Mod
|
||||
import mod.server.extraServerApi as serverApi
|
||||
|
||||
|
||||
@Mod.Binding(name="__mod_name__", version="0.0.1")
|
||||
class __mod_name__(object):
|
||||
|
||||
def __init__(self):
|
||||
print("===== init __mod_name__ mod =====")
|
||||
|
||||
@Mod.InitServer()
|
||||
def on_server_init(self):
|
||||
print("===== init __mod_name__ server =====")
|
||||
serverApi.RegisterSystem("__mod_name__", "__mod_name__ServerSystem", "__mod_name_lower__Scripts.modServer.serverSystem.__mod_name__ServerSystem")
|
||||
|
||||
@Mod.DestroyServer()
|
||||
def on_server_destroy(self):
|
||||
pass
|
||||
|
||||
@Mod.InitClient()
|
||||
def on_init_client(self):
|
||||
pass
|
||||
|
||||
@Mod.DestroyClient()
|
||||
def on_init_destroy(self):
|
||||
pass
|
||||
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import mod.server.extraServerApi as serverApi
|
||||
|
||||
from __mod_name_lower__Scripts.modCommon.emodSystem import EasyModBaseSystem
|
||||
|
||||
ServerSystem = serverApi.GetServerSystemCls()
|
||||
compFactory = serverApi.GetEngineCompFactory()
|
||||
namespace = serverApi.GetEngineNamespace()
|
||||
engineSystemName = serverApi.GetEngineSystemName()
|
||||
|
||||
|
||||
class __mod_name__ServerSystem(EasyModServerSystem):
|
||||
|
||||
def __init__(self, namespace, systemName):
|
||||
super(__mod_name__ServerSystem, self).__init__(namespace, systemName)
|
||||
print("===== __mod_name__ServerSystem init =====")
|
||||
|
||||
0
examples/default/behavior_pack/items/.gitkeep
Normal file
0
examples/default/behavior_pack/items/.gitkeep
Normal file
0
examples/default/behavior_pack/loot_tables/.gitkeep
Normal file
0
examples/default/behavior_pack/loot_tables/.gitkeep
Normal file
BIN
examples/default/behavior_pack/pack_icon.jpg
Normal file
BIN
examples/default/behavior_pack/pack_icon.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
31
examples/default/behavior_pack/pack_manifest.json
Normal file
31
examples/default/behavior_pack/pack_manifest.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"modules": [
|
||||
{
|
||||
"description": "",
|
||||
"type": "data",
|
||||
"uuid": "{behavior_module_uuid}",
|
||||
"version": [
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
}
|
||||
],
|
||||
"header": {
|
||||
"description": "",
|
||||
"name": "behavior_pack",
|
||||
"uuid": "{behavior_pack_uuid}",
|
||||
"version": [
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"min_engine_version": [
|
||||
1,
|
||||
18,
|
||||
0
|
||||
]
|
||||
},
|
||||
"dependencies": [],
|
||||
"format_version": 1
|
||||
}
|
||||
0
examples/default/behavior_pack/recipes/.gitkeep
Normal file
0
examples/default/behavior_pack/recipes/.gitkeep
Normal file
0
examples/default/behavior_pack/spawn_rules/.gitkeep
Normal file
0
examples/default/behavior_pack/spawn_rules/.gitkeep
Normal file
0
examples/default/behavior_pack/structures/.gitkeep
Normal file
0
examples/default/behavior_pack/structures/.gitkeep
Normal file
0
examples/default/behavior_pack/trading/.gitkeep
Normal file
0
examples/default/behavior_pack/trading/.gitkeep
Normal file
0
examples/default/resource_pack/animations/.gitkeep
Normal file
0
examples/default/resource_pack/animations/.gitkeep
Normal file
0
examples/default/resource_pack/attachables/.gitkeep
Normal file
0
examples/default/resource_pack/attachables/.gitkeep
Normal file
7
examples/default/resource_pack/blocks.json
Normal file
7
examples/default/resource_pack/blocks.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"format_version": [
|
||||
1,
|
||||
1,
|
||||
0
|
||||
]
|
||||
}
|
||||
0
examples/default/resource_pack/effects/.gitkeep
Normal file
0
examples/default/resource_pack/effects/.gitkeep
Normal file
0
examples/default/resource_pack/entity/.gitkeep
Normal file
0
examples/default/resource_pack/entity/.gitkeep
Normal file
0
examples/default/resource_pack/font/.gitkeep
Normal file
0
examples/default/resource_pack/font/.gitkeep
Normal file
0
examples/default/resource_pack/materials/.gitkeep
Normal file
0
examples/default/resource_pack/materials/.gitkeep
Normal file
0
examples/default/resource_pack/models/mesh/.gitkeep
Normal file
0
examples/default/resource_pack/models/mesh/.gitkeep
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"skeleton": [
|
||||
{
|
||||
"name": "root",
|
||||
"parent": "root",
|
||||
"initpos": [
|
||||
0.0,
|
||||
0.0,
|
||||
-0.0
|
||||
],
|
||||
"initquaternion": [
|
||||
-0.0000016026669982238673,
|
||||
-0.0000015070728522914579,
|
||||
0.697554349899292,
|
||||
0.7165318727493286
|
||||
],
|
||||
"initscale": [
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"offmtx": [
|
||||
[
|
||||
0.026835869997739793,
|
||||
0.9996398091316223,
|
||||
-1.1985919456947159e-7,
|
||||
-2.22485263889673e-17
|
||||
],
|
||||
[
|
||||
-0.9996398091316223,
|
||||
0.026835869997739793,
|
||||
-0.000004400427314976696,
|
||||
-8.168171115038121e-16
|
||||
],
|
||||
[
|
||||
-0.000004395626092446037,
|
||||
2.3790533987266827e-7,
|
||||
1.0,
|
||||
1.856222120455442e-10
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"boundingbox": [
|
||||
[
|
||||
-0.007048234809190035,
|
||||
-7.17939763195119e-10,
|
||||
-0.012045030482113362
|
||||
],
|
||||
[
|
||||
0.007048234809190035,
|
||||
0.01892676018178463,
|
||||
0.012045029550790787
|
||||
]
|
||||
]
|
||||
}
|
||||
BIN
examples/default/resource_pack/pack_icon.jpg
Normal file
BIN
examples/default/resource_pack/pack_icon.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
30
examples/default/resource_pack/pack_manifest.json
Normal file
30
examples/default/resource_pack/pack_manifest.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"header": {
|
||||
"description": "",
|
||||
"min_engine_version": [
|
||||
1,
|
||||
18,
|
||||
0
|
||||
],
|
||||
"name": "resource_pack",
|
||||
"uuid": "{resource_pack_uuid}",
|
||||
"version": [
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"description": "",
|
||||
"type": "resources",
|
||||
"uuid": "{resource_module_uuid}",
|
||||
"version": [
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
0
examples/default/resource_pack/sounds/.gitkeep
Normal file
0
examples/default/resource_pack/sounds/.gitkeep
Normal file
0
examples/default/resource_pack/texts/zh_CN.lang
Normal file
0
examples/default/resource_pack/texts/zh_CN.lang
Normal file
BIN
examples/default/resource_pack/textures/blocks/custom_brah.png
Normal file
BIN
examples/default/resource_pack/textures/blocks/custom_brah.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 286 B |
BIN
examples/default/resource_pack/textures/blocks/custom_dirt.png
Normal file
BIN
examples/default/resource_pack/textures/blocks/custom_dirt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 295 B |
BIN
examples/default/resource_pack/textures/items/custom_apple.png
Normal file
BIN
examples/default/resource_pack/textures/items/custom_apple.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 257 B |
BIN
examples/default/resource_pack/textures/sfxs/custom_sun.png
Normal file
BIN
examples/default/resource_pack/textures/sfxs/custom_sun.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"resource_pack_name": "vanilla",
|
||||
"texture_data": {
|
||||
|
||||
},
|
||||
"texture_name": "atlas.terrain"
|
||||
}
|
||||
0
examples/default/resource_pack/textures/ui/.gitkeep
Normal file
0
examples/default/resource_pack/textures/ui/.gitkeep
Normal file
0
examples/default/resource_pack/ui/.gitkeep
Normal file
0
examples/default/resource_pack/ui/.gitkeep
Normal file
11
examples/default/world_behavior_packs.json
Normal file
11
examples/default/world_behavior_packs.json
Normal file
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"pack_id": "{behavior_pack_uuid}",
|
||||
"type": "Addon",
|
||||
"version": [
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
}
|
||||
]
|
||||
11
examples/default/world_resource_packs.json
Normal file
11
examples/default/world_resource_packs.json
Normal file
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"pack_id": "{resource_pack_uuid}",
|
||||
"type": "Addon",
|
||||
"version": [
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user