From 945145c4e949fa5db9a38ac10d1f91aa13d75f95 Mon Sep 17 00:00:00 2001 From: tartaric_acid Date: Mon, 11 Nov 2024 23:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A0=BC=E6=B4=9B=E5=85=8B?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=B6=EF=BC=8C=E5=A5=B3=E4=BB=86=E6=9E=AA?= =?UTF-8?q?=E6=A2=B0=E5=9B=BE=E6=A0=87=E5=B4=A9=E6=BA=83=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compat/tacz/task/TaskGunAttack.java | 10 +++++++++- .../touhoulittlemaid/init/InitItems.java | 1 + .../models/item/tacz_gun_icon.json | 6 ++++++ .../textures/item/tacz_gun_icon.png | Bin 0 -> 262 bytes 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/touhou_little_maid/models/item/tacz_gun_icon.json create mode 100644 src/main/resources/assets/touhou_little_maid/textures/item/tacz_gun_icon.png diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/tacz/task/TaskGunAttack.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/tacz/task/TaskGunAttack.java index 6132eed60..d14123a00 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/tacz/task/TaskGunAttack.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/tacz/task/TaskGunAttack.java @@ -8,11 +8,13 @@ import com.github.tartaricacid.touhoulittlemaid.compat.tacz.utils.GunBehaviorUtils; import com.github.tartaricacid.touhoulittlemaid.config.subconfig.MaidConfig; import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; +import com.github.tartaricacid.touhoulittlemaid.init.InitItems; import com.github.tartaricacid.touhoulittlemaid.init.InitSounds; import com.github.tartaricacid.touhoulittlemaid.util.SoundUtil; import com.google.common.collect.Lists; import com.mojang.datafixers.util.Pair; import com.tacz.guns.GunMod; +import com.tacz.guns.api.TimelessAPI; import com.tacz.guns.api.item.IGun; import com.tacz.guns.api.item.builder.GunItemBuilder; import net.minecraft.resources.ResourceLocation; @@ -30,6 +32,7 @@ public class TaskGunAttack implements IAttackTask { public static final ResourceLocation UID = new ResourceLocation(TouhouLittleMaid.MOD_ID, "gun_attack"); + private ItemStack icon; @Override public ResourceLocation getUid() { @@ -38,7 +41,12 @@ public ResourceLocation getUid() { @Override public ItemStack getIcon() { - return GunItemBuilder.create().setId(new ResourceLocation(GunMod.MOD_ID, "glock_17")).build(); + ResourceLocation gunId = new ResourceLocation(GunMod.MOD_ID, "glock_17"); + if (icon == null) { + TimelessAPI.getCommonGunIndex(gunId).ifPresentOrElse(index -> this.icon = GunItemBuilder.create().setId(gunId).build(), + () -> this.icon = InitItems.TACZ_GUN_ICON.get().getDefaultInstance()); + } + return this.icon; } @Nullable diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java index 2f12ce150..8e7183e32 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java @@ -85,4 +85,5 @@ public final class InitItems { public static RegistryObject ALL_NETHERITE_EQUIPMENT = ITEMS.register("all_netherite_equipment", ItemAdvancementIcon::new); public static RegistryObject KILL_WITHER = ITEMS.register("kill_wither", ItemAdvancementIcon::new); public static RegistryObject KILL_DRAGON = ITEMS.register("kill_dragon", ItemAdvancementIcon::new); + public static RegistryObject TACZ_GUN_ICON = ITEMS.register("tacz_gun_icon", ItemAdvancementIcon::new); } \ No newline at end of file diff --git a/src/main/resources/assets/touhou_little_maid/models/item/tacz_gun_icon.json b/src/main/resources/assets/touhou_little_maid/models/item/tacz_gun_icon.json new file mode 100644 index 000000000..fc37208b2 --- /dev/null +++ b/src/main/resources/assets/touhou_little_maid/models/item/tacz_gun_icon.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "touhou_little_maid:item/tacz_gun_icon" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/touhou_little_maid/textures/item/tacz_gun_icon.png b/src/main/resources/assets/touhou_little_maid/textures/item/tacz_gun_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..36a0f40f787b5dd40b016170b316c11365b2fa78 GIT binary patch literal 262 zcmV+h0r~!kP)* z7?ePsi|aowjII^~fE4}jRQvxw4~U}~{{KG=rJq5u4~JU})-7=sMKX#hF^DHL7=aRo>th%K^!hj>Fkia_3g zxd^0Da3S}9p+&r;83Lohu2{(XUvxen@dh9Rm?30oh5?v&(8VbN08?AS?}DzelK=n! M07*qoM6N<$f^!#Ty8r+H literal 0 HcmV?d00001