diff --git a/src/main/java/io/github/pylonmc/pylon/PylonItemTag.java b/src/main/java/io/github/pylonmc/pylon/PylonItemTag.java new file mode 100644 index 000000000..a18a26079 --- /dev/null +++ b/src/main/java/io/github/pylonmc/pylon/PylonItemTag.java @@ -0,0 +1,28 @@ +package io.github.pylonmc.pylon; + +import com.destroystokyo.paper.MaterialSetTag; +import io.github.pylonmc.rebar.item.RebarItemTag; +import io.github.pylonmc.rebar.registry.RebarRegistry; +import org.bukkit.Material; + +import static io.github.pylonmc.pylon.util.PylonUtils.pylonKey; + +public class PylonItemTag { + public static final MaterialSetTag GLASSLIKE_BUKKIT = new MaterialSetTag(pylonKey("all_glass")) + .endsWith("_GLASS") + .endsWith("GLASS_PANE") + .add(Material.GLASS) + .add(Material.SEA_LANTERN) + .add(Material.BEACON) + .add(Material.GLOWSTONE) + .add(Material.REDSTONE_LAMP); + + public static final RebarItemTag GLASSLIKE = new RebarItemTag( + GLASSLIKE_BUKKIT.getKey(), + GLASSLIKE_BUKKIT.getValues().toArray(new Material[0]) + ); + + static { + RebarRegistry.ITEM_TAGS.register(GLASSLIKE); + } +} diff --git a/src/main/java/io/github/pylonmc/pylon/PylonItems.java b/src/main/java/io/github/pylonmc/pylon/PylonItems.java index 71f254af0..04ad37cd8 100644 --- a/src/main/java/io/github/pylonmc/pylon/PylonItems.java +++ b/src/main/java/io/github/pylonmc/pylon/PylonItems.java @@ -47,16 +47,22 @@ import io.papermc.paper.datacomponent.item.*; import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation; +import io.papermc.paper.registry.RegistryKey; +import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.keys.SoundEventKeys; +import io.papermc.paper.registry.keys.tags.DamageTypeTagKeys; +import io.papermc.paper.registry.set.RegistrySet; import net.kyori.adventure.key.Key; import org.bukkit.*; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.EquipmentSlot; -import org.bukkit.inventory.EquipmentSlotGroup; -import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.*; +import org.bukkit.inventory.recipe.CraftingBookCategory; +import org.bukkit.potion.PotionType; + +import java.util.Objects; import static io.github.pylonmc.pylon.util.PylonUtils.pylonKey; @@ -87,6 +93,25 @@ private PylonItems() { PylonPages.SCIENCE.addItem(LOUPE); } + + public static final ItemStack BRONZE_LOUPE = ItemStackBuilder.rebar(Material.CLAY_BALL, PylonKeys.BRONZE_LOUPE) + .set(DataComponentTypes.ITEM_MODEL, Material.GLASS_PANE.getKey()) + .set(DataComponentTypes.CONSUMABLE, Consumable.consumable() + .animation(ItemUseAnimation.SPYGLASS) + .hasConsumeParticles(false) + .consumeSeconds(ConfigSection.fromSettings(PylonKeys.BRONZE_LOUPE).getOrThrow("use-ticks", ConfigAdapter.INTEGER) / 20.0F) + .sound(SoundEventKeys.INTENTIONALLY_EMPTY) + ) + .set(DataComponentTypes.USE_COOLDOWN, UseCooldown.useCooldown( + ConfigSection.fromSettings(PylonKeys.BRONZE_LOUPE).getOrThrow("cooldown-ticks", ConfigAdapter.INTEGER) / 20.0F) + .cooldownGroup(PylonKeys.LOUPE) + ) + .build(); + static { + RebarItem.register(Loupe.class, BRONZE_LOUPE); + PylonPages.SCIENCE.addItem(BRONZE_LOUPE); + } + public static final ItemStack RESEARCH_PACK_1 = ItemStackBuilder.rebar(Material.RED_BANNER, PylonKeys.RESEARCH_PACK_1) .set(DataComponentTypes.MAX_STACK_SIZE, 3) .build(); @@ -983,6 +1008,15 @@ private PylonItems() { .addButton(new MachineRecipesButton(HammerRecipe.RECIPE_TYPE)); } + public static final ItemStack GLASS_BREAKER = ItemStackBuilder.rebarToolWeapon(Material.CLAY_BALL, PylonKeys.GLASS_BREAKER, RegistrySet.keySet(RegistryKey.BLOCK, PylonItemTag.GLASSLIKE.getValues().stream().map(it -> TypedKey.create(RegistryKey.BLOCK, it.getKey())).toList()), true, false, false) + .set(DataComponentTypes.ITEM_MODEL, Material.IRON_PICKAXE.getKey()) + .build(); + static { + RebarItem.register(RebarItem.class, GLASS_BREAKER); + PylonPages.TOOLS.addItem(GLASS_BREAKER); + } + + public static final ItemStack BRONZE_AXE = ItemStackBuilder.rebarToolWeapon(Material.STONE_AXE, PylonKeys.BRONZE_AXE, RebarUtils.axeMineable(), true, false, true) .set(DataComponentTypes.ITEM_MODEL, Material.GOLDEN_AXE.getKey()) .build(); diff --git a/src/main/java/io/github/pylonmc/pylon/PylonKeys.java b/src/main/java/io/github/pylonmc/pylon/PylonKeys.java index a2fc37314..1af84e9e6 100644 --- a/src/main/java/io/github/pylonmc/pylon/PylonKeys.java +++ b/src/main/java/io/github/pylonmc/pylon/PylonKeys.java @@ -97,6 +97,8 @@ public class PylonKeys { public static final NamespacedKey FIBER = pylonKey("fiber"); + public static final NamespacedKey GLASS_BREAKER = pylonKey("glass_breaker"); + public static final NamespacedKey BRONZE_SWORD = pylonKey("bronze_sword"); public static final NamespacedKey BRONZE_AXE = pylonKey("bronze_axe"); public static final NamespacedKey BRONZE_PICKAXE = pylonKey("bronze_pickaxe"); @@ -228,6 +230,7 @@ public class PylonKeys { public static final NamespacedKey CREATIVE_FLUID_SOURCE = pylonKey("creative_fluid_source"); public static final NamespacedKey LOUPE = pylonKey("loupe"); + public static final NamespacedKey BRONZE_LOUPE = pylonKey("bronze_loupe"); public static final NamespacedKey RESEARCH_PACK_1 = pylonKey("research_pack_1"); public static final NamespacedKey RESEARCH_PACK_2 = pylonKey("research_pack_2"); diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index 65b7a7c90..3482b84b4 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -154,6 +154,16 @@ item: 1x 4x + glass_breaker: + name: "Glass Breaker" + lore: |- + Breaks glass like material faster, includes: + - All types of glass blocks + - All types of glass panes + - Sea Lantern + - Glowstone Block + - Redstone Lamp + - Beacon bronze_anvil: name: "Bronze Anvil" lore: |- @@ -567,6 +577,13 @@ item: The rarer the item/block, the more times it can be examined The examined item/block will be consumed Hold right click on a block or dropped item to examine it + bronze_loupe: + name: "Bronze Loupe" + lore: |- + Examining items/blocks with the loupe yields research points + The rarer the item/block, the more times it can be examined + The examined item/block will be consumed + Hold right click on a block or dropped item to examine it lumber_axe: name: "Lumber Axe" diff --git a/src/main/resources/recipes/minecraft/crafting_shaped.yml b/src/main/resources/recipes/minecraft/crafting_shaped.yml index e7edfd76d..4d35bb7ac 100644 --- a/src/main/resources/recipes/minecraft/crafting_shaped.yml +++ b/src/main/resources/recipes/minecraft/crafting_shaped.yml @@ -123,6 +123,19 @@ pylon:gypsum_block_from_gypsum: result: pylon:gypsum_block category: building +pylon:glass_breaker: + pattern: + - "TCT" + - "RSR" + - " S " + key: + S: minecraft:stick + C: minecraft:glowstone + T: pylon:tin_ingot + R: minecraft:redstone + result: pylon:glass_breaker + category: equipment + pylon:bronze_sword: pattern: - " I " @@ -1087,6 +1100,17 @@ pylon:loupe: result: pylon:loupe category: equipment +pylon:bronze_loupe: + pattern: + - " C " + - "CGC" + - " C " + key: + C: pylon:bronze_ingot + G: pylon:loupe + result: pylon:bronze_loupe + category: equipment + pylon:fluid_strainer: pattern: - "CBC" diff --git a/src/main/resources/settings/bronze_loupe.yml b/src/main/resources/settings/bronze_loupe.yml new file mode 100644 index 000000000..7eb038492 --- /dev/null +++ b/src/main/resources/settings/bronze_loupe.yml @@ -0,0 +1,4 @@ +# how long it takes to scan an object +use-ticks: 10 +# after a successful scan, how long should the item be on cooldown +cooldown-ticks: 10 \ No newline at end of file diff --git a/src/main/resources/settings/glass_breaker.yml b/src/main/resources/settings/glass_breaker.yml new file mode 100644 index 000000000..fbc9ec981 --- /dev/null +++ b/src/main/resources/settings/glass_breaker.yml @@ -0,0 +1,6 @@ +durability: 512 +mining-speed: 9.0 +mining-durability-damage: 1 +attack-durability-damage: 1 +attack-damage: 4.5 +attack-speed: 1.2 \ No newline at end of file