Skip to content

Commit

Permalink
部分问题修正
Browse files Browse the repository at this point in the history
- 修正与 Retro Damage Indicators 模组的渲染冲突
- 修正与 L_Ender's Cataclysm 导致的类加载问题
- 为仆人铃添加音效
- 修正攻击村民的问题
- 为妖怪名单添加合成表
  • Loading branch information
TartaricAcid committed Sep 11, 2024
1 parent 4015ecf commit ba7b453
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.tartaricacid.touhoulittlemaid.client.renderer.entity;

import com.github.tartaricacid.touhoulittlemaid.api.entity.IMaid;
import com.github.tartaricacid.touhoulittlemaid.capability.GeckoMaidEntityCapabilityProvider;
import com.github.tartaricacid.touhoulittlemaid.client.entity.GeckoMaidEntity;
import com.github.tartaricacid.touhoulittlemaid.client.renderer.entity.geckolayer.*;
Expand Down Expand Up @@ -30,7 +31,7 @@ public void render(T entity, float entityYaw, float partialTick, PoseStack poseS
@Override
@SuppressWarnings("unchecked")
public GeckoMaidEntity<T> getAnimatableEntity(T entity) {
return entity.getCapability(GeckoMaidEntityCapabilityProvider.CAP).map(e -> (GeckoMaidEntity<T>) e).orElseThrow();
return entity.getCapability(GeckoMaidEntityCapabilityProvider.CAP).map(e -> (GeckoMaidEntity<T>) e).orElse(new GeckoMaidEntity<>(entity, IMaid.convert(entity)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ public static void initDefault(Level level) {
}

ForgeRegistries.ENTITY_TYPES.getValues().forEach(type -> {
Entity entity = type.create(level);
Entity entity = null;

// 因为某些模组方法 create 实体会失败
try {
entity = type.create(level);
} catch (Exception e) {
e.fillInStackTrace();
}

if (!(entity instanceof LivingEntity livingEntity)) {
return;
}
Expand Down Expand Up @@ -83,7 +91,7 @@ public static MonsterType getMonsterType(EntityType<?> entityType) {
public static boolean canAttack(EntityMaid maid, LivingEntity target, MonsterType monsterType) {
// 友好生物,无论什么情况不攻击
if (monsterType == MonsterType.FRIENDLY) {
return true;
return false;
}

// 中立生物,只有玩家攻击的,或者攻击过玩家的才会攻击
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionResultHolder;
Expand Down Expand Up @@ -113,6 +115,7 @@ public void releaseUsing(ItemStack stack, Level worldIn, LivingEntity entityLivi
teleportMaid(player, maids);
}
}
worldIn.playSound(null, player.blockPosition(), SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F);
player.getCooldowns().addCooldown(this, 20);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"type": "touhou_little_maid:altar_crafting",
"output": {
"type": "minecraft:item",
"nbt": {
"Item": {
"id": "touhou_little_maid:monster_list",
"Count": 1
}
}
},
"power": 0.2,
"ingredients": [
{
"tag": "forge:dusts/redstone"
},
{
"tag": "forge:dusts/redstone"
},
{
"tag": "forge:nuggets/gold"
},
{
"tag": "forge:nuggets/gold"
},
{
"item": "minecraft:book"
},
{
"item": "minecraft:book"
}
]
}

0 comments on commit ba7b453

Please sign in to comment.