2024/11/16

补充了一些内容
This commit is contained in:
叁玖领域 2024-11-16 17:55:39 +08:00
parent db41f395f7
commit f416520f5d
25 changed files with 236 additions and 59 deletions

View File

@ -1,4 +1,4 @@
# 版本 0.0.3.9.9.1 提前介绍c[最终版本对于0.0.4] 【注意:本解釋簡繁混寫,因爲趕時間,所以並不怎麽規範,請諒解】
# 版本 0.0.3.9.9.3 提前介绍c[最终版本对于0.0.4] 【注意:本解釋簡繁混寫,因爲趕時間,所以並不怎麽規範,請諒解】
## 简介
现在开始你可以用拴绳拴住玩家,也可以拴住自己了,不如尝试拴住彼此来通关我的世界吧(

View File

@ -34,7 +34,7 @@ mod_name=Leashed Player
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=0.0.3.9.9.1
mod_version=0.0.3.9.9.3
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -1,2 +1,2 @@
// 1.21 2024-11-11T13:22:05.9272287 Languages: en_us for mod: leashedplayer
4addbeba8c66e52ed59604cfd0f32643a427565c assets/leashedplayer/lang/en_us.json
// 1.21 2024-11-16T17:00:44.8646839 Languages: en_us for mod: leashedplayer
2d1cc1306605f16bca4d02aeeec79c571a6dc04b assets/leashedplayer/lang/en_us.json

View File

@ -1,4 +1,4 @@
// 1.21 2024-11-11T00:11:59.3315663 Recipes
// 1.21 2024-11-16T17:30:08.038895 Recipes
13ebe9a580731296eb10c05d1844657d58e07cc1 data/leashedplayer/advancement/recipes/misc/amethyst_shears.json
1b45d1ad8dc73f1787c97777ad13d9771c9e0ad1 data/leashedplayer/advancement/recipes/misc/leash_rope_arrow.json
04bd2d8a0c7288776da2119eb9a9f9cf694be1b6 data/leashedplayer/recipe/amethyst_shears.json
@ -7,5 +7,5 @@ c0e05f359296d3e28573fa1b205ac44736376622 data/minecraft/advancement/recipes/misc
131fcbef603bfde7204d8e1ad15e4544696926bf data/minecraft/advancement/recipes/misc/spectral_leash_rope_arrow_with_leash_rope_arrow.json
bb5909aa91d878c8f0ef9999881cfe89532509dd data/minecraft/recipe/spectral_leash_rope_arrow_with_glowstone_dust.json
a1381da885fbedec01243c78afbb0a50ca803ee4 data/minecraft/recipe/spectral_leash_rope_arrow_with_leash_rope_arrow.json
789cca4f5f6e86d5b7515afc4129121cf79d4579 data/minecraft/recipe/tipped_leash_rope_arrow_a.json
afe9e74453638d25e9fed30fd2ddc23afcc4e397 data/minecraft/recipe/tipped_leash_rope_arrow_b.json
4dffdb7a2a537b409d1ec2630d9b74300649e1d8 data/minecraft/recipe/tipped_leash_rope_arrow_a.json
7810cb5e8c165f479fc6cd030bd1cf7bc508993b data/minecraft/recipe/tipped_leash_rope_arrow_b.json

View File

@ -1,2 +1,2 @@
// 1.21 2024-11-11T13:22:05.9272287 Languages: zh_cn for mod: leashedplayer
fc4499fb20705f63dbce27b56b0b84cd94e63e8c assets/leashedplayer/lang/zh_cn.json
// 1.21 2024-11-16T17:00:44.8607047 Languages: zh_cn for mod: leashedplayer
6fa0fb8fbf5c92e73690f7743a2c9ee7a535b868 assets/leashedplayer/lang/zh_cn.json

View File

@ -1,2 +1,2 @@
// 1.21 2024-11-11T13:22:05.9192042 Languages: zh_tw for mod: leashedplayer
5c54c9e6bbc71fd718b1c711ce7ed17452a78f39 assets/leashedplayer/lang/zh_tw.json
// 1.21 2024-11-16T17:00:44.8557665 Languages: zh_tw for mod: leashedplayer
6be17f8a16fb8abefaa660484e2ceb853485731c assets/leashedplayer/lang/zh_tw.json

View File

@ -34,6 +34,11 @@
"gamerule.LP.KeepLeashNotDropTime.description": "The time of Keep new leash which has far distance alive (Tick)",
"gamerule.LP.TeleportWithLeashedPlayers": "Teleport leashed player with player holder",
"gamerule.LP.TeleportWithLeashedPlayers.description": "Holder will teleport with their leashed players ",
"item.leash_rope_arrow.desc.1": "§7This arrow will carry the owner along with its flight:",
"item.leash_rope_arrow.desc.2": "§c1.§r If it hits a fence or an entity, it will leash the owner to it and drop as a normal arrow.",
"item.leash_rope_arrow.desc.3": "§c2.§r Crouching near the arrow allows for faster retrieval. If the arrow's owner is not the player, the owner will be leashed to the player who picks it up.",
"item.leash_rope_arrow.desc.4": "§c3.§r When fired from its launcher, the first entity hit will become the arrow's owner and will fly along with it.",
"item.leash_rope_arrow.desc.5": "§c4.§r Under the §c§l\"no_leash\"§r effect, the behavior of the arrow when fired will follow the launchers behavior.",
"item.leash_rope_arrow.description": "Arrows with ropes attached?",
"item.leashedplayer.amethyst_shears": "Amethyst Shears",
"item.leashedplayer.fabric": "Fabric",
@ -45,7 +50,11 @@
"item.minecraft.potion.effect.no_leash": "No Leash Potion",
"item.minecraft.splash_potion.effect.no_leash": "Splash No Leash Potion",
"item.minecraft.tipped_arrow.effect.no_leash": "Arrow of No Leash",
"item.spectral_leash_rope_arrow.desc": "§c2.§r Strike the entity to give it a §e§lGlowing§r effect.",
"item.tipped_leash_rope_arrow.desc": "§c2.§rStrike the entity to give it a Potion effect.",
"item.tipped_leash_rope_arrow.name": "Tipped Leash Rope Arrow Soaked By %1$s",
"item.variant.leash_rope_arrow.desc.1": "§7A variant of Leash Rope Arrow",
"item.variant.leash_rope_arrow.desc.2": "§c1.§r The function is the same as its original one。",
"jukebox_song.leashedplayer.what_does_the_fox_say": "What does the fox say?",
"leashedplayer.chat.none_heard_you": "Nobody heard your message",
"leashedplayer.command.chat.message.talkarea.current_config": "%s 's §6TalkArea Current§7:§e %d §6blocks §f(§aPrefence§7:§e %d §ablocks§f)§r",
@ -73,7 +82,7 @@
"leashedplayer.command.motion.message.adder.successful": "§bAdd Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.command.motion.message.multiply.successful": "§bMultiply Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.command.motion.message.setter.successful": "§bSet Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.lead_breaker.item.desc": "can break the link of leash",
"leashedplayer.lead_breaker.item.desc": "§7can break the link of leash",
"painting.leashedplayer.group_photo.author": "§9Leisure §4Time §eDock§r",
"painting.leashedplayer.group_photo.title": "§dGroup Photo §7[§6memorable§7]§r",
"sound.leashedplayer.subtitle.what_does_the_fox_say": "Great Chu will rise again! Chen She will be king!"

View File

@ -34,6 +34,11 @@
"gamerule.LP.KeepLeashNotDropTime.description": "当距离过远时,保持新建拴绳不掉落的时间 (刻)",
"gamerule.LP.TeleportWithLeashedPlayers": "被拴玩家随玩家持有者传送",
"gamerule.LP.TeleportWithLeashedPlayers.description": "传送时将被拴玩家与持有者一起传送",
"item.leash_rope_arrow.desc.1": "§7该箭将会携带拥有者随其飞行",
"item.leash_rope_arrow.desc.2": "§c1.§r 若击中栅栏或生物时,将持有者拴在其上并已普通箭形式掉落;",
"item.leash_rope_arrow.desc.3": "§c2.§r 靠近该箭下蹲可以更快拾取该箭,如果该箭持有者不是自己,则持有者将被拾取者拴住;",
"item.leash_rope_arrow.desc.4": "§c3.§r 当前其发射器里发射,第一个射中的生物将成为此箭的持有者并随箭飞行;",
"item.leash_rope_arrow.desc.5": "§c4.§r 在§c§l禁拴§7(§c§rcno_leash§7)§r效果下射出的箭行为同发射器。",
"item.leash_rope_arrow.description": "带有拴绳的箭矢?",
"item.leashedplayer.amethyst_shears": "紫水晶剪刀",
"item.leashedplayer.fabric": "Fabric",
@ -45,7 +50,11 @@
"item.minecraft.potion.effect.no_leash": "禁拴药水",
"item.minecraft.splash_potion.effect.no_leash": "喷溅型禁拴药水",
"item.minecraft.tipped_arrow.effect.no_leash": "禁拴之箭",
"item.spectral_leash_rope_arrow.desc": "§c2.§r 击中实体给与其§e§l发光§7(§e§lGlowing§7)§r效果",
"item.tipped_leash_rope_arrow.desc": "§c2.§r 击中实体给与其药水效果",
"item.tipped_leash_rope_arrow.name": "用%1$s浸泡过的拴绳箭",
"item.variant.leash_rope_arrow.desc.1": "§7拴绳箭的一个变种",
"item.variant.leash_rope_arrow.desc.2": "§c1.§r 功能同其本体;",
"jukebox_song.leashedplayer.what_does_the_fox_say": "狐狸是怎么叫的?",
"leashedplayer.chat.none_heard_you": "沒有人接收到你的消息",
"leashedplayer.command.chat.message.talkarea.current_config": "%s§6目前聊天区域可见半径设置§7:§e %d §6格 §f(§a默认值§7:§e %d §a格§f)§r",
@ -73,7 +82,7 @@
"leashedplayer.command.motion.message.adder.successful": "§b添加成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.command.motion.message.multiply.successful": "§b倍乘成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.command.motion.message.setter.successful": "§b设置成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.lead_breaker.item.desc": "可以破坏拴绳链接",
"leashedplayer.lead_breaker.item.desc": "§7可以破坏拴绳链接",
"painting.leashedplayer.group_photo.author": "§9闲趣§4时§e坞§r",
"painting.leashedplayer.group_photo.title": "§d集体照 §7[§6纪念§7]§r",
"sound.leashedplayer.subtitle.what_does_the_fox_say": "大楚兴~ 陈胜王~~"

View File

@ -34,6 +34,11 @@
"gamerule.LP.KeepLeashNotDropTime.description": "儅距離過遠時,保持其不掉落的時間(刻)",
"gamerule.LP.TeleportWithLeashedPlayers": "被拴玩家随玩家持有者傳送",
"gamerule.LP.TeleportWithLeashedPlayers.description": "將被拴玩家將隨持有者一起傳送",
"item.leash_rope_arrow.desc.1": "§7該箭將會攜帶擁有者隨其飛行",
"item.leash_rope_arrow.desc.2": "§c1.§r 若擊中柵欄或生物時,將持有者拴在其上並以普通箭的形式掉落;",
"item.leash_rope_arrow.desc.3": "§c2.§r 靠近該箭下蹲可以更快拾取該箭,如果該箭的持有者不是自己,則持有者將被拾取者拴住;",
"item.leash_rope_arrow.desc.4": "§c3.§r 當箭從發射器發射時,第一個射中的生物將成為此箭的持有者並隨箭飛行;",
"item.leash_rope_arrow.desc.5": "§c4.§r 在§c§l禁拴§7(§c§rcno_leash§7)§r效果下射出的箭行為將與發射器的行為相同。",
"item.leash_rope_arrow.description": "帶有拴繩的箭矢?",
"item.leashedplayer.amethyst_shears": "紫水晶剪刀",
"item.leashedplayer.fabric": "Fabric",
@ -45,7 +50,11 @@
"item.minecraft.potion.effect.no_leash": "禁拴藥水",
"item.minecraft.splash_potion.effect.no_leash": "噴濺型禁拴藥水",
"item.minecraft.tipped_arrow.effect.no_leash": "禁拴之箭",
"item.spectral_leash_rope_arrow.desc": "擊中實體給予其§e§l發光§7(§e§lGlowing§7)§r效果",
"item.tipped_leash_rope_arrow.desc": "擊中實體給予其药水效果",
"item.tipped_leash_rope_arrow.name": "蘸有%1$s的拴繩箭",
"item.variant.leash_rope_arrow.desc.1": "§7拴繩箭矢的一個變種",
"item.variant.leash_rope_arrow.desc.2": "§c1.§r 功能與本體一致;",
"jukebox_song.leashedplayer.what_does_the_fox_say": "狐狸是怎麽叫的?",
"leashedplayer.chat.none_heard_you": "無人接收到你的訊息",
"leashedplayer.command.chat.message.talkarea.current_config": "%s§6目前可見訊息聊天半徑設置§7:§e%d §6格 §f(§a默認值§7:§e%d §a格§f)§r",
@ -73,7 +82,7 @@
"leashedplayer.command.motion.message.adder.successful": "§b添加成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.command.motion.message.multiply.successful": "§b倍乘成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.command.motion.message.setter.successful": "§b設置成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
"leashedplayer.lead_breaker.item.desc": "可以破壞拴繩鏈接",
"leashedplayer.lead_breaker.item.desc": "§7可以破壞拴繩鏈接",
"painting.leashedplayer.group_photo.author": "§9閑趣§4時§e塢§r",
"painting.leashedplayer.group_photo.title": "§d集體照 §7[§6紀念§7]§r",
"sound.leashedplayer.subtitle.what_does_the_fox_say": "大楚興~ 陳勝王~~"

View File

@ -1,4 +1,4 @@
{
"type": "minecraft:tipped_leash_rope_arrow_a_recipe",
"type": "leashedplayer:tipped_leash_rope_arrow_a_recipe",
"category": "misc"
}

View File

@ -1,4 +1,4 @@
{
"type": "minecraft:tipped_leash_rope_arrow_b_recipe",
"type": "leashedplayer:tipped_leash_rope_arrow_b_recipe",
"category": "misc"
}

View File

@ -11,13 +11,15 @@ import com.r3944realms.leashedplayer.content.entities.LeashRopeArrow;
import com.r3944realms.leashedplayer.content.entities.LittlePlayer;
import com.r3944realms.leashedplayer.content.entities.ModEntityRegister;
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
import com.r3944realms.leashedplayer.content.items.repcipe.ModRecipeSerializer;
import com.r3944realms.leashedplayer.content.items.repcipe.TippedLeashRopeArrowRecipe;
import com.r3944realms.leashedplayer.content.misc.LeadBreakItemBehavior;
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
import com.r3944realms.leashedplayer.utils.Util;
import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.component.DataComponents;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
@ -25,7 +27,6 @@ import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.Leashable;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.Fox;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -35,10 +36,10 @@ import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.phys.Vec3;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.event.AnvilUpdateEvent;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent;
import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent;
@ -58,12 +59,26 @@ public class CommonEventHandler {
TickCommand.register(dispatcher);
}
@SubscribeEvent
public static void OnRegisterPotionBrewing(RegisterBrewingRecipesEvent event) {
PotionBrewing.Builder builder = event.getBuilder();
builder.addMix(Potions.WATER, Items.SLIME_BALL, ModPotionRegister.NO_LEASH);
}
@SubscribeEvent
public static void OnAnvilUpdated(AnvilUpdateEvent event) {
String name = event.getName();
ItemStack left = event.getLeft();
if (left.is(Items.ANVIL) && name != null && name.equals("NeoForge")) {
event.setOutput(ModItemRegister.NEOFORGE.get().getDefaultInstance());
} else if (left.is(ModItemRegister.NEOFORGE.get().asItem()) && name != null && name.equals("Forge")) {
ItemStack instance = Items.ANVIL.getDefaultInstance();
instance.set(DataComponents.CUSTOM_NAME, Component.literal("Forge").withStyle(ChatFormatting.BOLD).withStyle(ChatFormatting.AQUA));
event.setOutput(instance);
}
}
@SubscribeEvent
public static void OnLivingTickEvent(EntityTickEvent.Post event) {
Entity entity = event.getEntity();
@ -126,21 +141,6 @@ public class CommonEventHandler {
event.put(ModEntityRegister.KID.get(), LittlePlayer.createAttributes().build());
}
@SubscribeEvent
public static void onRegisterEvent(RegisterEvent event) {
if (event.getRegistry() == BuiltInRegistries.RECIPE_SERIALIZER) {
ModRecipeSerializer.TIPPED_LEASH_ROPE_ARROW_A_RECIPE =
RecipeSerializer.register(
"tipped_leash_rope_arrow_a_recipe",
new SimpleCraftingRecipeSerializer<>(TippedLeashRopeArrowRecipe.TippedLeashRopeArrowARecipe::new)
);
ModRecipeSerializer.TIPPED_LEASH_ROPE_ARROW_B_RECIPE =
RecipeSerializer.register("tipped_leash_rope_arrow_b_recipe",
new SimpleCraftingRecipeSerializer<>(TippedLeashRopeArrowRecipe.TippedLeashRopeArrowBRecipe::new)
);
}
}
}
}

View File

@ -7,6 +7,7 @@ import com.r3944realms.leashedplayer.content.effects.ModPotionRegister;
import com.r3944realms.leashedplayer.content.entities.ModEntityRegister;
import com.r3944realms.leashedplayer.content.items.ModCreativeTab;
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
import com.r3944realms.leashedplayer.content.items.repcipe.ModRecipeRegister;
import com.r3944realms.leashedplayer.content.paintings.ModPaintingsRegister;
import com.r3944realms.leashedplayer.content.sounds.ModSoundRegister;
import com.r3944realms.leashedplayer.utils.Util;
@ -30,6 +31,7 @@ public class LeashedPlayer {
ModEntityRegister.register(event);
ModCreativeTab.register(event);
ModCriteriaTriggers.register(event);
ModRecipeRegister.register(event);
initiation();
}
private void initiation() {

View File

@ -35,7 +35,7 @@ public class ModItemRegister {
() -> new TippedLeashRopeArrow(new Item.Properties().stacksTo(16).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)));
public static final Supplier<Item> AMETHYST_SHEARS = ModItemRegister.register("amethyst_shears",
() -> new LeadBreakerItem(new Item.Properties().durability(100).component(DataComponents.TOOL, LeadBreakerItem.createToolProperties())
() -> new LeadBreakerItem(ModToolTier.AMETHYST, new Item.Properties().component(DataComponents.TOOL, LeadBreakerItem.createToolProperties())
.stacksTo(1)));
public static final Supplier<Item> KID_SPAWN_EGG = ModItemRegister.register("kid_spawn_egg",

View File

@ -0,0 +1,62 @@
package com.r3944realms.leashedplayer.content.items;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.NotNull;
import java.util.function.Supplier;
public enum ModToolTier implements Tier {
AMETHYST(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 100, 8.0F, 2.0F, 15, () -> Ingredient.of(Items.AMETHYST_SHARD));
private final TagKey<Block> incorrectBlocksForDrops;
private final int uses;
private final float speed;
private final float attackDamageBonus;
private final int enchantmentValue;
private final Supplier<Ingredient> repairIngredient;
ModToolTier(TagKey<Block> incorrectBlocksForDrops, int uses, float speed, float attackDamageBonus, int enchantmentValue, Supplier<Ingredient> repairIngredient) {
this.incorrectBlocksForDrops = incorrectBlocksForDrops;
this.uses = uses;
this.speed = speed;
this.attackDamageBonus = attackDamageBonus;
this.enchantmentValue = enchantmentValue;
this.repairIngredient = repairIngredient;
}
@Override
public int getUses() {
return this.uses;
}
@Override
public float getSpeed() {
return this.speed;
}
@Override
public float getAttackDamageBonus() {
return this.attackDamageBonus;
}
@Override
public @NotNull TagKey<Block> getIncorrectBlocksForDrops() {
return this.incorrectBlocksForDrops;
}
@Override
public int getEnchantmentValue() {
return this.enchantmentValue;
}
@Override
public @NotNull Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
}

View File

@ -0,0 +1,29 @@
package com.r3944realms.leashedplayer.content.items.repcipe;
import com.r3944realms.leashedplayer.LeashedPlayer;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier;
public class ModRecipeRegister {
public static final DeferredRegister<RecipeSerializer<?>> RECIPE_SERIALIZER =
DeferredRegister.create(BuiltInRegistries.RECIPE_SERIALIZER, LeashedPlayer.MOD_ID);
public static final DeferredHolder<RecipeSerializer<?>, RecipeSerializer<?>> TIPPED_LEASH_ROPE_ARROW_A_RECIPE =
RECIPE_SERIALIZER.register("tipped_leash_rope_arrow_a_recipe", () ->
new SimpleCraftingRecipeSerializer<>(TippedLeashRopeArrowRecipe.TippedLeashRopeArrowARecipe::new)
);
public static final DeferredHolder<RecipeSerializer<?>, RecipeSerializer<?>> TIPPED_LEASH_ROPE_ARROW_B_RECIPE =
RECIPE_SERIALIZER.register("tipped_leash_rope_arrow_b_recipe", () ->
new SimpleCraftingRecipeSerializer<>(TippedLeashRopeArrowRecipe.TippedLeashRopeArrowBRecipe::new)
);
public static void register(IEventBus eventBus) {
RECIPE_SERIALIZER.register(eventBus);
}
}

View File

@ -1,9 +0,0 @@
package com.r3944realms.leashedplayer.content.items.repcipe;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
public abstract class ModRecipeSerializer<T extends Recipe<?>> implements RecipeSerializer<T> {
public static RecipeSerializer<TippedLeashRopeArrowRecipe.TippedLeashRopeArrowARecipe> TIPPED_LEASH_ROPE_ARROW_A_RECIPE;
public static RecipeSerializer<TippedLeashRopeArrowRecipe.TippedLeashRopeArrowBRecipe> TIPPED_LEASH_ROPE_ARROW_B_RECIPE;
}

View File

@ -64,7 +64,7 @@ public abstract class TippedLeashRopeArrowRecipe {
@Override
public @NotNull RecipeSerializer<?> getSerializer() {
return ModRecipeSerializer.TIPPED_LEASH_ROPE_ARROW_A_RECIPE;
return ModRecipeRegister.TIPPED_LEASH_ROPE_ARROW_A_RECIPE.get();
}
}
public static class TippedLeashRopeArrowBRecipe extends CustomRecipe {
@ -113,7 +113,7 @@ public abstract class TippedLeashRopeArrowRecipe {
@Override
public @NotNull RecipeSerializer<?> getSerializer() {
return ModRecipeSerializer.TIPPED_LEASH_ROPE_ARROW_B_RECIPE;
return ModRecipeRegister.TIPPED_LEASH_ROPE_ARROW_B_RECIPE.get();
}
}
}

View File

@ -0,0 +1,7 @@
package com.r3944realms.leashedplayer.content.items.type;
import net.minecraft.world.item.Tier;
public interface ITierTool {
Tier getTier();
}

View File

@ -11,9 +11,7 @@ import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.Leashable;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ShearsItem;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.*;
import net.minecraft.world.item.component.Tool;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
@ -21,10 +19,12 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public class LeadBreakerItem extends ShearsItem {
public class LeadBreakerItem extends ShearsItem implements ITierTool{
private final Tier tier;
public static final String HOVER_KEY = "leashedplayer.lead_breaker.item.desc";
public LeadBreakerItem(Properties properties) {
super(properties);
public LeadBreakerItem(Tier tier, Properties properties) {
super(properties.durability(tier.getUses()));
this.tier = tier;
}
public static Tool createToolProperties() {
@ -73,18 +73,39 @@ public class LeadBreakerItem extends ShearsItem {
PlayerLeashable playerLeashable = (PlayerLeashable) pPlayer;
if (playerLeashable.isLeashed()) {
if(!(playerLeashable.getLeashHolder() instanceof LeashRopeArrow)) {
pPlayer.playSound(SoundEvents.SHEEP_SHEAR, 1.0F, 1.0F);
playerLeashable.dropLeash(true, true);
pPlayer.getItemInHand(pUsedHand).hurtAndBreak(10, pPlayer, LivingEntity.getSlotForHand(pUsedHand));
return InteractionResultHolder.success(pPlayer.getItemInHand(pUsedHand));
}
}
}
if(pLevel.isClientSide) {
PlayerLeashable playerLeashable = (PlayerLeashable) pPlayer;
if (playerLeashable.getLeashDataFromEntityData() != null) {
pPlayer.playSound(SoundEvents.SHEEP_SHEAR, 1.0F, 1.0F);
}
}
return super.use(pLevel, pPlayer, pUsedHand);
}
@Override
public void appendHoverText(@NotNull ItemStack pStack, @NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
pTooltipComponents.add(Component.translatable(HOVER_KEY));
}
@Override
public Tier getTier() {
return this.tier;
}
@Override
public int getEnchantmentValue(@NotNull ItemStack stack) {
return this.tier.getEnchantmentValue();
}
@Override
public boolean isValidRepairItem(@NotNull ItemStack pStack, @NotNull ItemStack pRepairCandidate) {
return this.tier.getRepairIngredient().test(pRepairCandidate) || super.isValidRepairItem(pRepairCandidate, pStack);
}
}

View File

@ -20,7 +20,15 @@ import javax.annotation.Nullable;
import java.util.List;
public class LeashRopeArrowItem extends ArrowItem implements ILeashRopeArrow{
public static final String descKey = "item.leash_rope_arrow.description";
public static final String descKey = "item.leash_rope_arrow.description",
DESC_1 = "item.leash_rope_arrow.desc.1",
DESC_2 = "item.leash_rope_arrow.desc.2",
DESC_3 = "item.leash_rope_arrow.desc.3",
DESC_4 = "item.leash_rope_arrow.desc.4",
DESC_5 = "item.leash_rope_arrow.desc.5";
public static final String
DESC_V_1 = "item.variant.leash_rope_arrow.desc.1",
DESC_V_2 = "item.variant.leash_rope_arrow.desc.2";
public LeashRopeArrowItem(Item.Properties pProperties) {
super(pProperties);
}
@ -41,7 +49,13 @@ public class LeashRopeArrowItem extends ArrowItem implements ILeashRopeArrow{
return Component.translatable(descKey).withStyle(ChatFormatting.GRAY);
}
public void appendHoverText(@NotNull ItemStack pStack, Item.@NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
//TODO:也许会做
pTooltipComponents.addAll(List.of(
Component.translatable(DESC_1),
Component.translatable(DESC_2),
Component.translatable(DESC_3),
Component.translatable(DESC_4),
Component.translatable(DESC_5)
));
}
}

View File

@ -20,8 +20,10 @@ import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.List;
public class SpectralLeashRopeArrowItem extends ArrowItem implements ILeashRopeArrow{
public static final String descKey = "item.spectral_leash_rope_arrow.description";
public static final String descKey = "item.spectral_leash_rope_arrow.description",
DESC = "item.spectral_leash_rope_arrow.desc";
public SpectralLeashRopeArrowItem(Properties pProperties) {
super(pProperties);
}
@ -41,6 +43,10 @@ public class SpectralLeashRopeArrowItem extends ArrowItem implements ILeashRopeA
return Component.translatable(descKey).withStyle(ChatFormatting.GRAY);
}
public void appendHoverText(@NotNull ItemStack pStack, Item.@NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
//TODO:也许会做
pTooltipComponents.addAll(List.of(
Component.translatable(LeashRopeArrowItem.DESC_V_1),
Component.translatable(LeashRopeArrowItem.DESC_V_2),
Component.translatable(DESC)
));
}
}

View File

@ -16,6 +16,7 @@ import java.util.Optional;
public class TippedLeashRopeArrow extends LeashRopeArrowItem {
public static final String TIPPED_LEASH_ROPE_ARROW_NAME = "item.tipped_leash_rope_arrow.name";
public static final String DESC = "item.tipped_leash_rope_arrow.desc";
public TippedLeashRopeArrow(Item.Properties pProperties) {
super(pProperties);
}
@ -28,10 +29,16 @@ public class TippedLeashRopeArrow extends LeashRopeArrowItem {
@Override
public void appendHoverText(@NotNull ItemStack pStack, Item.@NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
pTooltipComponents.addAll(List.of(
Component.translatable(LeashRopeArrowItem.DESC_V_1),
Component.translatable(LeashRopeArrowItem.DESC_V_2),
Component.translatable(DESC)
));
PotionContents potioncontents = pStack.get(DataComponents.POTION_CONTENTS);
if (potioncontents != null) {
potioncontents.addPotionTooltip(pTooltipComponents::add, 0.125F, pContext.tickRate());
}
}
// @Override
@ -51,4 +58,5 @@ public class TippedLeashRopeArrow extends LeashRopeArrowItem {
String potionTranslateKey = "item.minecraft.potion.effect." + (flag ? s1: s);
return Component.translatable(TIPPED_LEASH_ROPE_ARROW_NAME, Component.translatable(potionTranslateKey));
}
}

View File

@ -14,6 +14,7 @@ import com.r3944realms.leashedplayer.content.items.ModCreativeTab;
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
import com.r3944realms.leashedplayer.content.items.type.LeadBreakerItem;
import com.r3944realms.leashedplayer.content.items.type.LeashRopeArrowItem;
import com.r3944realms.leashedplayer.content.items.type.SpectralLeashRopeArrowItem;
import com.r3944realms.leashedplayer.content.items.type.TippedLeashRopeArrow;
import com.r3944realms.leashedplayer.content.sounds.ModSoundRegister;
import com.r3944realms.leashedplayer.datagen.provider.attributes.ModPaintingVariants;
@ -38,8 +39,17 @@ public enum ModLangKeyValue {
NEO_FORGE(ModItemRegister.NEOFORGE, ModPartEnum.ITEM, "NeoForge", "NeoForge", "NeoForge", false),
TIPPED_LEASH_ROPE_ARROW(TippedLeashRopeArrow.TIPPED_LEASH_ROPE_ARROW_NAME, ModPartEnum.ITEM, "Tipped Leash Rope Arrow Soaked By %1$s", "用%1$s浸泡过的拴绳箭", "蘸有%1$s的拴繩箭", false),
//ITEM_DESC
DESC_ITEM_LEASH_R_ARROW_ONE(LeashRopeArrowItem.DESC_1, ModPartEnum.DESCRIPTION, "§7This arrow will carry the owner along with its flight:", "§7该箭将会携带拥有者随其飞行", "§7該箭將會攜帶擁有者隨其飛行", false),
DESC_ITEM_LEASH_R_ARROW_TWO(LeashRopeArrowItem.DESC_2, ModPartEnum.DESCRIPTION, "§c1.§r If it hits a fence or an entity, it will leash the owner to it and drop as a normal arrow.", "§c1.§r 若击中栅栏或生物时,将持有者拴在其上并已普通箭形式掉落;", "§c1.§r 若擊中柵欄或生物時,將持有者拴在其上並以普通箭的形式掉落;", false),
DESC_ITEM_LEASH_R_ARROW_THREE(LeashRopeArrowItem.DESC_3, ModPartEnum.DESCRIPTION,"§c2.§r Crouching near the arrow allows for faster retrieval. If the arrow's owner is not the player, the owner will be leashed to the player who picks it up.", "§c2.§r 靠近该箭下蹲可以更快拾取该箭,如果该箭持有者不是自己,则持有者将被拾取者拴住;", "§c2.§r 靠近該箭下蹲可以更快拾取該箭,如果該箭的持有者不是自己,則持有者將被拾取者拴住;", false),
DESC_ITEM_LEASH_R_ARROW_FOUR(LeashRopeArrowItem.DESC_4, ModPartEnum.DESCRIPTION, "§c3.§r When fired from its launcher, the first entity hit will become the arrow's owner and will fly along with it.", "§c3.§r 当前其发射器里发射,第一个射中的生物将成为此箭的持有者并随箭飞行;", "§c3.§r 當箭從發射器發射時,第一個射中的生物將成為此箭的持有者並隨箭飛行;", false),
DESC_ITEM_LEASH_R_ARROW_FIVE(LeashRopeArrowItem.DESC_5, ModPartEnum.DESCRIPTION, "§c4.§r Under the §c§l\"no_leash\"§r effect, the behavior of the arrow when fired will follow the launchers behavior.", "§c4.§r 在§c§l禁拴§7(§c§rcno_leash§7)§r效果下射出的箭行为同发射器。","§c4.§r 在§c§l禁拴§7(§c§rcno_leash§7)§r效果下射出的箭行為將與發射器的行為相同。", false),
DESC_ITEM_LEASH_ROPE_ARROW(LeashRopeArrowItem.descKey, ModPartEnum.DESCRIPTION, "Arrows with ropes attached?","带有拴绳的箭矢?", "帶有拴繩的箭矢?", false),
DESC_ITEM_LEAD_BREAKER(LeadBreakerItem.HOVER_KEY, ModPartEnum.DESCRIPTION, "can break the link of leash", "可以破坏拴绳链接", "可以破壞拴繩鏈接", false),
DESC_ITEM_V_LEASH_R_ARROW_ONE(LeashRopeArrowItem.DESC_V_1, ModPartEnum.DESCRIPTION, "§7A variant of Leash Rope Arrow", "§7拴绳箭的一个变种", "§7拴繩箭矢的一個變種", false),
DESC_ITEM_V_LEASH_R_ARROW_TWO(LeashRopeArrowItem.DESC_V_2, ModPartEnum.DESCRIPTION, "§c1.§r The function is the same as its original one。", "§c1.§r 功能同其本体;", "§c1.§r 功能與本體一致;", false),
DESC_ITEM_S_LEASH_R_ARROW_THREE(SpectralLeashRopeArrowItem.DESC, ModPartEnum.DESCRIPTION, "§c2.§r Strike the entity to give it a §e§lGlowing§r effect.", "§c2.§r 击中实体给与其§e§l发光§7(§e§lGlowing§7)§r效果", "擊中實體給予其§e§l發光§7(§e§lGlowing§7)§r效果", false),
DESC_ITEM_T_LEASH_R_ARROW_THREE(TippedLeashRopeArrow.DESC, ModPartEnum.DESCRIPTION, "§c2.§rStrike the entity to give it a Potion effect.", "§c2.§r 击中实体给与其药水效果", "擊中實體給予其药水效果", false),
DESC_ITEM_LEAD_BREAKER(LeadBreakerItem.HOVER_KEY, ModPartEnum.DESCRIPTION, "§7can break the link of leash", "§7可以破坏拴绳链接", "§7可以破壞拴繩鏈接", false),
//PAINTING
GROUP_PHOTO_TITLE(ModPaintingVariants.getPaintingVariantTitleKey(ModPaintingVariants.GROUP_PHOTO),ModPartEnum.TITLE, "§dGroup Photo §7[§6memorable§7]§r", "§d集体照 §7[§6纪念§7]§r", "§d集體照 §7[§6紀念§7]§r", false),
GROUP_PHOTO_AUTHOR(ModPaintingVariants.getPaintingVariantAuthorKey(ModPaintingVariants.GROUP_PHOTO),ModPartEnum.AUTHOR, "§9Leisure §4Time §eDock§r","§9闲趣§4时§e坞§r","§9閑趣§4時§e塢§r",false),

View File

@ -217,7 +217,7 @@ public abstract class MixinPlayer extends LivingEntity implements PlayerLeashabl
boolean shouldDrop = !(entity instanceof LeashRopeArrow);
dropLeash(true, shouldDrop);
} else if(distanceTo(entity) > leashLength * 0.65f * breakDistanceTime && entity.onGround()) {
//大于eashLength * 0.65f * breakDistanceTime 倍绳长且在地面则会让其跳跃<1.25格阻拦情况下跳跃阻拦//TODO:待擴展
//大于leashLength * 0.65f * breakDistanceTime 倍绳长且在地面则会让其跳跃<1.25格阻拦情况下跳跃阻拦//TODO:待擴展
Entity applyMovementEntity = this.isPassenger() ? this.getVehicle() : this;
if(applyMovementEntity instanceof LivingEntity applyMovementLivingEntity) {
applyMovementLivingEntity.jumpFromGround();