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 39c24276c..aa351946d 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; @@ -158,171 +153,33 @@ 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(); - SPONGE_IRON_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/java/io/github/pylonmc/pylon/base/PylonBase.java b/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java index d7b8b2e87..78ba24ce4 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java +++ b/src/main/java/io/github/pylonmc/pylon/base/PylonBase.java @@ -4,6 +4,8 @@ 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.machines.smelting.Bloomery; import io.github.pylonmc.pylon.base.content.tools.HealthTalisman; import io.github.pylonmc.pylon.base.content.tools.ItemMagnet; @@ -59,9 +61,10 @@ public void onEnable() { pm.registerEvents(new Rune.RuneListener(), this); pm.registerEvents(new SoulboundRune.SoulboundRuneListener(), this); pm.registerEvents(new Bloomery.CreationListener(), this); + pm.registerEvents(new Grindstone.PlaceListener(), this); new ItemMagnet.Ticker().runTaskTimer(this, 0, 10); - new HealthTalisman.HealthTalismanTicker().runTaskTimer(this, 0, 40); + new HealthTalisman.HealthTalismanTicker().runTaskTimer(this, 0, BaseConfig.HEALTH_TALISMAN_CHECK_INTERVAL); } @Override 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 e9c7b9c01..ecf279b1f 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/machines/diesel/DieselPipeBender.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/diesel/DieselPipeBender.java index 6d3a84a0e..11fa0e889 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/diesel/DieselPipeBender.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/diesel/DieselPipeBender.java @@ -17,7 +17,6 @@ import io.github.pylonmc.pylon.core.i18n.PylonArgument; import io.github.pylonmc.pylon.core.item.PylonItem; import io.github.pylonmc.pylon.core.item.builder.ItemStackBuilder; -import io.github.pylonmc.pylon.core.util.PylonUtils; import io.github.pylonmc.pylon.core.util.gui.GuiItems; import io.github.pylonmc.pylon.core.util.gui.ProgressItem; import io.github.pylonmc.pylon.core.util.gui.unit.UnitFormat; @@ -166,7 +165,7 @@ public void tick(double deltaSeconds) { // check output has no item or the same item as the result ItemStack outputItem = outputInventory.getItem(0); - if (outputItem != null && !PylonUtils.isPylonSimilar(outputItem, recipe.result())) { + if (outputItem != null && !outputItem.isSimilar(recipe.result())) { return; } diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/CoalFiredPurificationTower.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/CoalFiredPurificationTower.java index 178d5fd6c..d348ad011 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/CoalFiredPurificationTower.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/CoalFiredPurificationTower.java @@ -151,7 +151,7 @@ public void tick(double deltaSeconds) { if (fuelTicksRemaining == null) { ItemStack item = inventory.getUnsafeItem(0); for (Map.Entry fuel : FUELS.entrySet()) { - if (item == null || !PylonUtils.isPylonSimilar(item, fuel.getKey())) { + if (item == null || !item.isSimilar(fuel.getKey())) { continue; } 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 d4b0db44a..3eefc5cde 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 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 47f3399c8..31d9578f6 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()) diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicTableSaw.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicTableSaw.java index 9f1c628e0..a095c46f7 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicTableSaw.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/hydraulics/HydraulicTableSaw.java @@ -19,7 +19,6 @@ import io.github.pylonmc.pylon.core.fluid.FluidPointType; import io.github.pylonmc.pylon.core.i18n.PylonArgument; import io.github.pylonmc.pylon.core.item.PylonItem; -import io.github.pylonmc.pylon.core.util.PylonUtils; import io.github.pylonmc.pylon.core.util.gui.unit.UnitFormat; import org.bukkit.Material; import org.bukkit.Particle; @@ -149,7 +148,7 @@ public void tick(double deltaSeconds) { double hydraulicFluidUsed = recipe.timeTicks() * HYDRAULIC_FLUID_USAGE; if (fluidAmount(BaseFluids.HYDRAULIC_FLUID) < hydraulicFluidUsed || fluidSpaceRemaining(BaseFluids.DIRTY_HYDRAULIC_FLUID) < hydraulicFluidUsed - || !PylonUtils.isPylonSimilar(stack, recipe.input()) + || !stack.isSimilar(recipe.input()) || stack.getAmount() < recipe.input().getAmount() ) { continue; 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 a9637bb50..6e5accf8b 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); + } + } + } } diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/Bloomery.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/Bloomery.java index 02bd18590..b97bf9c8d 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/Bloomery.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/Bloomery.java @@ -18,7 +18,6 @@ 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.item.PylonItem; -import io.github.pylonmc.pylon.core.util.PylonUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -106,7 +105,7 @@ public void tick(double deltaSeconds) { ItemStack stack = itemDisplay.getItemStack(); if (stack.getType().isAir()) return; - if (PylonUtils.isPylonSimilar(stack, BaseItems.SPONGE_IRON)) { + if (stack.isSimilar(BaseItems.SPONGE_IRON)) { IronBloom bloom = new IronBloom(BaseItems.IRON_BLOOM.clone()); bloom.setTemperature(0); bloom.setWorking(ThreadLocalRandom.current().nextInt(IronBloom.MIN_WORKING, IronBloom.MAX_WORKING + 1)); @@ -179,7 +178,7 @@ private void onSetFire(@NotNull BlockPlaceEvent event) { if (items.isEmpty()) return; Item gypsum = null; for (Item item : items) { - if (PylonUtils.isPylonSimilar(item.getItemStack(), BaseItems.GYPSUM_DUST)) { + if (item.getItemStack().isSimilar(BaseItems.GYPSUM_DUST)) { gypsum = item; break; } diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/BronzeAnvil.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/BronzeAnvil.java index 8e69f7a08..27a34e863 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/BronzeAnvil.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/BronzeAnvil.java @@ -18,7 +18,6 @@ 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.item.PylonItem; -import io.github.pylonmc.pylon.core.util.PylonUtils; import net.kyori.adventure.sound.Sound; import org.bukkit.Location; import org.bukkit.Particle; @@ -125,7 +124,7 @@ private void onLeftClick(@NotNull PlayerInteractEvent event) { if (temperature == 0) { player.swingHand(EquipmentSlot.HAND); return; - } else if (PylonUtils.isPylonSimilar(item, BaseItems.TONGS)) { + } else if (item.isSimilar(BaseItems.TONGS)) { workingChange -= temperature; getBlock().getWorld().playSound(TONGS_SOUND, player); } else if (PylonItem.fromStack(item) instanceof Hammer hammer) { @@ -162,7 +161,7 @@ private void onLeftClick(@NotNull PlayerInteractEvent event) { } bloom.setWorking(newWorking); itemDisplay.setItemStack(bloom.getStack()); - transformForWorking(newWorking, PylonUtils.isPylonSimilar(item, BaseItems.TONGS)); + transformForWorking(newWorking, item.isSimilar(BaseItems.TONGS)); } @Override diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryBurner.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryBurner.java index 5c33063aa..5b25818e6 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryBurner.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/smelting/SmelteryBurner.java @@ -25,7 +25,6 @@ import xyz.xenondevs.invui.gui.Gui; import xyz.xenondevs.invui.inventory.VirtualInventory; -import java.time.Duration; import java.util.Map; import static io.github.pylonmc.pylon.base.util.BaseUtils.baseKey; @@ -105,14 +104,14 @@ public void tick(double deltaSeconds) { SmelteryController controller = getController(); if (controller != null && controller.isRunning()) { if (fuel != null) { - controller.heatAsymptotically(deltaSeconds, fuel.temperature); + controller.heatAsymptotically(fuel.temperature); } else { itemLoop: for (int i = 0; i < inventory.getSize(); i++) { ItemStack item = inventory.getItem(i); if (item == null) continue; for (Fuel fuel : FUELS) { - if (PylonUtils.isPylonSimilar(item, fuel.material)) { + if (item.isSimilar(fuel.material)) { this.fuel = fuel; progressItem.setItemStackBuilder(burningProgressItem); progressItem.setTotalTimeSeconds((int) fuel.burnTimeSeconds); 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 dfeb09de5..cb3d37bf2 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; @@ -50,6 +52,7 @@ import xyz.xenondevs.invui.item.impl.AbstractItem; import java.util.*; +import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; import static io.github.pylonmc.pylon.base.util.BaseUtils.baseKey; @@ -63,7 +66,7 @@ public final class SmelteryController extends SmelteryComponent private static final Config settings = Settings.get(BaseKeys.SMELTERY_CONTROLLER); public static final int TICK_INTERVAL = settings.getOrThrow("tick-interval", ConfigAdapter.INT); - public static final double FLUID_REACTION_PER_SECOND = settings.getOrThrow("fluid-reaction-per-second", ConfigAdapter.DOUBLE); + public static final double FLUID_REACTION_PER_TICK = settings.getOrThrow("fluid-reaction-per-tick", ConfigAdapter.DOUBLE); public static final double HEATING_FACTOR = settings.getOrThrow("heating-factor", ConfigAdapter.DOUBLE); public static final double COOLING_FACTOR = settings.getOrThrow("cooling-factor", ConfigAdapter.DOUBLE); public static final double ROOM_TEMPERATURE = settings.getOrThrow("room-temperature", ConfigAdapter.DOUBLE); @@ -77,9 +80,12 @@ public final class SmelteryController extends SmelteryComponent .thenComparing(fluid -> fluid.getKey().toString()) ); - @Getter private boolean running; - @Getter private double temperature; - @Getter private double capacity; + @Getter + private boolean running; + @Getter + private double temperature; + @Getter + private double capacity; private int height; @SuppressWarnings("unused") @@ -102,6 +108,7 @@ public SmelteryController(@NotNull Block block, @NotNull PersistentDataContainer @Override public void write(@NotNull PersistentDataContainer pdc) { + applyHeat(); pdc.set(RUNNING_KEY, PylonSerializers.BOOLEAN, running); pdc.set(TEMPERATURE_KEY, PylonSerializers.DOUBLE, temperature); pdc.set(FLUIDS_KEY, PylonSerializers.MAP.mapTypeFrom(PylonSerializers.PYLON_FLUID, PylonSerializers.DOUBLE), fluids); @@ -289,13 +296,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); } } @@ -397,8 +403,23 @@ public double getTotalFluid() { // private int heaters = 0; - public void heatAsymptotically(double dt, double target) { - temperature += (target - temperature) * HEATING_FACTOR * dt * ++heaters; + private double avgTarget = -1; + + public void heatAsymptotically(double target) { + if (avgTarget == -1) { + avgTarget = target; + heaters = 1; + } else { + avgTarget += (target - avgTarget) / ++heaters; + } + } + + private void applyHeat() { + if (temperature < avgTarget) { + temperature += (avgTarget - temperature) * HEATING_FACTOR; + } + avgTarget = -1; + heaters = 0; } // @@ -407,17 +428,13 @@ public void heatAsymptotically(double dt, double target) { private static final int RESOLUTION = Settings.get(BaseKeys.SMELTERY_CONTROLLER).getOrThrow("display.resolution", ConfigAdapter.INT); private static final int PIXELS_PER_SIDE = 3 * RESOLUTION; - private final SimplexOctaveGenerator noise = new SimplexOctaveGenerator( - getBlock().getWorld().getSeed(), 4 - ); + private static final SimplexOctaveGenerator LAVA_NOISE = new SimplexOctaveGenerator(ThreadLocalRandom.current().nextLong(), 4); - { - noise.setScale(1 / 16.0); + static { + LAVA_NOISE.setScale(1 / 16.0); } - private double cumulativeSeconds = 0; - - public void spawnPixels() { + private void spawnPixels() { pixels.clear(); Location location = center.getLocation().add(-1, 0, -1); @@ -439,14 +456,14 @@ public void spawnPixels() { } } - public @NotNull List getPixels() { + private @NotNull List getPixels() { if (pixels.isEmpty()) { spawnPixels(); } return pixels; } - public void removePixels() { + private void removePixels() { for (TextDisplay pixel : pixels) { if (pixel.isValid()) { pixel.remove(); @@ -480,10 +497,10 @@ private void updateFluidDisplay() { int x = i % PIXELS_PER_SIDE; int z = (i / PIXELS_PER_SIDE) % PIXELS_PER_SIDE; - double value = noise.noise( + double value = LAVA_NOISE.noise( x, z, - cumulativeSeconds * LIGHTNESS_SPEED, + (System.currentTimeMillis() / 1000.0) * LIGHTNESS_SPEED, 0.01, 0.01, true @@ -513,7 +530,7 @@ private void updateFluidDisplay() { } // - private void performRecipes(double deltaSeconds) { + private void performRecipes() { if (fluids.isEmpty()) return; recipeLoop: for (SmelteryRecipe recipe : SmelteryRecipe.RECIPE_TYPE) { @@ -524,7 +541,7 @@ private void performRecipes(double deltaSeconds) { } double highestFluidAmount = getFluidAmount(recipe.getHighestFluid()); - double consumptionRatio = highestFluidAmount / (deltaSeconds * FLUID_REACTION_PER_SECOND); + double consumptionRatio = highestFluidAmount / FLUID_REACTION_PER_TICK; double currentTemperature = temperature; for (var entry : recipe.getFluidInputs().entrySet()) { PylonFluid fluid = entry.getKey(); @@ -542,13 +559,12 @@ private void performRecipes(double deltaSeconds) { @Override public void tick(double deltaSeconds) { - cumulativeSeconds += deltaSeconds; if (isFormedAndFullyLoaded()) { if (running) { - performRecipes(deltaSeconds); + applyHeat(); + performRecipes(); } - temperature -= (temperature - ROOM_TEMPERATURE) * COOLING_FACTOR * deltaSeconds; - heaters = 0; + temperature -= (temperature - ROOM_TEMPERATURE) * COOLING_FACTOR; updateFluidDisplay(); } infoItem.notifyWindows(); diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/resources/IronBloom.java b/src/main/java/io/github/pylonmc/pylon/base/content/resources/IronBloom.java index e41380d2b..e732cb99d 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/resources/IronBloom.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/resources/IronBloom.java @@ -9,7 +9,6 @@ import io.github.pylonmc.pylon.core.datatypes.PylonSerializers; import io.github.pylonmc.pylon.core.item.PylonItem; import io.github.pylonmc.pylon.core.item.base.PylonInventoryTicker; -import io.github.pylonmc.pylon.core.util.PylonUtils; import org.bukkit.NamespacedKey; import org.bukkit.damage.DamageSource; import org.bukkit.damage.DamageType; @@ -83,8 +82,8 @@ public long getTickInterval() { @Override public void onTick(@NotNull Player player) { - if (PylonUtils.isPylonSimilar(player.getInventory().getItemInMainHand(), BaseItems.TONGS) || - PylonUtils.isPylonSimilar(player.getInventory().getItemInOffHand(), BaseItems.TONGS)) { + if (player.getInventory().getItemInMainHand().isSimilar(BaseItems.TONGS) || + player.getInventory().getItemInOffHand().isSimilar(BaseItems.TONGS)) { return; } player.damage(UNPROTECTED_DAMAGE, DamageSource.builder(DamageType.HOT_FLOOR).build()); 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 db42e756d..2f2c18329 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/java/io/github/pylonmc/pylon/base/content/tools/Hammer.java b/src/main/java/io/github/pylonmc/pylon/base/content/tools/Hammer.java index 97fcc8980..1d203b736 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 @@ -9,9 +9,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; @@ -31,7 +29,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; @@ -81,10 +78,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)) { @@ -146,14 +140,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/content/tools/HydraulicCannon.java b/src/main/java/io/github/pylonmc/pylon/base/content/tools/HydraulicCannon.java index d7d4c52cd..f60e0a2eb 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/tools/HydraulicCannon.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/tools/HydraulicCannon.java @@ -25,8 +25,6 @@ import java.util.List; -import static io.github.pylonmc.pylon.core.util.PylonUtils.isPylonSimilar; - public class HydraulicCannon extends PylonItem implements PylonInteractor, HydraulicRefuelable { @@ -82,7 +80,7 @@ public void onUsedToRightClick(@NotNull PlayerInteractEvent event) { boolean projectileFound = false; for (ItemStack stack : event.getPlayer().getInventory()) { - if (isPylonSimilar(stack, BaseItems.TIN_PROJECTILE)) { + if (BaseItems.TIN_PROJECTILE.isSimilar(stack)) { stack.subtract(); projectileFound = true; break; 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 0610ac1c8..c37e97c96 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 6b7d54b18..0ab078dcc 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" @@ -485,19 +485,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 to use the hammer on it - Higher tier hammers are more likely to succeed + Right click an item dropped on top of a placed stone block to use the hammer on it + Higher tier hammers are twice as likely to succeed than the tier below them for a given recipe immobilizer: name: "Immobilizer" @@ -518,9 +518,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: @@ -578,7 +578,7 @@ item: name: "Nickel Nugget" nickel_block: - name: "Nickel Block" + name: "Block of Nickel" obsidian_chip: name: "Obsidian Chip" @@ -787,7 +787,7 @@ item: name: "Steel Nugget" steel_block: - name: "Steel Block" + name: "Block of Steel" steel_sheet: name: "Steel Sheet" @@ -805,7 +805,7 @@ item: name: "Tin Nugget" tin_block: - name: "Tin Block" + name: "Block of Tin" tin_sheet: name: "Tin Sheet" @@ -841,10 +841,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" @@ -1420,7 +1420,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: @@ -1451,6 +1451,7 @@ guide: melting: "Temperature: %temperature%" casting: "Temperature: %temperature%" drilling: "Cycle time: %time%" + hammer: "Chance: %chance%" message: fluid_none: "None" @@ -1462,6 +1463,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" diff --git a/src/main/resources/recipes/minecraft/crafting_shaped.yml b/src/main/resources/recipes/minecraft/crafting_shaped.yml index 8edd733d2..22f5c9c4f 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 81941be3e..d5a4fc1ff 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 000000000..b32c19a33 --- /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 87380401e..eee3da34c 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 a1bd238a2..a25ca9fd8 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 4396ae7e8..7ed10561a 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 diff --git a/src/main/resources/settings/smeltery_controller.yml b/src/main/resources/settings/smeltery_controller.yml index 71ae645b5..a902cdfca 100644 --- a/src/main/resources/settings/smeltery_controller.yml +++ b/src/main/resources/settings/smeltery_controller.yml @@ -1,12 +1,12 @@ tick-interval: 20 -fluid-reaction-per-second: 100.0 +fluid-reaction-per-tick: 100.0 display: resolution: 8 # pixels per block; defines the resolution of the fluid display lightness-variation: 0.3 # defines the lightness variation of the fluid display; 0.0 is no variation, 1.0 is full variation lightness-speed: 1 # defines the speed of the lightness variation; 0.0 is no speed, 1.0 is full speed room-temperature: 20.0 # °C; defines the temperature of the environment around the smeltery -heating-factor: 0.05 # unitless; defines how much the smeltery heats up per second when heated -cooling-factor: 0.02 # unitless; defines how much the smeltery cools down per second when not heated +heating-factor: 0.05 # unitless; defines how much the smeltery heats up per tick when under the target temperature +cooling-factor: 0.02 # unitless; defines how much the smeltery cools down per tick when above the target temperature max-height: 16 # blocks; defines the maximum height of the smeltery \ No newline at end of file