Skip to content

Commit 6f11ad9

Browse files
committed
1.完成动态贴图
1 parent cacb90d commit 6f11ad9

File tree

10 files changed

+44
-8
lines changed

10 files changed

+44
-8
lines changed

src/main/java/xyz/lisbammisakait/RelightTheThreePointStrategy.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ private ActionResult deadPlayerDisarm(PlayerEntity playerEntity, World world, Ha
123123
}
124124

125125
private boolean handlePlayerDeath(LivingEntity livingEntity, DamageSource damageSource, float damageAmount){
126-
if(livingEntity instanceof ServerPlayerEntity){
127-
ServerPlayerEntity player = (ServerPlayerEntity) livingEntity;
126+
if(livingEntity instanceof ServerPlayerEntity player){
128127
ItemStack mark = player.getInventory().getStack(MARKSLOT);
129128
int rsc = mark.get(RtTPSComponents.REMAININGRESPAWNCOUNT_TYPE);
130129
mark.set(RtTPSComponents.REMAININGRESPAWNCOUNT_TYPE, rsc - 1);

src/main/java/xyz/lisbammisakait/RelightTheThreePointStrategyClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
55
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
66
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
7+
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
8+
import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback;
79
import net.minecraft.client.option.KeyBinding;
810
import net.minecraft.client.util.InputUtil;
911
import org.lwjgl.glfw.GLFW;
@@ -17,6 +19,7 @@ public class RelightTheThreePointStrategyClient implements ClientModInitializer
1719

1820
@Override
1921
public void onInitializeClient() {
22+
2023
keyBindingV = KeyBindingHelper.registerKeyBinding(new KeyBinding(
2124
"key.RelightTheThreePointStrategy.SkillA", // The translation key of the keybinding's name
2225
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.

src/main/java/xyz/lisbammisakait/item/ModItems.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
44
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
5+
import net.minecraft.component.DataComponentTypes;
6+
import net.minecraft.component.type.CustomModelDataComponent;
57
import net.minecraft.item.Item;
68
import net.minecraft.item.ItemGroup;
79
import net.minecraft.item.ItemStack;
@@ -16,6 +18,9 @@
1618
import xyz.lisbammisakait.RelightTheThreePointStrategy;
1719
import xyz.lisbammisakait.compoennt.RtTPSComponents;
1820

21+
import java.util.Arrays;
22+
import java.util.List;
23+
1924
public class ModItems {
2025
//创建技能物品组
2126
public static final RegistryKey<ItemGroup> SKILL_GROUP_KEY = RegistryKey.of(Registries.ITEM_GROUP.getKey(), Identifier.of(RelightTheThreePointStrategy.MOD_ID, "skill_group"));
@@ -74,7 +79,10 @@ public class ModItems {
7479
public static final Item LIUBEIBSKILL = register(new LiuBeiBSkill( new Item.Settings().registryKey(LIUBEIBSKILL_KEY)), LIUBEIBSKILL_KEY);
7580
//注册马超A技能
7681
public static final RegistryKey<Item> HORSESUPERASKILL_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(RelightTheThreePointStrategy.MOD_ID, "horsesuperaskill"));
77-
public static final Item HORSESUPERASKILL = register(new HorseSuperASkill( new Item.Settings().registryKey(HORSESUPERASKILL_KEY).component(RtTPSComponents.LIMITEDSKILLEXHAUSTED_TYPE,false)), HORSESUPERASKILL_KEY);
82+
public static final Item HORSESUPERASKILL = register(new HorseSuperASkill( new Item.Settings()
83+
.registryKey(HORSESUPERASKILL_KEY)
84+
.component(RtTPSComponents.LIMITEDSKILLEXHAUSTED_TYPE,false)
85+
.component(DataComponentTypes.CUSTOM_MODEL_DATA,new CustomModelDataComponent(List.of(), List.of(true),List.of(),List.of()))), HORSESUPERASKILL_KEY);
7886
//注册张角A技能
7987
public static final RegistryKey<Item> ZHANGJIAOASKILL_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(RelightTheThreePointStrategy.MOD_ID, "zhangjiaoaskill"));
8088
public static final Item ZHANGJIAOASKILL = register(new ZhangJiaoASKill( new Item.Settings().registryKey(ZHANGJIAOASKILL_KEY).component(RtTPSComponents.USENUMBER_TYPE,0)), ZHANGJIAOASKILL_KEY);

src/main/java/xyz/lisbammisakait/mixin/LightningDamageMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public abstract class LightningDamageMixin {
2424
@Inject(method = "onStruckByLightning", at = @At("HEAD"), cancellable = true)
2525
private void onStruckByLightning(CallbackInfo ci) {
2626
// 检查当前实体是否为玩家
27-
if ((Object) this instanceof PlayerEntity) {
28-
PlayerEntity player = (PlayerEntity) (Object) this;
27+
if ((Object) this instanceof PlayerEntity player) {
28+
// PlayerEntity player = (PlayerEntity) (Object) this;
2929
// 检查玩家是否拥有特定物品
3030
if (player.getInventory().contains( ModItems.LEITINGZHIZHANG.getDefaultStack())) {
3131
// 取消雷电伤害

src/main/java/xyz/lisbammisakait/skill/CaoCaoASkill.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ public static void teleportPlayersTowardsTarget(PlayerEntity targetPlayer, Serve
126126
* @return 是否有其他玩家在周围5格内
127127
*/
128128
public static boolean hasOtherPlayersNearby(PlayerEntity player) {
129-
if (!(player.getWorld() instanceof ServerWorld)) {
129+
if (!(player.getWorld() instanceof ServerWorld world)) {
130130
return false;
131131
}
132-
ServerWorld world = (ServerWorld) player.getWorld();
132+
// ServerWorld world = (ServerWorld) player.getWorld();
133133
// 获取玩家位置
134134
Vec3d playerPos = player.getPos();
135135
// 定义检测范围(以玩家为中心,周围5格)

src/main/java/xyz/lisbammisakait/skill/HorseSuperASkill.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package xyz.lisbammisakait.skill;
22

3+
import net.minecraft.component.DataComponentTypes;
4+
import net.minecraft.component.type.CustomModelDataComponent;
35
import net.minecraft.item.Item;
46
import net.minecraft.item.ItemStack;
57
import net.minecraft.server.MinecraftServer;
@@ -8,13 +10,16 @@
810
import xyz.lisbammisakait.compoennt.RtTPSComponents;
911
import xyz.lisbammisakait.item.HutouzhanjinqiangItem;
1012

13+
import java.util.List;
14+
1115
public class HorseSuperASkill extends Item implements ActiveSkillable {
1216
public HorseSuperASkill(Settings settings) {
1317
super(settings);
1418
}
1519

1620
@Override
1721
public void processPracticalSkill(MinecraftServer server, ServerPlayerEntity player, ItemStack stack) {
22+
stack.set(DataComponentTypes.CUSTOM_MODEL_DATA,new CustomModelDataComponent(List.of(), List.of(false),List.of(),List.of()));
1823
boolean isExhausted = stack.getOrDefault(RtTPSComponents.LIMITEDSKILLEXHAUSTED_TYPE,true);
1924
if (isExhausted) {
2025
player.sendMessage(Text.of("你已经使用过该技能"), true);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"model": {
3+
"type": "minecraft:condition",
4+
"property": "minecraft:custom_model_data",
5+
"index": 0,
6+
"on_false": {
7+
"type": "minecraft:model",
8+
"model": "relight-the-three-point-strategy:item/unlaunchable"
9+
},
10+
"on_true": {
11+
"type": "minecraft:model",
12+
"model": "relight-the-three-point-strategy:item/horsesuperaskill"
13+
}
14+
}
15+
}

src/main/resources/assets/relight-the-three-point-strategy/items/hutouzhanjinqiang.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"type": "minecraft:model",
44
"model": "relight-the-three-point-strategy:item/hutouzhanjinqiang"
55
}
6-
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "item/handheld",
3+
"textures": {
4+
"layer0": "relight-the-three-point-strategy:item/horsesuperaskill"
5+
}
6+
}
99.7 KB
Loading

0 commit comments

Comments
 (0)