Skip to content

Commit e09f061

Browse files
committed
Merge branch 'kubejs_recipe' of https://github.com/CTNH-Team/CTNH-Core into dev
2 parents 195a552 + 723929e commit e09f061

35 files changed

Lines changed: 3005 additions & 971 deletions

dependencies.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ dependencies {
3131
modImplementation(ctnh.createmetallurgy)
3232
modImplementation(ctnh.createvintage)
3333
modImplementation(ctnh.createliquidfuel)
34-
// modImplementation(ctnh.createoreexcavation)
35-
modImplementation(ctnh.creatediesel)
3634
modImplementation(ctnh.createnewage)
35+
modImplementation(ctnh.creatediesel)
3736
modImplementation(ctnh.farmersdelight)
3837
modImplementation(ctnh.clothconfig)
3938
modImplementation(ctnh.ecologics)
@@ -117,10 +116,12 @@ dependencies {
117116
modCompileOnly(ctnh.immersiveaircraft)
118117
modCompileOnly(ctnh.ftbultimine)
119118
modCompileOnly(ctnh.createcafe)
119+
modCompileOnly(ctnh.createoreexcavation)
120120
} else {
121121
modImplementation(ctnh.immersiveaircraft)
122122
modImplementation(ctnh.ftbultimine)
123123
modImplementation(ctnh.createcafe)
124+
modImplementation(ctnh.createoreexcavation)
124125
}
125126

126127
modLocalRuntime(ctnh.curios)

src/generated/resources/assets/ctnhcore/lang/en_ud.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,13 +869,17 @@
869869
"material.ctnhcore.stratus": "snʇɐɹʇS",
870870
"material.ctnhcore.zanite": "ǝʇıuɐZ",
871871
"message.ctnhcore.portal.invalid_dimension": "pןɹoʍɹǝʌO ǝɥʇ uı pǝsn ǝq ʎןuo uɐɔ ןɐʇɹod sıɥ⟘",
872+
"modifier.ctnhcore.fortification": "uoıʇɐɔıɟıʇɹoℲ",
873+
"modifier.ctnhcore.fortification.description": "˙ʇɹnɥ uǝɥʍ spןǝıɥs ʇsǝɹoℲ ʇɥbıןıʍ⟘ uo sןןɐƆ",
872874
"modifier.ctnhcore.global_traveller.global_different_dimension": "ʎʇıpıןɐʌ ǝuıɯɹǝʇǝp ʇouuɐɔ 'uoısuǝɯıp sıɥʇ uı ʇou sı ɹǝuıɐʇuoɔ punoᗺ",
873875
"modifier.ctnhcore.global_traveller.global_invalid": "pıןɐʌuı sı ɹo ʇsıxǝ ʇou sǝop ɹǝuıɐʇuoɔ punoᗺ",
874876
"modifier.ctnhcore.global_traveller.global_link": "%s %s ʇɐ ɹǝuıɐʇuoɔ oʇ ʞuıꞀ",
875877
"modifier.ctnhcore.global_traveller.global_none": "ɹǝuıɐʇuoɔ punoq oN",
876878
"modifier.ctnhcore.global_traveller.global_pos": "sǝʇɐuıpɹooƆ ɹǝuıɐʇuoƆ punoᗺ",
877879
"modifier.ctnhcore.global_traveller.global_unlink": "%s %s ʇɐ ɹǝuıɐʇuoɔ ɯoɹɟ ʞuıןu∩",
878880
"modifier.ctnhcore.global_traveller.global_valid": "uoısuǝɯıp sıɥʇ uıɥʇıʍ pıןɐʌ sı ɹǝuıɐʇuoɔ punoᗺ",
881+
"modifier.ctnhcore.snowcity": "ʎʇıɔʍouS",
882+
"modifier.ctnhcore.snowcity.description": "˙buıʞɔɐʇʇɐ uǝɥʍ pןob doɹp oʇ ǝɔuɐɥɔ ɐ sɐH",
879883
"modifier.tconstruct.global_traveller": "ɹǝןןǝʌɐɹ⟘ ןɐqoן⅁",
880884
"modifier.tconstruct.global_traveller.description": "˙ǝbɐd sǝnןɐʌ ǝʇnqıɹʇʇɐ ǝɥʇ uo pǝʍǝıʌ ǝq uɐɔ uoıʇɐɯɹoɟuı pǝןıɐʇǝᗡu\\˙ʇı oʇ pǝʇɹodǝןǝʇ ǝq ןןıʍ sqoɯ pǝןןıʞ ɯoɹɟ sdoɹp puɐ sʞɔoןq pǝʎoɹʇsǝᗡ ˙ʇı puıq oʇ ɹǝuıɐʇuoɔ ɐ uo )suodɐǝʍ pǝbuɐɹ ɹoɟ ʞɔıןɔ-ʇɟǝן( ʞɔıןɔ-ʇɥbıɹ 'buıʞɐǝus ǝןıɥM",
881885
"modifier.tconstruct.global_traveller.flavor": "˙pןɹoʍ ǝɥʇ ןǝʌɐɹ⟘",

src/generated/resources/assets/ctnhcore/lang/en_us.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,13 +869,17 @@
869869
"material.ctnhcore.stratus": "Stratus",
870870
"material.ctnhcore.zanite": "Zanite",
871871
"message.ctnhcore.portal.invalid_dimension": "This portal can only be used in the Overworld",
872+
"modifier.ctnhcore.fortification": "Fortification",
873+
"modifier.ctnhcore.fortification.description": "Calls on Twilight Forest shields when hurt.",
872874
"modifier.ctnhcore.global_traveller.global_different_dimension": "Bound container is not in this dimension, cannot determine validity",
873875
"modifier.ctnhcore.global_traveller.global_invalid": "Bound container does not exist or is invalid",
874876
"modifier.ctnhcore.global_traveller.global_link": "Link to container at %s %s",
875877
"modifier.ctnhcore.global_traveller.global_none": "No bound container",
876878
"modifier.ctnhcore.global_traveller.global_pos": "Bound Container Coordinates",
877879
"modifier.ctnhcore.global_traveller.global_unlink": "Unlink from container at %s %s",
878880
"modifier.ctnhcore.global_traveller.global_valid": "Bound container is valid within this dimension",
881+
"modifier.ctnhcore.snowcity": "Snowcity",
882+
"modifier.ctnhcore.snowcity.description": "Has a chance to drop gold when attacking.",
879883
"modifier.tconstruct.global_traveller": "Global Traveller",
880884
"modifier.tconstruct.global_traveller.description": "While sneaking, right-click (left-click for ranged weapons) on a container to bind it. Destroyed blocks and drops from killed mobs will be teleported to it.\\nDetailed information can be viewed on the attribute values page.",
881885
"modifier.tconstruct.global_traveller.flavor": "Travel the world.",

src/generated/resources/assets/ctnhcore/lang/zh_cn.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,13 +1965,17 @@
19651965
"material.gtceu.zirconium_tetrachloride": "四氯化锆",
19661966
"material.gtceu.zirkelite": "钛锆钍石",
19671967
"message.ctnhcore.portal.invalid_dimension": "该传送门只能在主世界使用",
1968+
"modifier.ctnhcore.fortification": "护盾",
1969+
"modifier.ctnhcore.fortification.description": "受伤时调用暮色森林护盾。",
19681970
"modifier.ctnhcore.global_traveller.global_different_dimension": "绑定容器不在此维度内,无法判断有效性",
19691971
"modifier.ctnhcore.global_traveller.global_invalid": "绑定容器不存在或无效",
19701972
"modifier.ctnhcore.global_traveller.global_link": "绑定到位于 %s %s 的容器",
19711973
"modifier.ctnhcore.global_traveller.global_none": "未绑定容器",
19721974
"modifier.ctnhcore.global_traveller.global_pos": "绑定容器坐标",
19731975
"modifier.ctnhcore.global_traveller.global_unlink": "取消对位于 %s %s 的容器的绑定",
19741976
"modifier.ctnhcore.global_traveller.global_valid": "绑定容器在此维度内且有效",
1977+
"modifier.ctnhcore.snowcity": "斯诺大习题",
1978+
"modifier.ctnhcore.snowcity.description": "攻击时概率掉落金。",
19751979
"modifier.tconstruct.global_traveller": "环球旅行者",
19761980
"modifier.tconstruct.global_traveller.description": "潜行时对准容器右键(远程武器为左键)以绑定。破坏的方块与杀死怪物的掉落物都会被传送到其中。\n在属性数值页面可以查看详细信息。",
19771981
"modifier.tconstruct.global_traveller.flavor": "全世界折返。",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"values": [
3+
{
4+
"id": "createmetallurgy:flowing_molten_steel",
5+
"required": false
6+
}
7+
]
8+
}

