Skip to content

Commit 723929e

Browse files
committed
feat: 搬运kubejs的create\tconstruct\80extend.js\apothesis\sophisticatedbackpacks\immersive aircraft配方
1 parent 876d626 commit 723929e

27 files changed

Lines changed: 3008 additions & 164 deletions

dependencies.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies {
3333
modImplementation(ctnh.createliquidfuel)
3434
// modImplementation(ctnh.createoreexcavation)
3535
modImplementation(ctnh.creatediesel)
36+
modImplementation(ctnh.immersiveaircraft)
3637
modImplementation(ctnh.createnewage)
3738

3839
// season

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
import io.github.cpearl0.ctnhcore.data.recipe.*;
55
import io.github.cpearl0.ctnhcore.data.recipe.chain.*;
66
import io.github.cpearl0.ctnhcore.data.recipe.cogniassembly.WetwareCircuit;
7+
import io.github.cpearl0.ctnhcore.data.recipe.create.CreateMetallurgyRecipes;
8+
import io.github.cpearl0.ctnhcore.data.recipe.create.CreateOreExcavationRecipes;
79
import io.github.cpearl0.ctnhcore.data.recipe.create.CreateRecipes;
810
import io.github.cpearl0.ctnhcore.data.recipe.generated.HyperRotorRecipes;
11+
import io.github.cpearl0.ctnhcore.data.recipe.immersiveaircraft.ImmersiveAircraftRecipes;
912
import io.github.cpearl0.ctnhcore.data.recipe.mana.DigesterRecipes;
1013
import io.github.cpearl0.ctnhcore.data.recipe.mana.EternalGardenRecipes;
1114
import io.github.cpearl0.ctnhcore.data.recipe.mana.MiscManaRecipes;
@@ -15,6 +18,7 @@
1518
import io.github.cpearl0.ctnhcore.data.recipe.modmodify.EIORecipes;
1619
import io.github.cpearl0.ctnhcore.data.recipe.modmodify.omnicells.QuantumOmniRecipes;
1720
import io.github.cpearl0.ctnhcore.data.recipe.multiblock.*;
21+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.TConstructRecipes;
1822
import io.github.cpearl0.ctnhcore.registry.*;
1923
import io.github.cpearl0.ctnhcore.registry.machines.CTNHMachines;
2024

@@ -118,6 +122,8 @@ public void addRecipes(Consumer<FinishedRecipe> provider) {
118122
NaquadahReactorRecipes.init(provider);
119123
DefaultRecipes.init(provider);
120124
CrafttableScriptRecipe.init(provider);
125+
ApothesisScriptRecipe.init(provider);
126+
SophisticatedBackpacksScriptRecipe.init(provider);
121127
AlumiumChain.init(provider);
122128
PlatinumLine.init(provider);
123129
BrineChain.init(provider);
@@ -153,6 +159,10 @@ public void addRecipes(Consumer<FinishedRecipe> provider) {
153159
ZirconChain.init(provider);
154160

155161
CreateRecipes.init(provider);
162+
ImmersiveAircraftRecipes.init(provider);
163+
CreateOreExcavationRecipes.init(provider);
164+
CreateMetallurgyRecipes.init(provider);
165+
TConstructRecipes.init(provider);
156166

157167
CasingRecipes.init(provider);
158168
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,12 @@
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;
7+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.CTNHConstructCastingRecipes;
8+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.CTNHConstructMeltingRecipes;
9+
import io.github.cpearl0.ctnhcore.data.recipe.tconstruct.CTNHConstructModifierRecipes;
910
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialPartTextureGenerator;
1011
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialRenderInfoProvider;
1112
import io.github.cpearl0.ctnhcore.data.provider.CTNHConstructMaterialSpriteProvider;
@@ -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())

src/main/java/io/github/cpearl0/ctnhcore/common/CommonProxy.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import io.github.cpearl0.ctnhcore.CTNHConfig;
44
import io.github.cpearl0.ctnhcore.CTNHCore;
5+
import io.github.cpearl0.ctnhcore.client.ponder.CTNHCorePonderPlugin;
56
import io.github.cpearl0.ctnhcore.common.world.CTNHChunkLoading;
67
import io.github.cpearl0.ctnhcore.data.CTNHCoreDatagen;
7-
import io.github.cpearl0.ctnhcore.client.ponder.CTNHCorePonderPlugin;
88
import io.github.cpearl0.ctnhcore.data.materials.AeCrystalScienceMaterials;
99
import io.github.cpearl0.ctnhcore.data.materials.AeOmniMaterials;
1010
import io.github.cpearl0.ctnhcore.registry.*;
@@ -14,7 +14,6 @@
1414
import io.github.cpearl0.ctnhcore.registry.machines.GTMachineModify;
1515
import io.github.cpearl0.ctnhcore.registry.material.CTNHMaterials;
1616
import io.github.cpearl0.ctnhcore.registry.material.GTMaterialAddon;
17-
import tech.vixhentx.mcmod.ctnhlib.client.ponder.CTNHPonderLang;
1817

1918
import com.gregtechceu.gtceu.api.GTCEuAPI;
2019
import com.gregtechceu.gtceu.api.data.DimensionMarker;
@@ -41,6 +40,8 @@
4140
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
4241
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
4342

43+
import tech.vixhentx.mcmod.ctnhlib.client.ponder.CTNHPonderLang;
44+
4445
import java.util.Set;
4546

4647
@Mod.EventBusSubscriber(modid = CTNHCore.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
@@ -135,7 +136,7 @@ public static void gatherData(GatherDataEvent event) {
135136
generator.addProvider(true, new BiomeTagsLoader(packOutput, registries, existingFileHelper));
136137
DatapackBuiltinEntriesProvider provider = generator.addProvider(true, new DatapackBuiltinEntriesProvider(
137138
packOutput, registries, new RegistrySetBuilder()
138-
.add(Registries.DAMAGE_TYPE, CTNHDamageTypes::bootstrap),
139+
.add(Registries.DAMAGE_TYPE, CTNHDamageTypes::bootstrap),
139140
set));
140141
}
141142

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+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package io.github.cpearl0.ctnhcore.common.tconstruct.modifier;
2+
3+
import net.minecraft.world.entity.Entity;
4+
import net.minecraft.world.item.ItemStack;
5+
import net.minecraft.world.item.Items;
6+
import net.minecraft.world.level.Level;
7+
8+
import com.ctnhlang.CN;
9+
import com.ctnhlang.Category;
10+
import com.ctnhlang.Domain;
11+
import com.ctnhlang.EN;
12+
import com.ctnhlang.Key;
13+
import slimeknights.tconstruct.library.modifiers.Modifier;
14+
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
15+
import slimeknights.tconstruct.library.modifiers.ModifierHooks;
16+
import slimeknights.tconstruct.library.modifiers.hook.combat.MeleeHitModifierHook;
17+
import slimeknights.tconstruct.library.module.ModuleHookMap;
18+
import slimeknights.tconstruct.library.tools.context.ToolAttackContext;
19+
import slimeknights.tconstruct.library.tools.helper.ModifierUtil;
20+
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;
21+
import tech.vixhentx.mcmod.ctnhlib.langprovider.Lang;
22+
23+
@Domain("modifier")
24+
@Category("snowcity")
25+
public class SnowcityModifier extends Modifier implements MeleeHitModifierHook {
26+
27+
@EN("Snowcity")
28+
@CN("斯诺大习题")
29+
@Key("modifier.ctnhcore.snowcity")
30+
static Lang name;
31+
32+
@EN("Has a chance to drop gold when attacking.")
33+
@CN("攻击时概率掉落金。")
34+
@Key("modifier.ctnhcore.snowcity.description")
35+
static Lang description;
36+
37+
@Override
38+
protected void registerHooks(ModuleHookMap.Builder hookBuilder) {
39+
hookBuilder.addHook(this, ModifierHooks.MELEE_HIT);
40+
}
41+
42+
@Override
43+
public void afterMeleeHit(IToolStackView tool, ModifierEntry modifier, ToolAttackContext context,
44+
float damageDealt) {
45+
Level level = context.getLevel();
46+
Entity target = context.getTarget();
47+
if (level.isClientSide || context.getPlayerAttacker() == null || target == null) return;
48+
49+
// 迁移自 kubejs/server_scripts/src/tconstruct/modiifiers/snowcity.js。
50+
int chance = modifier.getLevel() * 10;
51+
double x = target.getX() + level.random.nextInt(3) - 1;
52+
double y = target.getY() + 1;
53+
double z = target.getZ() + level.random.nextInt(3) - 1;
54+
if (level.random.nextInt(100) < chance) {
55+
ModifierUtil.dropItem(level, x, y, z, new ItemStack(Items.GOLD_INGOT));
56+
}
57+
if (level.random.nextInt(1000) < chance) {
58+
ModifierUtil.dropItem(level, x, y, z, new ItemStack(Items.GOLD_BLOCK));
59+
}
60+
}
61+
}

src/main/java/io/github/cpearl0/ctnhcore/data/provider/CTNHConstructModifierProvider.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@ protected void addModifiers() {
2323
buildModifier(CTNHConstructModifier.Ids.GLOBAL_TRAVELLER)
2424
.levelDisplay(ModifierLevelDisplay.NO_LEVELS)
2525
.build();
26+
buildModifier(CTNHConstructModifier.Ids.SNOW_CITY)
27+
.build();
28+
buildModifier(CTNHConstructModifier.Ids.FORTIFICATION)
29+
.build();
2630
}
2731
}

0 commit comments

Comments
 (0)