Skip to content

Commit

Permalink
同步 1.20 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Nov 12, 2024
1 parent 3a5b4da commit 5eda224
Show file tree
Hide file tree
Showing 39 changed files with 361 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"touhou_little_maid:danmaku_ender_killer"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"touhou_little_maid:danmaku"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"touhou_little_maid:fairy"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"touhou_little_maid:fairy"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"touhou_little_maid:danmaku"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"touhou_little_maid:fairy"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_book": {
"conditions": {
"items": [
{
"items": "minecraft:book"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "touhou_little_maid:entity_id_copy"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_book"
]
],
"rewards": {
"recipes": [
"touhou_little_maid:entity_id_copy"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
"group": "altar_recipe",
"ingredients": [
{
"tag": "c:dusts/redstone"
"tag": "minecraft:planks"
},
{
"tag": "c:dusts/redstone"
"tag": "minecraft:planks"
},
{
"tag": "c:nuggets/gold"
"tag": "minecraft:planks"
},
{
"tag": "c:nuggets/gold"
"tag": "c:dyes/black"
},
{
"item": "minecraft:book"
"tag": "c:dyes/red"
},
{
"item": "minecraft:book"
"tag": "c:gems/diamond"
}
],
"lang": "jei.touhou_little_maid.altar_craft.item_craft.result",
"power": 0.2,
"power": 0.1,
"result": {
"count": 1,
"id": "touhou_little_maid:monster_list"
"id": "touhou_little_maid:cchess"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"type": "touhou_little_maid:altar_recipe_serializers",
"category": "misc",
"entity": "minecraft:item",
"group": "altar_recipe",
"ingredients": [
{
"tag": "minecraft:planks"
},
{
"tag": "minecraft:planks"
},
{
"tag": "minecraft:planks"
},
{
"tag": "c:dyes/black"
},
{
"tag": "c:dyes/white"
},
{
"tag": "c:gems/emerald"
}
],
"lang": "jei.touhou_little_maid.altar_craft.item_craft.result",
"power": 0.1,
"result": {
"count": 1,
"id": "touhou_little_maid:wchess"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"tag": "c:leathers"
},
{
"item": "minecraft:paper"
}
],
"result": {
"count": 1,
"id": "touhou_little_maid:entity_id_copy"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static void maidMove(ServerPlayer player, Level level, BlockPos pos, int
&& sit.getFirstPassenger() instanceof EntityMaid maid && maid.isOwnedBy(player)) {
// TODO: 暂时不加段位系统
maid.getFavorabilityManager().apply(Type.CCHESS_WIN);
maid.getGameRecordManager().markStatue(true);
maid.getGameRecordManager().markStatue(false);
InitTrigger.MAID_EVENT.get().trigger(player, TriggerType.WIN_CCHESS);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public static void maidMove(ServerPlayer player, Level level, BlockPos pos, int
if (level instanceof ServerLevel serverLevel && serverLevel.getEntity(sitId) instanceof EntitySit sit && sit.getFirstPassenger() instanceof EntityMaid maid) {
maid.swing(InteractionHand.MAIN_HAND);
if (playerLost) {
maid.getGameRecordManager().markStatue(false);
maid.getGameRecordManager().markStatue(true);
}
}
level.playSound(null, pos, InitSounds.GOMOKU.get(), SoundSource.BLOCKS, 1.0f, 0.8F + level.random.nextFloat() * 0.4F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public ItemInteractionResult useItemOn(ItemStack itemStack, BlockState state, Le
// 但是和其他人的女仆对弈不加好感哦
if (statue == Statue.WIN && maid.isOwnedBy(player)) {
maid.getFavorabilityManager().apply(Type.GOMOKU_WIN);
maid.getGameRecordManager().markStatue(true);
maid.getGameRecordManager().markStatue(false);
int rankBefore = MaidGomokuAI.getRank(maid);
maid.getGameRecordManager().increaseGomokuWinCount();
int rankAfter = MaidGomokuAI.getRank(maid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static void maidMove(ServerPlayer player, Level level, BlockPos pos, int
&& sit.getFirstPassenger() instanceof EntityMaid maid && maid.isOwnedBy(player)) {
// TODO: 暂时不加段位系统
maid.getFavorabilityManager().apply(Type.WCHESS_WIN);
maid.getGameRecordManager().markStatue(true);
maid.getGameRecordManager().markStatue(false);
InitTrigger.MAID_EVENT.get().trigger(player, TriggerType.WIN_WCHESS);
}

Expand Down Expand Up @@ -128,7 +128,7 @@ public static void maidMove(ServerPlayer player, Level level, BlockPos pos, int
if (level instanceof ServerLevel serverLevel && serverLevel.getEntity(sitId) instanceof EntitySit sit && sit.getFirstPassenger() instanceof EntityMaid maid) {
maid.swing(InteractionHand.MAIN_HAND);
if (playerLost) {
maid.getGameRecordManager().markStatue(false);
maid.getGameRecordManager().markStatue(true);
}
}
level.playSound(null, pos, InitSounds.GOMOKU.get(), SoundSource.BLOCKS, 1.0f, 0.8F + level.random.nextFloat() * 0.4F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.util.Map;
import java.util.Objects;

import static com.github.tartaricacid.touhoulittlemaid.util.ResourceLocationUtil.isValidResourceLocation;

@IPNPlayerSideOnly
@IPNGuiHint(button = IPNButton.SORT, horizontalOffset = -36, bottom = -12)
@IPNGuiHint(button = IPNButton.SORT_COLUMNS, horizontalOffset = -24, bottom = -24)
Expand Down Expand Up @@ -119,7 +121,7 @@ private void addMonsterType() {
if (StringUtils.isBlank(value)) {
return;
}
if (!ResourceLocation.isValidNamespace(value)) {
if (!isValidResourceLocation(value)) {
return;
}
ResourceLocation id = ResourceLocation.parse(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.github.tartaricacid.touhoulittlemaid.datagen;

import com.github.tartaricacid.touhoulittlemaid.TouhouLittleMaid;
import com.github.tartaricacid.touhoulittlemaid.datagen.tag.DamageTypeGenerator;
import com.github.tartaricacid.touhoulittlemaid.datagen.tag.EntityTypeGenerator;
import com.github.tartaricacid.touhoulittlemaid.datagen.tag.TagBlock;
import com.github.tartaricacid.touhoulittlemaid.datagen.tag.TagItem;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.neoforged.api.distmarker.Dist;
Expand Down Expand Up @@ -50,6 +54,8 @@ public static void gatherData(GatherDataEvent event) {
.addProvider(packOutput -> new TagBlock(packOutput, registries, TouhouLittleMaid.MOD_ID, existingFileHelper));
vanillaPack.addProvider(
packOutput -> new TagItem(packOutput, registries, blockTagsProvider.contentsGetter(), TouhouLittleMaid.MOD_ID, existingFileHelper));
generator.addProvider(event.includeServer(), new DamageTypeGenerator(pack, event.getLookupProvider(), event.getExistingFileHelper()));
generator.addProvider(event.includeServer(), new EntityTypeGenerator(pack, event.getLookupProvider(), event.getExistingFileHelper()));

// Registry Based Stuff
DatapackBuiltinEntriesProvider datapackProvider = new RegistryDataGenerator(pack, event.getLookupProvider());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.tartaricacid.touhoulittlemaid.datagen;

import com.github.tartaricacid.touhoulittlemaid.datagen.tag.TagItem;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.RegistryAccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,22 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.requires(Tags.Items.GEMS_DIAMOND)
.save(recipeOutput);

AltarRecipeBuilder.shapeless(RecipeCategory.MISC, InitItems.CCHESS)
.power(0.1F)
.requires(3, ItemTags.PLANKS)
.requires(Tags.Items.DYES_BLACK)
.requires(Tags.Items.DYES_RED)
.requires(Tags.Items.GEMS_DIAMOND)
.save(recipeOutput);

AltarRecipeBuilder.shapeless(RecipeCategory.MISC, InitItems.WCHESS)
.power(0.1F)
.requires(3, ItemTags.PLANKS)
.requires(Tags.Items.DYES_BLACK)
.requires(Tags.Items.DYES_WHITE)
.requires(Tags.Items.GEMS_EMERALD)
.save(recipeOutput);

AltarRecipeBuilder.shapeless(RecipeCategory.MISC, InitItems.HAKUREI_GOHEI)
.power(0.15F)
.requires(3, Tags.Items.RODS_WOODEN)
Expand Down Expand Up @@ -281,13 +297,6 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.requires(2, Tags.Items.RODS_WOODEN)
.save(recipeOutput);

AltarRecipeBuilder.shapeless(RecipeCategory.MISC, InitItems.MONSTER_LIST)
.power(0.2F)
.requires(2, Tags.Items.DUSTS_REDSTONE)
.requires(2, Tags.Items.NUGGETS_GOLD)
.requires(2, Items.BOOK)
.save(recipeOutput);

ItemStack entityPlaceholder = new ItemStack(InitItems.ENTITY_PLACEHOLDER.asItem());
entityPlaceholder.set(InitDataComponent.RECIPES_ID_TAG, "reborn_maid");
AltarRecipeBuilder.shapeless(RecipeCategory.MISC, entityPlaceholder)
Expand Down Expand Up @@ -374,5 +383,11 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.define('R', Tags.Items.DUSTS_REDSTONE)
.unlockedBy(getHasName(Items.REDSTONE), has(Tags.Items.DUSTS_REDSTONE))
.save(recipeOutput);

ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, InitItems.ENTITY_ID_COPY)
.requires(Tags.Items.LEATHERS)
.requires(Items.PAPER)
.unlockedBy(getHasName(Items.BOOK), has(Items.BOOK))
.save(recipeOutput);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.tartaricacid.touhoulittlemaid.datagen.tag;

import com.github.tartaricacid.touhoulittlemaid.TouhouLittleMaid;
import com.github.tartaricacid.touhoulittlemaid.init.InitDamage;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.DamageTypeTagsProvider;
import net.minecraft.tags.DamageTypeTags;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

public class DamageTypeGenerator extends DamageTypeTagsProvider {
public DamageTypeGenerator(PackOutput pOutput, CompletableFuture<HolderLookup.Provider> pLookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
super(pOutput, pLookupProvider, TouhouLittleMaid.MOD_ID, existingFileHelper);
}

@Override
protected void addTags(HolderLookup.Provider pProvider) {
this.tag(DamageTypeTags.IS_PROJECTILE).add(InitDamage.DANMAKU);
this.tag(DamageTypeTags.ALWAYS_HURTS_ENDER_DRAGONS).add(InitDamage.DANMAKU_ENDER_KILLER);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.tartaricacid.touhoulittlemaid.datagen.tag;

import com.github.tartaricacid.touhoulittlemaid.init.InitEntities;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.tags.EntityTypeTags;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.common.data.internal.NeoForgeEntityTypeTagsProvider;

import java.util.concurrent.CompletableFuture;

public class EntityTypeGenerator extends NeoForgeEntityTypeTagsProvider {
public EntityTypeGenerator(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, ExistingFileHelper existingFileHelper) {
super(output, lookupProvider, existingFileHelper);
}

@Override
public void addTags(HolderLookup.Provider lookupProvider) {
tag(EntityTypeTags.IMPACT_PROJECTILES).add(InitEntities.DANMAKU.get());
tag(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS).add(InitEntities.FAIRY.get());
tag(EntityTypeTags.FREEZE_IMMUNE_ENTITY_TYPES).add(InitEntities.FAIRY.get());
tag(EntityTypeTags.FALL_DAMAGE_IMMUNE).add(InitEntities.FAIRY.get());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.tartaricacid.touhoulittlemaid.datagen;
package com.github.tartaricacid.touhoulittlemaid.datagen.tag;

import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.tartaricacid.touhoulittlemaid.datagen;
package com.github.tartaricacid.touhoulittlemaid.datagen.tag;

import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.tartaricacid.touhoulittlemaid.datagen;
package com.github.tartaricacid.touhoulittlemaid.datagen.tag;

import com.github.tartaricacid.touhoulittlemaid.init.InitItems;
import net.minecraft.core.HolderLookup;
Expand Down
Loading

0 comments on commit 5eda224

Please sign in to comment.