src/main/java/io/github/cpearl0/ctnhcore/CTNHCoreGTAddon.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
import io.github.cpearl0.ctnhcore.data.recipe.chain.*;
66
import io.github.cpearl0.ctnhcore.data.recipe.cogniassembly.WetwareCircuit;
77
import io.github.cpearl0.ctnhcore.data.recipe.create.CafeRecipes;
8+
import io.github.cpearl0.ctnhcore.data.recipe.create.CreateMetallurgyRecipes;
9+
import io.github.cpearl0.ctnhcore.data.recipe.create.CreateOreExcavationRecipes;
810
import io.github.cpearl0.ctnhcore.data.recipe.create.CreateRecipes;
911
import io.github.cpearl0.ctnhcore.data.recipe.create.DieselGeneratorRecipes;
10-
import io.github.cpearl0.ctnhcore.data.recipe.create.MetallurgyRecipes;
1112
import io.github.cpearl0.ctnhcore.data.recipe.generated.HyperRotorRecipes;
13+
import io.github.cpearl0.ctnhcore.data.recipe.immersiveaircraft.ImmersiveAircraftRecipes;
1214
import io.github.cpearl0.ctnhcore.data.recipe.mana.DigesterRecipes;
1315
import io.github.cpearl0.ctnhcore.data.recipe.mana.EternalGardenRecipes;
1416
import io.github.cpearl0.ctnhcore.data.recipe.mana.MiscManaRecipes;
@@ -18,6 +20,7 @@
1820
import io.github.cpearl0.ctnhcore.data.recipe.modmodify.EIORecipes;
1921
import io.github.cpearl0.ctnhcore.data.recipe.modmodify.omnicells.QuantumOmniRecipes;
2022
import io.github.cpearl0.ctnhcore.data.recipe.multiblock.*;
23+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.TConstructRecipes;
2124
import io.github.cpearl0.ctnhcore.registry.*;
2225
import io.github.cpearl0.ctnhcore.registry.machines.CTNHMachines;
2326

@@ -131,6 +134,8 @@ public void addRecipes(Consumer<FinishedRecipe> provider) {
131134
NaquadahReactorRecipes.init(provider);
132135
DefaultRecipes.init(provider);
133136
CrafttableScriptRecipe.init(provider);
137+
ApothesisScriptRecipe.init(provider);
138+
SophisticatedBackpacksScriptRecipe.init(provider);
134139
AlumiumChain.init(provider);
135140
PlatinumLine.init(provider);
136141
BrineChain.init(provider);
@@ -167,7 +172,11 @@ public void addRecipes(Consumer<FinishedRecipe> provider) {
167172

168173
CreateRecipes.init(provider);
169174
DieselGeneratorRecipes.init(provider);
170-
MetallurgyRecipes.init(provider);
175+
176+
ImmersiveAircraftRecipes.init(provider);
177+
CreateOreExcavationRecipes.init(provider);
178+
CreateMetallurgyRecipes.init(provider);
179+
TConstructRecipes.init(provider);
171180

172181
CasingRecipes.init(provider);
173182
UHVPartsRecipe.init(provider);

src/main/java/io/github/cpearl0/ctnhcore/common/tconstruct/CTNHTiCAddon.java renamed to src/main/java/io/github/cpearl0/ctnhcore/CTNHCoreTiCAddon.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
package io.github.cpearl0.ctnhcore.common.tconstruct;
1+
package io.github.cpearl0.ctnhcore;
22

3-
import io.github.cpearl0.ctnhcore.CTNHCore;
43
import io.github.cpearl0.ctnhcore.common.tconstruct.materials.CTNHConstructMaterialRecipes;
4+
import io.github.cpearl0.ctnhcore.common.tconstruct.modifier.FortificationModifier;
55
import io.github.cpearl0.ctnhcore.common.tconstruct.modifier.GlobalTraveller;
6-
import io.github.cpearl0.ctnhcore.common.tconstruct.recipes.CTNHConstructCastingRecipes;
7-
import io.github.cpearl0.ctnhcore.common.tconstruct.recipes.CTNHConstructMeltingRecipes;
8-
import io.github.cpearl0.ctnhcore.common.tconstruct.recipes.CTNHConstructModifierRecipes;
6+
import io.github.cpearl0.ctnhcore.common.tconstruct.modifier.SnowcityModifier;
97
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialPartTextureGenerator;
108
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialRenderInfoProvider;
119
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialSpriteProvider;
@@ -14,6 +12,9 @@
1412
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialsTraitsProvider;
1513
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructModifierProvider;
1614
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructToolDefinitionDataProvider;
15+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.CTNHConstructCastingRecipes;
16+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.CTNHConstructMeltingRecipes;
17+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.CTNHConstructModifierRecipes;
1718
import io.github.cpearl0.ctnhcore.registry.CTNHConstructFuel;
1819

1920
import slimeknights.tconstruct.data.resource.TiCDynamicResourceGenerator;
@@ -23,7 +24,7 @@
2324
import slimeknights.tconstruct.library.addon.TiCAddon;
2425

2526
@TiCAddon(requiredMods = CTNHCore.MODID)
26-
public class CTNHTiCAddon implements ITiCAddon, ITiCStaticModifierAddon {
27+
public class CTNHCoreTiCAddon implements ITiCAddon, ITiCStaticModifierAddon {
2728

2829
@Override
2930
public String addonModId() {
@@ -33,6 +34,8 @@ public String addonModId() {
3334
@Override
3435
public void registerStaticModifiers(StaticModifierRegistrar registrar) {
3536
registrar.register("global_traveller", GlobalTraveller::new);
37+
registrar.register("snow_city", SnowcityModifier::new);
38+
registrar.register("fortification", FortificationModifier::new);
3639
}
3740

3841
@Override

src/main/java/io/github/cpearl0/ctnhcore/client/ponder/CTNHCorePonderSceneBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.gregtechceu.gtceu.GTCEu;
66

77
import net.createmod.ponder.api.scene.SceneBuilder;
8+
89
import tech.vixhentx.mcmod.ctnhlib.client.ponder.CTNHPonderSceneBuilder;
910

1011
import static io.github.cpearl0.ctnhcore.registry.CTNHRegistration.REGISTRATE;

src/main/java/io/github/cpearl0/ctnhcore/client/ponder/CTNHCorePonderScenes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
public final class CTNHCorePonderScenes {
1616

17-
private CTNHCorePonderScenes() {
18-
}
17+
private CTNHCorePonderScenes() {}
1918

2019
public static void register(PonderSceneRegistrationHelper<ResourceLocation> helper) {
2120
helper.forComponents(CTPPMultiblockMachines.BIG_DAM.getId())
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
package io.github.cpearl0.ctnhcore.common.tconstruct.modifier;
2+
3+
import io.github.cpearl0.ctnhcore.CTNHCore;
4+
import io.github.cpearl0.ctnhcore.registry.CTNHConstructModifier;
5+
6+
import net.minecraft.nbt.CompoundTag;
7+
import net.minecraft.world.damagesource.DamageSource;
8+
import net.minecraft.world.entity.EquipmentSlot;
9+
import net.minecraft.world.entity.player.Player;
10+
import net.minecraft.world.item.ItemStack;
11+
12+
import com.ctnhlang.CN;
13+
import com.ctnhlang.Category;
14+
import com.ctnhlang.Domain;
15+
import com.ctnhlang.EN;
16+
import com.ctnhlang.Key;
17+
import slimeknights.tconstruct.library.modifiers.Modifier;
18+
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
19+
import slimeknights.tconstruct.library.modifiers.ModifierHooks;
20+
import slimeknights.tconstruct.library.modifiers.hook.armor.OnAttackedModifierHook;
21+
import slimeknights.tconstruct.library.module.ModuleHookMap;
22+
import slimeknights.tconstruct.library.tools.context.EquipmentContext;
23+
import slimeknights.tconstruct.library.tools.helper.ModifierUtil;
24+
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;
25+
import tech.vixhentx.mcmod.ctnhlib.langprovider.Lang;
26+
import twilightforest.capabilities.CapabilityList;
27+
28+
@Domain("modifier")
29+
@Category("fortification")
30+
public class FortificationModifier extends Modifier implements OnAttackedModifierHook {
31+
32+
private static final String SHIELD_COOLDOWN = CTNHCore.MODID + ":fortification_shield_cooldown";
33+
private static final int INITIAL_COOLDOWN = 600;
34+
35+
@EN("Fortification")
36+
@CN("护盾")
37+
@Key("modifier.ctnhcore.fortification")
38+
static Lang name;
39+
40+
@EN("Calls on Twilight Forest shields when hurt.")
41+
@CN("受伤时调用暮色森林护盾。")
42+
@Key("modifier.ctnhcore.fortification.description")
43+
static Lang description;
44+
45+
@Override
46+
protected void registerHooks(ModuleHookMap.Builder hookBuilder) {
47+
hookBuilder.addHook(this, ModifierHooks.ON_ATTACKED);
48+
}
49+
50+
@Override
51+
public void onAttacked(IToolStackView tool, ModifierEntry modifier, EquipmentContext context,
52+
EquipmentSlot slotType, DamageSource source, float amount, boolean isDirectDamage) {
53+
if (context.getEntity() instanceof Player player) {
54+
applyShield(player);
55+
}
56+
}
57+
58+
public static void tickCooldown(Player player) {
59+
CompoundTag data = player.getPersistentData();
60+
if (!data.contains(SHIELD_COOLDOWN)) {
61+
data.putInt(SHIELD_COOLDOWN, INITIAL_COOLDOWN);
62+
return;
63+
}
64+
int cooldown = data.getInt(SHIELD_COOLDOWN);
65+
if (cooldown > 0) {
66+
data.putInt(SHIELD_COOLDOWN, cooldown - 1);
67+
}
68+
}
69+
70+
public static void applyShield(Player player) {
71+
if (player.level().isClientSide) return;
72+
int totalLevel = getTotalLevel(player);
73+
if (totalLevel <= 0) return;
74+
75+
CompoundTag data = player.getPersistentData();
76+
if (data.getInt(SHIELD_COOLDOWN) > 0) return;
77+
78+
// 迁移自 kubejs/server_scripts/src/tconstruct/modiifiers/fortification.js;直接调用暮色森林能力,替代原指令。
79+
player.getCapability(CapabilityList.SHIELDS)
80+
.ifPresent(shields -> shields.setShields(totalLevel, true));
81+
int cooldown = Math.max(400, (int) (100 * (1 - 0.05 * totalLevel)));
82+
data.putInt(SHIELD_COOLDOWN, cooldown);
83+
}
84+
85+
private static int getTotalLevel(Player player) {
86+
int level = getLevel(player.getMainHandItem()) + getLevel(player.getOffhandItem());
87+
for (EquipmentSlot slot : new EquipmentSlot[] { EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS,
88+
EquipmentSlot.FEET }) {
89+
level += getLevel(player.getItemBySlot(slot));
90+
}
91+
return level;
92+
}
93+
94+
private static int getLevel(ItemStack stack) {
95+
if (stack.isEmpty()) return 0;
96+
return ModifierUtil.getModifierLevel(stack, CTNHConstructModifier.Ids.FORTIFICATION);
97+
}
98+
}

0 commit comments

Comments
 (0)