Block hardness adaptions (issue #32). Lang files updated. Build utils enhanced to prepare code release for 1.13/1.14.
This commit is contained in:
parent
8af8544e30
commit
0a310c4261
19 changed files with 1221 additions and 618 deletions
|
@ -28,7 +28,7 @@ wildcardr=$(foreach d,$(wildcard $1*),$(call wildcardr,$d/,$2) $(filter $(subst
|
|||
#
|
||||
# Targets
|
||||
#
|
||||
.PHONY: default mod init clean clean-all all run install sanatize dist-check dist start-server
|
||||
.PHONY: default mod init clean clean-all mrproper all run install sanatize dist-check dist start-server port-languages
|
||||
|
||||
default: mod
|
||||
|
||||
|
@ -46,8 +46,17 @@ clean:
|
|||
clean-all: clean
|
||||
@echo "[1.12] Cleaning using gradle ..."
|
||||
@rm -f dist/*
|
||||
@rm -rf run/logs/
|
||||
@rm -rf run/crash-reports/
|
||||
@$(GRADLE) clean cleanCache
|
||||
|
||||
mrproper: clean-all
|
||||
@rm -rf meta/*
|
||||
@rm -rf run/
|
||||
@rm -rf out/
|
||||
@rm -f .project
|
||||
@rm -f .classpath
|
||||
|
||||
init:
|
||||
@echo "[1.12] Initialising eclipse workspace using gradle ..."
|
||||
@$(GRADLE) setupDecompWorkspace
|
||||
|
@ -90,3 +99,7 @@ dist: sanatize dist-check clean-all mod
|
|||
@mkdir -p dist
|
||||
@cp build/libs/$(MOD_JAR_PREFIX)* dist/
|
||||
@djs tasks.js dist
|
||||
|
||||
port-languages:
|
||||
@echo "[1.12] Porting language files to 1.13/1.14 ..."
|
||||
@djs tasks.js port-languages
|
||||
|
|
|
@ -24,6 +24,11 @@ archivesBaseName = "engineersdecor-${version_minecraft}"
|
|||
|
||||
def signing = { ->
|
||||
def sp = new Properties()
|
||||
sp.keystore_file = project.keystore_file
|
||||
sp.keystore_alias = project.keystore_alias
|
||||
sp.keystore_pass = project.keystore_pass
|
||||
sp.keystore_keypass = project.keystore_keypass
|
||||
sp.fingerprint_sha1 = project.fingerprint_sha1
|
||||
if(file("signing.properties").exists()) file("signing.properties").withInputStream { sp.load(it) }
|
||||
return sp
|
||||
}()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.12.2": {
|
||||
"1.0.9-b1": "[U] Lang file ru_ru updated (PR#31, yaroslav4167).\n[M] Block hardness adaptions (issue #32).",
|
||||
"1.0.8": "[R] Release based on v1.0.8-b2. Release-to-release changes: * Added factory area sign. * Added stained clinker. * Config opt-out fixes, detailed feature selection possible now. * Recipe adaptions and fixes. * Lang files updated.\n[A] Added stained clinker brick block/stairs. Can be mixed with \"normal\" clinkers.\n[A] Added opt-out option for CTRL-SHIFT tooltips.\n[M] Recipe condition requirements updated, recipes categorized.",
|
||||
"1.0.8-b2": "[F] Config opt-out fixed (thx IronPiston for the report #30).\n[A] Added opt-out config for detailed including/excluding of features (using registry name wildcard matching).",
|
||||
"1.0.8-b1": "[A] Added \"Factory area\" sign.\n[M] Electrical furnace recipe changed (hoppers to conveyors).\n[A] Opt-out config options added.\n[F] Lang file fixes for en_us (Angela, PR#29).",
|
||||
|
@ -44,6 +45,6 @@
|
|||
},
|
||||
"promos": {
|
||||
"1.12.2-recommended": "1.0.8",
|
||||
"1.12.2-latest": "1.0.8"
|
||||
"1.12.2-latest": "1.0.9-b1"
|
||||
}
|
||||
}
|
|
@ -8,9 +8,10 @@ Mod sources for Minecraft version 1.12.2.
|
|||
- Compiled mod distribution channel is curseforge: https://www.curseforge.com/minecraft/mc-mods/engineers-decor/files.
|
||||
|
||||
----
|
||||
## Revision history
|
||||
## Version history
|
||||
|
||||
~ v1.0.9-b1 [U] Lang file ru_ru updated (PR#31, yaroslav4167).
|
||||
- v1.0.9-b1 [U] Lang file ru_ru updated (PR#31, yaroslav4167).
|
||||
[M] Block hardness adaptions (issue #32).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
- v1.0.8 [R] Release based on v1.0.8-b2. Release-to-release changes:
|
||||
|
|
|
@ -90,28 +90,28 @@ public class ModBlocks
|
|||
public static final BlockDecorStraightPole THIN_STEEL_POLE = new BlockDecorStraightPole(
|
||||
"thin_steel_pole",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT,
|
||||
Material.IRON, 1.0f, 15f, SoundType.METAL,
|
||||
Material.IRON, 2.0f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(6,6,0, 10,10,16)
|
||||
);
|
||||
|
||||
public static final BlockDecorStraightPole THIN_STEEL_POLE_HEAD = new BlockDecorStraightPole(
|
||||
"thin_steel_pole_head",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME,
|
||||
Material.IRON, 1.0f, 15f, SoundType.METAL,
|
||||
Material.IRON, 2.0f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(6,6,0, 10,10,16)
|
||||
);
|
||||
|
||||
public static final BlockDecorStraightPole THICK_STEEL_POLE = new BlockDecorStraightPole(
|
||||
"thick_steel_pole",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT,
|
||||
Material.IRON, 1.0f, 15f, SoundType.METAL,
|
||||
Material.IRON, 2.0f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(5,5,0, 11,11,16)
|
||||
);
|
||||
|
||||
public static final BlockDecorStraightPole THICK_STEEL_POLE_HEAD = new BlockDecorStraightPole(
|
||||
"thick_steel_pole_head",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME,
|
||||
Material.IRON, 1.0f, 15f, SoundType.METAL,
|
||||
Material.IRON, 2.0f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(5,5,0, 11,11,16)
|
||||
);
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class ModBlocks
|
|||
public static final BlockDecorDirected INSET_LIGHT_IRON = new BlockDecorDirected(
|
||||
"iron_inset_light",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_OPPOSITE_PLACEMENT|(14<<BlockDecor.CFG_LIGHT_VALUE_SHIFT),
|
||||
Material.IRON, 0.3f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(5.2,5.2,15.7, 10.8,10.8,16.0)
|
||||
);
|
||||
|
||||
|
@ -168,14 +168,14 @@ public class ModBlocks
|
|||
"small_lab_furnace",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|
|
||||
BlockDecor.CFG_ELECTRICAL,
|
||||
Material.IRON, 0.35f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(1,0,1, 15,15,16)
|
||||
);
|
||||
|
||||
public static final BlockDecorFurnaceElectrical SMALL_ELECTRICAL_FURNACE = new BlockDecorFurnaceElectrical(
|
||||
"small_electrical_furnace",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_ELECTRICAL,
|
||||
Material.IRON, 0.35f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
|
||||
);
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class ModBlocks
|
|||
public static final BlockDecorHorizontalSupport STEEL_DOUBLE_T_SUPPORT = new BlockDecorHorizontalSupport(
|
||||
"steel_double_t_support",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
Material.IRON, 2.0f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(5,11,0, 11,16,16)
|
||||
);
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class ModBlocks
|
|||
"straight_pipe_valve",
|
||||
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
|
||||
BlockDecor.CFG_CUTOUT,
|
||||
Material.IRON, 0.35f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16)
|
||||
);
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class ModBlocks
|
|||
"straight_pipe_valve_redstone",
|
||||
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_REDSTONE_CONTROLLED,
|
||||
Material.IRON, 0.35f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16)
|
||||
);
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class ModBlocks
|
|||
"straight_pipe_valve_redstone_analog",
|
||||
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_REDSTONE_CONTROLLED|BlockDecor.CFG_ANALOG,
|
||||
Material.IRON, 0.35f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(4,4,0, 12,12,16)
|
||||
);
|
||||
|
||||
|
@ -221,7 +221,7 @@ public class ModBlocks
|
|||
"passive_fluid_accumulator",
|
||||
BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_SHIFTCLICK|
|
||||
BlockDecor.CFG_CUTOUT,
|
||||
Material.IRON, 0.35f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
|
||||
);
|
||||
|
||||
|
@ -263,7 +263,7 @@ public class ModBlocks
|
|||
public static final BlockDecorDropper FACTORY_DROPPER = new BlockDecorDropper(
|
||||
"factory_dropper",
|
||||
BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_REDSTONE_CONTROLLED,
|
||||
Material.IRON, 0.3f, 15f, SoundType.METAL,
|
||||
Material.IRON, 0.5f, 15f, SoundType.METAL,
|
||||
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,15)
|
||||
);
|
||||
|
||||
|
@ -282,37 +282,37 @@ public class ModBlocks
|
|||
public static final BlockDecorHalfSlab HALFSLAB_CONCRETE = new BlockDecorHalfSlab(
|
||||
"halfslab_concrete",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.ROCK, 0.4f, 10f, SoundType.STONE
|
||||
Material.ROCK, 1.0f, 10f, SoundType.STONE
|
||||
);
|
||||
public static final BlockDecorHalfSlab HALFSLAB_TREATEDWOOD = new BlockDecorHalfSlab(
|
||||
"halfslab_treated_wood",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.WOOD, 0.4f, 4f, SoundType.WOOD
|
||||
Material.WOOD, 0.6f, 4f, SoundType.WOOD
|
||||
);
|
||||
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALIRON = new BlockDecorHalfSlab(
|
||||
"halfslab_sheetmetal_iron",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.IRON, 0.4f, 10f, SoundType.METAL
|
||||
Material.IRON, 0.8f, 10f, SoundType.METAL
|
||||
);
|
||||
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALSTEEL = new BlockDecorHalfSlab(
|
||||
"halfslab_sheetmetal_steel",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.IRON, 0.4f, 10f, SoundType.METAL
|
||||
Material.IRON, 0.8f, 10f, SoundType.METAL
|
||||
);
|
||||
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALCOPPER = new BlockDecorHalfSlab(
|
||||
"halfslab_sheetmetal_copper",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.IRON, 0.4f, 10f, SoundType.METAL
|
||||
Material.IRON, 0.8f, 10f, SoundType.METAL
|
||||
);
|
||||
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALGOLD = new BlockDecorHalfSlab(
|
||||
"halfslab_sheetmetal_gold",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.IRON, 0.4f, 10f, SoundType.METAL
|
||||
Material.IRON, 0.6f, 10f, SoundType.METAL
|
||||
);
|
||||
public static final BlockDecorHalfSlab HALFSLAB_SHEETMETALALUMINIUM = new BlockDecorHalfSlab(
|
||||
"halfslab_sheetmetal_aluminum",
|
||||
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HARD_IE_DEPENDENT,
|
||||
Material.IRON, 0.4f, 10f, SoundType.METAL
|
||||
Material.IRON, 0.6f, 10f, SoundType.METAL
|
||||
);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
|
165
1.12/src/main/resources/assets/engineersdecor/lang/zh_cn.lang
Normal file
165
1.12/src/main/resources/assets/engineersdecor/lang/zh_cn.lang
Normal file
|
@ -0,0 +1,165 @@
|
|||
#
|
||||
# Engineer's Decor lang file
|
||||
#
|
||||
#PARSE_ESCAPES
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
itemGroup.tabengineersdecor=工程师的装饰
|
||||
engineersdecor.config.title=工程师的装饰配置
|
||||
engineersdecor.tooltip.hint.extended=§6[按§9SHIFT§r获取更多信息§6]§r
|
||||
engineersdecor.tooltip.hint.help=§6[按§9CTRL-SHIFT§r获取帮助§6]§r
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
# Stone/"ceramic material" based blocks
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.clinker_brick_block.name=熟料砖
|
||||
tile.engineersdecor.clinker_brick_block.help=§6具有位置相关纹理变化的砖块.§r\n看起来比原版砖块稍暗,颜色更浓.
|
||||
tile.engineersdecor.clinker_brick_stained_block.name=Stained Clinker Brick Block
|
||||
#tile.engineersdecor.clinker_brick_stained_block.help=§6A brick block with position dependent texture variations.§r\nLooks slightly darker and more color intensive than the vanilla brick block. Has more visible traces of grime or stain.
|
||||
tile.engineersdecor.slag_brick_block.name=炉渣砖
|
||||
tile.engineersdecor.slag_brick_block.help=§6灰褐色砖块,具有位置相关的纹理变化.
|
||||
tile.engineersdecor.rebar_concrete.name=钢筋混凝土
|
||||
tile.engineersdecor.rebar_concrete.help=§6钢筋混凝土砌块.§r 昂贵,但像黑曜石一样防苦力怕.
|
||||
tile.engineersdecor.panzerglass_block.name=Panzer Glass Block
|
||||
#tile.engineersdecor.panzerglass_block.help=§6Reinforced glass block.§r Expensive, explosion-proof. Dark gray tint, faint structural lines visible, multi texture for seemless look.
|
||||
tile.engineersdecor.rebar_concrete_tile.name=Rebar Concrete Tile
|
||||
#tile.engineersdecor.rebar_concrete_tile.help=§6Steel reinforced concrete tile.§r Expensive but Creeper-proof like obsidian.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.rebar_concrete_wall.name=钢筋混凝土墙
|
||||
tile.engineersdecor.rebar_concrete_wall.help=§6钢筋混凝土墙.§r 昂贵,但像黑曜石一样防苦力怕.
|
||||
tile.engineersdecor.concrete_wall.name=水泥墙
|
||||
tile.engineersdecor.concrete_wall.help=§6墙由坚固的混凝土制成.
|
||||
tile.engineersdecor.clinker_brick_wall.name=Clinker Brick Wall
|
||||
#tile.engineersdecor.clinker_brick_wall.help=§6Simplistic Clinker Brick Wall.
|
||||
tile.engineersdecor.slag_brick_wall.name=Slag Brick Wall
|
||||
#tile.engineersdecor.slag_brick_wall.help=§6Simplistic Slag Brick Wall.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.metal_rung_ladder.name=金属环梯
|
||||
tile.engineersdecor.metal_rung_ladder.help=§6典型的工业墙梯,包括水平金属杆横档.
|
||||
tile.engineersdecor.metal_rung_steps.name=交错的金属台阶
|
||||
tile.engineersdecor.metal_rung_steps.help=§6贴在墙上的交错的杆横档,允许爬上,爬下等等.
|
||||
tile.engineersdecor.treated_wood_ladder.name=经过处理的木梯
|
||||
tile.engineersdecor.treated_wood_ladder.help=§6防风雨的木梯.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.clinker_brick_stairs.name=熟料砖楼梯
|
||||
tile.engineersdecor.clinker_brick_stairs.help=§6看起来比原版砖块稍暗,颜色更浓.
|
||||
tile.engineersdecor.clinker_brick_stained_stairs.name=Stained Clinker Brick Stairs
|
||||
#tile.engineersdecor.clinker_brick_stained_stairs.help=§6Looks slightly darker and more color intensive than the vanilla brick block. Has more visible traces of grime or stain.
|
||||
tile.engineersdecor.slag_brick_stairs.name=炉渣砖楼梯
|
||||
tile.engineersdecor.slag_brick_stairs.help=§6灰褐色砖块楼梯.
|
||||
tile.engineersdecor.rebar_concrete_stairs.name=钢筋混凝土楼梯
|
||||
tile.engineersdecor.rebar_concrete_stairs.help=§6钢筋混凝土楼梯.§r 昂贵,但像黑曜石一样防苦力怕.
|
||||
tile.engineersdecor.rebar_concrete_tile_stairs.name=Rebar Concrete Tile Stairs
|
||||
#tile.engineersdecor.rebar_concrete_tile_stairs.help=§6Steel reinforced concrete tile stairs.§r Expensive but Creeper-proof like obsidian.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.treated_wood_pole.name=直立处理木杆
|
||||
tile.engineersdecor.treated_wood_pole.help=§6具有导线继电器直径的直极片段.§r\n如果需要特殊的特殊长度,或作为结构的支撑,可以作为线柱的替代品.
|
||||
tile.engineersdecor.treated_wood_pole_head.name=Straight Treated Wood Pole Head/Foot
|
||||
#tile.engineersdecor.treated_wood_pole_head.help=§6Wooden part fitting as foot or head of straight poles.
|
||||
tile.engineersdecor.treated_wood_pole_support.name=Straight Treated Wood Pole Support
|
||||
#tile.engineersdecor.treated_wood_pole_support.help=§6Heavy duty wooden support part fitting as foot or head of straight poles.
|
||||
tile.engineersdecor.thick_steel_pole.name=Straight Thick Steel Pole
|
||||
#tile.engineersdecor.thick_steel_pole.help=§6Straight hollow pole fragment (6x6x16) for structural support purposes.
|
||||
tile.engineersdecor.thin_steel_pole.name=Straight Thin Steel Pole
|
||||
#tile.engineersdecor.thin_steel_pole.help=§6Straight hollow pole fragment (4x4x16) for structural support purposes.
|
||||
tile.engineersdecor.thin_steel_pole_head.name=Straight Thin Steel Pole head/foot
|
||||
#tile.engineersdecor.thin_steel_pole_head.help=§6Steel part fitting as foot or head of the thin steel pole (4x4x16).
|
||||
tile.engineersdecor.thick_steel_pole_head.name=Straight Thick Steel Pole Head/Foot
|
||||
#tile.engineersdecor.thick_steel_pole_head.help=§6Steel part fitting as foot or head of the thick steel pole (6x6x16).
|
||||
tile.engineersdecor.steel_double_t_support.name=Steel Double T Support
|
||||
#tile.engineersdecor.steel_double_t_support.help=§6Horizontal ceiling support bream fragment.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.treated_wood_table.name=经过处理的木桌
|
||||
tile.engineersdecor.treated_wood_table.help=§6坚固的四足木桌.
|
||||
tile.engineersdecor.treated_wood_stool.name=Treated Wood Stool
|
||||
#tile.engineersdecor.treated_wood_stool.help=§6Robust Wood Stool.§r Indoor and outdoor use.
|
||||
tile.engineersdecor.treated_wood_crafting_table.name=Treated Wood Crafting Table
|
||||
#tile.engineersdecor.treated_wood_crafting_table.help=§6Robust and weather-proof.§r Eight storage slots, keeps inventory, no vanilla recipe book.\n\
|
||||
Click up/down arrow buttons for crafting history selection, output slot for item placement, X-button \
|
||||
to clear crafting grid and history. Shift-click stack: player-to-storage stack transfer when crafting \
|
||||
grid empty, otherwise player-to-grid stack transfer. Automatically distributes the clicked stack.
|
||||
tile.engineersdecor.iron_inset_light.name=Inset Light
|
||||
#tile.engineersdecor.iron_inset_light.help=§6Small glowstone light source, sunk into the floor, ceiling or wall.§r\n\
|
||||
Useful to light up places where electrical light installations are problematic.\
|
||||
Light level like a torch.
|
||||
tile.engineersdecor.treated_wood_window.name=Treated Wood Window
|
||||
#tile.engineersdecor.treated_wood_window.help=§6Wood framed triple glazed window. Well insulating.§r Does not connect to adjacent blocks like glass panes.
|
||||
tile.engineersdecor.treated_wood_windowsill.name=Treated Wood Window Sill
|
||||
#tile.engineersdecor.treated_wood_windowsill.help=§6Simple window decoration.
|
||||
tile.engineersdecor.steel_framed_window.name=Steel Framed Window
|
||||
#tile.engineersdecor.steel_framed_window.help=§6Steel framed triple glazed window. Well insulating. §r Does not connect to adjacent blocks like glass panes.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.small_lab_furnace.name=Small Laboratory Furnace
|
||||
#tile.engineersdecor.small_lab_furnace.help=§6Small metal cased lab kiln.§r Solid fuel consuming, updraught. \
|
||||
Slightly hotter and better isolated than a cobblestone furnace, therefore more efficient. \
|
||||
Two auxiliary slots e.g. for storage. Two stack internal hopper fifos for input, output, \
|
||||
and fuel. Place an external heater into a aux slot and connect power for electrical \
|
||||
smelting speed boost.
|
||||
tile.engineersdecor.small_electrical_furnace.name=Small Electrical Furnace
|
||||
#tile.engineersdecor.small_electrical_furnace.help=§6Small metal cased pass-through furnace.§r \
|
||||
Automatically draws items from the input side and puts items into the inventory at the output side. \
|
||||
Items can be inserted or drawn from all sides using hoppers. Implicitly bypasses items that cannot be \
|
||||
smelted or cooked to the output. Slightly more energy efficient and faster than a heated cobblestone \
|
||||
furnace. Fifos and feeders transfer whole stacks. Feeders require a bit of power.
|
||||
tile.engineersdecor.small_waste_incinerator.name=Small Waste Incinerator
|
||||
#tile.engineersdecor.small_waste_incinerator.help=§6Trash with internal fifo slots.§r Items can be inserted on all sides, and are kept until \
|
||||
there is no space left in the fifo. After that the oldest stack will be incinerated. Apply \
|
||||
electrical RF/FE power to increase the processing speed. Keeps its inventory when being \
|
||||
relocated.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.straight_pipe_valve.name=Fluid Pipe Check Valve
|
||||
#tile.engineersdecor.straight_pipe_valve.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \
|
||||
Does not connect to the sides. Reduces flow rate. Sneak to place in reverse direction.
|
||||
tile.engineersdecor.straight_pipe_valve_redstone.name=Redstone Controlled Fluid Valve
|
||||
#tile.engineersdecor.straight_pipe_valve_redstone.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \
|
||||
Does not connect to the sides. Sneak to place in reverse direction. \
|
||||
Blocks if not redstone powered.
|
||||
tile.engineersdecor.straight_pipe_valve_redstone_analog.name=Redstone Analog Fluid Valve
|
||||
#tile.engineersdecor.straight_pipe_valve_redstone_analog.help=§6Straight fluid pipe fragment.§r Conducts fluids only in one direction. \
|
||||
Does not connect to the sides. Sneak to place in reverse direction. \
|
||||
Blocks if not redstone powered, reduces the flow rate linear from power 1 to 14, \
|
||||
opens to maximum possible valve flow rate for power 15.
|
||||
tile.engineersdecor.passive_fluid_accumulator.name=Passive Fluid Accumulator
|
||||
#tile.engineersdecor.passive_fluid_accumulator.help=§6Vacuum suction based fluid collector.§r Has one output, all other sides are input. \
|
||||
Drains fluids from adjacent tanks when being drained from the output port by a pump.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.factory_dropper.name=Factory Dropper
|
||||
#tile.engineersdecor.factory_dropper.help=§6Dropper suitable for advanced factory automation.§r Has twelve round-robin selected slots. \
|
||||
Drop force, angle, stack size, and cool-down delay adjustable in the GUI. Three stack compare \
|
||||
slots with logical AND or OR can be used as internal trigger source. Internal trigger can be \
|
||||
AND'ed or OR'ed with the external redstone signal trigger. Trigger simulation buttons for testing. \
|
||||
Pre-opens shutter door when internal trigger conditions are met. Drops all matching stacks \
|
||||
simultaneously. Click on all elements in the GUI to see how it works.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.sign_decor.name=Sign Plate (Engineer's decor)
|
||||
#tile.engineersdecor.sign_decor.help=§6This should not be craftable or visible in JEI. Used for creative tab and screenshots.
|
||||
tile.engineersdecor.sign_hotwire.name=Sign "Caution Hot Wire"
|
||||
#tile.engineersdecor.sign_hotwire.help=§6Electrical hazard warning. Don't forget to place around HV, or you'll have a mark in the next audit.
|
||||
tile.engineersdecor.sign_mindstep.name=Sign "Mind The Step"
|
||||
#tile.engineersdecor.sign_mindstep.help=§6Placable on walls (horizontally).
|
||||
tile.engineersdecor.sign_danger.name=Sign "Caution Really Dangerous There"
|
||||
#tile.engineersdecor.sign_danger.help=§6General danger warning.
|
||||
tile.engineersdecor.sign_defense.name=Sign "Caution Defense System Ahead"
|
||||
#tile.engineersdecor.sign_defense.help=§6Warning sign for turrets, Tesla Coils, and traps.
|
||||
tile.engineersdecor.sign_factoryarea.name=Sign "Factory Area"
|
||||
#tile.engineersdecor.sign_factoryarea.help=§6Marker sign for buildings or areas where the really big machines are.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
tile.engineersdecor.halfslab_rebar_concrete.name=Rebar Concrete Slice
|
||||
#tile.engineersdecor.halfslab_rebar_concrete.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_concrete.name=Concrete Slice
|
||||
#tile.engineersdecor.halfslab_concrete.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_treated_wood.name=Treated Wood Slice
|
||||
#tile.engineersdecor.halfslab_treated_wood.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_sheetmetal_iron.name=Iron Sheet Metal Slice
|
||||
#tile.engineersdecor.halfslab_sheetmetal_iron.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_sheetmetal_steel.name=Steel Sheet Metal Slice
|
||||
#tile.engineersdecor.halfslab_sheetmetal_steel.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_sheetmetal_copper.name=Copper Sheet Metal Slice
|
||||
#tile.engineersdecor.halfslab_sheetmetal_copper.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_sheetmetal_gold.name=Gold Sheet Metal Slice
|
||||
#tile.engineersdecor.halfslab_sheetmetal_gold.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
tile.engineersdecor.halfslab_sheetmetal_aluminum.name=Aluminum Sheet Metal Slice
|
||||
#tile.engineersdecor.halfslab_sheetmetal_aluminum.help=§6Vertically stackable slice.§r Right/left click with the slice stack on the top or bottom surface to add/remove slices.
|
||||
#-----------------------------------------------------------------------------------------------------------
|
||||
# EOF
|
||||
#-----------------------------------------------------------------------------------------------------------
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
350
1.12/tasks.js
350
1.12/tasks.js
|
@ -1,349 +1,25 @@
|
|||
#!/usr/bin/djs
|
||||
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
|
||||
"use strict";
|
||||
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod source directory.");
|
||||
if(!fs.isdir("../.git")) throw new Error("Missing git repository in parent directory of mod source.");
|
||||
|
||||
const constants = include("../meta/lib/constants.js")();
|
||||
const libtask = include("../meta/lib/libtask.js")(constants);
|
||||
const liblang = include("../meta/lib/liblang.1.12.js")(constants);
|
||||
const liblang13 = include("../meta/lib/liblang.1.13.js")(constants);
|
||||
const liblang14 = include("../meta/lib/liblang.1.13.js")(constants);
|
||||
var tasks = {};
|
||||
|
||||
tasks["dist-check"] = function() {
|
||||
const uncommitted_changes = sys.shell("git status -s").trim();
|
||||
const gittags = sys.shell('git log -1 --format="%D"')
|
||||
.replace(/[\s]/g,"").split(",")
|
||||
.filter(function(s){ return s.indexOf("tag:")==0;})
|
||||
.map(function(s){ return s.replace(/^tag:/,"");});
|
||||
const version_engineersdecor = fs.readfile("gradle.properties", function(line){
|
||||
if(line.trim().indexOf("version_engineersdecor")!=0) return false;
|
||||
return line.replace(/^.*?=/,"").trim()
|
||||
}).trim();
|
||||
const git_remote = sys.shell("git remote -v").trim();
|
||||
const git_branch = sys.shell("git rev-parse --abbrev-ref HEAD").trim();
|
||||
const git_diff = sys.shell("git diff .").trim();
|
||||
var fails = [];
|
||||
if(version_engineersdecor=="") fails.push("Could not determine 'version_engineersdecor' from gradle properties.");
|
||||
if(!gittags.length) fails.push("Version not tagged.");
|
||||
if(!gittags.filter(function(s){return s.indexOf(version_engineersdecor.replace(/[-]/g,""))>=0}).length) fails.push("No tag version not found matching the gradle properties version.");
|
||||
if(git_remote.replace(/[\s]/g,"").indexOf("git@github.com:stfwi/engineers-decor.git(push)") < 0) fails.push("Not the reference repository.");
|
||||
if((git_branch != "develop") && (git_branch != "master")) {
|
||||
fails.push("No valid branch for dist. (branch:'"+git_branch+"')");
|
||||
} else if((git_branch == "develop") && (version_engineersdecor.replace(/[^ab]/g,"")=="")) {
|
||||
fails.push("Cannot make release dist on develop branch.");
|
||||
} else if((git_branch == "master") && (version_engineersdecor.replace(/[^ab]/g,"")!="")) {
|
||||
fails.push("Cannot make beta dist on master branch.");
|
||||
}
|
||||
if(git_diff !== "") fails.push("Not everything committed to the GIT repository.");
|
||||
if((!fs.isfile("signing.jks")) || (!fs.isfile("signing.properties"))) fails.push("Jar signing files missing.");
|
||||
if(fails.length>0) {
|
||||
for(var i in fails) fails[i] = " - " + fails[i];
|
||||
alert("Dist check failed");
|
||||
alert(fails.join("\n")+"\n");
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
tasks["sync-languages"] = function() {
|
||||
function load() {
|
||||
var lang_data = {};
|
||||
fs.find("./src/main/resources/assets/engineersdecor/lang", '*.lang', function(f){
|
||||
var lang_code = fs.basename(f).replace(/\..*$/,"").trim().toLowerCase();
|
||||
var lines = fs.readfile(f).trim().split("\n");
|
||||
var was_eol_escape = false;
|
||||
for(var i in lines) {
|
||||
if(was_eol_escape) {
|
||||
var k=0;
|
||||
for(k=i-1; k>=0; --k) {
|
||||
if(lines[k] != null) {
|
||||
lines[k] += "\n" + lines[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
was_eol_escape = lines[i].match(/[^\\][\\]$/) != null;
|
||||
lines[i] = null;
|
||||
} else {
|
||||
lines[i] = lines[i].trim();
|
||||
was_eol_escape = lines[i].match(/[^\\][\\]$/) != null;
|
||||
}
|
||||
}
|
||||
lang_data[lang_code] = lines.filter(function(l){return (l!==null);});
|
||||
return false;
|
||||
});
|
||||
return lang_data;
|
||||
}
|
||||
function reference_content(lang_data, reflang_code) {
|
||||
var lang_lines = [];
|
||||
for(var i in lang_data[reflang_code]) {
|
||||
var txt = lang_data[reflang_code][i].trim();
|
||||
if((txt.search(/^#/)>=0) || (txt.search("=")<0)) { lang_lines.push(txt); continue; }; // comment "#" or empty line in the ref lang file
|
||||
var kv = txt.split("=", 2);
|
||||
var key = kv[0].trim();
|
||||
var val = kv[1].trim();
|
||||
var o = {key:key, tr:{}};
|
||||
o.tr[reflang_code] = val;
|
||||
lang_lines.push(o);
|
||||
}
|
||||
delete lang_data[reflang_code];
|
||||
return lang_lines;
|
||||
}
|
||||
function add_language(lang_lines, lang_name, lang_data) {
|
||||
const find_line = function(lines, key) {
|
||||
for(var i in lines) {
|
||||
if((typeof(lines[i]) !== "object")) continue;
|
||||
if(lines[i].key.toLowerCase()==key.toLowerCase()) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
for(var i in lang_data) {
|
||||
var txt = lang_data[i].trim();
|
||||
if(txt.search(/^#/)>=0) continue;
|
||||
if(txt.search("=")<0) continue;
|
||||
var kv = txt.split("=", 2);
|
||||
var key = kv[0].trim();
|
||||
var val = kv[1].trim();
|
||||
var line_i = find_line(lang_lines, key);
|
||||
if(line_i >= 0) {
|
||||
lang_data[i] = undefined;
|
||||
lang_lines[line_i].tr[lang_name] = val;
|
||||
}
|
||||
}
|
||||
return lang_data;
|
||||
}
|
||||
|
||||
function complete_lang_lines(lang_lines, lang_names, reflang_code) {
|
||||
var lang_outputs = {};
|
||||
for(var i in lang_names) lang_outputs[lang_names[i]] = [];
|
||||
for(var i_line in lang_lines) {
|
||||
var entry = lang_lines[i_line];
|
||||
if(typeof(entry) !== "object") {
|
||||
for(var i in lang_names) lang_outputs[lang_names[i]].push(entry);
|
||||
} else {
|
||||
for(var i in lang_names) {
|
||||
var name = lang_names[i];
|
||||
if(entry.tr[name] !== undefined) {
|
||||
lang_outputs[name].push(entry.key + "=" + entry.tr[name]);
|
||||
} else {
|
||||
var added = entry.key + "=" + entry.tr[reflang_code];
|
||||
if((entry.key.search(/\.tip$/)>0) || (entry.key.search(/\.help$/)>0)) added = "#" + added;
|
||||
lang_outputs[name].push(added);
|
||||
if(added.search(/^#/)<0) print("[warn] Lang: Added default language for missing entry in " + name + ": '" + added + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lang_outputs;
|
||||
}
|
||||
|
||||
const reflang_code = "en_us";
|
||||
var lang_data = load();
|
||||
var lang_names = Object.keys(lang_data);
|
||||
var lang_lines = reference_content(lang_data, reflang_code);
|
||||
for(var lang_name in lang_data) {
|
||||
lang_data[lang_name] = add_language(lang_lines, lang_name, lang_data[lang_name]);
|
||||
lang_data[lang_name] = lang_data[lang_name].filter(function(l){ return !!l; });
|
||||
if(lang_data[lang_name].length == 0) delete lang_data[lang_name];
|
||||
}
|
||||
var output_data = complete_lang_lines(lang_lines, lang_names, reflang_code);
|
||||
for(var i in output_data) output_data[i] = output_data[i].join("\n") + "\n\n";
|
||||
|
||||
// Remaining lines in lang files (not in the reference lang file)
|
||||
for(var lang_name in lang_data) {
|
||||
for(var i in lang_data[lang_name]) {
|
||||
if(lang_data[lang_name][i].search(/^#/)<0) {
|
||||
var added = "# " + lang_data[lang_name][i].replace(/^[#\s]+/,"");
|
||||
output_data[lang_name] += added + "\n";
|
||||
print("[warn] Lang: Commented out unknown key in " + lang_name + ": '" + added + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var name in output_data) output_data[name] = output_data[name].trim() + "\n";
|
||||
|
||||
for(var name in output_data) {
|
||||
fs.writefile("./src/main/resources/assets/engineersdecor/lang/" + name + ".lang", output_data[name]);
|
||||
}
|
||||
liblang.sync_languages();
|
||||
};
|
||||
|
||||
tasks["tabs-to-spaces"] = function() {
|
||||
var file_list = (function() {
|
||||
var ls = [];
|
||||
const ext = ['java','lang'];
|
||||
for(var i in ext) ls = ls.concat(fs.find("./src", '*.'+ext[i]));
|
||||
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
|
||||
ls.sort();
|
||||
ls.push("readme.md");
|
||||
return ls;
|
||||
})();
|
||||
for(var file_i in file_list) {
|
||||
var file = file_list[file_i];
|
||||
var txt = fs.readfile(file);
|
||||
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
|
||||
const txt_length = txt.length;
|
||||
txt = txt.replace(/[\t]/g," ");
|
||||
const n = txt.length - txt_length;
|
||||
if(n > 0) {
|
||||
print("File '" + file + "': Changed " + n + " tabs to 2 spaces." );
|
||||
fs.writefile(file, txt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tasks["trailing-whitespaces"] = function() {
|
||||
var file_list = (function() {
|
||||
var ls = [];
|
||||
const ext = ['java','json','lang'];
|
||||
for(var i in ext) ls = ls.concat(fs.find("./src", '*.'+ext[i]));
|
||||
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
|
||||
ls.sort();
|
||||
ls.push("readme.md");
|
||||
return ls;
|
||||
})();
|
||||
for(var file_i in file_list) {
|
||||
var file = file_list[file_i];
|
||||
var txt = fs.readfile(file);
|
||||
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
|
||||
const txt_length = txt.length;
|
||||
txt = txt.replace(/[\r\t ]+[\n]/g,"\n");
|
||||
const n = txt_length - txt.length;
|
||||
if(n > 0) {
|
||||
print("File '" + file + "': Fixed " + n + " lines with trailing whitespaces." );
|
||||
fs.writefile(file, txt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tasks["version-check"] = function() {
|
||||
var version_minecraft="";
|
||||
var version_forge="";
|
||||
var version_engineersdecor="";
|
||||
fs.readfile("gradle.properties", function(line){
|
||||
if(line.search(/^[\s]*version_minecraft[\s]*=/i) >= 0) {
|
||||
version_minecraft = line.replace(/^[^=]+=/,"").trim();
|
||||
} else if(line.search(/^[\s]*version_forge[\s]*=/i) >= 0) {
|
||||
version_forge = line.replace(/^[^=]+=/,"").trim();
|
||||
} else if(line.search(/^[\s]*version_engineersdecor[\s]*=/i) >= 0) {
|
||||
version_engineersdecor = line.replace(/^[^=]+=/,"").trim();
|
||||
}
|
||||
tasks["port-languages"] = function() {
|
||||
fs.find("src/main/resources/assets/"+ constants.mod_registry_name() +"/lang", '*.lang', function(path){
|
||||
const unified = liblang.load(path);
|
||||
path = path.replace(/\.lang$/,"");
|
||||
liblang13.save("../1.13/"+path+".json", unified);
|
||||
liblang14.save("../1.14/"+path+".json", unified);
|
||||
return false;
|
||||
})
|
||||
const combined_version = version_minecraft + "-" + version_engineersdecor;
|
||||
var readme_version_found = fs.readfile("readme.md", function(line){
|
||||
var m = line.match(/^[\s]+[-~][\s]+v([\d]+[\.][\d]+[\.][\d]+[-][abrc][\d]+)/i);
|
||||
if((!m) || (!m.length) || (m.length < 2)) {
|
||||
m = line.match(/^[\s]+[-~][\s]+v([\d]+[\.][\d]+[\.][\d]+)/i);
|
||||
if((!m) || (!m.length) || (m.length < 2)) return false;
|
||||
}
|
||||
return m[1]==version_engineersdecor;
|
||||
});
|
||||
var ok=true;
|
||||
if(!readme_version_found) {
|
||||
alert("Version 'v" + version_engineersdecor + "' not found in the readme changelog.");
|
||||
ok = false;
|
||||
}
|
||||
if(!ok) {
|
||||
alert("Version data:");
|
||||
alert(" - combined_version : '" + combined_version + "'");
|
||||
alert(" - version_forge : '" + version_forge + "'");
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
tasks["dist"] = function() {
|
||||
function readme_history(file_path) {
|
||||
var readme = fs.readfile(file_path);
|
||||
if(!readme) throw new Error("Failed to load readme.md");
|
||||
readme = readme.split(/[\r]?[\n]/);
|
||||
while((readme.length > 0) && readme[0].search(/^## Revision history/i)<0) readme.shift();
|
||||
while((readme.length > 0) && readme[0].trim()=="") readme.shift();
|
||||
// revision history section
|
||||
if(!readme.length) throw new Error("Revision history section not found in readme");
|
||||
readme.shift();
|
||||
var end_of_history = readme.length;
|
||||
for(var i=0; i<readme.length; ++i) if(readme[i].search(/^---/) >= 0) { end_of_history=i; break; }
|
||||
if(end_of_history >= readme.length) throw new Error("Could not find the end-of-history header marker.");
|
||||
// remove empty lines, splitters
|
||||
while(readme.length >= end_of_history) readme.pop();
|
||||
while((readme.length >0) && (readme[readme.length-1].replace(/[\s-]/g,"")=="")) readme.pop();
|
||||
|
||||
const min_indent = readme
|
||||
.map(function(s){return s.search(/[^\s]/)})
|
||||
.filter(function(e){return e>=0})
|
||||
.reduce(function(acc,e){return (e<acc)?e:acc});
|
||||
|
||||
if(min_indent > 1) {
|
||||
for(var i in readme) { readme[i] = readme[i].substr(min_indent-2); }
|
||||
}
|
||||
return readme.join("\n");
|
||||
}
|
||||
const html = "<pre>\n" + (readme_history("readme.md").replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<")) + "\n</pre>";
|
||||
fs.writefile("dist/revision-history.html", html);
|
||||
};
|
||||
|
||||
tasks["update-json"] = function() {
|
||||
const root_dir = fs.cwd();
|
||||
function read_history() {
|
||||
var readme = fs.readfile(root_dir + "/readme.md");
|
||||
if(!readme) throw new Error("Failed to load readme.md");
|
||||
readme = readme.split(/[\r]?[\n]/);
|
||||
while((readme.length > 0) && readme[0].search(/^## Revision history/i)<0) readme.shift();
|
||||
// revision history section
|
||||
if(!readme.length) throw new Error("Revision history section not found in readme");
|
||||
readme.shift();
|
||||
var end_of_history = readme.length;
|
||||
for(var i=0; i<readme.length; ++i) if(readme[i].search(/^---/) >= 0) { end_of_history=i; break; }
|
||||
if(end_of_history >= readme.length) throw new Error("Could not find the end-of-history header marker.");
|
||||
// remove empty lines, splitters
|
||||
while(readme.length >= end_of_history) readme.pop();
|
||||
for(var i in readme) readme[i] = readme[i].replace(/[\s]+$/g,"").replace(/[\t]/g," ");
|
||||
readme = readme.filter(function(a){return a.replace(/[\s-]+/g,"")!="";});
|
||||
// condense multilines to single line entries for each fix or feature. ([A] ... [M] ...)
|
||||
for(var i=readme.length-1; i>0; --i) {
|
||||
var line = readme[i].replace(/^\s+/,"");
|
||||
if(line.search(/^[\[\-]/) < 0) {
|
||||
readme[i-1] += " " + line;
|
||||
readme[i] = "";
|
||||
}
|
||||
}
|
||||
readme = readme.filter(function(a){return a!="";});
|
||||
// Condense log entries sepatated with newlines to one line for each version
|
||||
for(var i=readme.length-1; i>0; --i) {
|
||||
var line = readme[i].replace(/^\s+/,"");
|
||||
if(line.search(/^[-~]/) < 0) {
|
||||
readme[i-1] += "\n" + line;
|
||||
readme[i] = "";
|
||||
}
|
||||
}
|
||||
readme = readme.filter(function(a){return a!="";});
|
||||
// Separate versions.
|
||||
var history = {};
|
||||
for(var i in readme) {
|
||||
var line = readme[i].replace(/^[\sv-]+/g,"").trim();
|
||||
var ver = line.substr(0, line.search(" ")).trim().toLowerCase();
|
||||
var txt = line.substr(line.search(" ")).trim();
|
||||
if(ver.search("~")===0) continue;
|
||||
if(history[ver] !== undefined) throw new Error("Double definition of version '" + ver + "' in the readme revision history.");
|
||||
history[ver] = txt;
|
||||
}
|
||||
return history;
|
||||
}
|
||||
var history = read_history();
|
||||
var latest_release = "";
|
||||
var latest_beta = "";
|
||||
for(var ver in history) { latest_beta=ver; break; }
|
||||
for(var ver in history) if(ver.search(/(rc|b|a)/) < 0) { latest_release=ver; break; }
|
||||
var update_json = {
|
||||
homepage: "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.12.2": history,
|
||||
promos: {
|
||||
"1.12.2-recommended": latest_release,
|
||||
"1.12.2-latest": latest_beta,
|
||||
}
|
||||
}
|
||||
fs.mkdir(root_dir + "/meta");
|
||||
fs.writefile(root_dir + "/meta/update.json", JSON.stringify(update_json, null, 2));
|
||||
};
|
||||
|
||||
const task_name = sys.args[0];
|
||||
if((task_name===undefined) || (tasks[task_name])===undefined) {
|
||||
alert("No task ", task_name);
|
||||
exit(1);
|
||||
} else {
|
||||
tasks[task_name]();
|
||||
}
|
||||
libtask.run(tasks, sys.args);
|
||||
|
|
|
@ -8,9 +8,10 @@ Mod sources for Minecraft version 1.13.2.
|
|||
- Compiled mod distribution channel is curseforge: https://www.curseforge.com/minecraft/mc-mods/engineers-decor/files.
|
||||
|
||||
----
|
||||
## Revision history
|
||||
## Version history
|
||||
|
||||
~ v1.0.7-b5 [A]
|
||||
~ v1.0.7-b5 [A] Added translation zh_cn (PR#33, XuyuEre)
|
||||
[M] Updated textures.
|
||||
|
||||
- v1.0.7-b4 [A] Added stained clinker brick block/stairs.
|
||||
|
||||
|
|
230
1.13/tasks.js
230
1.13/tasks.js
|
@ -1,233 +1,13 @@
|
|||
#!/usr/bin/djs
|
||||
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
|
||||
"use strict";
|
||||
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod source directory.");
|
||||
if(!fs.isdir("../.git")) throw new Error("Missing git repository in parent directory of mod source.");
|
||||
|
||||
const constants = include("../meta/lib/constants.js")();
|
||||
const libtask = include("../meta/lib/libtask.js")(constants);
|
||||
const liblang = include("../meta/lib/liblang.1.13.js")(constants);
|
||||
var tasks = {};
|
||||
|
||||
tasks["dist-check"] = function() {
|
||||
const uncommitted_changes = sys.shell("git status -s").trim();
|
||||
const gittags = sys.shell('git log -1 --format="%D"')
|
||||
.replace(/[\s]/g,"").split(",")
|
||||
.filter(function(s){ return s.indexOf("tag:")==0;})
|
||||
.map(function(s){ return s.replace(/^tag:/,"");});
|
||||
const version_engineersdecor = fs.readfile("gradle.properties", function(line){
|
||||
if(line.trim().indexOf("version_engineersdecor")!=0) return false;
|
||||
return line.replace(/^.*?=/,"").trim()
|
||||
}).trim();
|
||||
const git_remote = sys.shell("git remote -v").trim();
|
||||
const git_branch = sys.shell("git rev-parse --abbrev-ref HEAD").trim();
|
||||
const git_diff = sys.shell("git diff").trim();
|
||||
var fails = [];
|
||||
if(version_engineersdecor=="") fails.push("Could not determine 'version_engineersdecor' from gradle properties.");
|
||||
if(!gittags.length) fails.push("Version not tagged.");
|
||||
if(!gittags.filter(function(s){return s.indexOf(version_engineersdecor.replace(/[-]/g,""))>=0}).length) fails.push("No tag version not found matching the gradle properties version.");
|
||||
if(git_remote.replace(/[\s]/g,"").indexOf("git@github.com:stfwi/engineers-decor.git(push)") < 0) fails.push("Not the reference repository.");
|
||||
if((git_branch != "develop") && (git_branch != "master")) {
|
||||
fails.push("No valid branch for dist. (branch:'"+git_branch+"')");
|
||||
} else if((git_branch == "develop") && (version_engineersdecor.replace(/[^ab]/g,"")=="")) {
|
||||
fails.push("Cannot make release dist on develop branch.");
|
||||
} else if((git_branch == "master") && (version_engineersdecor.replace(/[^ab]/g,"")!="")) {
|
||||
fails.push("Cannot make beta dist on master branch.");
|
||||
}
|
||||
if(git_diff !== "") fails.push("Not everything committed to the GIT repository.");
|
||||
if((!fs.isfile("signing.jks")) || (!fs.isfile("signing.properties"))) fails.push("Jar signing files missing.");
|
||||
if(fails.length>0) {
|
||||
for(var i in fails) fails[i] = " - " + fails[i];
|
||||
alert("Dist check failed");
|
||||
alert(fails.join("\n")+"\n");
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
tasks["sync-languages"] = function() {
|
||||
// @todo: has become easier but needs impl.
|
||||
liblang.sync_languages();
|
||||
};
|
||||
|
||||
tasks["tabs-to-spaces"] = function() {
|
||||
var file_list = (function() {
|
||||
var ls = [];
|
||||
const ext = ['java'];
|
||||
for(var i in ext) ls = ls.concat(fs.find("./src", '*.'+ext[i]));
|
||||
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
|
||||
ls.sort();
|
||||
ls.push("readme.md");
|
||||
return ls;
|
||||
})();
|
||||
for(var file_i in file_list) {
|
||||
var file = file_list[file_i];
|
||||
var txt = fs.readfile(file);
|
||||
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
|
||||
const txt_length = txt.length;
|
||||
txt = txt.replace(/[\t]/g," ");
|
||||
const n = txt.length - txt_length;
|
||||
if(n > 0) {
|
||||
print("File '" + file + "': Changed " + n + " tabs to 2 spaces." );
|
||||
fs.writefile(file, txt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tasks["trailing-whitespaces"] = function() {
|
||||
var file_list = (function() {
|
||||
var ls = [];
|
||||
const ext = ['java','json','lang'];
|
||||
for(var i in ext) ls = ls.concat(fs.find("./src", '*.'+ext[i]));
|
||||
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
|
||||
ls.sort();
|
||||
ls.push("readme.md");
|
||||
return ls;
|
||||
})();
|
||||
for(var file_i in file_list) {
|
||||
var file = file_list[file_i];
|
||||
var txt = fs.readfile(file);
|
||||
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
|
||||
const txt_length = txt.length;
|
||||
txt = txt.replace(/[\r\t ]+[\n]/g,"\n");
|
||||
const n = txt_length - txt.length;
|
||||
if(n > 0) {
|
||||
print("File '" + file + "': Fixed " + n + " lines with trailing whitespaces." );
|
||||
fs.writefile(file, txt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tasks["version-check"] = function() {
|
||||
var version_minecraft="";
|
||||
var version_forge="";
|
||||
var version_engineersdecor="";
|
||||
fs.readfile("gradle.properties", function(line){
|
||||
if(line.search(/^[\s]*version_minecraft[\s]*=/i) >= 0) {
|
||||
version_minecraft = line.replace(/^[^=]+=/,"").trim();
|
||||
} else if(line.search(/^[\s]*version_forge[\s]*=/i) >= 0) {
|
||||
version_forge = line.replace(/^[^=]+=/,"").trim();
|
||||
} else if(line.search(/^[\s]*version_engineersdecor[\s]*=/i) >= 0) {
|
||||
version_engineersdecor = line.replace(/^[^=]+=/,"").trim();
|
||||
}
|
||||
return false;
|
||||
})
|
||||
const combined_version = version_minecraft + "-" + version_engineersdecor;
|
||||
var readme_version_found = fs.readfile("readme.md", function(line){
|
||||
var m = line.match(/^[\s]+[-~][\s]+v([\d]+[\.][\d]+[\.][\d]+[-][abrc][\d]+)/i);
|
||||
if((!m) || (!m.length) || (m.length < 2)) {
|
||||
m = line.match(/^[\s]+[-~][\s]+v([\d]+[\.][\d]+[\.][\d]+)/i);
|
||||
if((!m) || (!m.length) || (m.length < 2)) return false;
|
||||
}
|
||||
return m[1]==version_engineersdecor;
|
||||
});
|
||||
var ok=true;
|
||||
if(!readme_version_found) {
|
||||
alert("Version 'v" + version_engineersdecor + "' not found in the readme changelog.");
|
||||
ok = false;
|
||||
}
|
||||
if(!ok) {
|
||||
alert("Version data:");
|
||||
alert(" - combined_version : '" + combined_version + "'");
|
||||
alert(" - version_forge : '" + version_forge + "'");
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
tasks["dist"] = function() {
|
||||
function readme_history(file_path) {
|
||||
var readme = fs.readfile(file_path);
|
||||
if(!readme) throw new Error("Failed to load readme.md");
|
||||
readme = readme.split(/[\r]?[\n]/);
|
||||
while((readme.length > 0) && readme[0].search(/^## Revision history/i)<0) readme.shift();
|
||||
while((readme.length > 0) && readme[0].trim()=="") readme.shift();
|
||||
// revision history section
|
||||
if(!readme.length) throw new Error("Revision history section not found in readme");
|
||||
readme.shift();
|
||||
var end_of_history = readme.length;
|
||||
for(var i=0; i<readme.length; ++i) if(readme[i].search(/^---/) >= 0) { end_of_history=i; break; }
|
||||
if(end_of_history >= readme.length) throw new Error("Could not find the end-of-history header marker.");
|
||||
// remove empty lines, splitters
|
||||
while(readme.length >= end_of_history) readme.pop();
|
||||
while((readme.length >0) && (readme[readme.length-1].replace(/[\s-]/g,"")=="")) readme.pop();
|
||||
|
||||
const min_indent = readme
|
||||
.map(function(s){return s.search(/[^\s]/)})
|
||||
.filter(function(e){return e>=0})
|
||||
.reduce(function(acc,e){return (e<acc)?e:acc});
|
||||
|
||||
if(min_indent > 1) {
|
||||
for(var i in readme) { readme[i] = readme[i].substr(min_indent-2); }
|
||||
}
|
||||
return readme.join("\n");
|
||||
}
|
||||
const html = "<pre>\n" + (readme_history("readme.md").replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<")) + "\n</pre>";
|
||||
fs.writefile("dist/revision-history.html", html);
|
||||
};
|
||||
|
||||
tasks["update-json"] = function() {
|
||||
const root_dir = fs.cwd();
|
||||
function read_history() {
|
||||
var readme = fs.readfile(root_dir + "/readme.md");
|
||||
if(!readme) throw new Error("Failed to load readme.md");
|
||||
readme = readme.split(/[\r]?[\n]/);
|
||||
while((readme.length > 0) && readme[0].search(/^## Revision history/i)<0) readme.shift();
|
||||
// revision history section
|
||||
if(!readme.length) throw new Error("Revision history section not found in readme");
|
||||
readme.shift();
|
||||
var end_of_history = readme.length;
|
||||
for(var i=0; i<readme.length; ++i) if(readme[i].search(/^---/) >= 0) { end_of_history=i; break; }
|
||||
if(end_of_history >= readme.length) throw new Error("Could not find the end-of-history header marker.");
|
||||
// remove empty lines, splitters
|
||||
while(readme.length >= end_of_history) readme.pop();
|
||||
for(var i in readme) readme[i] = readme[i].replace(/[\s]+$/g,"").replace(/[\t]/g," ");
|
||||
readme = readme.filter(function(a){return a.replace(/[\s-]+/g,"")!="";});
|
||||
// condense multilines to single line entries for each fix or feature. ([A] ... [M] ...)
|
||||
for(var i=readme.length-1; i>0; --i) {
|
||||
var line = readme[i].replace(/^\s+/,"");
|
||||
if(line.search(/^[\[\-]/) < 0) {
|
||||
readme[i-1] += " " + line;
|
||||
readme[i] = "";
|
||||
}
|
||||
}
|
||||
readme = readme.filter(function(a){return a!="";});
|
||||
// Condense log entries sepatated with newlines to one line for each version
|
||||
for(var i=readme.length-1; i>0; --i) {
|
||||
var line = readme[i].replace(/^\s+/,"");
|
||||
if(line.search(/^[-~]/) < 0) {
|
||||
readme[i-1] += "\n" + line;
|
||||
readme[i] = "";
|
||||
}
|
||||
}
|
||||
readme = readme.filter(function(a){return a!="";});
|
||||
// Separate versions.
|
||||
var history = {};
|
||||
for(var i in readme) {
|
||||
var line = readme[i].replace(/^[\sv-]+/g,"").trim();
|
||||
var ver = line.substr(0, line.search(" ")).trim().toLowerCase();
|
||||
var txt = line.substr(line.search(" ")).trim();
|
||||
if(ver.search("~")===0) continue;
|
||||
if(history[ver] !== undefined) throw new Error("Double definition of version '" + ver + "' in the readme revision history.");
|
||||
history[ver] = txt;
|
||||
}
|
||||
return history;
|
||||
}
|
||||
var history = read_history();
|
||||
var latest_release = "";
|
||||
var latest_beta = "";
|
||||
for(var ver in history) { latest_beta=ver; break; }
|
||||
for(var ver in history) if(ver.search(/(rc|b|a)/) < 0) { latest_release=ver; break; }
|
||||
var update_json = {
|
||||
homepage: "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.13.2": history,
|
||||
promos: {
|
||||
"1.13.2-recommended": latest_release,
|
||||
"1.13.2-latest": latest_beta,
|
||||
}
|
||||
}
|
||||
fs.mkdir(root_dir + "/meta");
|
||||
fs.writefile(root_dir + "/meta/update.json", JSON.stringify(update_json, null, 2));
|
||||
};
|
||||
|
||||
const task_name = sys.args[0];
|
||||
if((task_name===undefined) || (tasks[task_name])===undefined) {
|
||||
alert("No task ", task_name);
|
||||
exit(1);
|
||||
} else {
|
||||
tasks[task_name]();
|
||||
}
|
||||
libtask.run(tasks, sys.args);
|
||||
|
|
43
Makefile
43
Makefile
|
@ -6,24 +6,26 @@
|
|||
# Note for reviewers/clones: This file is a auxiliary script for my setup.
|
||||
# It's not needed to build the mod.
|
||||
#
|
||||
.PHONY: default init clean clean-all dist sync-main-repo sanatize update-json
|
||||
.PHONY: init-1.12 clean-1.12 clean-all-1.12 dist-1.12 sanatize-1.12
|
||||
.PHONY: init-1.13 clean-1.13 clean-all-1.13 dist-1.13 sanatize-1.13
|
||||
.PHONY: default init clean clean-all mrproper sanatize dist update-json sync-main-repo compare migrate-from-112
|
||||
|
||||
default: ; @echo "(You are not in a MC specific version directory)"
|
||||
clean: clean-1.12 clean-1.13
|
||||
clean-all: clean-all-1.13
|
||||
init: init-1.12 init-1.13
|
||||
default: ; @echo "First change to specific version directory."
|
||||
init: default
|
||||
dist: default
|
||||
|
||||
clean-1.12: ; -@cd 1.12; make -s clean
|
||||
clean-1.13: ; -@cd 1.13; make -s clean
|
||||
clean-all-1.12: ; -@cd 1.12; make -s clean-all
|
||||
clean-all-1.13: ; -@cd 1.13; make -s clean-all
|
||||
init-1.12: ; -@cd 1.12; make -s init
|
||||
init-1.13: ; -@cd 1.13; make -s init
|
||||
dist-1.12: ; @cd 1.12; make -s dist
|
||||
dist-1.13: ; @cd 1.13; make -s dist
|
||||
dist: ; @echo "First change to specific version directory."
|
||||
clean:
|
||||
-@cd 1.12; make -s clean
|
||||
-@cd 1.13; make -s clean
|
||||
-@cd 1.14; make -s clean
|
||||
|
||||
clean-all:
|
||||
-@cd 1.12; make -s clean-all
|
||||
-@cd 1.13; make -s clean-all
|
||||
-@cd 1.14; make -s clean-all
|
||||
|
||||
mrproper:
|
||||
-@cd 1.12; make -s mrproper
|
||||
-@cd 1.13; make -s mrproper
|
||||
-@cd 1.14; make -s mrproper
|
||||
|
||||
update-json:
|
||||
@echo "[main] Update update.json ..."
|
||||
|
@ -31,9 +33,18 @@ update-json:
|
|||
|
||||
sanatize:
|
||||
@cd 1.12; make -s sanatize
|
||||
@cd 1.12; make -s port-languages
|
||||
@cd 1.13; make -s sanatize
|
||||
@cd 1.14; make -s sanatize
|
||||
@make -s update-json
|
||||
|
||||
compare:
|
||||
@djs tasks.js compare-blockstates -v
|
||||
@djs tasks.js compare-textures -v
|
||||
|
||||
migrate-from-112:
|
||||
@djs tasks.js migrate-textures -v
|
||||
|
||||
# For reviewers: I am using a local repository for experimental changes,
|
||||
# this target copies the local working tree to the location of the
|
||||
# repository that you cloned.
|
||||
|
|
19
meta/lib/constants.js
Normal file
19
meta/lib/constants.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
(function(){
|
||||
var c = {};
|
||||
c.mod_registry_name = function() { return "engineersdecor" }
|
||||
c.reference_repository = function() { return "git@github.com:stfwi/engineers-decor.git"; }
|
||||
c.gradle_property_modversion = function() { return "version_engineersdecor"; }
|
||||
c.gradle_property_version_minecraft = function() { return "version_minecraft"; }
|
||||
c.gradle_property_version_forge = function() { return "version_forge"; }
|
||||
c.project_download_inet_page = function() { return "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/"; }
|
||||
c.languages = {
|
||||
"en_us": { code:"en_us", name:"English", region:"United States" },
|
||||
"de_de": { code:"de_de", name:"German", region:"Germany" },
|
||||
"ru_ru": { code:"ru_ru", name:"Russian", region:"Russia" },
|
||||
"zh_cn": { code:"zh_cn", name:"Chinese", region:"China" }
|
||||
}
|
||||
Object.freeze(c.languages);
|
||||
Object.freeze(c);
|
||||
return c;
|
||||
});
|
127
meta/lib/libassets.js
Normal file
127
meta/lib/libassets.js
Normal file
|
@ -0,0 +1,127 @@
|
|||
"use strict";
|
||||
(function(constants){
|
||||
var me = {};
|
||||
|
||||
|
||||
/**
|
||||
* Determines a list of all textures in the given path as plain object,
|
||||
* where the keys are the unified texture path (e.g. "block/", not "blocks/"),
|
||||
* and the value an object containing file path, SHA1, size, etc.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.load_texture_data = function(textures_path) {
|
||||
const wd = fs.cwd();
|
||||
var data = {};
|
||||
try {
|
||||
if(!fs.chdir(textures_path)) throw new Error("Texture root path does not exist: '" + textures_path + "'");
|
||||
fs.find(".", '*.*', function(path) {
|
||||
const file = path.replace(/[\\]/g, "/").replace(/^\.\//,"");
|
||||
const unified_file = file.replace(/^blocks\//, "block/");
|
||||
data[unified_file] = { path:file, size:fs.size(file), sha:sys.hash.sha1(path, true) };
|
||||
return false;
|
||||
});
|
||||
return data;
|
||||
} finally {
|
||||
fs.chdir(wd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares texture files and mcdata files two given assets paths, returns the
|
||||
* lists of both file trees and the differences as object.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.compare_textures = function(assets_path_a, assets_path_b) {
|
||||
const txpath_a = assets_path_a + "/" + constants.mod_registry_name() + "/textures";
|
||||
const txpath_b = assets_path_b + "/" + constants.mod_registry_name() + "/textures";
|
||||
const a = me.load_texture_data(txpath_a);
|
||||
const b = me.load_texture_data(txpath_b);
|
||||
const txpath_a_is112 = fs.isdir(txpath_a + "/blocks");
|
||||
const txpath_b_is112 = fs.isdir(txpath_b + "/blocks");
|
||||
const cmp = {a:{},b:{}};
|
||||
cmp.a.path = txpath_a;
|
||||
cmp.b.path = txpath_b;
|
||||
cmp.a.is112 = txpath_a_is112;
|
||||
cmp.b.is112 = txpath_b_is112;
|
||||
cmp.a.files = Object.assign({},a);
|
||||
cmp.b.files = Object.assign({},b);
|
||||
cmp.match = {}
|
||||
cmp.differ = {}
|
||||
cmp.onlyin_a = {}
|
||||
cmp.onlyin_b = {}
|
||||
for(var key in a) {
|
||||
if(b[key] === undefined) {
|
||||
cmp.onlyin_a[key] = a[key];
|
||||
continue;
|
||||
}
|
||||
if(a[key].sha === b[key].sha) {
|
||||
cmp.match[key] = a[key];
|
||||
b[key]=undefined; delete b[key];
|
||||
} else {
|
||||
cmp.differ[key] = { a:a[key], b:b[key] };
|
||||
b[key]=undefined; delete b[key];
|
||||
}
|
||||
}
|
||||
a = undefined;
|
||||
for(var key in b) {
|
||||
cmp.onlyin_b[key] = b[key];
|
||||
}
|
||||
b = undefined;
|
||||
return cmp;
|
||||
};
|
||||
|
||||
/**
|
||||
* Loads all blockstate files in the given assets path, and returns the parsed JSON
|
||||
* data as plain object, where the keys are the blockstate names, and the value the
|
||||
* parsed JSON files.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.load_blockstates = function(assets_path) {
|
||||
const wd = fs.cwd();
|
||||
var data = {};
|
||||
try {
|
||||
if(!fs.chdir(assets_path+"/blockstates")) throw new Error("blockstates path not found in: '" + assets_path + "'");
|
||||
fs.find(".", '*.json', function(path) {
|
||||
const file = path.replace(/[\\]/g, "/").replace(/^\.\//,"");
|
||||
if(fs.basename(file) != fs.basename(file).toLowerCase()) throw new Error("Blockstate file must be lowercase: '"+file+"'"); // hard fail
|
||||
const blockstate_name = fs.basename(file).replace(/[\.]json/i, "");
|
||||
if(blockstate_name.search(/[^a-z0-9_]/) >= 0) throw new Error("Blockstate file name contains invalid characters: '"+file+"'"); // here, too
|
||||
var json = fs.readfile(path);
|
||||
if(json===undefined) throw new Error("Failed to read blockstate file '"+file+"' (could not open file)");
|
||||
try { json=JSON.parse(json); } catch(ex) { throw new Error("Failed to parse blockstate file '"+file+"' (invalid JSON)"); }
|
||||
data[blockstate_name] = {file:(assets_path+"/blockstates/"+file), data:json};
|
||||
return false;
|
||||
});
|
||||
return data;
|
||||
} finally {
|
||||
fs.chdir(wd);
|
||||
}
|
||||
};
|
||||
|
||||
me.compare_blockstates = function(assets_path_a, assets_path_b) {
|
||||
const a = me.load_blockstates(assets_path_a);
|
||||
const b = me.load_blockstates(assets_path_b);
|
||||
const onlyin_a = {};
|
||||
const onlyin_b = {};
|
||||
for(var key in a) {
|
||||
if(b[key] === undefined) {
|
||||
onlyin_a[key] = a[key];
|
||||
continue;
|
||||
} else {
|
||||
b[key]=undefined; delete b[key];
|
||||
}
|
||||
}
|
||||
a = undefined;
|
||||
for(var key in b) {
|
||||
onlyin_b[key] = b[key];
|
||||
}
|
||||
b = undefined;
|
||||
return {
|
||||
onlyin_a: onlyin_a,
|
||||
onlyin_b: onlyin_b,
|
||||
}
|
||||
};
|
||||
|
||||
Object.freeze(me);
|
||||
return me;
|
||||
});
|
205
meta/lib/liblang.1.12.js
Normal file
205
meta/lib/liblang.1.12.js
Normal file
|
@ -0,0 +1,205 @@
|
|||
"use strict";
|
||||
(function(constants){
|
||||
var me = {};
|
||||
|
||||
/**
|
||||
* Loads the raw data of the lang file.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.load_raw = function(file_path, remove_comments) {
|
||||
const lang_code = fs.basename(file_path).replace(/\..*$/,"").trim().toLowerCase();
|
||||
var lines = fs.readfile(file_path).trim().split("\n");
|
||||
var was_eol_escape = false;
|
||||
for(var i in lines) {
|
||||
if(was_eol_escape) {
|
||||
var k=0;
|
||||
for(k=i-1; k>=0; --k) {
|
||||
if(lines[k] != null) {
|
||||
lines[k] += "\n" + lines[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
was_eol_escape = lines[i].match(/[^\\][\\]$/) != null;
|
||||
lines[i] = null;
|
||||
} else {
|
||||
lines[i] = lines[i].trim();
|
||||
was_eol_escape = lines[i].match(/[^\\][\\]$/) != null;
|
||||
}
|
||||
}
|
||||
lines = lines.filter(function(l){return (l!==null)});
|
||||
if(!!remove_comments) lines = lines.filter(function(l){return (l.trim().search(/^#/)!=0)});
|
||||
return { code:lang_code, data:lines };
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a language into a unified object format
|
||||
*/
|
||||
me.load = function(file_path) {
|
||||
const modid = constants.mod_registry_name();
|
||||
const data = {
|
||||
creative_tab: "",
|
||||
config_title: "",
|
||||
blocks: {},
|
||||
items: {},
|
||||
other: {},
|
||||
lang: {},
|
||||
invalid: {}
|
||||
};
|
||||
var lines = me.load_raw(file_path, true).data.map(function(line){return line.replace(/[\s]*[\\][\r]?[\n][\s]*/mig, " ").trim()});
|
||||
for(var i in lines) {
|
||||
if(!lines[i].length) continue;
|
||||
const kv = lines[i].split("=", 2);
|
||||
if(kv.length!=2) throw new Error("Invalid line in '"+file_path+"': '"+lines[i]+"'");
|
||||
const key = kv[0].trim();
|
||||
const text = kv[1].trim();
|
||||
if(key.length == 0) {
|
||||
throw new Error("Empty key in '"+file_path+"' line '" + lines[i] + "'");
|
||||
} else if(key.search("tile."+modid+".")==0) {
|
||||
key = key.replace("tile."+modid+".", "");
|
||||
key = key.split(".", 2);
|
||||
const block = key[0];
|
||||
const prop = key[1];
|
||||
if(data.blocks[block]===undefined) data.blocks[block] = {};
|
||||
data.blocks[block][prop] = text;
|
||||
} else if(key.search("item."+modid+".")==0) {
|
||||
key = key.replace("item."+modid+".", "");
|
||||
key = key.split(".", 2);
|
||||
const item = key[0];
|
||||
const prop = key[1];
|
||||
if(data.items[item]===undefined) data.blocks[item] = {};
|
||||
data.blocks[item][prop] = text;
|
||||
} else if(key.search(modid + ".config.title")==0) {
|
||||
data.config_title = text;
|
||||
} else if(key.search("itemGroup.tab" + modid)==0) {
|
||||
data.creative_tab = text;
|
||||
} else if(key.search(modid + ".")==0) {
|
||||
data.other[key] = text;
|
||||
} else {
|
||||
data.invalid[key] = text;
|
||||
}
|
||||
}
|
||||
const lang_code = fs.basename(file_path).replace(/[\.].*$/, "").trim().toLowerCase();
|
||||
if(constants.languages[lang_code] === undefined) throw new Error("No language header constants defined for '" + lang_code + "'");
|
||||
data.lang = constants.languages[lang_code];
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a language in the version specific MC format from
|
||||
* a unified object format.
|
||||
*/
|
||||
me.save = function(file_path, lang_data) {
|
||||
throw new Error("lang.save() not implemented yet for 1.12 lang files.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds missing entries to the language file, master is en_us.
|
||||
* Applies to the CWD and 1.12.2 lang files.
|
||||
* @returns {void}
|
||||
*/
|
||||
me.sync_languages = function(reflang_code) {
|
||||
if(reflang_code===undefined) reflang_code = "en_us";
|
||||
reflang_code = reflang_code.trim().toLowerCase();
|
||||
function load() {
|
||||
var lang_data = {};
|
||||
fs.find("./src/main/resources/assets/"+ constants.mod_registry_name() +"/lang", '*.lang', function(f){
|
||||
const r = me.load_raw(f);
|
||||
lang_data[r.code] = r.data;
|
||||
return false;
|
||||
});
|
||||
return lang_data;
|
||||
}
|
||||
function reference_content(lang_data, reflang_code) {
|
||||
var lang_lines = [];
|
||||
for(var i in lang_data[reflang_code]) {
|
||||
var txt = lang_data[reflang_code][i].trim();
|
||||
if((txt.search(/^#/)>=0) || (txt.search("=")<0)) { lang_lines.push(txt); continue; }; // comment "#" or empty line in the ref lang file
|
||||
var kv = txt.split("=", 2);
|
||||
var key = kv[0].trim();
|
||||
var val = kv[1].trim();
|
||||
var o = {key:key, tr:{}};
|
||||
o.tr[reflang_code] = val;
|
||||
lang_lines.push(o);
|
||||
}
|
||||
delete lang_data[reflang_code];
|
||||
return lang_lines;
|
||||
}
|
||||
function add_language(lang_lines, lang_name, lang_data) {
|
||||
const find_line = function(lines, key) {
|
||||
for(var i in lines) {
|
||||
if((typeof(lines[i]) !== "object")) continue;
|
||||
if(lines[i].key.toLowerCase()==key.toLowerCase()) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
for(var i in lang_data) {
|
||||
var txt = lang_data[i].trim();
|
||||
if(txt.search(/^#/)>=0) continue;
|
||||
if(txt.search("=")<0) continue;
|
||||
var kv = txt.split("=", 2);
|
||||
var key = kv[0].trim();
|
||||
var val = kv[1].trim();
|
||||
var line_i = find_line(lang_lines, key);
|
||||
if(line_i >= 0) {
|
||||
lang_data[i] = undefined;
|
||||
lang_lines[line_i].tr[lang_name] = val;
|
||||
}
|
||||
}
|
||||
return lang_data;
|
||||
}
|
||||
|
||||
function complete_lang_lines(lang_lines, lang_names, reflang_code) {
|
||||
var lang_outputs = {};
|
||||
for(var i in lang_names) lang_outputs[lang_names[i]] = [];
|
||||
for(var i_line in lang_lines) {
|
||||
var entry = lang_lines[i_line];
|
||||
if(typeof(entry) !== "object") {
|
||||
for(var i in lang_names) lang_outputs[lang_names[i]].push(entry);
|
||||
} else {
|
||||
for(var i in lang_names) {
|
||||
var name = lang_names[i];
|
||||
if(entry.tr[name] !== undefined) {
|
||||
lang_outputs[name].push(entry.key + "=" + entry.tr[name]);
|
||||
} else {
|
||||
var added = entry.key + "=" + entry.tr[reflang_code];
|
||||
if((entry.key.search(/\.tip$/)>0) || (entry.key.search(/\.help$/)>0)) added = "#" + added;
|
||||
lang_outputs[name].push(added);
|
||||
if(added.search(/^#/)<0) print("[warn] Lang: Added default language for missing entry in " + name + ": '" + added + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lang_outputs;
|
||||
}
|
||||
|
||||
var lang_data = load();
|
||||
var lang_names = Object.keys(lang_data);
|
||||
var lang_lines = reference_content(lang_data, reflang_code);
|
||||
for(var lang_name in lang_data) {
|
||||
lang_data[lang_name] = add_language(lang_lines, lang_name, lang_data[lang_name]);
|
||||
lang_data[lang_name] = lang_data[lang_name].filter(function(l){ return !!l; });
|
||||
if(lang_data[lang_name].length == 0) delete lang_data[lang_name];
|
||||
}
|
||||
var output_data = complete_lang_lines(lang_lines, lang_names, reflang_code);
|
||||
for(var i in output_data) output_data[i] = output_data[i].join("\n") + "\n\n";
|
||||
|
||||
// Remaining lines in lang files (not in the reference lang file)
|
||||
for(var lang_name in lang_data) {
|
||||
for(var i in lang_data[lang_name]) {
|
||||
if(lang_data[lang_name][i].search(/^#/)<0) {
|
||||
var added = "# " + lang_data[lang_name][i].replace(/^[#\s]+/,"");
|
||||
output_data[lang_name] += added + "\n";
|
||||
print("[warn] Lang: Commented out unknown key in " + lang_name + ": '" + added + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var name in output_data) output_data[name] = output_data[name].trim() + "\n";
|
||||
|
||||
for(var name in output_data) {
|
||||
fs.writefile("./src/main/resources/assets/engineersdecor/lang/" + name + ".lang", output_data[name]);
|
||||
}
|
||||
};
|
||||
|
||||
Object.freeze(me);
|
||||
return me;
|
||||
});
|
122
meta/lib/liblang.1.13.js
Normal file
122
meta/lib/liblang.1.13.js
Normal file
|
@ -0,0 +1,122 @@
|
|||
"use strict";
|
||||
(function(constants){
|
||||
var me = {};
|
||||
|
||||
/**
|
||||
* Loads the raw data of the lang file.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.load_raw = function(file_path) {
|
||||
const lang_code = fs.basename(file_path).replace(/\..*$/,"").trim().toLowerCase();
|
||||
const data = JSON.parse(fs.readfile(file_path).trim());
|
||||
return { code:lang_code, data:data };
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads
|
||||
*/
|
||||
me.load = function(file_path) {
|
||||
const modid = constants.mod_registry_name();
|
||||
const data = {
|
||||
creative_tab: "",
|
||||
config_title: "",
|
||||
blocks: {},
|
||||
items: {},
|
||||
other: {},
|
||||
lang: {},
|
||||
invalid: {}
|
||||
};
|
||||
var lines = me.load_raw(file_path).data;
|
||||
for(var objkey in lines) {
|
||||
const key = objkey.trim();
|
||||
const text = lines[objkey].trim();
|
||||
if(key.length == 0) {
|
||||
throw new Error("Empty key in '"+file_path+"' line '" + lines[i] + "'");
|
||||
} else if(key.search("block."+modid+".")==0) {
|
||||
key = key.replace("block."+modid+".", "");
|
||||
key = key.split(".", 2);
|
||||
const block = key[0];
|
||||
const prop = ((key.length<2) || (key[1]=="")) ? "name" : key[1];
|
||||
if(data.blocks[block]===undefined) data.blocks[block] = {};
|
||||
data.blocks[block][prop] = text;
|
||||
} else if(key.search("item."+modid+".")==0) {
|
||||
key = key.replace("item."+modid+".", "");
|
||||
key = key.split(".", 2);
|
||||
const item = key[0];
|
||||
const prop = ((key.length<2) || (key[1]=="")) ? "name" : key[1];
|
||||
if(data.items[item]===undefined) data.blocks[item] = {};
|
||||
data.blocks[item][prop] = text;
|
||||
} else if(key.search(modid + ".config.title")==0) {
|
||||
data.config_title = text;
|
||||
} else if(key.search("itemGroup.tab" + modid)==0) {
|
||||
data.creative_tab = text;
|
||||
} else if(key.search(modid + ".")==0) {
|
||||
data.other[key] = text;
|
||||
} else if(key.search("language")==0) {
|
||||
key = key.replace("language", "");
|
||||
key = key.split(".", 2);
|
||||
const prop = ((key.length<2) || (key[1]=="")) ? "name" : key[1];
|
||||
data.lang[prop] = text;
|
||||
} else {
|
||||
data.invalid[key] = text;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a language in the version specific MC format from
|
||||
* a unified object format.
|
||||
*/
|
||||
me.save = function(file_path, data) {
|
||||
if(Object.keys(data.invalid).length > 0) throw new Error("Given language data have entries in the marked-invalid data, fix this first.");
|
||||
const modid = constants.mod_registry_name();
|
||||
var out = {};
|
||||
out["language"] = data.lang.name;
|
||||
out["language.code"] = data.lang.code;
|
||||
out["language.region"] = data.lang.region;
|
||||
out["itemGroup.tab" + modid] = data.creative_tab;
|
||||
out[modid+".config.title"] = data.config_title;
|
||||
for(var it in data.other) {
|
||||
out[it] = data.other[it];
|
||||
}
|
||||
for(var blkname in data.blocks) {
|
||||
var blk = data.blocks[blkname];
|
||||
for(var key in blk) {
|
||||
if(key=="name") {
|
||||
out["block."+modid+"."+blkname] = blk[key];
|
||||
} else {
|
||||
out["block."+modid+"."+blkname+"."+key] = blk[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var itemname in data.items) {
|
||||
var item = data.items[itemname];
|
||||
for(var key in item) {
|
||||
if(key=="name") {
|
||||
out["item."+modid+"."+itemname] = item[key];
|
||||
} else {
|
||||
out["item."+modid+"."+itemname+"."+key] = item[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
var txt = JSON.stringify(out,null,1);
|
||||
var file_lang_code = fs.basename(file_path).replace(/\.json/,"");
|
||||
const filename = fs.basename(file_path);
|
||||
if(filename.toLowerCase() != filename) throw new Error("Language files must be completely lowercase.");
|
||||
if(file_lang_code != data.lang.code) throw new Error("File name to save does not contain the language code of the given data.");
|
||||
if(filename.search("\.json$") <= 0) throw new Error("File name to save must be a json file (lowercase).");
|
||||
if(!fs.isdir(fs.dirname(file_path))) throw new Error("File to save: Parent directory does not exist.");
|
||||
fs.writefile(file_path, txt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds missing entries to the language file, master is en_us.
|
||||
* Applies to the CWD and 1.12.2 lang files.
|
||||
* @returns {void}
|
||||
*/
|
||||
me.sync_languages = function(reflang_code) {};
|
||||
|
||||
Object.freeze(me);
|
||||
return me;
|
||||
});
|
383
meta/lib/libtask.js
Normal file
383
meta/lib/libtask.js
Normal file
|
@ -0,0 +1,383 @@
|
|||
#!/usr/bin/djs
|
||||
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
|
||||
"use strict";
|
||||
|
||||
(function(constants){
|
||||
const me = {'tasks':{}, 'parsing':{},'sanatizing':{}};
|
||||
|
||||
/**
|
||||
* Returns the version history as full text from a given file path.
|
||||
* @returns {string}
|
||||
*/
|
||||
me.parsing.readme_history_section = function (file_path) {
|
||||
var readme = fs.readfile(file_path);
|
||||
if(!readme) throw new Error("Failed to load readme.md");
|
||||
readme = readme.split(/[\r]?[\n]/);
|
||||
while((readme.length > 0) && readme[0].search(/^## Version history/i)<0) readme.shift();
|
||||
while((readme.length > 0) && readme[0].trim()=="") readme.shift();
|
||||
// version history section
|
||||
if(!readme.length) throw new Error("Version history section not found in readme");
|
||||
readme.shift();
|
||||
var end_of_history = readme.length;
|
||||
for(var i=0; i<readme.length; ++i) if(readme[i].search(/^---/) >= 0) { end_of_history=i; break; }
|
||||
if(end_of_history >= readme.length) throw new Error("Could not find the end-of-history header marker.");
|
||||
// remove empty lines, splitters
|
||||
while(readme.length >= end_of_history) readme.pop();
|
||||
while((readme.length >0) && (readme[readme.length-1].replace(/[\s-]/g,"")=="")) readme.pop();
|
||||
const min_indent = readme
|
||||
.map(function(s){return s.search(/[^\s]/)})
|
||||
.filter(function(e){return e>=0})
|
||||
.reduce(function(acc,e){return (e<acc)?e:acc});
|
||||
if(min_indent > 1) {
|
||||
for(var i in readme) { readme[i] = readme[i].substr(min_indent-2); }
|
||||
}
|
||||
return readme.join("\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version history as array of version-text pairs from a given file path.
|
||||
* @returns {array}
|
||||
*/
|
||||
me.parsing.readme_changelog = function(file_path) {
|
||||
var readme = me.parsing.readme_history_section(file_path).split(/[\r]?[\n]/);
|
||||
var versions = [];
|
||||
var ver="", txt=[];
|
||||
const addversion = function(){
|
||||
if((ver.length == 0) && (txt.length == 0)) return;
|
||||
if((ver.length > 0) != (txt.length > 0)) throw new Error("Version entry with empty corresponding text.");
|
||||
for(var i in txt) txt[i] = txt[i].trim();
|
||||
for(var i=txt.length-1; i>0; --i) {
|
||||
if((txt[i].length == 0) || (txt[i][0] == '[')) continue;
|
||||
txt[i-1] += " " + txt[i];
|
||||
txt[i] = "";
|
||||
}
|
||||
txt = txt.filter(function(v){return v.length>0;});
|
||||
for(var i in txt) txt[i] = txt[i].replace(/[\s]+/, " ");
|
||||
versions.push({ver:ver,txt:txt});
|
||||
};
|
||||
for(var il in readme) {
|
||||
var line = readme[il];
|
||||
if(line.replace(/[\s-]+/, "").length == 0) {
|
||||
continue; // separator line
|
||||
} if(line.search(/^[\s]*[~-][\s]*v[\d]+[\.][\d]+[\.][\d]/) == 0) {
|
||||
addversion();
|
||||
var is_preversion = (line.search(/^[\s]*[~]/) == 0);
|
||||
ver = line.replace(/^[\s]*[~-][\s]*/,"").replace(/[\s].*$/,"").toLowerCase();
|
||||
txt = [line.replace(ver, " ".repeat(ver.length)).replace(/^[\s]*[~-]/, function(m){ return " ".repeat(m.length); })];
|
||||
if(is_preversion) ver = "~" + ver;
|
||||
} else {
|
||||
txt.push(line);
|
||||
}
|
||||
}
|
||||
addversion();
|
||||
return versions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the versions known from the readme
|
||||
* @returns {array}
|
||||
*/
|
||||
me.parsing.readme_versions = function(file_path, no_pre_versions) {
|
||||
var o = me.parsing.readme_changelog(file_path);
|
||||
var versions = [];
|
||||
for(var i in o) versions.push(o[i].ver);
|
||||
if(!no_pre_versions) return versions;
|
||||
versions = versions.filter(function(v){ return v[0]!="~"; });
|
||||
return versions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the gradle.properties settings as key-value plain object.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.parsing.gradle_properties = function(file_path) {
|
||||
var lines = fs.readfile(file_path).split(/[\r]?[\n]/);
|
||||
var properties = {};
|
||||
for(var i in lines) {
|
||||
var line = lines[i].trim();
|
||||
if(line.search("#")==0) continue;
|
||||
if(line.search("//")>=0) { line=line.substr(0, line.search("//")).trim(); }
|
||||
if(line.search(/^[a-z][a-z0-9_\.]+[=]/i) < 0) continue;
|
||||
line = line.split("=", 2);
|
||||
properties[line[0].trim()] = line[1].trim();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes one tab to two spaces in files with the given extension
|
||||
* recursively found in the current working directory.
|
||||
* @returns {void}
|
||||
*/
|
||||
me.sanatizing.tabs_to_spaces = function(extensions) {
|
||||
var file_list = (function() {
|
||||
var ls = [];
|
||||
const ext = extensions;
|
||||
for(var i in ext) ls = ls.concat(fs.find("./src", '*.'+ext[i]));
|
||||
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
|
||||
ls.sort();
|
||||
ls.push("readme.md");
|
||||
return ls;
|
||||
})();
|
||||
for(var file_i in file_list) {
|
||||
var file = file_list[file_i];
|
||||
var txt = fs.readfile(file);
|
||||
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
|
||||
const txt_length = txt.length;
|
||||
txt = txt.replace(/[\t]/g," ");
|
||||
const n = txt.length - txt_length;
|
||||
if(n > 0) {
|
||||
print("File '" + file + "': Changed " + n + " tabs to 2 spaces." );
|
||||
fs.writefile(file, txt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes space characters at the end of lines in files with the given
|
||||
* extension recursively found in the current working directory.
|
||||
* @returns {void}
|
||||
*/
|
||||
me.sanatizing.remove_trailing_whitespaces = function(extensions) {
|
||||
var file_list = (function() {
|
||||
var ls = [];
|
||||
const ext = extensions;
|
||||
for(var i in ext) ls = ls.concat(fs.find("./src", '*.'+ext[i]));
|
||||
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
|
||||
ls.sort();
|
||||
ls.push("readme.md");
|
||||
return ls;
|
||||
})();
|
||||
for(var file_i in file_list) {
|
||||
var file = file_list[file_i];
|
||||
var txt = fs.readfile(file);
|
||||
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
|
||||
const txt_length = txt.length;
|
||||
txt = txt.replace(/[\r\t ]+[\n]/g,"\n");
|
||||
const n = txt_length - txt.length;
|
||||
if(n > 0) {
|
||||
print("File '" + file + "': Fixed " + n + " lines with trailing whitespaces." );
|
||||
fs.writefile(file, txt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks the versions specified in the gradle.properties against
|
||||
* the last readme.md changelog version. Applies to the CWD.
|
||||
* @returns {object}
|
||||
*/
|
||||
me.tasks.version_check = function(allow_preversions) {
|
||||
var fails = [];
|
||||
const properties = me.parsing.gradle_properties("gradle.properties");
|
||||
const version_minecraft = properties[constants.gradle_property_version_minecraft()];
|
||||
const version_forge = properties[constants.gradle_property_version_forge()];
|
||||
const version_mod = properties[constants.gradle_property_modversion()];
|
||||
const combined_version = version_minecraft + "-" + version_mod;
|
||||
const readme_versions = me.parsing.readme_versions("readme.md").map(function(v){return v.replace(/^[v]/i, "").trim()});
|
||||
const readme_preversion_found = (readme_versions.filter(function(v){return v==("~v"+version_mod)}).length == 1);
|
||||
var readme_version_found = readme_versions.filter(function(v){return v==version_mod}).length == 1;
|
||||
if(allow_preversions && readme_preversion_found) readme_version_found = true;
|
||||
if(!readme_version_found) fails.push("Version 'v" + version_mod + "' not found in the readme changelog.");
|
||||
return {
|
||||
fails: fails,
|
||||
version_mod: version_mod,
|
||||
combined_version: combined_version,
|
||||
version_forge: version_forge,
|
||||
preversion_found: readme_preversion_found
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Distribution JAR pre-checks.
|
||||
* @returns {array}
|
||||
*/
|
||||
me.tasks.dist_check = function() {
|
||||
const uncommitted_changes = sys.shell("git status -s").trim();
|
||||
const gittags = sys.shell('git log -1 --format="%D"')
|
||||
.replace(/[\s]/g,"").split(",")
|
||||
.filter(function(s){ return s.indexOf("tag:")==0;})
|
||||
.map(function(s){ return s.replace(/^tag:/,"");});
|
||||
const modversion = fs.readfile("gradle.properties", function(line){
|
||||
if(line.trim().indexOf(constants.gradle_property_modversion())!=0) return false;
|
||||
return line.replace(/^.*?=/,"").trim()
|
||||
}).trim();
|
||||
const git_remote = sys.shell("git remote -v").trim();
|
||||
const git_branch = sys.shell("git rev-parse --abbrev-ref HEAD").trim();
|
||||
const git_diff = sys.shell("git diff .").trim();
|
||||
var fails = [];
|
||||
if(modversion=="") fails.push("Could not determine '"+ constants.gradle_property_modversion() +"' from gradle properties.");
|
||||
if(!gittags.length) fails.push("Version not tagged.");
|
||||
if(!gittags.filter(function(s){return s.indexOf(modversion.replace(/[-]/g,""))>=0}).length) fails.push("No tag version not found matching the gradle properties version.");
|
||||
if(git_remote.replace(/[\s]/g,"").indexOf(constants.reference_repository() + "(push)") < 0) fails.push("Not the reference repository.");
|
||||
if((git_branch != "develop") && (git_branch != "master")) {
|
||||
fails.push("No valid branch for dist. (branch:'"+git_branch+"')");
|
||||
} else if((git_branch == "develop") && (modversion.replace(/[^ab]/g,"")=="")) {
|
||||
fails.push("Cannot make release dist on develop branch.");
|
||||
} else if((git_branch == "master") && (modversion.replace(/[^ab]/g,"")!="")) {
|
||||
fails.push("Cannot make beta dist on master branch.");
|
||||
}
|
||||
if(git_diff !== "") fails.push("Not everything committed to the GIT repository.");
|
||||
// if((!fs.isfile("signing.jks")) || (!fs.isfile("signing.properties"))) fails.push("Jar signing files missing.");
|
||||
return fails;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a version check object for the given MC version.
|
||||
*/
|
||||
me.tasks.changelog_data = function(mc_version) {
|
||||
if(mc_version===undefined) throw new Error("No MC version given for generating an update JSON.");
|
||||
mc_version = (""+mc_version).trim();
|
||||
function read_history() {
|
||||
var readme = fs.readfile(fs.cwd() + "/readme.md");
|
||||
if(!readme) throw new Error("Failed to load readme.md");
|
||||
readme = readme.split(/[\r]?[\n]/);
|
||||
while((readme.length > 0) && readme[0].search(/^## Version history/i)<0) readme.shift();
|
||||
// version history section
|
||||
if(!readme.length) throw new Error("Version history section not found in readme");
|
||||
readme.shift();
|
||||
var end_of_history = readme.length;
|
||||
for(var i=0; i<readme.length; ++i) if(readme[i].search(/^---/) >= 0) { end_of_history=i; break; }
|
||||
if(end_of_history >= readme.length) throw new Error("Could not find the end-of-history header marker.");
|
||||
// remove empty lines, splitters
|
||||
while(readme.length >= end_of_history) readme.pop();
|
||||
for(var i in readme) readme[i] = readme[i].replace(/[\s]+$/g,"").replace(/[\t]/g," ");
|
||||
readme = readme.filter(function(a){return a.replace(/[\s-]+/g,"")!="";});
|
||||
// condense multilines to single line entries for each fix or feature. ([A] ... [M] ...)
|
||||
for(var i=readme.length-1; i>0; --i) {
|
||||
var line = readme[i].replace(/^\s+/,"");
|
||||
if(line.search(/^[\[\-]/) < 0) {
|
||||
readme[i-1] += " " + line;
|
||||
readme[i] = "";
|
||||
}
|
||||
}
|
||||
readme = readme.filter(function(a){return a!="";});
|
||||
// Condense log entries sepatated with newlines to one line for each version
|
||||
for(var i=readme.length-1; i>0; --i) {
|
||||
var line = readme[i].replace(/^\s+/,"");
|
||||
if(line.search(/^[-~]/) < 0) {
|
||||
readme[i-1] += "\n" + line;
|
||||
readme[i] = "";
|
||||
}
|
||||
}
|
||||
readme = readme.filter(function(a){return a!="";});
|
||||
// Separate versions.
|
||||
var history = {};
|
||||
for(var i in readme) {
|
||||
var line = readme[i].replace(/^[\sv-]+/g,"").trim();
|
||||
var ver = line.substr(0, line.search(" ")).trim().toLowerCase();
|
||||
var txt = line.substr(line.search(" ")).trim();
|
||||
if(ver.search("~")===0) continue;
|
||||
if(history[ver] !== undefined) throw new Error("Double definition of version '" + ver + "' in the readme version history.");
|
||||
history[ver] = txt;
|
||||
}
|
||||
return history;
|
||||
}
|
||||
var history = read_history();
|
||||
var latest_release = "";
|
||||
var latest_beta = "";
|
||||
for(var ver in history) { latest_beta=ver; break; }
|
||||
for(var ver in history) if(ver.search(/(rc|b|a)/) < 0) { latest_release=ver; break; }
|
||||
var update_json = {}
|
||||
update_json["homepage"] = constants.project_download_inet_page();
|
||||
update_json[mc_version] = history;
|
||||
update_json["promos"] = {};
|
||||
update_json["promos"][""+mc_version+"-recommended"] = latest_release;
|
||||
update_json["promos"][""+mc_version+"-latest"] = latest_beta;
|
||||
return update_json;
|
||||
};
|
||||
|
||||
// Standard tasks
|
||||
var stdtasks = {};
|
||||
|
||||
stdtasks["dist-check"] = function() {
|
||||
var fails = me.tasks.dist_check();
|
||||
if(fails.length == 0) return;
|
||||
for(var i in fails) fails[i] = " - " + fails[i];
|
||||
alert("Dist check failed");
|
||||
alert(fails.join("\n")+"\n");
|
||||
exit(1);
|
||||
};
|
||||
stdtasks["version-check"] = function(args) {
|
||||
var r = me.tasks.version_check(!args.join().search("--no-preversions")>=0);
|
||||
if(r.fails.length == 0) return;
|
||||
for(var i in r.fails) r.fails[i] = " - " + r.fails[i];
|
||||
alert("Version data:");
|
||||
alert(" - version_mod : '" + r.version_mod + "'");
|
||||
alert(" - combined_version : '" + r.combined_version + "'");
|
||||
alert(" - version_forge : '" + r.version_forge + "'");
|
||||
if(!!r.preversion_found) alert(" - PREVERSION FOUND : '~" + r.version_mod + "'");
|
||||
exit(1);
|
||||
};
|
||||
stdtasks["version-html"] = function() {
|
||||
if(!fs.isdir("dist")) throw new Error("'dist' directory does not exist.");
|
||||
const hist = me.parsing.readme_history_section("readme.md");
|
||||
const html = "<pre>\n" + (hist.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<")) + "\n</pre>";
|
||||
fs.writefile("dist/revision-history.html", html);
|
||||
};
|
||||
stdtasks["tabs-to-spaces"] = function() {
|
||||
me.sanatizing.tabs_to_spaces(['java','lang']);
|
||||
};
|
||||
stdtasks["trailing-whitespaces"] = function() {
|
||||
me.sanatizing.remove_trailing_whitespaces(['java','json','lang']);
|
||||
};
|
||||
stdtasks["sanatize"] = function() {
|
||||
stdtasks["trailing-whitespaces"]();
|
||||
stdtasks["tabs-to-spaces"]();
|
||||
}
|
||||
stdtasks["dist"] = function() {
|
||||
stdtasks["version-html"]();
|
||||
};
|
||||
stdtasks["update-json"] = function() {
|
||||
const version_minecraft = me.parsing.gradle_properties("gradle.properties").version_minecraft;
|
||||
const json = me.tasks.changelog_data(version_minecraft);
|
||||
fs.mkdir("./meta");
|
||||
fs.writefile("./meta/update.json", JSON.stringify(json, null, 2));
|
||||
};
|
||||
|
||||
stdtasks["dump-languages"] = function() {
|
||||
const lang_version = (me.parsing.gradle_properties("gradle.properties").version_minecraft.search("1.12.")==0) ? "1.12" : "1.13";
|
||||
const lang_extension = (lang_version == "1.12") ? ("lang") : ("json");
|
||||
const liblang = include("../meta/lib/liblang."+lang_version+".js")(constants);
|
||||
var lang_files = {};
|
||||
fs.find("./src/main/resources/assets/"+ constants.mod_registry_name() +"/lang", '*.'+lang_extension, function(f){
|
||||
const code = fs.basename(f).replace(/[\.].*$/,"").trim();
|
||||
const data = liblang.load(f);
|
||||
lang_files[code] = data;
|
||||
return false;
|
||||
});
|
||||
print(JSON.stringify(lang_files,null,1));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Task main
|
||||
*/
|
||||
me.run = function(tasks, args, no_std_tasks, rel_root_path) {
|
||||
if(rel_root_path===undefined) rel_root_path = "..";
|
||||
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod source directory.");
|
||||
if(!fs.isdir(rel_root_path+"/.git")) throw new Error("Missing git repository in parent directory of mod source.");
|
||||
if(!no_std_tasks) {
|
||||
for(var key in stdtasks) {
|
||||
if(tasks[key]===undefined) tasks[key] = stdtasks[key];
|
||||
}
|
||||
}
|
||||
const task_name = args[0];
|
||||
var task_args = args.slice(1).map(function(v){return(v===undefined)?(""):(""+v).trim()}).filter(function(v){return(v.length>0)});
|
||||
if(task_name===undefined) {
|
||||
alert("No task specified.");
|
||||
exit(1);
|
||||
} else if((tasks[task_name])===undefined) {
|
||||
alert("No task '" + task_name + "' defined.");
|
||||
exit(1);
|
||||
} else {
|
||||
tasks[task_name](task_args);
|
||||
}
|
||||
};
|
||||
|
||||
// Module include return value
|
||||
Object.freeze(me.parsing);
|
||||
Object.freeze(me.tasks);
|
||||
Object.freeze(me);
|
||||
return me;
|
||||
});
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.12.2": {
|
||||
"1.0.9-b1": "[U] Lang file ru_ru updated (PR#31, yaroslav4167).\n[M] Block hardness adaptions (issue #32).",
|
||||
"1.0.8": "[R] Release based on v1.0.8-b2. Release-to-release changes: * Added factory area sign. * Added stained clinker. * Config opt-out fixes, detailed feature selection possible now. * Recipe adaptions and fixes. * Lang files updated.\n[A] Added stained clinker brick block/stairs. Can be mixed with \"normal\" clinkers.\n[A] Added opt-out option for CTRL-SHIFT tooltips.\n[M] Recipe condition requirements updated, recipes categorized.",
|
||||
"1.0.8-b2": "[F] Config opt-out fixed (thx IronPiston for the report #30).\n[A] Added opt-out config for detailed including/excluding of features (using registry name wildcard matching).",
|
||||
"1.0.8-b1": "[A] Added \"Factory area\" sign.\n[M] Electrical furnace recipe changed (hoppers to conveyors).\n[A] Opt-out config options added.\n[F] Lang file fixes for en_us (Angela, PR#29).",
|
||||
|
@ -56,10 +57,18 @@
|
|||
"1.0.0-a2": "[A] Added panzer glass.",
|
||||
"1.0.0-a1": "[A] Initial port to 1.13.2 with Forge beta."
|
||||
},
|
||||
"1.14.2": {
|
||||
"1.0.8-b1": "[V] Feature set of 1.12 ported.\n[A] CTRL-SHIFT tooltips ported.\n[A] Ported stained clinker block/stairs.\n[M] Updated textures.\n[I] Issue: Scoped recipe constants still not working.",
|
||||
"1.0.7-b5": "[U] Updated to Forge BETA 1.14.2-26.0.35/20190608-1.14.2.\n[A] Factory dropper functionality ported.\n[A] Small lab furnace functionality ported.\n[A] Small electrical lab furnace functionality ported.\n[A] Small waste incinerator functionality ported.\n[A] Fluid valves, Passive Fluid Accumulator ported.\n[I] Issue: Scoped recipe constants still not working.",
|
||||
"1.0.7-b4": "[U] Updated to Forge BETA 1.14.2-26.0.32/20190608-1.14.2.\n[A] Sitting on the stool ported.\n[A] Ladder climbing speed boost ported.\n[A] Crafting table functionality ported.\n[I] Issue: Scoped recipe constants not working yet with the current Forge version (or somehow changed).",
|
||||
"1.0.7-b3": "[A] Initial 1.14.2 port of decorative blocks."
|
||||
},
|
||||
"promos": {
|
||||
"1.12.2-recommended": "1.0.8",
|
||||
"1.12.2-latest": "1.0.8",
|
||||
"1.12.2-latest": "1.0.9-b1",
|
||||
"1.13.2-recommended": "",
|
||||
"1.13.2-latest": "1.0.7-b4"
|
||||
"1.13.2-latest": "1.0.7-b4",
|
||||
"1.14.2-recommended": "",
|
||||
"1.14.2-latest": "1.0.8-b1"
|
||||
}
|
||||
}
|
|
@ -145,6 +145,10 @@ More to come slowly but steadily.
|
|||
- Bug reports: Yes, please let me know. Drop a mail or better open an issue
|
||||
for the repository.
|
||||
|
||||
- Translations: Please translate the 1.12 lang files if possible (because the
|
||||
1.13+ JSON language files are automatically generated from these `.lang`
|
||||
files - saves me a bit of work).
|
||||
|
||||
- Pull requests: Happily accepted. Please make sure that use the ***develop
|
||||
branch*** for pull requests. The master branch is for release versions only.
|
||||
I might merge the pull request locally if I'm ahead of the github repository,
|
||||
|
@ -154,7 +158,7 @@ More to come slowly but steadily.
|
|||
blocks under development to be registered as well.
|
||||
|
||||
----
|
||||
## Revision history
|
||||
## Version history
|
||||
|
||||
Mod versions are tracked in the readme files for individual Minecraft versions, and
|
||||
of course in the commits of this repository. Beta and release versions that are
|
||||
|
@ -166,6 +170,8 @@ commits.
|
|||
|
||||
- [1.13](1.13/readme.md)
|
||||
|
||||
- [1.14](1.14/readme.md)
|
||||
|
||||
### Community references
|
||||
|
||||
Mods covering similar features, or may fit well together with IE and the decorations of this mod:
|
||||
|
|
101
tasks.js
101
tasks.js
|
@ -1,26 +1,32 @@
|
|||
#!/usr/bin/djs
|
||||
"use strict";
|
||||
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
|
||||
const config_main_repo = fs.realpath("../engineersdecor-github");
|
||||
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod repository base directory.");
|
||||
if(!fs.isdir(".git")) throw new Error("Missing git repository in mod repository base directory.");
|
||||
const constants = include("meta/lib/constants.js")();
|
||||
const libtask = include("meta/lib/libtask.js")(constants);
|
||||
const libassets = include("meta/lib/libassets.js")(constants);
|
||||
const modid = constants.mod_registry_name();
|
||||
const with_113 = false;
|
||||
var tasks = {};
|
||||
|
||||
tasks["update-json"] = function() {
|
||||
const root_dir = fs.realpath(fs.dirname(sys.script));
|
||||
var update_jsons = {
|
||||
"1.12.2": JSON.parse(fs.readfile(root_dir + "/1.12/meta/update.json")),
|
||||
"1.13.2": JSON.parse(fs.readfile(root_dir + "/1.13/meta/update.json"))
|
||||
"1.13.2": JSON.parse(fs.readfile(root_dir + "/1.13/meta/update.json")),
|
||||
"1.14.2": JSON.parse(fs.readfile(root_dir + "/1.14/meta/update.json"))
|
||||
};
|
||||
var update_json = {
|
||||
homepage: "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.12.2": update_jsons["1.12.2"]["1.12.2"],
|
||||
"1.13.2": update_jsons["1.13.2"]["1.13.2"],
|
||||
"1.14.2": update_jsons["1.14.2"]["1.14.2"],
|
||||
promos: {
|
||||
"1.12.2-recommended": update_jsons["1.12.2"]["promos"]["1.12.2-recommended"],
|
||||
"1.12.2-latest": update_jsons["1.12.2"]["promos"]["1.12.2-latest"],
|
||||
"1.13.2-recommended": update_jsons["1.13.2"]["promos"]["1.13.2-recommended"],
|
||||
"1.13.2-latest": update_jsons["1.13.2"]["promos"]["1.13.2-latest"],
|
||||
"1.14.2-recommended": update_jsons["1.14.2"]["promos"]["1.14.2-recommended"],
|
||||
"1.14.2-latest": update_jsons["1.14.2"]["promos"]["1.14.2-latest"]
|
||||
}
|
||||
}
|
||||
fs.mkdir(root_dir + "/meta");
|
||||
|
@ -33,7 +39,7 @@ tasks["sync-main-repository"] = function() {
|
|||
if(sys.shell("git remote -v") != "") throw new Error("Dev repository has a remote set.");
|
||||
if(main_repo_local == "") throw new Error("Main repository (real) path not found.");
|
||||
const test_repo_local = fs.cwd();
|
||||
const main_repo_local = fs.realpath(config_main_repo);
|
||||
const main_repo_local = fs.realpath("../engineersdecor-github");
|
||||
if(main_repo_local == fs.realpath(test_repo_local)) throw new Error("This is already the main repository");
|
||||
const cd_dev = function(subdir) {
|
||||
if((!fs.chdir(test_repo_local)) || (!fs.isdir(".git"))) throw new Error("Failed to switch to mod source directory.");
|
||||
|
@ -65,10 +71,83 @@ tasks["sync-main-repository"] = function() {
|
|||
print(sys.shell("git status -s"))
|
||||
};
|
||||
|
||||
const task_name = sys.args[0];
|
||||
if((task_name===undefined) || (tasks[task_name])===undefined) {
|
||||
alert("No task ", task_name);
|
||||
exit(1);
|
||||
} else {
|
||||
tasks[task_name]();
|
||||
tasks["compare-textures"] = function(args) {
|
||||
if(args.length==0) args.push("");
|
||||
// const verbose = (args.find("-v")) || (args.find("--verbose")); //// NO ARRAY.FIND???? --> fix in JS engine
|
||||
const verbose = (args[0]=="-v") || (args[0]=="-verbose"); //// NO ARRAY.FIND???? --> fix in JS engine
|
||||
function compare(va, vb) {
|
||||
const cmp = libassets.compare_textures(
|
||||
va+"/src/main/resources/assets",
|
||||
vb+"/src/main/resources/assets"
|
||||
);
|
||||
const n_diff = Object.keys(cmp.differ).length;
|
||||
const n_match = Object.keys(cmp.match).length;
|
||||
const n_onlya = Object.keys(cmp.onlyin_a).length;
|
||||
const n_onlyb = Object.keys(cmp.onlyin_b).length;
|
||||
if(!verbose) {
|
||||
if((n_diff==0) && (n_onlya==0) && (n_onlyb==0)) return true;
|
||||
print("[warn] Textures of " + va + "<->" + vb + " differ: " + n_match + " matching, " + n_diff +
|
||||
" different, " + n_onlya + " only in " + va + ", " + n_onlyb + " only in " + vb +
|
||||
". (--verbose for details)");
|
||||
return false;
|
||||
} else {
|
||||
if((n_diff==0) && (n_onlya==0) && (n_onlyb==0)) {
|
||||
print("[pass] Textures of " + va + "<->" + vb + " all match.");
|
||||
return true;
|
||||
}
|
||||
for(var key in cmp.differ) {
|
||||
print("[warn] Texture of " + va + "<->" + vb + " differs: '" + key + "'.");
|
||||
}
|
||||
for(var key in cmp.onlyin_a) {
|
||||
print("[warn] Texture only in " + va + ": '" + key + "'.");
|
||||
}
|
||||
for(var key in cmp.onlyin_b) {
|
||||
print("[warn] Texture only in " + vb + ": '" + key + "'.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var ok = true;
|
||||
if(with_113 && !compare("1.12", "1.13")) ok = false;
|
||||
if(!compare("1.12", "1.14")) ok = false;
|
||||
return ok;
|
||||
};
|
||||
|
||||
tasks["migrate-textures"] = function(args) {
|
||||
if(args.length==0) args.push("");
|
||||
const verbose = (args[0]=="-v") || (args[0]=="-verbose");
|
||||
throw new Error("Migration is WIP");
|
||||
}
|
||||
|
||||
tasks["compare-blockstates"] = function(args) {
|
||||
if(args.length==0) args.push("");
|
||||
const verbose = (args[0]=="-v") || (args[0]=="-verbose");
|
||||
const compare = function(va, vb) {
|
||||
const cmp = libassets.compare_blockstates(va+"/src/main/resources/assets/"+modid, vb+"/src/main/resources/assets/"+modid);
|
||||
const n_onlya = Object.keys(cmp.onlyin_a).length;
|
||||
const n_onlyb = Object.keys(cmp.onlyin_b).length;
|
||||
if(!verbose) {
|
||||
if((n_onlya==0) && (n_onlyb==0)) return true;
|
||||
print("[warn] Block states of " + va + "<->" + vb + " differ: " + n_onlya + " only in " + va + ", " + n_onlyb + " only in " + vb + ". (--verbose for details)");
|
||||
return false;
|
||||
} else {
|
||||
if((n_onlya==0) && (n_onlyb==0)) {
|
||||
print("[pass] Block states of " + va + "<->" + vb + " all match.");
|
||||
return true;
|
||||
}
|
||||
for(var key in cmp.onlyin_a) {
|
||||
print("[warn] Block states only in " + va + ", not " + vb + ": '" + key + "'.");
|
||||
}
|
||||
for(var key in cmp.onlyin_b) {
|
||||
print("[warn] Block states only in " + vb + ", not " + va + ": '" + key + "'.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var ok = true;
|
||||
if(with_113 && !compare("1.12", "1.13")) ok = false;
|
||||
if(!compare("1.12", "1.14")) ok = false;
|
||||
return ok;
|
||||
};
|
||||
|
||||
libtask.run(tasks, sys.args, true, ".");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue