From d90cd47ce778de2572ce8207ed26b9f154507789 Mon Sep 17 00:00:00 2001 From: Seggan Date: Wed, 12 Nov 2025 17:46:10 -0500 Subject: [PATCH 1/9] Update loupe desc Fixes #422 --- src/main/resources/lang/en.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index 5e6517d3..8c1fe3fc 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -480,9 +480,9 @@ item: loupe: name: "Loupe" lore: |- - Examining items with the loupe yields research points - The rarer the item, the more times it can be examined - The examined item will be consumed + 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: From 642e4df9f42a1168f9746ecc5f20b2a65ec8d535 Mon Sep 17 00:00:00 2001 From: Seggan Date: Wed, 12 Nov 2025 18:33:15 -0500 Subject: [PATCH 2/9] Fix grindstone top slab Fixes #242 --- .../github/pylonmc/pylon/base/PylonBase.java | 4 +++- .../content/machines/simple/Grindstone.java | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java b/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java index 5539b9b6..5a118732 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java +++ b/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java @@ -4,9 +4,10 @@ import io.github.pylonmc.pylon.base.content.building.IgneousCompositeListener; import io.github.pylonmc.pylon.base.content.building.Immobilizer; import io.github.pylonmc.pylon.base.content.machines.fluid.Sprinkler; +import io.github.pylonmc.pylon.base.content.machines.simple.Grindstone; +import io.github.pylonmc.pylon.base.content.tools.HealthTalisman; import io.github.pylonmc.pylon.base.content.tools.ItemMagnet; import io.github.pylonmc.pylon.base.content.tools.SoulboundRune; -import io.github.pylonmc.pylon.base.content.tools.HealthTalisman; import io.github.pylonmc.pylon.base.content.tools.base.Rune; import io.github.pylonmc.pylon.core.addon.PylonAddon; import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; @@ -60,6 +61,7 @@ public void onEnable() { new ItemMagnet.Ticker().runTaskTimer(this, 0, 10); pm.registerEvents(new SoulboundRune.SoulboundRuneListener(), this); new HealthTalisman.HealthTalismanTicker().runTaskTimer(this, 0, BaseConfig.HEALTH_TALISMAN_CHECK_INTERVAL); + pm.registerEvents(new Grindstone.PlaceListener(), this); } @Override diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/simple/Grindstone.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/simple/Grindstone.java index a9637bb5..6e5accf8 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/simple/Grindstone.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/simple/Grindstone.java @@ -15,6 +15,7 @@ import io.github.pylonmc.pylon.core.config.adapter.ConfigAdapter; import io.github.pylonmc.pylon.core.entity.display.ItemDisplayBuilder; import io.github.pylonmc.pylon.core.entity.display.transform.TransformBuilder; +import io.github.pylonmc.pylon.core.event.PrePylonBlockPlaceEvent; import io.github.pylonmc.pylon.core.event.PrePylonCraftEvent; import io.github.pylonmc.pylon.core.event.PylonCraftEvent; import io.github.pylonmc.pylon.core.item.builder.ItemStackBuilder; @@ -23,8 +24,11 @@ import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.block.Block; +import org.bukkit.block.data.type.Slab; import org.bukkit.entity.ItemDisplay; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; @@ -201,4 +205,20 @@ public boolean tryStartRecipe(@NotNull GrindstoneRecipe nextRecipe, @Nullable Pl .rotate(0, rotation, 0) .buildForItemDisplay(); } + + public static final class PlaceListener implements Listener { + @EventHandler + private void onPlace(PrePylonBlockPlaceEvent e) { + if (!e.getBlockSchema().getKey().equals(BaseKeys.GRINDSTONE)) return; + Slab slab = (Slab) e.getBlock().getBlockData(); + switch (slab.getType()) { + case TOP -> { + slab.setType(Slab.Type.BOTTOM); + e.getBlock().setBlockData(slab); + } + case BOTTOM -> { /* Allow */ } + case DOUBLE -> e.setCancelled(true); + } + } + } } From a65515cf628de0ac2261279ca5bce96fb31b874c Mon Sep 17 00:00:00 2001 From: Seggan Date: Wed, 12 Nov 2025 19:32:12 -0500 Subject: [PATCH 3/9] Random lore stuff Fixes #442 Resolves #384 Resolves #383 --- .../base/content/building/Immobilizer.java | 8 +-- .../pylon/base/content/tools/Hammer.java | 16 +----- .../pylon/base/recipes/HammerRecipe.java | 51 +++++++++++++++---- src/main/resources/lang/en.yml | 13 ++--- 4 files changed, 53 insertions(+), 35 deletions(-) diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/building/Immobilizer.java b/src/main/java/io/github/pylonmc/pylon/base/content/building/Immobilizer.java index e9c7b9c0..ecf279b1 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/building/Immobilizer.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/building/Immobilizer.java @@ -9,6 +9,7 @@ import io.github.pylonmc.pylon.core.config.adapter.ConfigAdapter; import io.github.pylonmc.pylon.core.i18n.PylonArgument; import io.github.pylonmc.pylon.core.item.PylonItem; +import io.github.pylonmc.pylon.core.util.gui.unit.UnitFormat; import io.github.pylonmc.pylon.core.util.position.BlockPosition; import org.bukkit.Bukkit; import org.bukkit.NamespacedKey; @@ -26,6 +27,7 @@ import org.bukkit.scheduler.BukkitScheduler; import org.jetbrains.annotations.NotNull; +import java.time.Duration; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -46,9 +48,9 @@ public Item(@NotNull ItemStack stack) { @Override public @NotNull List getPlaceholders() { return List.of( - PylonArgument.of("duration", duration), - PylonArgument.of("radius", radius), - PylonArgument.of("cooldown", cooldown) + PylonArgument.of("duration", UnitFormat.formatDuration(Duration.ofSeconds(duration / 20))), + PylonArgument.of("radius", UnitFormat.BLOCKS.format(radius)), + PylonArgument.of("cooldown", UnitFormat.formatDuration(Duration.ofMillis(cooldown * 50L))) ); } } diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/tools/Hammer.java b/src/main/java/io/github/pylonmc/pylon/base/content/tools/Hammer.java index 95fb5edf..3bffde60 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/tools/Hammer.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/tools/Hammer.java @@ -7,9 +7,7 @@ import io.github.pylonmc.pylon.core.event.PrePylonCraftEvent; import io.github.pylonmc.pylon.core.event.PylonCraftEvent; import io.github.pylonmc.pylon.core.item.PylonItem; -import io.github.pylonmc.pylon.core.item.PylonItemSchema; import io.github.pylonmc.pylon.core.item.base.PylonBlockInteractor; -import io.github.pylonmc.pylon.core.registry.PylonRegistry; import io.github.pylonmc.pylon.core.util.MiningLevel; import io.github.pylonmc.pylon.core.util.PylonUtils; import io.github.pylonmc.pylon.core.util.RandomizedSound; @@ -29,7 +27,6 @@ import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.Unmodifiable; import java.util.ArrayList; import java.util.List; @@ -80,10 +77,7 @@ public boolean tryDoRecipe(@NotNull Block block, @Nullable Player player, @Nulla anyRecipeAttempted = true; - float adjustedChance = recipe.chance() * - // Each tier is twice as likely to succeed as the previous one - (1 << miningLevel.getNumericalLevel() - recipe.level().getNumericalLevel()); - if (ThreadLocalRandom.current().nextFloat() > adjustedChance) continue; + if (ThreadLocalRandom.current().nextFloat() > recipe.getChanceFor(miningLevel)) continue; for (ItemStack item : items) { if (recipe.input().matches(item)) { @@ -145,14 +139,6 @@ private static MiningLevel getMiningLevel(@NotNull NamespacedKey key) { ).get(key); } - public static @NotNull @Unmodifiable List hammersWithMiningLevelAtLeast(@NotNull MiningLevel level) { - return PylonRegistry.ITEMS.getValues().stream() - .map(PylonItemSchema::getItemStack) - .filter(item -> fromStack(item) instanceof Hammer hammer - && hammer.miningLevel.isAtLeast(level)) - .toList(); - } - private static boolean recipeMatches(List items, @NotNull HammerRecipe recipe) { return items.stream().anyMatch(recipe.input()::matches); } diff --git a/src/main/java/io/github/pylonmc/pylon/base/recipes/HammerRecipe.java b/src/main/java/io/github/pylonmc/pylon/base/recipes/HammerRecipe.java index 0610ac1c..c37e97c9 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/recipes/HammerRecipe.java +++ b/src/main/java/io/github/pylonmc/pylon/base/recipes/HammerRecipe.java @@ -1,27 +1,33 @@ package io.github.pylonmc.pylon.base.recipes; +import com.google.common.base.Preconditions; import io.github.pylonmc.pylon.base.content.tools.Hammer; import io.github.pylonmc.pylon.core.config.ConfigSection; import io.github.pylonmc.pylon.core.config.adapter.ConfigAdapter; import io.github.pylonmc.pylon.core.guide.button.ItemButton; -import io.github.pylonmc.pylon.core.item.builder.ItemStackBuilder; +import io.github.pylonmc.pylon.core.i18n.PylonArgument; +import io.github.pylonmc.pylon.core.item.PylonItem; +import io.github.pylonmc.pylon.core.item.PylonItemSchema; import io.github.pylonmc.pylon.core.recipe.*; +import io.github.pylonmc.pylon.core.registry.PylonRegistry; import io.github.pylonmc.pylon.core.util.MiningLevel; import io.github.pylonmc.pylon.core.util.gui.GuiItems; +import io.github.pylonmc.pylon.core.util.gui.unit.UnitFormat; +import net.kyori.adventure.text.Component; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import xyz.xenondevs.invui.gui.Gui; -import xyz.xenondevs.invui.item.impl.AutoCycleItem; +import java.util.ArrayList; import java.util.List; import static io.github.pylonmc.pylon.base.util.BaseUtils.baseKey; /** - * @param input the input item (setting the itemstack to have an amount that's not 1 will have no effect) + * @param input the input item (setting the itemstack to have an amount that's not 1 will have no effect) * @param result the output item (respects amount) - * @param level the minimum hammer mining level + * @param level the minimum hammer mining level * @param chance the chance to succeed per attempt */ public record HammerRecipe( @@ -75,14 +81,37 @@ public record HammerRecipe( ) .addIngredient('#', GuiItems.backgroundBlack()) .addIngredient('i', ItemButton.from(input)) - .addIngredient('h', new AutoCycleItem(20, - Hammer.hammersWithMiningLevelAtLeast(level) - .stream() - .map(ItemStackBuilder::of) - .toList() - .toArray(ItemStackBuilder[]::new) - )) + .addIngredient('h', new ItemButton(getHammers())) .addIngredient('o', ItemButton.from(result)) .build(); } + + public float getChanceFor(@NotNull MiningLevel hammerLevel) { + if (!hammerLevel.isAtLeast(level)) { + return 0f; + } + // Each tier is twice as likely to succeed as the previous one + return chance * (1 << hammerLevel.getNumericalLevel() - level.getNumericalLevel()); + } + + private List getHammers() { + List hammers = new ArrayList<>(); + for (PylonItemSchema itemSchema : PylonRegistry.ITEMS.getValues()) { + ItemStack stack = itemSchema.getItemStack(); + PylonItem item = PylonItem.fromStack(stack); + if (item instanceof Hammer hammer) { + float chance = Math.min(1, getChanceFor(hammer.miningLevel)); + if (chance <= 0f) continue; + List lore = stack.lore(); + Preconditions.checkNotNull(lore); + lore.add(Component.empty()); + lore.add(Component.translatable("pylon.pylonbase.guide.recipe.hammer", + PylonArgument.of("chance", UnitFormat.PERCENT.format(chance * 100f).significantFigures(3)) + )); + stack.lore(lore); + hammers.add(stack); + } + } + return hammers; + } } \ No newline at end of file diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index 8c1fe3fc..a682d705 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -450,19 +450,19 @@ item: name: "Diamond Hammer" lore: |- Right click an item dropped on top of a placed block of diamond to use the hammer on it - Higher tier hammers are more likely to succeed + Higher tier hammers are twice as likely to succeed than the tier below them for a given recipe iron_hammer: name: "Iron Hammer" lore: |- Right click an item dropped on top of a placed block of iron to use the hammer on it - Higher tier hammers are more likely to succeed + Higher tier hammers are twice as likely to succeed than the tier below them for a given recipe stone_hammer: name: "Stone Hammer" lore: |- Right click an item dropped on top of a placed stone block to use the hammer on it - Higher tier hammers are more likely to succeed + Higher tier hammers are twice as likely to succeed than the tier below them for a given recipe immobilizer: name: "Immobilizer" @@ -803,10 +803,10 @@ item: item_magnet: name: "Item Magnet" lore: |- - Pulls item towards you in a range - Right click to toggle + Pulls items towards you in a range + Right click to toggle Does not stack - Pulls distance: %pickup-distance% + Pull distance: %pickup-distance% water_pump: name: "Water Pump" @@ -1403,6 +1403,7 @@ guide: melting: "Temperature: %temperature%" casting: "Temperature: %temperature%" drilling: "Cycle time: %time%" + hammer: "Chance: %chance%" message: fluid_none: "None" From 42ec1313e046803321ebeb2c9c6c04e999f011c0 Mon Sep 17 00:00:00 2001 From: Seggan Date: Wed, 12 Nov 2025 19:46:57 -0500 Subject: [PATCH 4/9] Excavator now only uses fluid when actually mined Fixes #307 --- .../content/machines/hydraulics/HydraulicExcavator.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicExcavator.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicExcavator.java index d4b0db44..3eefc5cd 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicExcavator.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicExcavator.java @@ -3,7 +3,6 @@ import io.github.pylonmc.pylon.base.BaseFluids; import io.github.pylonmc.pylon.base.BaseKeys; import io.github.pylonmc.pylon.core.block.PylonBlock; -import io.github.pylonmc.pylon.core.block.base.PylonEntityHolderBlock; import io.github.pylonmc.pylon.core.block.base.PylonFluidBufferBlock; import io.github.pylonmc.pylon.core.block.base.PylonInteractBlock; import io.github.pylonmc.pylon.core.block.base.PylonTickingBlock; @@ -133,13 +132,12 @@ public void tick(double deltaSeconds) { Block block = position.getBlock(); if (Tag.MINEABLE_SHOVEL.isTagged(block.getType())) { block.breakNaturally(); + removeFluid(BaseFluids.HYDRAULIC_FLUID, hydraulicFluidUsed); + addFluid(BaseFluids.DIRTY_HYDRAULIC_FLUID, hydraulicFluidUsed); break; } } } - - removeFluid(BaseFluids.HYDRAULIC_FLUID, hydraulicFluidUsed); - addFluid(BaseFluids.DIRTY_HYDRAULIC_FLUID, hydraulicFluidUsed); } @Override From c1226ec99aa6da14f4eb6d79cad9f8d8e0a9aba6 Mon Sep 17 00:00:00 2001 From: Seggan Date: Thu, 13 Nov 2025 13:52:32 -0500 Subject: [PATCH 5/9] Loupe fixes Fixes #429 Fixes #423 --- .../pylon/base/content/science/Loupe.java | 16 +++++++++------- src/main/resources/lang/en.yml | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/science/Loupe.java b/src/main/java/io/github/pylonmc/pylon/base/content/science/Loupe.java index db42e756..2f2c1832 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/science/Loupe.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/science/Loupe.java @@ -1,5 +1,6 @@ package io.github.pylonmc.pylon.base.content.science; +import com.google.common.base.Preconditions; import io.github.pylonmc.pylon.base.BaseKeys; import io.github.pylonmc.pylon.base.PylonBase; import io.github.pylonmc.pylon.core.block.BlockStorage; @@ -31,11 +32,7 @@ import org.bukkit.persistence.PersistentDataType; import org.jetbrains.annotations.NotNull; -import java.util.Collection; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; +import java.util.*; @SuppressWarnings("UnstableApiUsage") @@ -113,6 +110,11 @@ public void onUsedToRightClick(@NotNull PlayerInteractEvent event) { } private static boolean processMaterial(Material type, Player player) { + if (!type.isItem()) { + player.sendMessage(Component.translatable("pylon.pylonbase.message.loupe.invalid_block")); + return true; + } + var items = player.getPersistentDataContainer().getOrDefault(CONSUMED_KEY, CONSUMED_TYPE, Map.of()); ItemRarity rarity = type.getDefaultData(DataComponentTypes.RARITY); int maxUses = itemConfigs.get(rarity).uses; @@ -155,12 +157,12 @@ public void onConsumed(@NotNull PlayerItemConsumeEvent event) { // process block aimed at Material blockType = toScan.getType(); BlockType bt = blockType.asBlockType(); - if (bt == null) return; // shouldn't happen + Preconditions.checkNotNull(bt); + if (!new BlockBreakEvent(toScan, player).callEvent()) return; if (addPoints(blockType, Component.translatable(bt.translationKey()), player)) return; if (blockType.getHardness() > 0f) { // filter out unbreakable blocks toScan.setType(Material.AIR); - new BlockBreakEvent(toScan, player).callEvent(); } } diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index a682d705..fb5ada67 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -1415,6 +1415,7 @@ message: gained_research_points: "+%points% research points (%total% points total)" loupe: nothing: "You look at your hand. It is not very interesting" + invalid_block: "Try as you may, you cannot glean any information from this block" already_examined: "You cannot find any more interesting things about this item" is_pylon: "Having built this, you can't think of anything interesting you might find out about it" examined: "As you examine the %item%, you get a sudden flash of insight" From 06f2478b40f7dfdb47610e6a87248340622c86c1 Mon Sep 17 00:00:00 2001 From: Seggan Date: Thu, 13 Nov 2025 14:17:01 -0500 Subject: [PATCH 6/9] Fix wrong interpolation for hydraulic hammer head Fixes #376 --- .../base/content/machines/hydraulics/HydraulicHammerHead.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicHammerHead.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicHammerHead.java index 559280e6..31e7c894 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicHammerHead.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicHammerHead.java @@ -182,7 +182,7 @@ public void tick(double deltaSeconds) { Bukkit.getScheduler().runTaskLater(PylonBase.getInstance(), () -> { BaseUtils.animate(getHammerHead(), hammer.cooldownTicks - GO_DOWN_TIME_TICKS, getHeadTransformation(0.7)); - BaseUtils.animate(getHammerTip(), hammer.cooldownTicks - GO_DOWN_TIME_TICKS, getHeadTransformation(0.7)); + BaseUtils.animate(getHammerTip(), hammer.cooldownTicks - GO_DOWN_TIME_TICKS, getTipTransformation(-0.3)); new ParticleBuilder(Particle.BLOCK) .data(baseBlock.getBlockData()) From 1b41bb8593607803d2b1c5856509f6426390f1ad Mon Sep 17 00:00:00 2001 From: Seggan Date: Thu, 13 Nov 2025 16:10:49 -0500 Subject: [PATCH 7/9] Various recipe-related things Resolves #274 Resolves #419 Fixes #252 Resolves #396 --- .../github/pylonmc/pylon/base/BaseFluids.java | 142 ------------- .../recipes/minecraft/crafting_shaped.yml | 10 +- .../recipes/minecraft/crafting_shapeless.yml | 16 +- .../resources/recipes/pylonbase/casting.yml | 53 +++++ .../recipes/pylonbase/grindstone.yml | 6 + .../resources/recipes/pylonbase/hammer.yml | 14 +- .../resources/recipes/pylonbase/melting.yml | 194 +++++++++++++++++- 7 files changed, 285 insertions(+), 150 deletions(-) create mode 100644 src/main/resources/recipes/pylonbase/casting.yml diff --git a/src/main/java/io/github/pylonmc/pylon/base/BaseFluids.java b/src/main/java/io/github/pylonmc/pylon/base/BaseFluids.java index e6cdb63b..cad23e38 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/BaseFluids.java +++ b/src/main/java/io/github/pylonmc/pylon/base/BaseFluids.java @@ -1,15 +1,10 @@ package io.github.pylonmc.pylon.base; import io.github.pylonmc.pylon.base.content.machines.smelting.Slurry; -import io.github.pylonmc.pylon.base.recipes.CastingRecipe; -import io.github.pylonmc.pylon.base.recipes.MeltingRecipe; import io.github.pylonmc.pylon.core.fluid.PylonFluid; import io.github.pylonmc.pylon.core.fluid.tags.FluidTemperature; -import io.github.pylonmc.pylon.core.recipe.RecipeInput; import org.bukkit.Material; -import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.Nullable; import static io.github.pylonmc.pylon.base.util.BaseUtils.baseKey; @@ -153,169 +148,32 @@ private BaseFluids() { // TODO refactor into static blocks as in BaseItems public static void initialize() { WATER.register(); - LAVA.register(); - OBSCYRA.register(); - SULFUR.register(); - MERCURY.register(); - COPPER.register(); - addMetalRecipes( - COPPER, - 1083, - new ItemStack(Material.COPPER_INGOT), - BaseItems.COPPER_DUST, - null, - new ItemStack(Material.COPPER_BLOCK) - ); - GOLD.register(); - addMetalRecipes( - GOLD, - 1064, - new ItemStack(Material.GOLD_INGOT), - BaseItems.GOLD_DUST, - null, - new ItemStack(Material.GOLD_BLOCK) - ); - IRON.register(); - addMetalRecipes( - IRON, - 1064, - new ItemStack(Material.IRON_INGOT), - BaseItems.IRON_DUST, - new ItemStack(Material.IRON_NUGGET), - new ItemStack(Material.IRON_BLOCK) - ); - TIN.register(); - addMetalRecipes( - TIN, - 231.9, - BaseItems.TIN_INGOT, - BaseItems.TIN_DUST, - BaseItems.TIN_NUGGET, - BaseItems.TIN_BLOCK - ); - COBALT.register(); - addMetalRecipes( - COBALT, - 1495, - BaseItems.COBALT_INGOT, - BaseItems.COBALT_DUST, - BaseItems.COBALT_NUGGET, - BaseItems.COBALT_BLOCK - ); - NICKEL.register(); - addMetalRecipes( - NICKEL, - 1455, - BaseItems.NICKEL_INGOT, - BaseItems.NICKEL_DUST, - BaseItems.NICKEL_NUGGET, - BaseItems.NICKEL_BLOCK - ); - BRONZE.register(); - addMetalRecipes( - BRONZE, - 950, - BaseItems.BRONZE_INGOT, - BaseItems.BRONZE_DUST, - BaseItems.BRONZE_NUGGET, - BaseItems.BRONZE_BLOCK - ); - STEEL.register(); - addMetalRecipes( - STEEL, - 950, - BaseItems.STEEL_INGOT, - BaseItems.STEEL_DUST, - BaseItems.STEEL_NUGGET, - BaseItems.STEEL_BLOCK - ); SLURRY.register(); - COAL_SLURRY.register(); - CARBON_SLURRY.register(); - RAW_COPPER_SLURRY.register(); - RAW_GOLD_SLURRY.register(); - RAW_IRON_SLURRY.register(); - RAW_TIN_SLURRY.register(); - REDSTONE_SLURRY.register(); PLANT_OIL.register(); - HYDRAULIC_FLUID.register(); - DIRTY_HYDRAULIC_FLUID.register(); - REFLECTOR_FLUID.register(); - BIODIESEL.register(); } - - private static void addMetalRecipes( - PylonFluid fluid, - double temperature, - ItemStack ingot, - ItemStack dust, - @Nullable ItemStack nugget, - ItemStack block - ) { - CastingRecipe.RECIPE_TYPE.addRecipe(new CastingRecipe( - NamespacedKey.fromString(fluid.getKey() + "_to_ingot"), - RecipeInput.of(fluid, 144.0), - ingot, - temperature - )); - - MeltingRecipe.RECIPE_TYPE.addRecipe(new MeltingRecipe( - NamespacedKey.fromString(fluid.getKey() + "_from_ingot"), - RecipeInput.of(ingot), - fluid, - 144.0, - temperature - )); - - MeltingRecipe.RECIPE_TYPE.addRecipe(new MeltingRecipe( - NamespacedKey.fromString(fluid.getKey() + "_from_dust"), - RecipeInput.of(dust), - fluid, - 144.0, - temperature - )); - - if (nugget != null) { - MeltingRecipe.RECIPE_TYPE.addRecipe(new MeltingRecipe( - NamespacedKey.fromString(fluid.getKey() + "_from_nugget"), - RecipeInput.of(nugget), - fluid, - 16.0, - temperature - )); - } - - MeltingRecipe.RECIPE_TYPE.addRecipe(new MeltingRecipe( - NamespacedKey.fromString(fluid.getKey() + "_from_block"), - RecipeInput.of(block), - fluid, - 1296.0, - temperature - )); - } } diff --git a/src/main/resources/recipes/minecraft/crafting_shaped.yml b/src/main/resources/recipes/minecraft/crafting_shaped.yml index 231f2875..d43604f7 100644 --- a/src/main/resources/recipes/minecraft/crafting_shaped.yml +++ b/src/main/resources/recipes/minecraft/crafting_shaped.yml @@ -1023,7 +1023,7 @@ pylonbase:explosive_target: G: minecraft:gunpowder X: minecraft:target result: pylonbase:explosive_target - category: building + category: redstone pylonbase:immobilizer: pattern: @@ -1076,12 +1076,12 @@ pylonbase:elevator_3: pylonbase:press: pattern: - - "BPB" - - "B B" - - "BBB" + - "LPL" + - "L L" + - "LLL" key: P: minecraft:piston - B: minecraft:brick + L: "#minecraft:logs" result: pylonbase:press category: building diff --git a/src/main/resources/recipes/minecraft/crafting_shapeless.yml b/src/main/resources/recipes/minecraft/crafting_shapeless.yml index 81941be3..d5a4fc1f 100644 --- a/src/main/resources/recipes/minecraft/crafting_shapeless.yml +++ b/src/main/resources/recipes/minecraft/crafting_shapeless.yml @@ -3,60 +3,70 @@ pylonbase:tin_nuggets_from_tin_ingot: - pylonbase:tin_ingot result: pylonbase:tin_nugget: 9 + category: misc pylonbase:tin_ingots_from_tin_block: ingredients: - pylonbase:tin_block result: pylonbase:tin_ingot: 9 + category: misc pylonbase:bronze_nuggets_from_bronze_ingot: ingredients: - pylonbase:bronze_ingot result: pylonbase:bronze_nugget: 9 + category: misc pylonbase:bronze_ingots_from_bronze_block: ingredients: - pylonbase:bronze_block result: pylonbase:bronze_ingot: 9 + category: misc pylonbase:steel_nuggets_from_steel_ingot: ingredients: - pylonbase:steel_ingot result: pylonbase:steel_nugget: 9 + category: misc pylonbase:steel_ingots_from_steel_block: ingredients: - pylonbase:steel_block result: pylonbase:steel_ingot: 9 + category: misc pylonbase:nickel_nuggets_from_nickel_ingot: ingredients: - pylonbase:nickel_ingot result: pylonbase:nickel_nugget: 9 + category: misc pylonbase:nickel_ingots_from_nickel_block: ingredients: - pylonbase:nickel_block result: pylonbase:nickel_ingot: 9 + category: misc pylonbase:cobalt_nuggets_from_cobalt_ingot: ingredients: - pylonbase:cobalt_ingot result: pylonbase:cobalt_nugget: 9 + category: misc pylonbase:cobalt_ingots_from_cobalt_block: ingredients: - pylonbase:cobalt_block result: pylonbase:cobalt_ingot: 9 + category: misc pylonbase:shimmer_dust_1: ingredients: @@ -65,6 +75,7 @@ pylonbase:shimmer_dust_1: - minecraft:clay_ball result: pylonbase:shimmer_dust_1: 1 + category: misc pylonbase:medkit: ingredients: @@ -73,6 +84,7 @@ pylonbase:medkit: - pylonbase:disinfectant result: pylonbase:medkit: 1 + category: equipment pylonbase:research_pack_1: ingredients: @@ -82,9 +94,11 @@ pylonbase:research_pack_1: - pylonbase:sulfur result: pylonbase:research_pack_1: 1 + category: equipment pylonbase:explosive_target_super: ingredients: - pylonbase:explosive_target: 4 result: - pylonbase:explosive_target_super: 1 \ No newline at end of file + pylonbase:explosive_target_super: 1 + category: redstone \ No newline at end of file diff --git a/src/main/resources/recipes/pylonbase/casting.yml b/src/main/resources/recipes/pylonbase/casting.yml new file mode 100644 index 00000000..b32c19a3 --- /dev/null +++ b/src/main/resources/recipes/pylonbase/casting.yml @@ -0,0 +1,53 @@ +pylonbase:sulfur: + input: + pylonbase:sulfur: 144 + result: pylonbase:sulfur + temperature: 112.8 + +pylonbase:copper_ingot: + input: + pylonbase:copper: 144 + result: minecraft:copper_ingot + temperature: 1083 + +pylonbase:gold_ingot: + input: + pylonbase:gold: 144 + result: minecraft:gold_ingot + temperature: 1064 + +pylonbase:iron_ingot: + input: + pylonbase:iron: 144 + result: minecraft:iron_ingot + temperature: 1538 + +pylonbase:tin_ingot: + input: + pylonbase:tin: 144 + result: pylonbase:tin_ingot + temperature: 231.9 + +pylonbase:cobalt_ingot: + input: + pylonbase:cobalt: 144 + result: pylonbase:cobalt_ingot + temperature: 1495 + +pylonbase:nickel_ingot: + input: + pylonbase:nickel: 144 + result: pylonbase:nickel_ingot + temperature: 1455 + +pylonbase:bronze_ingot: + input: + pylonbase:bronze: 144 + result: pylonbase:bronze_ingot + temperature: 950 + +pylonbase:steel_ingot: + input: + pylonbase:steel: 144 + result: pylonbase:steel_ingot + temperature: 1410 \ No newline at end of file diff --git a/src/main/resources/recipes/pylonbase/grindstone.yml b/src/main/resources/recipes/pylonbase/grindstone.yml index 87380401..eee3da34 100644 --- a/src/main/resources/recipes/pylonbase/grindstone.yml +++ b/src/main/resources/recipes/pylonbase/grindstone.yml @@ -56,6 +56,12 @@ pylonbase:rock_dust: cycles: 2 particle-data: minecraft:cobblestone +pylonbase:sand: + input: minecraft:gravel + results: minecraft:sand + cycles: 2 + particle-data: minecraft:sand + pylonbase:coal_dust: input: "#minecraft:coals" results: pylonbase:coal_dust diff --git a/src/main/resources/recipes/pylonbase/hammer.yml b/src/main/resources/recipes/pylonbase/hammer.yml index a1bd238a..a25ca9fd 100644 --- a/src/main/resources/recipes/pylonbase/hammer.yml +++ b/src/main/resources/recipes/pylonbase/hammer.yml @@ -67,4 +67,16 @@ pylonbase:steel_sheet: input: pylonbase:steel_ingot result: pylonbase:steel_sheet mining-level: diamond - chance: 0.25 \ No newline at end of file + chance: 0.25 + +pylonbase:gravel_from_rocks: + input: "#pyloncore:rocks" + result: minecraft:gravel + mining-level: stone + chance: 0.5 + +pylonbase:flint_from_gravel: + input: minecraft:gravel + result: minecraft:flint + mining-level: stone + chance: 0.5 \ No newline at end of file diff --git a/src/main/resources/recipes/pylonbase/melting.yml b/src/main/resources/recipes/pylonbase/melting.yml index 4396ae7e..7ed10561 100644 --- a/src/main/resources/recipes/pylonbase/melting.yml +++ b/src/main/resources/recipes/pylonbase/melting.yml @@ -2,4 +2,196 @@ pylonbase:sulfur: input: pylonbase:sulfur result: pylonbase:sulfur amount: 144 - temperature: 112.8 \ No newline at end of file + temperature: 112.8 + +pylonbase:copper_from_ingot: + input: minecraft:copper_ingot + result: pylonbase:copper + amount: 144 + temperature: 1083 + +pylonbase:copper_from_dust: + input: pylonbase:copper_dust + result: pylonbase:copper + amount: 144 + temperature: 1083 + +pylonbase:copper_from_nugget: + input: minecraft:copper_nugget + result: pylonbase:copper + amount: 16 + temperature: 1083 + +pylonbase:copper_from_block: + input: "#minecraft:copper" + result: pylonbase:copper + amount: 1296 + temperature: 1083 + +pylonbase:gold_from_ingot: + input: minecraft:gold_ingot + result: pylonbase:gold + amount: 144 + temperature: 1064 + +pylonbase:gold_from_dust: + input: pylonbase:gold_dust + result: pylonbase:gold + amount: 144 + temperature: 1064 + +pylonbase:gold_from_nugget: + input: minecraft:gold_nugget + result: pylonbase:gold + amount: 16 + temperature: 1064 + +pylonbase:gold_from_block: + input: minecraft:gold_block + result: pylonbase:gold + amount: 1296 + temperature: 1064 + +pylonbase:iron_from_ingot: + input: minecraft:iron_ingot + result: pylonbase:iron + amount: 144 + temperature: 1064 + +pylonbase:iron_from_dust: + input: pylonbase:iron_dust + result: pylonbase:iron + amount: 144 + temperature: 1064 + +pylonbase:iron_from_nugget: + input: minecraft:iron_nugget + result: pylonbase:iron + amount: 16 + temperature: 1064 + +pylonbase:iron_from_block: + input: minecraft:iron_block + result: pylonbase:iron + amount: 1296 + temperature: 1064 + +pylonbase:tin_from_ingot: + input: pylonbase:tin_ingot + result: pylonbase:tin + amount: 144 + temperature: 231.9 + +pylonbase:tin_from_dust: + input: pylonbase:tin_dust + result: pylonbase:tin + amount: 144 + temperature: 231.9 + +pylonbase:tin_from_nugget: + input: pylonbase:tin_nugget + result: pylonbase:tin + amount: 16 + temperature: 231.9 + +pylonbase:tin_from_block: + input: pylonbase:tin_block + result: pylonbase:tin + amount: 1296 + temperature: 231.9 + +pylonbase:cobalt_from_ingot: + input: pylonbase:cobalt_ingot + result: pylonbase:cobalt + amount: 144 + temperature: 1495 + +pylonbase:cobalt_from_dust: + input: pylonbase:cobalt_dust + result: pylonbase:cobalt + amount: 144 + temperature: 1495 + +pylonbase:cobalt_from_nugget: + input: pylonbase:cobalt_nugget + result: pylonbase:cobalt + amount: 16 + temperature: 1495 + +pylonbase:cobalt_from_block: + input: pylonbase:cobalt_block + result: pylonbase:cobalt + amount: 1296 + temperature: 1495 + +pylonbase:nickel_from_ingot: + input: pylonbase:nickel_ingot + result: pylonbase:nickel + amount: 144 + temperature: 1455 + +pylonbase:nickel_from_dust: + input: pylonbase:nickel_dust + result: pylonbase:nickel + amount: 144 + temperature: 1455 + +pylonbase:nickel_from_nugget: + input: pylonbase:nickel_nugget + result: pylonbase:nickel + amount: 16 + temperature: 1455 + +pylonbase:nickel_from_block: + input: pylonbase:nickel_block + result: pylonbase:nickel + amount: 1296 + temperature: 1455 + +pylonbase:bronze_from_ingot: + input: pylonbase:bronze_ingot + result: pylonbase:bronze + amount: 144 + temperature: 950 + +pylonbase:bronze_from_dust: + input: pylonbase:bronze_dust + result: pylonbase:bronze + amount: 144 + temperature: 950 + +pylonbase:bronze_from_nugget: + input: pylonbase:bronze_nugget + result: pylonbase:bronze + amount: 16 + temperature: 950 + +pylonbase:bronze_from_block: + input: pylonbase:bronze_block + result: pylonbase:bronze + amount: 1296 + temperature: 950 + +pylonbase:steel_from_ingot: + input: pylonbase:steel_ingot + result: pylonbase:steel + amount: 144 + temperature: 1410 + +pylonbase:steel_from_dust: + input: pylonbase:steel_dust + result: pylonbase:steel + amount: 144 + temperature: 1410 + +pylonbase:steel_from_nugget: + input: pylonbase:steel_nugget + result: pylonbase:steel + amount: 16 + temperature: 1410 + +pylonbase:steel_from_block: + input: pylonbase:steel_block + result: pylonbase:steel + amount: 1296 + temperature: 1410 \ No newline at end of file From b9a4a81f20b58097b10fd3873cb7955e408aea9c Mon Sep 17 00:00:00 2001 From: Seggan Date: Thu, 13 Nov 2025 16:20:47 -0500 Subject: [PATCH 8/9] Tweak names Fixes #362 Fixes #447 --- src/main/resources/lang/en.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index fb5ada67..4bbfaa22 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -26,7 +26,7 @@ item: name: "Bronze Nugget" bronze_block: - name: "Bronze Block" + name: "Block of Bronze" bronze_sheet: name: "Bronze Sheet" @@ -59,7 +59,7 @@ item: name: "Cobalt Nugget" cobalt_block: - name: "Cobalt Block" + name: "Block of Cobalt" carbon: name: "Carbon" @@ -541,7 +541,7 @@ item: name: "Nickel Nugget" nickel_block: - name: "Nickel Block" + name: "Block of Nickel" obsidian_chip: name: "Obsidian Chip" @@ -566,7 +566,7 @@ item: Components 1x - 8x Coal Block + 8x Block of Coal 20x Coarse Dirt 1x Campfire (%campfire%x speed) ...or 1x Fire (%fire%x speed) @@ -749,7 +749,7 @@ item: name: "Steel Nugget" steel_block: - name: "Steel Block" + name: "Block of Steel" steel_sheet: name: "Steel Sheet" @@ -767,7 +767,7 @@ item: name: "Tin Nugget" tin_block: - name: "Tin Block" + name: "Block of Tin" tin_sheet: name: "Tin Sheet" @@ -1373,7 +1373,7 @@ research: climbing_equipment: "<#a6b579>Climbing equipment" vacuum_hoppers: "<#54536d>Vacuum hoppers" advanced_vacuum_hoppers: "<#54536d>Advanced vacuum hoppers" - reactivated_skulls: "<#000000>Reactivated wither skulls" + reactivated_skulls: "Reactivated wither skulls" soul_attachment: "Soul attachment" guide: From 143965f48df7c66e6d2ec0f520482e89836417cc Mon Sep 17 00:00:00 2001 From: Seggan Date: Mon, 24 Nov 2025 15:42:20 -0500 Subject: [PATCH 9/9] Fix wrong amount of liquid removed Fixes #345 --- .../machines/smelting/SmelteryController.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryController.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryController.java index 91e4f169..899b33e3 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryController.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryController.java @@ -6,7 +6,9 @@ import io.github.pylonmc.pylon.base.util.BaseUtils; import io.github.pylonmc.pylon.base.util.HslColor; import io.github.pylonmc.pylon.core.block.BlockStorage; -import io.github.pylonmc.pylon.core.block.base.*; +import io.github.pylonmc.pylon.core.block.base.PylonGuiBlock; +import io.github.pylonmc.pylon.core.block.base.PylonMultiblock; +import io.github.pylonmc.pylon.core.block.base.PylonTickingBlock; import io.github.pylonmc.pylon.core.block.context.BlockBreakContext; import io.github.pylonmc.pylon.core.block.context.BlockCreateContext; import io.github.pylonmc.pylon.core.config.Config; @@ -289,13 +291,12 @@ public void onMultiblockFormed() { @Override public void onMultiblockRefreshed() { - double previousCapacity = capacity; capacity = height * insidePositions.size() * 1000; - - if (capacity < previousCapacity) { - double removeRatio = 1 - (capacity / previousCapacity); - for (PylonFluid fluid : new HashSet<>(fluids.keySet())) { - removeFluid(fluid, fluids.getDouble(fluid) * removeRatio); + double totalFluid = getTotalFluid(); + if (totalFluid > capacity) { + double ratio = capacity / totalFluid; + for (PylonFluid fluid : fluids.keySet()) { + fluids.computeDouble(fluid, (key, value) -> value * ratio); } }