Skip to content

Commit

Permalink
修复一点小Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CSneko committed Aug 4, 2024
1 parent 3609274 commit 1c3dfa8
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 58 deletions.
98 changes: 50 additions & 48 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

插件版需要的前置插件: [ctlib](https://modrinth.com/plugin/ctlib)

**目前插件版暂停开发了哦**

## 小提示
如果你遇到了部分语言与你的实际语言不同,只需要修改[配置文件](#配置)中的`language`就可以了哦

Expand Down
1 change: 1 addition & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Pre-mod required for the module version (must be added): [ctlib](https://modrint

Pre-plugin required for the plugin version: [ctlib](https://modrinth.com/plugin/ctlib)

**Currently the plugin version is temporarily suspended**
## Tips
If you found that some text isn't your language, just modify [the config file](#configuration) to your language.

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ geckolib_version=4.5.6
# Trinkets
trinkets_version = 3.10.0
# Mod Properties
mod_version = 1.1.7
mod_version = 1.1.8
maven_group = org.cneko
archives_base_name = toNeko
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
}

if (playerEntity == null || !playerEntity.getAbilities().creativeMode) {
// 把玩家变成猫猫
if (!world.isClient) {
toneko(world, playerEntity, user.getActiveHand());
}
if (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
}
Expand All @@ -75,7 +79,9 @@ public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {

}
// 把玩家变成猫猫
toneko(world, playerEntity, user.getActiveHand());
if (!world.isClient) {
toneko(world, playerEntity, user.getActiveHand());
}
user.emitGameEvent(GameEvent.DRINK);
return stack;
}
Expand Down
28 changes: 20 additions & 8 deletions src/main/java/org/cneko/toneko/fabric/items/ToNekoItems.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package org.cneko.toneko.fabric.items;

import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.item.ItemGroups;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.cneko.toneko.common.util.ConfigUtil;

Expand All @@ -17,6 +21,8 @@ public class ToNekoItems {
public static NekoArmor.NekoEarsItem NEKO_EARS;
public static NekoArmor.NekoTailItem NEKO_TAIL;
public static NekoArmor.NekoPawsItem NEKO_PAWS;
public static RegistryKey<ItemGroup> TONEKO_ITEM_GROUP_KEY;
public static ItemGroup TONEKO_ITEM_GROUP;
public static boolean isGeckolibInstalled = FabricLoader.getInstance().isModLoaded("geckolib");
public static boolean isTrinketsInstalled = FabricLoader.getInstance().isModLoaded("trinkets");
public static void init() {
Expand All @@ -32,7 +38,6 @@ public static void registerWithOutConfig() {
NEKO_COLLECTOR = new NekoCollectorItem();
Registry.register(Registries.ITEM, Identifier.of(MODID, NekoPotionItem.ID), NEKO_POTION);
Registry.register(Registries.ITEM, Identifier.of(MODID, NekoCollectorItem.ID), NEKO_COLLECTOR);

// 如果安装了geckolib,则注册为ArmorItem
if (isGeckolibInstalled) {
// 如果安装了trinkets,则注册为TrinketItem
Expand All @@ -46,16 +51,23 @@ public static void registerWithOutConfig() {
Registry.register(Registries.ITEM, Identifier.of(MODID, NekoArmor.NekoEarsItem.ID), NEKO_EARS);
Registry.register(Registries.ITEM, Identifier.of(MODID, NekoArmor.NekoTailItem.ID), NEKO_TAIL);
Registry.register(Registries.ITEM, Identifier.of(MODID, NekoArmor.NekoPawsItem.ID), NEKO_PAWS);
TONEKO_ITEM_GROUP = FabricItemGroup.builder()
.icon(() -> new ItemStack(NEKO_EARS))
.displayName(Text.translatable("itemGroup.toneko"))
.build();
}else {
TONEKO_ITEM_GROUP = FabricItemGroup.builder()
.icon(() -> new ItemStack(NEKO_POTION))
.displayName(Text.translatable("itemGroup.toneko"))
.build();
}
// 注册物品组
TONEKO_ITEM_GROUP_KEY = RegistryKey.of(Registries.ITEM_GROUP.getKey(), Identifier.of(MODID, "item_group"));
Registry.register(Registries.ITEM_GROUP, TONEKO_ITEM_GROUP_KEY,TONEKO_ITEM_GROUP);

// 注册到物品组
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register(content -> {
ItemGroupEvents.modifyEntriesEvent(TONEKO_ITEM_GROUP_KEY).register(content -> {
content.add(NEKO_POTION);
});
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(content -> {
content.add(NEKO_COLLECTOR);
});
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(content -> {
if (isGeckolibInstalled) {
content.add(NEKO_EARS);
content.add(NEKO_TAIL);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/toneko/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"item.toneko.neko_ears": "Neko ears",
"item.toneko.neko_collector": "Neko collector",
"item.toneko.neko_collector.info": "%d / %d Neko Energy already",
"itemGroup.toneko": "Neko",
"attribute.name.neko.degree": "neko degree",
"enchantment.toneko.reversion": "Reversion",
"quirk.toneko.caress": "caress",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/toneko/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"item.toneko.neko_ears": "猫耳朵",
"item.toneko.neko_collector": "喵喵吸收器",
"item.toneko.neko_collector.info": "已经吸收 %d / %d 猫猫能量啦",
"itemGroup.toneko": "猫猫",
"attribute.name.neko.degree": "猫猫等级",
"enchantment.toneko.reversion": "反转",
"quirk.toneko.caress": "抚摸",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/toneko/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"item.toneko.neko_ears": "貓耳朵",
"item.toneko.neko_collector": "猫猫吸收器",
"item.toneko.neko_collector.info": "已有%d / %d 猫猫能量",
"itemGroup.toneko": "猫猫",
"attribute.name.neko.degree": "猫猫等级",
"enchantment.toneko.reversion": "反轉",
"quirk.toneko.caress": "撫摸",
Expand Down

0 comments on commit 1c3dfa8

Please sign in to comment.