From a0ab5d41dda38bd6fea05fba9f845f3a208feb85 Mon Sep 17 00:00:00 2001 From: cech12 Date: Mon, 9 Nov 2020 19:29:29 +0100 Subject: [PATCH] ender helmet added #15 --- gradle.properties | 2 +- .../java/cech12/usefulhats/config/Config.java | 20 ++ .../java/cech12/usefulhats/init/ModItems.java | 14 ++ .../usefulhats/item/EnderHelmetItem.java | 183 ++++++++++++++++++ .../usefulhats/item/HatArmorMaterial.java | 3 + .../usefulhats/item/IRightClickListener.java | 10 + .../assets/usefulhats/lang/de_de.json | 8 + .../assets/usefulhats/lang/en_us.json | 8 + .../assets/usefulhats/lang/es_es.json | 8 + .../assets/usefulhats/lang/pt_br.json | 10 +- .../assets/usefulhats/lang/zh_tw.json | 8 + .../usefulhats/models/item/ender_helmet.json | 6 + .../usefulhats/textures/item/ender_helmet.png | Bin 0 -> 245 bytes .../textures/models/armor/ender_layer_1.png | Bin 0 -> 345 bytes .../models/armor/ender_layer_1_overlay.png | Bin 0 -> 176 bytes .../recipes/combat/ender_helmet.json | 32 +++ .../data/usefulhats/recipes/ender_helmet.json | 21 ++ 17 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 src/main/java/cech12/usefulhats/item/EnderHelmetItem.java create mode 100644 src/main/java/cech12/usefulhats/item/IRightClickListener.java create mode 100644 src/main/resources/assets/usefulhats/models/item/ender_helmet.json create mode 100644 src/main/resources/assets/usefulhats/textures/item/ender_helmet.png create mode 100644 src/main/resources/assets/usefulhats/textures/models/armor/ender_layer_1.png create mode 100644 src/main/resources/assets/usefulhats/textures/models/armor/ender_layer_1_overlay.png create mode 100644 src/main/resources/data/usefulhats/advancements/recipes/combat/ender_helmet.json create mode 100644 src/main/resources/data/usefulhats/recipes/ender_helmet.json diff --git a/gradle.properties b/gradle.properties index f5a4a71..dc6907f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -mod_version=1.8.5 +mod_version=1.9.0 minecraft_version=1.16.2+ forge_version=1.16.2-33.0.5 diff --git a/src/main/java/cech12/usefulhats/config/Config.java b/src/main/java/cech12/usefulhats/config/Config.java index bf0da0c..0703ab6 100644 --- a/src/main/java/cech12/usefulhats/config/Config.java +++ b/src/main/java/cech12/usefulhats/config/Config.java @@ -36,6 +36,11 @@ public class Config { public static final ConfigType.Double CHOPPING_HAT_SPEED_WITH_EFFICIENCY_4 = new ConfigType.Double(1.0); public static final ConfigType.Double CHOPPING_HAT_SPEED_WITH_EFFICIENCY_5 = new ConfigType.Double(1.5); + public static final ConfigType.Boolean ENDER_HELMET_ENABLED = new ConfigType.Boolean(true); + public static final ConfigType.Boolean ENDER_HELMET_DAMAGE_ENABLED = new ConfigType.Boolean(true); + public static final ConfigType.Integer ENDER_HELMET_DURABILITY = new ConfigType.Integer(80); + public static final ConfigType.Boolean ENDER_HELMET_INTERDIMENSIONAL_ENABLED = new ConfigType.Boolean(true); + public static final ConfigType.Boolean HALO_ENABLED = new ConfigType.Boolean(true); public static final ConfigType.Boolean HALO_DAMAGE_ENABLED = new ConfigType.Boolean(true); public static final ConfigType.Integer HALO_DURABILITY = new ConfigType.Integer(600); @@ -119,6 +124,9 @@ public class Config { CHOPPING_HAT_ENABLED.configObj = common .comment("Whether or not Chopping Hat should be enabled.") .define("choppingHatEnabled", CHOPPING_HAT_ENABLED.getDefaultValue()); + ENDER_HELMET_ENABLED.configObj = common + .comment("Whether or not Ender Helmet should be enabled.") + .define("enderHelmetEnabled", ENDER_HELMET_ENABLED.getDefaultValue()); HALO_ENABLED.configObj = common .comment("Whether or not Halo should be enabled.") .define("haloEnabled", HALO_ENABLED.getDefaultValue()); @@ -207,6 +215,18 @@ public class Config { .defineInRange("choppingHatSpeedWithEfficiency5", CHOPPING_HAT_SPEED_WITH_EFFICIENCY_5.getDefaultValue(), 0.0, 5.0); common.pop(); + common.push("Ender Helmet"); + ENDER_HELMET_DAMAGE_ENABLED.configObj = common + .comment("Whether or not damaging of Ender Helmet should be enabled.") + .define("enderHelmetDamageEnabled", ENDER_HELMET_DAMAGE_ENABLED.getDefaultValue()); + ENDER_HELMET_DURABILITY.configObj = common + .comment("Ender Helmet durability.") + .defineInRange("enderHelmetDurability", ENDER_HELMET_DURABILITY.getDefaultValue(), 1, 10000); + ENDER_HELMET_INTERDIMENSIONAL_ENABLED.configObj = common + .comment("Whether or not interdimensional teleporting with the Ender Helmet should be enabled.") + .define("enderHelmetInterdimensionalEnabled", ENDER_HELMET_INTERDIMENSIONAL_ENABLED.getDefaultValue()); + common.pop(); + common.push("Halo"); HALO_DAMAGE_ENABLED.configObj = common .comment("Whether or not damaging of Halo should be enabled.") diff --git a/src/main/java/cech12/usefulhats/init/ModItems.java b/src/main/java/cech12/usefulhats/init/ModItems.java index f4ab3f4..232f32d 100644 --- a/src/main/java/cech12/usefulhats/init/ModItems.java +++ b/src/main/java/cech12/usefulhats/init/ModItems.java @@ -25,6 +25,7 @@ import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.entity.player.ItemFishedEvent; import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -38,6 +39,7 @@ public class ModItems { new AquanautHelmetItem(), new BunnyEarsItem(), new ChoppingHatItem(), + new EnderHelmetItem(), new HaloItem(), new LuckyHatItem(), new MiningHatItem(), @@ -82,6 +84,7 @@ public static void addEventListeners() { MinecraftForge.EVENT_BUS.addListener(ModItems::onLivingEquipmentChangeEvent); MinecraftForge.EVENT_BUS.addListener(ModItems::onLivingSetAttackTargetEvent); MinecraftForge.EVENT_BUS.addListener(ModItems::onLivingUseItemEvent); + MinecraftForge.EVENT_BUS.addListener(ModItems::onRightClickItemEvent); //curios events if (CuriosMod.isLoaded()) { MinecraftForge.EVENT_BUS.addListener(ModItems::onCuriosEquipmentChangeEvent); @@ -218,6 +221,17 @@ private static void onLivingSetAttackTargetEvent(LivingSetAttackTargetEvent even } } + private static void onRightClickItemEvent(PlayerInteractEvent.RightClickItem event) { + PlayerEntity player = event.getPlayer(); + for (ItemStack headSlotItemStack : UsefulHatsUtils.getEquippedHatItemStacks(player)) { + for (Item item : ModItems.items) { + if (item instanceof IRightClickListener && item == headSlotItemStack.getItem()) { + ((IRightClickListener) item).onRightClickItemEvent(event, headSlotItemStack); + } + } + } + } + @OnlyIn(Dist.CLIENT) private static void onRenderGameOverlayEvent(RenderGameOverlayEvent.Pre event) { if (!event.isCanceled() && event.getType() == RenderGameOverlayEvent.ElementType.HELMET) { diff --git a/src/main/java/cech12/usefulhats/item/EnderHelmetItem.java b/src/main/java/cech12/usefulhats/item/EnderHelmetItem.java new file mode 100644 index 0000000..27e7ba4 --- /dev/null +++ b/src/main/java/cech12/usefulhats/item/EnderHelmetItem.java @@ -0,0 +1,183 @@ +package cech12.usefulhats.item; + +import cech12.usefulhats.UsefulHatsUtils; +import cech12.usefulhats.config.Config; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.play.server.STitlePacket; +import net.minecraft.server.MinecraftServer; +import net.minecraft.stats.Stats; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +public class EnderHelmetItem extends AbstractHatItem implements IRightClickListener { + + public static final String TELEPORT_POSITION_ID = "TeleportPosition"; + + public EnderHelmetItem() { + super("ender_helmet", HatArmorMaterial.ENDER, rawColorFromRGB(43, 203, 175), Config.ENDER_HELMET_ENABLED, Config.ENDER_HELMET_DAMAGE_ENABLED); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { + this.addTextLineToTooltip(tooltip, new TranslationTextComponent("item.usefulhats.ender_helmet.desc.define_teleport").mergeStyle(TextFormatting.BLUE)); + if (hasPosition(stack)) { + super.addInformation(stack, worldIn, tooltip, flagIn); + BlockPos pos = getPosition(stack); + this.addTextLineToTooltip(tooltip, new TranslationTextComponent("item.usefulhats.ender_helmet.desc.teleport").mergeStyle(TextFormatting.BLUE)); + this.addTextLineToTooltip(tooltip, new TranslationTextComponent("item.usefulhats.ender_helmet.desc.teleport_position", pos.getX(), pos.getY(), pos.getZ()).mergeStyle(TextFormatting.BLUE)); + if (worldIn == null || !isRightDimension(worldIn, stack)) { + this.addTextLineToTooltip(tooltip, new StringTextComponent(getDimensionString(stack)).mergeStyle(TextFormatting.BLUE)); + } + } + } + + private static void setPosition(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull PlayerEntity player) { + CompoundNBT nbt = stack.getOrCreateTag().copy(); + CompoundNBT positionNBT = new CompoundNBT(); + BlockPos pos = player.getPosition(); + positionNBT.putInt("X", pos.getX()); + positionNBT.putInt("Y", pos.getY()); + positionNBT.putInt("Z", pos.getZ()); + positionNBT.putString("dimKey", world.func_234923_W_().getRegistryName().toString()); //dimension registry key + positionNBT.putString("dimValue", world.func_234923_W_().func_240901_a_().toString()); //dimension name + nbt.put(TELEPORT_POSITION_ID, positionNBT); + stack.setTag(nbt); + } + + private static boolean hasPosition(@Nonnull ItemStack stack) { + return stack.getOrCreateTag().contains(TELEPORT_POSITION_ID); + } + + private static BlockPos getPosition(@Nonnull ItemStack stack) { + if (hasPosition(stack)) { + CompoundNBT nbt = stack.getOrCreateTag(); + CompoundNBT positionNBT = nbt.getCompound(TELEPORT_POSITION_ID); + return new BlockPos(positionNBT.getInt("X"), positionNBT.getInt("Y"), positionNBT.getInt("Z")); + } + return null; + } + + @OnlyIn(Dist.CLIENT) + private String getDimensionString(@Nonnull ItemStack stack) { + if (hasPosition(stack)) { + return stack.getOrCreateTag().getCompound(TELEPORT_POSITION_ID).getString("dimValue"); + } + return "?"; + } + + private static boolean equalsWorldAndNBT(World world, CompoundNBT positionNBT) { + return world.func_234923_W_().getRegistryName().toString().equals(positionNBT.getString("dimKey")) + && world.func_234923_W_().func_240901_a_().toString().equals(positionNBT.getString("dimValue")); + } + + private ServerWorld getWorld(@Nonnull MinecraftServer server, @Nonnull ItemStack stack) { + if (hasPosition(stack)) { + CompoundNBT positionNBT = stack.getOrCreateTag().getCompound(TELEPORT_POSITION_ID); + for (ServerWorld world : server.getWorlds()) { + if (equalsWorldAndNBT(world, positionNBT)) { + return world; + } + } + } + return null; + } + + private static boolean isRightDimension(@Nonnull World world, @Nonnull ItemStack stack) { + CompoundNBT nbt = stack.getOrCreateTag(); + if (hasPosition(stack)) { + CompoundNBT positionNBT = nbt.getCompound(TELEPORT_POSITION_ID); + return equalsWorldAndNBT(world, positionNBT); + } + return false; + } + + private static boolean canTeleportToPosition(@Nonnull World world, @Nonnull BlockPos pos) { + return !world.getBlockState(pos).isSolid() + && !world.getBlockState(pos.up()).isSolid(); + } + + @Nonnull + @Override + public ActionResult onItemRightClick(@Nonnull World worldIn, @Nonnull PlayerEntity playerIn, @Nonnull Hand handIn) { + ItemStack stack = playerIn.getHeldItem(handIn); + if (playerIn.isSneaking() && !stack.isEmpty()) { //shift right click + if (!worldIn.isRemote) { + //save position on item stack + setPosition(stack, worldIn, playerIn); + //inform player about saved position + ((ServerPlayerEntity) playerIn).connection.sendPacket(new STitlePacket(STitlePacket.Type.ACTIONBAR, new TranslationTextComponent("item.usefulhats.ender_helmet.message.position_saved"), 10, 60, 10)); + } + return ActionResult.func_233538_a_(stack, worldIn.isRemote()); + } + return super.onItemRightClick(worldIn, playerIn, handIn); + } + + @Override + public void onRightClickItemEvent(PlayerInteractEvent.RightClickItem event, ItemStack headSlotItemStack) { + PlayerEntity player = event.getPlayer(); + if (!UsefulHatsUtils.getEquippedHatItemStacks(player).contains(headSlotItemStack)) return; //only one worn stack of this item should add its effect + World world = event.getWorld(); + ItemStack usedStack = event.getItemStack(); + //only do teleportation when using an ender pearl and the hat item has a stored position + if (usedStack.getItem() == Items.ENDER_PEARL && hasPosition(headSlotItemStack)) { + player.swingArm(event.getHand()); + + if (!world.isRemote) { + //check for correct dimension + if (Config.ENDER_HELMET_INTERDIMENSIONAL_ENABLED.getValue() || isRightDimension(world, headSlotItemStack)) { + ServerWorld destinationWorld = getWorld(player.getServer(), headSlotItemStack); + BlockPos destinationPos = getPosition(headSlotItemStack); + //check for correct position + if (destinationPos != null && destinationWorld != null && canTeleportToPosition(destinationWorld, destinationPos)) { + //set cooldown for ender pearls + player.getCooldownTracker().setCooldown(usedStack.getItem(), 20); + //teleport player + player.fallDistance = 0; + player.playSound(SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F); + if (player.world != destinationWorld) { + ((ServerPlayerEntity) player).teleport(destinationWorld, destinationPos.getX() + 0.5, destinationPos.getY(), destinationPos.getZ() + 0.5, player.rotationYaw, player.rotationPitch); + } else { + player.setPositionAndUpdate(destinationPos.getX() + 0.5, destinationPos.getY(), destinationPos.getZ() + 0.5); + } + player.playSound(SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F); + //remove one ender pearl + player.addStat(Stats.ITEM_USED.get(usedStack.getItem())); + if (!player.abilities.isCreativeMode) { + usedStack.shrink(1); + } + //damage hat item + this.damageHatItemByOne(headSlotItemStack, player); + } else { + ((ServerPlayerEntity) player).connection.sendPacket(new STitlePacket(STitlePacket.Type.ACTIONBAR, new TranslationTextComponent("item.usefulhats.ender_helmet.message.position_obstructed"), 10, 60, 10)); + } + } else { + ((ServerPlayerEntity) player).connection.sendPacket(new STitlePacket(STitlePacket.Type.ACTIONBAR, new TranslationTextComponent("item.usefulhats.ender_helmet.message.wrong_dimension"), 10, 60, 10)); + } + } + //cancel other right click operations + event.setCanceled(true); + } + } +} diff --git a/src/main/java/cech12/usefulhats/item/HatArmorMaterial.java b/src/main/java/cech12/usefulhats/item/HatArmorMaterial.java index ee58fea..98832be 100644 --- a/src/main/java/cech12/usefulhats/item/HatArmorMaterial.java +++ b/src/main/java/cech12/usefulhats/item/HatArmorMaterial.java @@ -26,6 +26,9 @@ public enum HatArmorMaterial implements IArmorMaterial { CHOPPING("usefulhats:chopping", Config.CHOPPING_HAT_DURABILITY, 15, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> { return Ingredient.fromItems(Items.RABBIT_HIDE); }), + ENDER("usefulhats:ender", Config.ENDER_HELMET_DURABILITY, 15, SoundEvents.ITEM_ARMOR_EQUIP_IRON, () -> { + return Ingredient.fromItems(Items.ENDER_PEARL); + }), HALO("usefulhats:halo", Config.HALO_DURABILITY, 15, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, () -> { return Ingredient.fromItems(Items.GLOWSTONE_DUST); }), diff --git a/src/main/java/cech12/usefulhats/item/IRightClickListener.java b/src/main/java/cech12/usefulhats/item/IRightClickListener.java new file mode 100644 index 0000000..f65a1c7 --- /dev/null +++ b/src/main/java/cech12/usefulhats/item/IRightClickListener.java @@ -0,0 +1,10 @@ +package cech12.usefulhats.item; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public interface IRightClickListener { + + void onRightClickItemEvent(PlayerInteractEvent.RightClickItem event, ItemStack headSlotItemStack); + +} diff --git a/src/main/resources/assets/usefulhats/lang/de_de.json b/src/main/resources/assets/usefulhats/lang/de_de.json index fe22414..d6c8fef 100644 --- a/src/main/resources/assets/usefulhats/lang/de_de.json +++ b/src/main/resources/assets/usefulhats/lang/de_de.json @@ -9,6 +9,14 @@ "item.usefulhats.chopping_hat": "Holzfällermütze", "item.usefulhats.chopping_hat.desc.chopping_speed": "Mit einer Axt Holz hacken ist §2%s%%§9 schneller. (mit Verzauberungen und Tränken kombinierbar)", + "item.usefulhats.ender_helmet": "Enderhelm", + "item.usefulhats.ender_helmet.desc.define_teleport": "Shift-Rechtsklick um eine neue Teleport-Position zu definieren.", + "item.usefulhats.ender_helmet.desc.teleport": "Benutze eine Enderperle um dich an die definierte Position zu teleportieren.", + "item.usefulhats.ender_helmet.desc.teleport_position": "Position: X: %s, Y: %s, Z: %s", + "item.usefulhats.ender_helmet.message.position_saved": "Position gespeichert.", + "item.usefulhats.ender_helmet.message.position_obstructed": "Ziel blockiert.", + "item.usefulhats.ender_helmet.message.wrong_dimension": "Falsche Dimension.", + "item.usefulhats.halo": "Heiligenschein", "item.usefulhats.halo.desc.no_attack": "Kein Gegner greift dich an (außer Bossmonster).", "item.usefulhats.halo.desc.beware_of_nether": "Aber hüte dich vor dem §4Nether§c.", diff --git a/src/main/resources/assets/usefulhats/lang/en_us.json b/src/main/resources/assets/usefulhats/lang/en_us.json index 25fcec3..ec98d12 100644 --- a/src/main/resources/assets/usefulhats/lang/en_us.json +++ b/src/main/resources/assets/usefulhats/lang/en_us.json @@ -9,6 +9,14 @@ "item.usefulhats.chopping_hat": "Chopping Hat", "item.usefulhats.chopping_hat.desc.chopping_speed": "Chopping with an axe is §2%s%%§9 faster. (stackable with enchantments and potions)", + "item.usefulhats.ender_helmet": "Ender Helmet", + "item.usefulhats.ender_helmet.desc.define_teleport": "Sneak right click to define a new teleport position.", + "item.usefulhats.ender_helmet.desc.teleport": "Use an Ender Pearl to teleport to the defined position.", + "item.usefulhats.ender_helmet.desc.teleport_position": "Position: X: %s, Y: %s, Z: %s", + "item.usefulhats.ender_helmet.message.position_saved": "Position saved.", + "item.usefulhats.ender_helmet.message.position_obstructed": "Destination obstructed.", + "item.usefulhats.ender_helmet.message.wrong_dimension": "Wrong dimension.", + "item.usefulhats.halo": "Halo", "item.usefulhats.halo.desc.no_attack": "No mob except bosses attacks you.", "item.usefulhats.halo.desc.beware_of_nether": "But beware of the §4Nether§c.", diff --git a/src/main/resources/assets/usefulhats/lang/es_es.json b/src/main/resources/assets/usefulhats/lang/es_es.json index b50a8ea..e1bf5cf 100644 --- a/src/main/resources/assets/usefulhats/lang/es_es.json +++ b/src/main/resources/assets/usefulhats/lang/es_es.json @@ -9,6 +9,14 @@ "item.usefulhats.chopping_hat": "Sombrero de leñador", "item.usefulhats.chopping_hat.desc.chopping_speed": "Cortar con un hacha es §2%s%%§9 más rápido. (se puede combinar con encantos y pociones)", + "item.usefulhats.ender_helmet": "Ender Helmet", + "item.usefulhats.ender_helmet.desc.define_teleport": "Sneak right click to define a new teleport position.", + "item.usefulhats.ender_helmet.desc.teleport": "Use an Ender Pearl to teleport to the defined position.", + "item.usefulhats.ender_helmet.desc.teleport_position": "Position: X: %s, Y: %s, Z: %s", + "item.usefulhats.ender_helmet.message.position_saved": "Position saved.", + "item.usefulhats.ender_helmet.message.position_obstructed": "Destination obstructed.", + "item.usefulhats.ender_helmet.message.wrong_dimension": "Wrong dimension.", + "item.usefulhats.halo": "Aureola", "item.usefulhats.halo.desc.no_attack": "Ningunas criaturas te atacan excepto jefes.", "item.usefulhats.halo.desc.beware_of_nether": "Pero cuidado con el §4Nether§c.", diff --git a/src/main/resources/assets/usefulhats/lang/pt_br.json b/src/main/resources/assets/usefulhats/lang/pt_br.json index d8b2ec7..6775428 100644 --- a/src/main/resources/assets/usefulhats/lang/pt_br.json +++ b/src/main/resources/assets/usefulhats/lang/pt_br.json @@ -8,7 +8,15 @@ "item.usefulhats.chopping_hat": "Chapéu do Lenhador", "item.usefulhats.chopping_hat.desc.chopping_speed": "Cortar com um machado é §2%s%%§9 mais rápido. (Somase a encantamentos e poções)", - + + "item.usefulhats.ender_helmet": "Ender Helmet", + "item.usefulhats.ender_helmet.desc.define_teleport": "Sneak right click to define a new teleport position.", + "item.usefulhats.ender_helmet.desc.teleport": "Use an Ender Pearl to teleport to the defined position.", + "item.usefulhats.ender_helmet.desc.teleport_position": "Position: X: %s, Y: %s, Z: %s", + "item.usefulhats.ender_helmet.message.position_saved": "Position saved.", + "item.usefulhats.ender_helmet.message.position_obstructed": "Destination obstructed.", + "item.usefulhats.ender_helmet.message.wrong_dimension": "Wrong dimension.", + "item.usefulhats.halo": "Auréola", "item.usefulhats.halo.desc.no_attack": "Nenhuma mob ataca você (Exceto chefes).", "item.usefulhats.halo.desc.beware_of_nether": "Mas cuidado com o §4Nether§c.", diff --git a/src/main/resources/assets/usefulhats/lang/zh_tw.json b/src/main/resources/assets/usefulhats/lang/zh_tw.json index c7c2023..07f74e6 100644 --- a/src/main/resources/assets/usefulhats/lang/zh_tw.json +++ b/src/main/resources/assets/usefulhats/lang/zh_tw.json @@ -9,6 +9,14 @@ "item.usefulhats.chopping_hat": "木工帽", "item.usefulhats.chopping_hat.desc.chopping_speed": "用斧砍樹時加速 §2%s%%§9 時間. (可和附魔及藥水效果疊加)", + "item.usefulhats.ender_helmet": "Ender Helmet", + "item.usefulhats.ender_helmet.desc.define_teleport": "Sneak right click to define a new teleport position.", + "item.usefulhats.ender_helmet.desc.teleport": "Use an Ender Pearl to teleport to the defined position.", + "item.usefulhats.ender_helmet.desc.teleport_position": "Position: X: %s, Y: %s, Z: %s", + "item.usefulhats.ender_helmet.message.position_saved": "Position saved.", + "item.usefulhats.ender_helmet.message.position_obstructed": "Destination obstructed.", + "item.usefulhats.ender_helmet.message.wrong_dimension": "Wrong dimension.", + "item.usefulhats.halo": "聖光", "item.usefulhats.halo.desc.no_attack": "除了Boss以外的生物不會攻擊你.", "item.usefulhats.halo.desc.beware_of_nether": "除了 §4地獄§c 生物.", diff --git a/src/main/resources/assets/usefulhats/models/item/ender_helmet.json b/src/main/resources/assets/usefulhats/models/item/ender_helmet.json new file mode 100644 index 0000000..20793fc --- /dev/null +++ b/src/main/resources/assets/usefulhats/models/item/ender_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "usefulhats:item/ender_helmet" + } +} diff --git a/src/main/resources/assets/usefulhats/textures/item/ender_helmet.png b/src/main/resources/assets/usefulhats/textures/item/ender_helmet.png new file mode 100644 index 0000000000000000000000000000000000000000..3d7b084257de331015a19fc1f98b045cf630704e GIT binary patch literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}H0G|+7Ag!ybJ9X;R+S*zvDXIVe{~tVfFeoU<(GjSWK|JawNF`TEkY6xR z3IZ55ozXcD6y+@Nh%9Dc;5!Jyj5{V~zXb|Nn{1`KGI<7W#Ux`}dI{p;V85!L;Vzd8+sJGhgG_b<5=TTfh0j zCtu0`mNmFjHLvgKipXky5&Qd^ajQYY&i^H c@(;|B=lSBQV)DyxG0^1zopr0OzKIzyJUM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/usefulhats/textures/models/armor/ender_layer_1_overlay.png b/src/main/resources/assets/usefulhats/textures/models/armor/ender_layer_1_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..4a7fcc7ed5c33fe7567018d6bb90a020d609da6e GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3-p)I`?e@QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`*#dk*T!AzYEKT2e9!N2j1o;L3XL!2ZzzfLZEbxddW?;`A4^Ki03quzJ2jl$>#;<@H7(8A5T-G@yGywqpz$jG! literal 0 HcmV?d00001 diff --git a/src/main/resources/data/usefulhats/advancements/recipes/combat/ender_helmet.json b/src/main/resources/data/usefulhats/advancements/recipes/combat/ender_helmet.json new file mode 100644 index 0000000..5a1c719 --- /dev/null +++ b/src/main/resources/data/usefulhats/advancements/recipes/combat/ender_helmet.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "usefulhats:ender_helmet" + ] + }, + "criteria": { + "has_ender_pearl": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "minecraft:ender_pearl" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "usefulhats:ender_helmet" + } + } + }, + "requirements": [ + [ + "has_ender_pearl", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/usefulhats/recipes/ender_helmet.json b/src/main/resources/data/usefulhats/recipes/ender_helmet.json new file mode 100644 index 0000000..4367c59 --- /dev/null +++ b/src/main/resources/data/usefulhats/recipes/ender_helmet.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "type": "usefulhats:is_enabled", + "item": "usefulhats:ender_helmet" + } + ], + "pattern": [ + "###", + "# #" + ], + "key": { + "#": { + "item": "minecraft:ender_pearl" + } + }, + "result": { + "item": "usefulhats:ender_helmet" + } +} \ No newline at end of file