Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/main/java/io/github/pylonmc/pylon/PylonItemTag.java
Original file line number Diff line number Diff line change
@@ -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")
Comment thread
Intybyte marked this conversation as resolved.
Resolved
.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);
}
}
40 changes: 37 additions & 3 deletions src/main/java/io/github/pylonmc/pylon/PylonItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/github/pylonmc/pylon/PylonKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
17 changes: 17 additions & 0 deletions src/main/resources/lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ item:
<diamond> 1x <yellow><item:pylon:bloomery/></yellow>
<diamond> 4x <yellow><item:pylon:refractory_bricks/></yellow>

glass_breaker:
name: "Glass Breaker"
lore: |-
<arrow> Breaks glass like material faster, includes:
<arrow> - All types of glass blocks
<arrow> - All types of glass panes
<arrow> - Sea Lantern
<arrow> - Glowstone Block
<arrow> - Redstone Lamp
<arrow> - Beacon
Comment on lines +160 to +166

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New lore suggestion:

<arrow> Breaks fragile blocks faster
<arrow> Works on <yellow>Glass Blocks</yellow>, <yellow>Glass Panes</yellow>, <yellow>Sea Lanterns</yellow>, <yellow>Glowstone Blocks</yellow>, <yellow>Redstone Lamps</yellow>, and <yellow>Beacons</yellow>

(2nd line looks way longer than it is because the tags)

bronze_anvil:
name: "Bronze Anvil"
lore: |-
Expand Down Expand Up @@ -567,6 +577,13 @@ item:
<arrow> The rarer the item/block, the more times it can be examined
<arrow> <red>The examined item/block will be consumed</red>
<arrow> <insn>Hold right click</insn> on a block or dropped item to examine it
bronze_loupe:
name: "Bronze Loupe"
lore: |-
<arrow> Examining items/blocks with the loupe yields research points
<arrow> The rarer the item/block, the more times it can be examined
<arrow> <red>The examined item/block will be consumed</red>
<arrow> <insn>Hold right click</insn> on a block or dropped item to examine it

lumber_axe:
name: "Lumber Axe"
Expand Down
24 changes: 24 additions & 0 deletions src/main/resources/recipes/minecraft/crafting_shaped.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/settings/bronze_loupe.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions src/main/resources/settings/glass_breaker.yml
Original file line number Diff line number Diff line change
@@ -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
Loading