From bd92200db55c6e1f24fdaaf3727aef36394888c8 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Thu, 7 Nov 2024 08:57:43 -0800 Subject: [PATCH 01/10] backport release script for example config updates --- scripts/release.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/release.sh b/scripts/release.sh index 6ce083db8..b6bf81a0e 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,3 +1,14 @@ #!/bin/bash +echo 'updating example configs...' + +cp ./run/config/cyclic.toml ./examples/config/cyclic.toml +cp ./run/config/cyclic-client.toml ./examples/config/cyclic-client.toml + +echo '... done' + +echo 'deploying...' + ./gradlew cleanJar build signJar + +echo 'jar deployed to ./build/libs/' From 4e451b08b30e41ae67e039dccecd2e5e3ccbb4e2 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Thu, 7 Nov 2024 08:58:06 -0800 Subject: [PATCH 02/10] typo for #2435 --- src/main/resources/assets/cyclic/lang/en_us.json | 2 +- update.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/cyclic/lang/en_us.json b/src/main/resources/assets/cyclic/lang/en_us.json index 410632683..4d946126e 100644 --- a/src/main/resources/assets/cyclic/lang/en_us.json +++ b/src/main/resources/assets/cyclic/lang/en_us.json @@ -335,7 +335,7 @@ "block.cyclic.breaker": "Block Breaker", "block.cyclic.breaker.tooltip": "Breaks blocks placed in front of it", "block.cyclic.breaker.guide": "Breakers can be used to break the block placed directly in front of it, like a player would. Breakers do not have internal item storage, so the broken block will drop itself (or its loot) in the world to be picked up.", - "item.cyclic.wrench":"Block Rotatator", + "item.cyclic.wrench":"Block Rotator", "item.cyclic.wrench.tooltip":"Rotates simple blocks", "item.cyclic.wrench.guide":"Its not really a wrench, see the data tags. This sipmle tool can be used to rotate simple blocks such as stairs, slabs, and similar compatible blocks that face certain directions. Try hitting blocks from different angles", "item.cyclic.cable_wrench":"Wrench", diff --git a/update.json b/update.json index 3607dc1de..7f110f048 100644 --- a/update.json +++ b/update.json @@ -81,6 +81,6 @@ ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms " ,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. " - ,"1.6.0":"Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " + ,"1.6.0":"Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " } } From 02207c2cc4ed9669f671be1fb6fadebd2f0fc2e7 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Thu, 7 Nov 2024 12:23:13 -0800 Subject: [PATCH 03/10] update for #2435 --- .../cyclic/block/dropper/BlockDropper.java | 14 ++++++++++++++ update.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lothrazar/cyclic/block/dropper/BlockDropper.java b/src/main/java/com/lothrazar/cyclic/block/dropper/BlockDropper.java index 787d40ce8..007222607 100644 --- a/src/main/java/com/lothrazar/cyclic/block/dropper/BlockDropper.java +++ b/src/main/java/com/lothrazar/cyclic/block/dropper/BlockDropper.java @@ -6,6 +6,7 @@ import com.lothrazar.cyclic.util.BlockstatesUtil; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.core.BlockPos; +import net.minecraft.world.Containers; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -50,4 +51,17 @@ public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntit protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(BlockStateProperties.FACING).add(LIT); } + + @Override + public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + if (state.getBlock() != newState.getBlock()) { + TileDropper tileentity = (TileDropper) worldIn.getBlockEntity(pos); + if (tileentity != null && tileentity.gpsSlots != null) { + for (int s = 0; s < tileentity.gpsSlots.getSlots(); s++) { + Containers.dropItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), tileentity.gpsSlots.getStackInSlot(s)); + } + } + } + super.onRemove(state, worldIn, pos, newState, isMoving); + } } diff --git a/update.json b/update.json index 454865612..5f9dfa804 100644 --- a/update.json +++ b/update.json @@ -132,7 +132,7 @@ ,"1.7.20":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. Add recipes in the solidifier machine for Waxed copper blocks " - ,"1.8.0":"Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " + ,"1.8.0":"Fix spelling #2435. Fix breaking precise dropper voids GPS card inside #2349. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " } } From ce32d9d2352aa58aa57d5ebe9775548d806ea65a Mon Sep 17 00:00:00 2001 From: lothrazar Date: Thu, 7 Nov 2024 12:48:26 -0800 Subject: [PATCH 04/10] backport peat on waterlogged sources #2399 --- .../java/com/lothrazar/cyclic/block/PeatBlock.java | 10 ++++++---- update.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/block/PeatBlock.java b/src/main/java/com/lothrazar/cyclic/block/PeatBlock.java index 134108616..3fca2ea50 100644 --- a/src/main/java/com/lothrazar/cyclic/block/PeatBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/PeatBlock.java @@ -7,9 +7,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; +import net.minecraft.fluid.FluidState; +import net.minecraft.fluid.Fluids; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; @@ -32,8 +32,10 @@ public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random List waters = new ArrayList<>(); for (BlockPos p : around) { //try to bake if SOURCE water is nearby - Block bSide = world.getBlockState(p).getBlock(); - if (bSide == Blocks.WATER) { + //using FluidState instead of Block + //backport fix from this PR by PocketSizedWeeb https://github.com/Lothrazar/Cyclic/pull/2404/files#diff-75c5d8aa746dbf1c0a18dfd3f48a80408e4191eb536ea0566c243038eaf05269 + FluidState fluid = world.getFluidState(p); + if (fluid.getFluid() == Fluids.WATER.getFluid()) { sidesWet++; waters.add(p); } diff --git a/update.json b/update.json index 7f110f048..6c8a2eebe 100644 --- a/update.json +++ b/update.json @@ -81,6 +81,6 @@ ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms " ,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. " - ,"1.6.0":"Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " + ,"1.6.0":"Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " } } From c7e781a87342b83a3170ee61f29f87f4b74d0225 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Thu, 7 Nov 2024 16:42:43 -0800 Subject: [PATCH 05/10] Add mouse-dragging capability to the slider controls in machines --- .../com/lothrazar/cyclic/base/ScreenBase.java | 14 +++ .../cyclic/gui/GuiSliderInteger.java | 85 +++++++------------ update.json | 2 +- 3 files changed, 47 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/base/ScreenBase.java b/src/main/java/com/lothrazar/cyclic/base/ScreenBase.java index 1b381d477..4567e2a08 100644 --- a/src/main/java/com/lothrazar/cyclic/base/ScreenBase.java +++ b/src/main/java/com/lothrazar/cyclic/base/ScreenBase.java @@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.IGuiEventListener; import net.minecraft.client.gui.screen.inventory.ContainerScreen; +import net.minecraft.client.gui.widget.AbstractSlider; import net.minecraft.client.gui.widget.Widget; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; @@ -106,4 +107,17 @@ public void drawButtonTooltips(MatrixStack ms, int mouseX, int mouseY) { } } } + + /** + * Propogate mouse drag events down to slider widgets + */ + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + for (Widget btn : this.buttons) { + if (btn.isMouseOver(mouseX, mouseY) && btn instanceof AbstractSlider) { + ((AbstractSlider) btn).mouseDragged(mouseX, mouseY, button, dragX, dragY); + } + } + return super.mouseDragged(mouseX, mouseY, button, dragX, dragY); + } } diff --git a/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java b/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java index 58664a29b..4e286242b 100644 --- a/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java +++ b/src/main/java/com/lothrazar/cyclic/gui/GuiSliderInteger.java @@ -2,7 +2,6 @@ import com.lothrazar.cyclic.net.PacketTileData; import com.lothrazar.cyclic.registry.PacketRegistry; -import com.mojang.blaze3d.matrix.MatrixStack; import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; @@ -27,37 +26,22 @@ public class GuiSliderInteger extends AbstractSlider implements IHasTooltip { private final int field; // field ID for saving value private List tooltip; - public GuiSliderInteger(int x, int y, int width, int height, int field, - BlockPos pos, int min, int max, - double initialVal) { + public GuiSliderInteger(int x, int y, int width, int height, int field, BlockPos pos, int min, int max, double initialVal) { super(x, y, width, height, StringTextComponent.EMPTY, 0); this.field = field; this.pos = pos; this.min = min; this.max = max; - setSliderValueActual((int) initialVal); + setSliderPercentageOfMax((int) initialVal); + this.func_230979_b_(); } - /** - * exact copy of super() but replaced hardcoded 20 with this.height - */ - // @SuppressWarnings("deprecation") - @Override - protected void renderBg(MatrixStack matrixStack, Minecraft minecraft, int mouseX, int mouseY) { - minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION); - // RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - int i = (this.isHovered() ? 2 : 1) * 20; - if (this.height != 20) { - this.blit(matrixStack, this.x + (int) (this.sliderValue * (this.width - 8)), this.y, 0, 46 + i + 20 - this.height, 4, this.height); - this.blit(matrixStack, this.x + (int) (this.sliderValue * (this.width - 8)) + 4, this.y, 196, 46 + i + 20 - this.height, 4, this.height); - int height = this.height - 2; - this.blit(matrixStack, this.x + (int) (this.sliderValue * (this.width - 8)), this.y, 0, 46 + i, 4, height); - this.blit(matrixStack, this.x + (int) (this.sliderValue * (this.width - 8)) + 4, this.y, 196, 46 + i, 4, height); - } - else { - this.blit(matrixStack, this.x + (int) (this.sliderValue * (this.width - 8)), this.y, 0, 46 + i, 4, this.height); - this.blit(matrixStack, this.x + (int) (this.sliderValue * (this.width - 8)) + 4, this.y, 196, 46 + i, 4, this.height); - } + public double getSliderValue() { + return this.sliderValue; + } + + public int getField() { + return this.field; } /** @@ -73,9 +57,7 @@ public List getTooltip() { */ @Override public void setTooltip(String tt) { - // if (tooltip == null) { - tooltip = new ArrayList<>(); - // } + this.tooltip = new ArrayList<>(); this.tooltip.add(new TranslationTextComponent(tt)); this.tooltip.add(new TranslationTextComponent("cyclic.gui.sliderkeys").mergeStyle(TextFormatting.DARK_GRAY)); } @@ -86,8 +68,7 @@ public void setTooltip(String tt) { @Override public boolean mouseScrolled(double mouseX, double mouseY, double delta) { if (delta != 0) { - setSliderValueActual(this.getSliderValueActual() + (int) delta); - this.func_230979_b_(); + moveSliderAndUpdate((int) delta); return true; } return super.mouseScrolled(mouseX, mouseY, delta); @@ -115,54 +96,52 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { else if (Screen.hasAltDown()) { delta = delta * 10; } - setSliderValueActual(this.getSliderValueActual() + delta); - this.func_230979_b_(); + moveSliderAndUpdate(delta); return true; } return super.keyPressed(keyCode, scanCode, modifiers); } + /** + * move position by delta and save and refresh + * + * @param delta + */ + private void moveSliderAndUpdate(int delta) { + setSliderPercentageOfMax(this.getSliderAsInteger() + delta); + this.func_230972_a_(); + this.func_230979_b_(); + } + /** * Refresh display message */ @Override protected void func_230979_b_() { - int val = getSliderValueActual(); + int val = getSliderAsInteger(); this.setMessage(new TranslationTextComponent("" + val)); } /** - * SAVE to tile entity with packet + * Save to tile entity with packet */ @Override protected void func_230972_a_() { - int val = getSliderValueActual(); + int val = getSliderAsInteger(); PacketRegistry.INSTANCE.sendToServer(new PacketTileData(this.field, val, pos)); } - @Override - protected void onDrag(double mouseX, double mouseY, double dragX, double dragY) { - // this.changeSliderValueActual(mouseX); - super.onDrag(mouseX, mouseY, dragX, dragY); - // ("ondrag" + mouseX); - func_230972_a_(); - func_230979_b_(); - } - /** * Set inner [0,1] value relative to maximum and trigger save/ & refresh */ - private void setSliderValueActual(int val) { + private void setSliderPercentageOfMax(int val) { this.sliderValue = val / max; - this.func_230979_b_(); - this.func_230972_a_(); } - public int getSliderValueActual() { - return MathHelper.floor(MathHelper.clampedLerp(min, max, this.sliderValue)); - } - - public int getField() { - return this.field; + /** + * clamp sliderValue to an integer between min and max + */ + public int getSliderAsInteger() { + return MathHelper.floor(MathHelper.clampedLerp(min, max, this.getSliderValue())); } } diff --git a/update.json b/update.json index 6c8a2eebe..ec743091c 100644 --- a/update.json +++ b/update.json @@ -81,6 +81,6 @@ ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms " ,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. " - ,"1.6.0":"Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " + ,"1.6.0":" Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Add mouse-dragging capability to the slider controls in machines. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " } } From 02ea434c63982efae52d0f0a9621193f21b4e1c2 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Fri, 8 Nov 2024 18:27:03 -0800 Subject: [PATCH 06/10] fluid hoppers inserting into cauldrons --- .../block/hopperfluid/TileFluidHopper.java | 4 ++- .../com/lothrazar/cyclic/util/UtilFluid.java | 26 +++++++++++++++++++ update.json | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/block/hopperfluid/TileFluidHopper.java b/src/main/java/com/lothrazar/cyclic/block/hopperfluid/TileFluidHopper.java index fd33f3be8..f847ec058 100644 --- a/src/main/java/com/lothrazar/cyclic/block/hopperfluid/TileFluidHopper.java +++ b/src/main/java/com/lothrazar/cyclic/block/hopperfluid/TileFluidHopper.java @@ -64,7 +64,10 @@ public void tick() { //then pull from hopper facey side Direction exportToSide = this.getBlockState().get(BlockFluidHopper.FACING); if (exportToSide != null && exportToSide != Direction.UP) { + //if the target is a tank moveFluids(exportToSide, pos.offset(exportToSide), FLOW, tank); + //if the target is a cauldron + UtilFluid.insertSourceCauldron(world, pos.offset(exportToSide), tank); this.updateComparatorOutputLevel(); this.updateComparatorOutputLevelAt(pos.offset(exportToSide)); } @@ -83,7 +86,6 @@ private void tryExtract(Direction extractSide) { if (success) { this.updateComparatorOutputLevelAt(target); this.updateComparatorOutputLevel(); - return; } } if (!success && tank.getSpace() >= FluidAttributes.BUCKET_VOLUME) { diff --git a/src/main/java/com/lothrazar/cyclic/util/UtilFluid.java b/src/main/java/com/lothrazar/cyclic/util/UtilFluid.java index 0b752621e..182760985 100644 --- a/src/main/java/com/lothrazar/cyclic/util/UtilFluid.java +++ b/src/main/java/com/lothrazar/cyclic/util/UtilFluid.java @@ -77,6 +77,32 @@ public static Model3D getFluidModel(FluidStack fluid, int stage) { return model; } + /** + * + * @param level + * @param posTarget + * where the cauldron exists + * @param tank + * of myself that i want to extract frm for the target + * @return + */ + public static boolean insertSourceCauldron(World level, BlockPos posTarget, IFluidHandler tank) { + //for mc 1.16.5 cauldrons only allow water. lava/snow cauldronds added in 1.17 + BlockState targetState = level.getBlockState(posTarget); + if (targetState.getBlock() == Blocks.CAULDRON.getBlock() && targetState.hasProperty(CauldronBlock.LEVEL) && targetState.get(CauldronBlock.LEVEL) == 0) { + FluidStack simulate = tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE); + if (simulate.getAmount() == FluidAttributes.BUCKET_VOLUME) { + //we are able to fill the tank + if (level.setBlockState(posTarget, targetState.with(CauldronBlock.LEVEL, 3))) { + //we filled the cauldron, so now drain with execute + tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.EXECUTE); + return true; + } + } + } + return false; + } + public static void extractSourceWaterloggedCauldron(World level, BlockPos posTarget, IFluidHandler tank) { if (tank == null) { return; diff --git a/update.json b/update.json index ec743091c..66b317b80 100644 --- a/update.json +++ b/update.json @@ -81,6 +81,6 @@ ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms " ,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. " - ,"1.6.0":" Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Add mouse-dragging capability to the slider controls in machines. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " + ,"1.6.0":"Add mouse-dragging capability to the slider controls in machines. Fluid Hoppers can now insert into cauldrons. Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " } } From ec839a4db998e29949843408e89e8febc227b489 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 08:59:54 -0800 Subject: [PATCH 07/10] add medium texturesize for clock; readjust slider layouts and alignments --- .../cyclic/block/clock/ContainerClock.java | 2 +- .../cyclic/block/clock/ScreenClock.java | 18 ++++------ .../collectitem/ContainerItemCollector.java | 2 +- .../collectitem/ScreenItemCollector.java | 31 ++++++++---------- .../lothrazar/cyclic/block/fan/ScreenFan.java | 2 +- .../cyclic/block/forester/ScreenForester.java | 16 ++++----- .../block/harvester/ScreenHarvester.java | 12 +++---- .../cyclic/block/miner/ScreenMiner.java | 6 ++-- .../cyclic/registry/TextureRegistry.java | 1 + .../cyclic/textures/gui/inventory_medium.png | Bin 0 -> 758 bytes update.json | 2 +- 11 files changed, 40 insertions(+), 52 deletions(-) create mode 100644 src/main/resources/assets/cyclic/textures/gui/inventory_medium.png diff --git a/src/main/java/com/lothrazar/cyclic/block/clock/ContainerClock.java b/src/main/java/com/lothrazar/cyclic/block/clock/ContainerClock.java index 4489fb441..fe6af0a71 100644 --- a/src/main/java/com/lothrazar/cyclic/block/clock/ContainerClock.java +++ b/src/main/java/com/lothrazar/cyclic/block/clock/ContainerClock.java @@ -18,7 +18,7 @@ public ContainerClock(int windowId, World world, BlockPos pos, PlayerInventory p tile = (TileRedstoneClock) world.getTileEntity(pos); this.playerEntity = player; this.playerInventory = playerInventory; - layoutPlayerInventorySlots(8, 153); + layoutPlayerInventorySlots(8, 84); this.trackAllIntFields(tile, TileRedstoneClock.Fields.values().length); } diff --git a/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java b/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java index 24ca6ee31..d7c1b1740 100644 --- a/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java +++ b/src/main/java/com/lothrazar/cyclic/block/clock/ScreenClock.java @@ -14,7 +14,6 @@ public class ScreenClock extends ScreenBase { public ScreenClock(ContainerClock screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); - this.ySize = 256; } @Override @@ -22,22 +21,22 @@ public void init() { super.init(); int x, y; int w = 160; - int h = 20; - x = guiLeft + 8; - y = guiTop + 8; + int h = 18; + x = guiLeft + 6; + y = guiTop + 6; btnRedstone = addButton(new ButtonMachineField(x, y, TileRedstoneClock.Fields.REDSTONE.ordinal(), container.tile.getPos())); int f = TileRedstoneClock.Fields.DURATION.ordinal(); x = guiLeft + 8; - y = guiTop + 38; + y = guiTop + 26; GuiSliderInteger dur = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), 1, 200, container.tile.getField(f))); dur.setTooltip("cyclic.clock.duration"); - y += 26; + y += h + 1; f = TileRedstoneClock.Fields.DELAY.ordinal(); GuiSliderInteger delay = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), 1, 200, container.tile.getField(f))); delay.setTooltip("cyclic.clock.delay"); - y += 26; + y += h + 1; f = TileRedstoneClock.Fields.POWER.ordinal(); GuiSliderInteger power = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), 1, 15, container.tile.getField(f))); @@ -60,9 +59,6 @@ protected void drawGuiContainerForegroundLayer(MatrixStack ms, int mouseX, int m @Override protected void drawGuiContainerBackgroundLayer(MatrixStack ms, float partialTicks, int mouseX, int mouseY) { - this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); - // this.txtDuration.render(ms, mouseX, mouseX, partialTicks); - // this.txtDelay.render(ms, mouseX, mouseX, partialTicks); - // this.txtPower.render(ms, mouseX, mouseX, partialTicks); + this.drawBackground(ms, TextureRegistry.INVENTORY); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/collectitem/ContainerItemCollector.java b/src/main/java/com/lothrazar/cyclic/block/collectitem/ContainerItemCollector.java index b43b0a67c..c510ac3a5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/collectitem/ContainerItemCollector.java +++ b/src/main/java/com/lothrazar/cyclic/block/collectitem/ContainerItemCollector.java @@ -31,7 +31,7 @@ public ContainerItemCollector(int windowId, World world, BlockPos pos, PlayerInv } } addSlot(new SlotItemHandler(tile.filter, 0, 152, 9)); - layoutPlayerInventorySlots(8, 153); + layoutPlayerInventorySlots(8, 132); this.trackAllIntFields(tile, TileItemCollector.Fields.values().length); } diff --git a/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java b/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java index b9788c1f9..0631a9a7c 100644 --- a/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java +++ b/src/main/java/com/lothrazar/cyclic/block/collectitem/ScreenItemCollector.java @@ -14,13 +14,13 @@ public class ScreenItemCollector extends ScreenBase { private ButtonMachineField btnRedstone; private ButtonMachineField btnRender; - private GuiSliderInteger sizeSlider; private ButtonMachineField btnDirection; + private GuiSliderInteger sizeSlider; private GuiSliderInteger heightslider; public ScreenItemCollector(ContainerItemCollector screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); - this.ySize = 256; + this.ySize = 214; } @Override @@ -29,33 +29,28 @@ public void init() { int x = guiLeft + 6; int y = guiTop + 6; int f = TileItemCollector.Fields.REDSTONE.ordinal(); + int h = 20; btnRedstone = addButton(new ButtonMachineField(x, y, f, container.tile.getPos())); f = TileItemCollector.Fields.RENDER.ordinal(); - y += 20; + y += h; btnRender = addButton(new ButtonMachineField(x, y, f, - container.tile.getPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render")) - // .setSize(18) - ; + container.tile.getPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render")); //then toggle f = TileItemCollector.Fields.DIRECTION.ordinal(); - y += 20; + y += h; btnDirection = addButton(new ButtonMachineField(x, y, f, - container.tile.getPos(), TextureEnum.DIR_DOWN, TextureEnum.DIR_UPWARDS, "gui.cyclic.direction")) - //.setSize(18) - ; - int w = 110; - int h = 18; - //now start sliders - // - y = guiTop + 22; - x = guiLeft + 34; + container.tile.getPos(), TextureEnum.DIR_DOWN, TextureEnum.DIR_UPWARDS, "gui.cyclic.direction")); + int w = 140; + //now start sliders + x = guiLeft + 30; + y = guiTop + 34; f = TileItemCollector.Fields.HEIGHT.ordinal(); heightslider = this.addButton(new GuiSliderInteger(x, y, w, h, TileItemCollector.Fields.HEIGHT.ordinal(), container.tile.getPos(), 0, TileItemCollector.MAX_HEIGHT, container.tile.getField(f))); heightslider.setTooltip("buildertype.height.tooltip"); //then size f = TileItemCollector.Fields.SIZE.ordinal(); - y += h + 1; + y += h + 4; sizeSlider = this.addButton(new GuiSliderInteger(x, y, w, h, TileItemCollector.Fields.SIZE.ordinal(), container.tile.getPos(), 0, TileItemCollector.MAX_SIZE, container.tile.getField(f))); sizeSlider.setTooltip("buildertype.size.tooltip"); @@ -81,7 +76,7 @@ protected void drawGuiContainerForegroundLayer(MatrixStack ms, int mouseX, int m @Override protected void drawGuiContainerBackgroundLayer(MatrixStack ms, float partialTicks, int mouseX, int mouseY) { - this.drawBackground(ms, TextureRegistry.INVENTORY_LARGE_PLAIN); + this.drawBackground(ms, TextureRegistry.INVENTORY_MEDIUM); for (int i = 0; i < 9; i++) { int y = 81; this.drawSlot(ms, 7 + i * Const.SQ, y); diff --git a/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java b/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java index 9306a424b..709916733 100644 --- a/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java +++ b/src/main/java/com/lothrazar/cyclic/block/fan/ScreenFan.java @@ -25,7 +25,7 @@ public void init() { x = guiLeft + 6; y = guiTop + 6; btnRedstone = addButton(new ButtonMachineField(x, y, TileFan.Fields.REDSTONE.ordinal(), container.tile.getPos())); - y += 20; + x += 20; btnRender = addButton(new ButtonMachineField(x, y, TileFan.Fields.RENDER.ordinal(), container.tile.getPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render")); // diff --git a/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java b/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java index dc32e6d4d..af69978d1 100644 --- a/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java +++ b/src/main/java/com/lothrazar/cyclic/block/forester/ScreenForester.java @@ -27,27 +27,25 @@ public ScreenForester(ContainerForester screenContainer, PlayerInventory inv, IT @Override public void init() { super.init(); - int x, y; + int x = guiLeft + 6; + int y = guiTop + 6; energy.guiLeft = guiLeft; energy.guiTop = guiTop; energy.visible = TileForester.POWERCONF.get() > 0; - x = guiLeft + 6; - y = guiTop + 6; btnRedstone = addButton(new ButtonMachineField(x, y, TileForester.Fields.REDSTONE.ordinal(), container.tile.getPos())); y += 20; btnRender = addButton(new ButtonMachineField(x, y, TileForester.Fields.RENDER.ordinal(), container.tile.getPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render")); - final int w = 110; - final int h = 18; + final int w = 120; + final int h = 20; int f = TileForester.Fields.HEIGHT.ordinal(); - x = guiLeft + 34; - y = guiTop + 38; + x = guiLeft + 30; + y = guiTop + 36; heightslider = this.addButton(new GuiSliderInteger(x, y, w, h, TileForester.Fields.HEIGHT.ordinal(), container.tile.getPos(), 0, TileForester.MAX_HEIGHT, container.tile.getField(f))); // f = TileForester.Fields.SIZE.ordinal(); - // x += 28; - y += 20; + y += h + 4; size = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), 0, TileForester.MAX_SIZE, container.tile.getField(f))); } diff --git a/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java b/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java index 2be83b9eb..8d1a476db 100644 --- a/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java +++ b/src/main/java/com/lothrazar/cyclic/block/harvester/ScreenHarvester.java @@ -42,19 +42,17 @@ public void init() { y += 20; btnDirection = addButton(new ButtonMachineField(x, y, f, container.tile.getPos(), TextureEnum.DIR_DOWN, TextureEnum.DIR_UPWARDS, "gui.cyclic.direction")); - final int w = 110; - final int h = 18; //now start sliders - // - // - y = guiTop + 24; - x = guiLeft + 34; + final int w = 120; + final int h = 20; + x = guiLeft + 30; + y = guiTop + 36; f = TileHarvester.Fields.HEIGHT.ordinal(); heightslider = this.addButton(new GuiSliderInteger(x, y, w, h, TileHarvester.Fields.HEIGHT.ordinal(), container.tile.getPos(), 0, TileHarvester.MAX_HEIGHT, container.tile.getField(f))); // f = TileHarvester.Fields.SIZE.ordinal(); - y += 28; + y += h + 4; size = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), 0, TileHarvester.MAX_SIZE, container.tile.getField(f))); } diff --git a/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java b/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java index c560b402d..f8faab118 100644 --- a/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java +++ b/src/main/java/com/lothrazar/cyclic/block/miner/ScreenMiner.java @@ -43,14 +43,14 @@ public void init() { // int w = 120; int h = 20; - x = guiLeft + 32; - y += h + 1; + x = guiLeft + 30; + y += h + 4; // height fi f = TileMiner.Fields.HEIGHT.ordinal(); GuiSliderInteger heightslider = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), 0, TileMiner.MAX_HEIGHT, container.tile.getField(f))); heightslider.setTooltip("buildertype.height.tooltip"); - y += h + 1; + y += h + 4; // f = TileMiner.Fields.SIZE.ordinal(); sizeSlider = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), diff --git a/src/main/java/com/lothrazar/cyclic/registry/TextureRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/TextureRegistry.java index 178c2fb09..c3b584577 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/TextureRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/TextureRegistry.java @@ -12,6 +12,7 @@ public class TextureRegistry { public static final ResourceLocation INVENTORY_PLAIN = new ResourceLocation(ModCyclic.MODID, "textures/gui/inventory_plain.png"); public static final ResourceLocation INVENTORY_LARGE = new ResourceLocation(ModCyclic.MODID, "textures/gui/inventory_large.png"); public static final ResourceLocation INVENTORY_LARGE_PLAIN = new ResourceLocation(ModCyclic.MODID, "textures/gui/inventory_large_plain.png"); + public static final ResourceLocation INVENTORY_MEDIUM = new ResourceLocation(ModCyclic.MODID, "textures/gui/inventory_medium.png"); // 176x214 public static final ResourceLocation INVENTORY_SOUND = new ResourceLocation(ModCyclic.MODID, "textures/gui/inventory_sound.png"); public static final ResourceLocation SLOT = new ResourceLocation(ModCyclic.MODID, "textures/gui/slot.png"); public static final ResourceLocation SLOT_CHARGE = new ResourceLocation(ModCyclic.MODID, "textures/gui/slot_charge.png"); diff --git a/src/main/resources/assets/cyclic/textures/gui/inventory_medium.png b/src/main/resources/assets/cyclic/textures/gui/inventory_medium.png new file mode 100644 index 0000000000000000000000000000000000000000..e1365b3989364802e20d7fada4495f9022d59b80 GIT binary patch literal 758 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5D>38$lZxy-8q?;Kn_c~qpu?a z!^VE@KZ&eBzG#3?h%1o(|NsB7W5+^6L(R?2ySuxABB`6FO9LtPk|4iepeztDNO?26 z0fjgVJR*x37`XXBn9*V1L!g07;hrvzAr*0NZyd~$PULC5SQvBuw|&v;FV~pkS`{vG z%*|K+A?{?mgXNjU`DDNJ+T)dXo?THW@cH%qzTGQUJ4U-@CHtpy+c0jbbpYCM;%+L) z9}e62Ie^s8-8w*$;lwvaprAtebdb9lZrUjT$tUkNfjA1c*;yDE8t%l3fp{su8-V15 z-KUv=R6~xu0FWvwj|7qo6W%fd1s&e$af5jDv}``Z{(IFaaetpr&ucgyy?y>SkmEoA z>Q^w^Chz^OYs_O#jW;{~eo#FSRFER%NoCD4)LiSibel z@c62iY$x>JhCc59S*;H?5)mvQuEYK5b5;Q@kc5QfSAK>2aqFe_zfX&+eYsRxp*|OA zmE-Sw;LrgohXpoB>xJ*8+g~k}OaP{UH*7n~8Ri@>em_Hs;hger^^kw>>zV%i%r{uJ s-#z@=hN3VAqw8!6#kmwxry0+EHt)JF-&)L^DhG0cr>mdKI;Vst02{&Z;{X5v literal 0 HcmV?d00001 diff --git a/update.json b/update.json index 66b317b80..baa7f633d 100644 --- a/update.json +++ b/update.json @@ -81,6 +81,6 @@ ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms " ,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. " - ,"1.6.0":"Add mouse-dragging capability to the slider controls in machines. Fluid Hoppers can now insert into cauldrons. Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " + ,"1.6.0":"Add mouse-dragging capability to the slider controls in machines. Fluid Hoppers can now insert into cauldrons. Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Clock gui-screen size reduced from large to normal. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) " } } From ad1a91b2c971114d4f35a8a7ad772113769f6c48 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 13:47:06 -0800 Subject: [PATCH 08/10] fix new facade config list and update defaults --- examples/config/cyclic.toml | 6 +++--- .../cyclic/config/ConfigRegistry.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index a2e59889a..cda02f7bb 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -12,7 +12,7 @@ traveler = true #Radius per level. size around player to perform growth logic #Range: 1 ~ 16 - growthRadius = 2 + growthRadius = 6 #Set false to disable enchantment reach = true #Set false to disable enchantment @@ -154,8 +154,8 @@ [cyclic.blocks.facades] # - # These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others) - itemsNotAllowed = ["minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily", "minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars", "minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine", "minecraft:rail", "minecraft:*_rail", "minecraft:brewing_stand", "minecraft:*_dripleaf", "minecraft:*_pane", "minecraft:*_sapling", "minecraft:*_sign", "minecraft:*_door", "minecraft:*_banner", "minecraft:*_shulker_box", "cyclic:*_pipe", "cyclic:*_bars", "storagenetwork:*"] + # These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others). If you want to ignore one entire mod use an entry like this : storagenetwork:* + itemsNotAllowed = ["minecraft:double_plant", "minecraft:waterlily", "minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars", "minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine", "minecraft:brewing_stand", "minecraft:*_dripleaf", "minecraft:*_pane", "minecraft:*_sapling", "minecraft:*_sign", "minecraft:*_door", "minecraft:*_banner", "minecraft:*_shulker_box", "storagenetwork:*"] [cyclic.blocks.facades.cables] # diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 79c72dad4..0d2e4de65 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -414,21 +414,18 @@ private static void initConfig() { CABLE_FACADES = CFG.comment("\r\n Allow cables to have blocks placed in them as facades (sneak-left-click to set; use empty hand to remove). Set to false to disable facades") .define("cables.enabled", true); //a few default - List list = Arrays.asList("minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily", + List list = Arrays.asList("minecraft:double_plant", "minecraft:waterlily", "minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars", "minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine", - "minecraft:rail", - "minecraft:*_rail", "minecraft:brewing_stand", "minecraft:*_dripleaf", "minecraft:*_pane", "minecraft:*_sapling", "minecraft:*_sign", "minecraft:*_door", "minecraft:*_banner", "minecraft:*_shulker_box", - "cyclic:*_pipe", "cyclic:*_bars", "storagenetwork:*"); - FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others)") - .define("itemsNotAllowed", list); + FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others). If you want to ignore one entire mod use an entry like this : storagenetwork:* ") + .defineList("itemsNotAllowed", list, it -> it instanceof String); CFG.pop(); // TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions " @@ -569,6 +566,11 @@ public static List getGloomIgnoreList() { return (List) GLOOM_IGNORE_LIST.get(); } + @SuppressWarnings("unchecked") + public static List getFacadeIgnoreList() { + return (List) FACADE_IGNORELIST.get(); + } + public static Map getMappedBeheading() { Map mappedBeheading = new HashMap(); for (String s : BEHEADING_SKINS.get()) { @@ -586,11 +588,11 @@ public static Map getMappedBeheading() { } public static BooleanValue CABLE_FACADES; - private static ConfigValue> FACADE_IGNORELIST; + private static ConfigValue> FACADE_IGNORELIST; public static boolean isFacadeAllowed(ItemStack item) { ResourceLocation itemId = ForgeRegistries.ITEMS.getKey(item.getItem()); - if (UtilString.isInList(FACADE_IGNORELIST.get(), itemId)) { + if (UtilString.isInList(getFacadeIgnoreList(), itemId)) { return false; } return true; From 0ee2bf2945626e1255592e0c771e809597f56ba3 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 17:50:10 -0800 Subject: [PATCH 09/10] update fluid hopper lava cauldrons --- .../lothrazar/cyclic/util/FluidHelpers.java | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java b/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java index edafe4bbb..605421479 100644 --- a/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java +++ b/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java @@ -20,13 +20,13 @@ import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LayeredCauldronBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; @@ -43,6 +43,12 @@ public class FluidHelpers { public static final FluidRenderMap> CACHED_FLUIDS = new FluidRenderMap<>(); public static final int STAGES = 1400; + /** + * maps fluid to colour hex code as int value. Used by itemstack durability bar on filled held tanks + * + * @param fstack + * @return + */ public static int getColorFromFluid(FluidStack fstack) { if (fstack != null && fstack.getFluid() != null) { //first check mine @@ -64,17 +70,20 @@ else if (fstack.getFluid() == FluidXpJuiceHolder.STILL.get()) { else if (fstack.getFluid().getAttributes().getColor() > 0) { return fstack.getFluid().getAttributes().getColor(); } - else if (fstack.getFluid() == ForgeMod.MILK.get()) { - return COLOUR_MILK; - } - else if (fstack.getFluid() == Fluids.LAVA) { - return COLOUR_LAVA; - } + return COLOUR_MILK; + } + else if (fstack.getFluid() == Fluids.LAVA) { + return COLOUR_LAVA; } return COLOUR_DEFAULT; } /** + * Internally knows that water cauldrons fil to level 3, but lava cauldrons are a different block without the level property. + * + * Ignores partially filled water cauldrons. + * + * a full cauldron is 1000mb * * @param level * @param posTarget @@ -91,7 +100,7 @@ public static boolean insertSourceCauldron(Level level, BlockPos posTarget, IFlu FluidStack simulate = tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE); if (simulate.getAmount() == FluidAttributes.BUCKET_VOLUME) { //we are able to fill the tank - if (level.setBlock(posTarget, Blocks.WATER_CAULDRON.defaultBlockState(), 3)) { + if (level.setBlock(posTarget, Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), 3)) { //we filled the cauldron, so now drain with execute tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.EXECUTE); return true; @@ -111,6 +120,17 @@ public static boolean insertSourceCauldron(Level level, BlockPos posTarget, IFlu return false; } + /** + * Internally knows that water cauldrons fil to level 3, but lava cauldrons are a different block without the level property. + * + * Ignores partially filled water cauldrons. + * + * a full cauldron is 1000mb + * + * @param level + * @param posTarget + * @param tank + */ public static void extractSourceWaterloggedCauldron(Level level, BlockPos posTarget, IFluidHandler tank) { if (tank == null) { return; @@ -127,7 +147,7 @@ public static void extractSourceWaterloggedCauldron(Level level, BlockPos posTar tank.fill(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAction.EXECUTE); } } - else if (targetState.getBlock() == Blocks.WATER_CAULDRON) { + else if (targetState.getBlock() == Blocks.WATER_CAULDRON && targetState.getValue(LayeredCauldronBlock.LEVEL) >= 3) { int simFill = tank.fill(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE); if (simFill == FluidAttributes.BUCKET_VOLUME && level.setBlockAndUpdate(posTarget, Blocks.CAULDRON.defaultBlockState())) { From 3c9956874d4ae40b272a389b999087bbea5d543b Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 19:39:04 -0800 Subject: [PATCH 10/10] backport laser shoots even when you miss --- .../com/lothrazar/cyclic/event/EventRender.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/event/EventRender.java b/src/main/java/com/lothrazar/cyclic/event/EventRender.java index 311edee04..00dc8e11a 100644 --- a/src/main/java/com/lothrazar/cyclic/event/EventRender.java +++ b/src/main/java/com/lothrazar/cyclic/event/EventRender.java @@ -236,12 +236,9 @@ else if (!stHere.isAir()) { if (distance < LaserItem.RANGE_MAX) { //first vector is FROM, second is TO BlockHitResult miss = mc.level.clip(new ClipContext(cameraEyePosition, entityHitResultLocation, ClipContext.Block.VISUAL, ClipContext.Fluid.NONE, mc.player)); - // BlockHitResult miss = BlockHitResult.miss(entityHitResultLocation, Direction.getNearest(cameraViewVector.x, cameraViewVector.y, cameraViewVector.z), new BlockPos(entityHitResultLocation)); - if (miss.getType() == HitResult.Type.BLOCK) { - //we hit a wall, dont shoot thru walls - } - else { - //Render and Shoot + //Render and Shoot + if (miss.getType() != HitResult.Type.BLOCK) { + //dont shoot thru walls RenderMiningLaser.renderLaser(event, player, mc.getFrameTime(), stack, InteractionHand.MAIN_HAND); if (world.getGameTime() % 4 == 0) { PacketRegistry.INSTANCE.sendToServer(new PacketEntityLaser(ehr.getEntity().getId(), false)); @@ -250,6 +247,10 @@ else if (!stHere.isAir()) { } } } + else { + //we missed + RenderMiningLaser.renderLaser(event, player, mc.getFrameTime(), stack, InteractionHand.MAIN_HAND); + } } } }