Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize (and Boltify) Liquid Tanks #1036

Open
wants to merge 77 commits into
base: master
Choose a base branch
from

Conversation

SpecialBuilder32
Copy link
Member

@SpecialBuilder32 SpecialBuilder32 commented Sep 6, 2024

This PR updates some of the liquid tanks backend to use the more efficient (or at least simpler) execute if items added by 1.20.4, and modernizes to display entities and computation improvements. XP tanks now hold 4x the liquid (50 levels) and have a quick deposit/withdraw interface similar to XP storage. Potion liquids has been updated with the newest potion types, and now supports awkward, thick, and mundane potions. Kyrius's polished liquid skin textures give the tanks a fresh coat of paint.

This PR also adds a somewhat experimental (as in we may not use this approach in other modules, not as in the code is unstable) set of bolt bindings/wrappers for creating and defining new liquids for a liquid tank. This approach uses a decorator-based design scheme to add mcfunction lines to places where different liquids might have different commands, but is somewhat more complex as a result of that. It does have the benefit of reducing repetition throughout the liquid-tanks codebase however, and makes future maintaining hopefully much faster. I hope this style of bolt usage at least sparks a discussion about what might best serve other modules.

Potion liquids is now (nearly) fully automatically built from a file listing all the vanilla potions and their effects. This makes adding new effects much simpler going forward. Additionally, any new potions that do not have an explicitly added skin texture available will auto-generate their skin texture to match the potion's particle color, though an artists manual touch is preferred in the long run.

Remaining TODOs:

  • Remove reference to autocrafters for unstackables
  • Update/add new PackTests
  • Add (or not) omnious bottles to either Potion Liquids or Standard Liquids
  • Triple check all these changes in-game (I've solely been believing Packtest that this passes existing tests)
  • Add docs

author SpecialBuilder <[email protected]> 1668556612 -0500
committer SpecialBuilder <[email protected]> 1668556612 -0500

Update main.yml

Rename folder to use new module id

Fix typo

Resources for Machine Blocks (Gamemode4Dev#56)

Adds font-magic needed to make machine names look fancy in the future.

Fix some typos (Gamemode4Dev#57)

- probably fixes the warnings, hopefully doesn't break anything

update script and bismutite_lump

Machine blocks V1

machine changes part 2

hopper minecart items

actual textures for the blocks

Fix translate tags with the packager (Gamemode4Dev#59)

Add Container GUIs (Gamemode4Dev#61)

Adds Texture GUIs for Machine Blocks Machines.
Textures by Hozz

Fix Corrupted Image

Update to 1.19 (Gamemode4Dev#63)

* Fix TP anchors, update beet

* Update to 1.19

Auto Crafter GUI (Gamemode4Dev#65)

auto crafter gui should now look correct, but the CC container image is used as a placeholder

Add auto crafter texture, and update optifine copy

fix TP Jammer's name

update phantom model

Pack format and required atlases

-Increments pack format to 1.19.3 version,
-Adds atlas sources to properly load textures not in `items` or `blocks` directories

Update pack.png (Gamemode4Dev#68)

Replaces old pack.png with Custom Crafter

Add shrieking textures to Orb of Ankou (Gamemode4Dev#67)

Adds textures and a CMD path for the shrieking soul and shard

Update pack_format and other versions

Update GUI Font Magic for 1.19.4 (Gamemode4Dev#69)

- uses JP's perfect TTF font
  - names are now exactly center align
  - non-latin alphanumeric characters should work now (not tested)
- simplified the GUI name requirement
  - no more \u00a0 for spaces in container names

Update to 1.20

Move apple trees and scuba assets to module-folder

Move CMD-controlling item models to base

Load RPs into beet and output final to /out

Model config validation

Adds a model_data field to meta, which allows for nested configs to inherit properties from their parent for ease of defining similar items

Each module generates minecraft-model overrides for itself

Model config `item` may be a list

Allows for modules which wish to use the same integer value for multiple different items: ie shamir tools

Start generating model overrides with original file

Add and remove configured model data to global registry

Assign new CMD values

Attempt to use same cmd first

Allow config for custom override predicates

Transition existing processes to service object

Process config options late, allowin for programatic generation

Functional config validation and error reporting on inherited model_data

Move index retrieval/assignment to class methods

Simplify filter function syntax

Basics of auto-model generation (templating)

textures defaults to reference

Outputs registry after build

NOTE: uses the wrapped output style used in PlayerheadManagement, though that has not been merged as of yet

Refactor some RP files into new spec

Bugfix to model validation

Github action fails if new CMD needs to be issued

Fix CMD assignment/reassignment

Logger revamp

BROKEN: Attempt fix for vanilla override merging

Fix vanilla model override merging

Migrate many simple textures to their parent datapack

Migrate more complex module textures

Last uncomplex item config

(to be redone) template_options pydantic models

Reconfigure for extendable transform functions

Transform designed for item_display calculations

"block" model template

Templates are classes, and textures can be specified by name

template/transform combo for the common CC-like models

... class inheritance ended up working really nicely here.

Cache registry during build

Disassembler model move

Custom templates support transforms

First attempt at LT models using the new item_display transform

dev pipeline fully defined in beet-dev.yaml

Rewrite of textures field for list and dict support

Optional pydantic fields processed in order

Fix liquid tanks block and item models

Ender hoppers without minecart

Auto crafting models

Ench Extractors models

Teleportation anchors models

Update block_compressors to use display entities

block_compressors model data config

Update tinkering_compressors to display entities

tinkering_compressors model data

Migrate remaining unused directional ender_hoppers models

NOTE: item_displays actually allow for the remodelling of the player head item, even when shown with the "head" model variant. This removes the need for the stone-button model used previously

Forming press models

Smelteries models

NOTE: This uses the expandability function of the item model templates, although it would be roughly as easy to implement programmatically in a generator plugin

Tnt landmines entity models

Leftover model cleanup

Fix custom crafters relocators with display entity change

Relocator models

Trapped sign models

Metallurgy bands and lumps

Metallurgy tool shamir models

This improperly handles shared CMD registration, and is solely to get the models more-or-less working in game

Support different models for items sharing a CMD value

New example syntax in apple_trees, to be cleaned up in the following commit

Clean up example config

Metallurgy shamir textures complete

Move template class to Pydantic, for configurable tempaltes

Refactor TemplateOptions for multiple model creation

Shamir models, but correctly this time

Glob pattern support for allocations

Remove old metallurgy models

Remove sky dimension textures/models

Start of advancement icon models

Continuation of advancement icons

Fix old-format scuba gear models

Final advancement icons

Clean up old advancement models

Restore end_fishing custom tuned sword offsets

Merge config cleanup

Basics of Mecha Transformer rule

Pass jsonfiles through Mecha manually

Better Diagnostics when manually parsing jsonfiles

Adds a transformer name to the unique key used when registering a fake ComplilationUnit, to avoid overwriting previous rule's results

Basic nbt transformations

Port spreadsheet values to registry, pt 1

Move shamir bands to the same CMD/Reference as shamir tools

Port metallurgy spreadsheet values to registry, pt2

Alphabetize and correct lingering shamir indexes

Remove redundant metallurgy band model config

Rename shamir references to `shamir/foo` to reflect multi-texture nature

Use mecha rules in source packs: animi-boots_of_ostra

Add rule for substitutions into `data modify ... value`

Use mecha rules in source files: calling_bell-enchant_extractors

Reconfig end fishing to share tool/armor CMD between different item types

Rename end fishing textures to start at 1

Ensure vanilla overrides are added in ascending CMD order

Update ender_hoppers to use item displays. Use mecha rules in source files

Extend jsonfile mecha rules into overlays

Use mecha rules in source files: liquid_minecarts-note_block_interface

Update orb_of_ankou model references - shards and essences are shared ref

Use mecha rules in source files : particles_pack-ziprails (the rest)

Remaining migration cleanup/bugfixes

Restore texture existance checks

Add beet.contrib.optifine

CMD reference lookup for optifine CIT .properties

Migrate simple CIT textures

Remove public-server only optifine textures

End fishing optifine armor

Zauber cauldrons optifine textures

Fix animated zauber textures

Shamirs generate optifine armor config files

NOTE: during this commit a significant bug with file merging was discovered. It does not currently function completely as a result

Migrate metallurgy armor optifine animations

Optifine custom-entity-models

This is a dumb simple migration of optifine CEM models. In the future, if more than one pack wishes to use the same entity, some clever beet merge rules could be written to make it work in our monorepo

item_display machines set to full brightness

Font-powered custom guis

Cleanup last old RP files

Setup RP as a module, with its own beet.yaml instructions

Use beet autoload to ensure merge policies apply during broadcast merges

Remove optifine metallurgy armor .properties - they are generated by the plugin

Repair optifine cit spyglass and trident item retextures

Resource pack plays nice with beet-dev

Update beet-release.yaml

Add babelbox for translations

Port existing (outdated) translations to new spreadsheets

Fix `beet readme-gen` to work and also only load the metadata

Allow CMD prefix to be configured

Framework for "interrupted" broadcast

[Broken] Hash-based update detector

Completed hash-based update detector

Ensures builds are fully deterministic/reproducible so zipfile hashes can reliably be used to detect changes to a module.

Run libraries through new patch system

Rename plugin to `update_checker`

Rename plugin to `worker` and run libraries and RP through new update checking

Better organize new plugins, add repro-zipfile dependancy

Descriptions for libraries, prevents addition of version number to mcmeta

Move folder to `resource_pack` and finish patch tracking

Add missing rename

Skip writing RP version to datapack init functions

Use mecha.contrib.json_files to get better diagnostics from LootTable processing

Move json rules to class mixin

Exclude block/fluid tag predicates from `tag` processing (easy way out)

Allow proper parsing of newlines (like used in Guidebook)

ill-formed nbt produces pretty diagnostic

Translation key linting

Add missing translations to babelbox shreadsheets

Add warnings for unused translations

Missing potion_liquids translations

OOA Translations [babelbox makes nonfunctional atm]

Add extra entries to item model files to return to the vanilla model on unused CMD values

`generated` template supports creating the same model for multiple items

Generate trapped signs model_data via plugin. Add simple hanging sign texture

Update bolt to function

Patch cache-less build

Clear leftover item models

Update beet to fix babelbox unicode loading

Update mecha to fix orb_of_ankou build

Copy vanilla model data first to prevent cross-build errors

Restore CMD model padding

Fix metallurgy shields and texture linting

Various warning cleanup

Github action debug

Update translations.csv

Revert "Github action debug"

This reverts commit b489e57.

Remove old tunnel bores placement, and its ascioated translation

Add unripe golden apple texture

Texture credit: Hozz

Co-Authored-By: hozz8528 <[email protected]>

Edit RP dev pack description

Save beet-dev generated config in tempfile to fix watch

Fix `beet dev -w`

Repair `beet readme-gen` cli command with new config method

Update zauber translations

Migrate zauber armor textures

Migrate zauber crystal textures

Migrate zauber soulution textures

Migrate zauber magicol CMD

Migrate new zauber advancements

Zauber Cauldron custom model.

Model and Textures by @kyrkis

Co-Authored-By: kyrius <[email protected]>

Fallback translations include "Lingering" and "Splash" for potions

Update zauber_cauldrons_paint_biome.json

Update beet-dev.yaml

Begin incorporation of guidebook textures

Add copies of legacy guidebook gm4 items

Guidebooks have arrows

Textures by @kyrkis

Co-Authored-By: kyrius <[email protected]>

New Orb of Ankou Textures

Image credit: Hozz

Co-Authored-By: hozz8528 <[email protected]>

Namespace custom crafter reference - avoids error with unusual autocrafter guidebook inclusion

CLI option for auto-updating babelbox translations from source fallback.

Intended for auto-propagating guidebook translations

Repair some config issues

Load test files during `beet dev` pipeline

Correct metallurgy advancement icon config

Mecha logging filter to limit single line length.

Allow backfilling of unset translation keys

Transfer guidebook translations into translations.csv

Misc translation inconsistencies 1

Misc translation inconsistencies 2

Misc translation inconsistencies 3

Fix github test action by adding RP plugins

Test build does not include complex beet tooling for update detection and patch number increments. Since tests dont check the update behavior currently this is acceptable, but may need to bae changed in the future

Correct guidebook translation tag format

Misc translation inconsistencies 4

Fix Gamemode4Dev#932

Skip mecha linting in beet-test.yaml

Misc translation inconsistencies 5

Fix function tag leaks from worker-based update checker

Use new pack.copy() from beet v0.104.0

config option for translation linter ignores

Guidebook auto-generates advancement icons using module logos

Guidebook item reference in all the places

Texture gm4 root advancement

Various cleanup

Beet 0.104.1 fixes Unicode in beet.yaml on windows

Update commands.py

Prevent "worker reload" warning message on beet-release

Optional `model_data.yaml` file for storing long config outside of beet.yaml

Fix zauber cauldrons KeyError

Fix RP worker merge

Redundant `ignore` config

Stably sort player heads skin cache

Abstract dynamic config builder

Separate RP and DP pack formats

Correct ender hoppers cart display entity height
@SpecialBuilder32 SpecialBuilder32 added feature-update An additional feature has been added to a module needs-testing Requires in-game testing quality-update Improves efficiency or structure without affecting functionality of a module labels Sep 6, 2024
Copy link

@RitikShah RitikShah left a comment

Choose a reason for hiding this comment

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

I did a brief overview of the bolt stuff specifically. I wanna look at it a bit closer, i think you can clean things up a decent amount. The overall technique is nice, but there are some things I think could help simplify.

gm4_liquid_tanks/override_formatting.py Outdated Show resolved Hide resolved

Choose a reason for hiding this comment

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

This is a really odd way to load the module. Was there a specific reason you are mounting this file in code? you could just do it directly in your beet.yaml

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted a cleaner way to mount the bolt module from another subproject. Running a plugin from another module is pretty easy, but mounting this external bolt file in data_pack got ugly due to the long paths and scope jumps. It would've been something like data/gm4_liquid_tanks/modules/liquid_wrappers.bolt : ../gm4_liquid_tanks/data/gm4_liquid_tanks/modules/liquid_wrappers.bolt (if relative paths even work here, which I think they don't)

Choose a reason for hiding this comment

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

Very interesting, I'm considering doing something similar with my interface for like kit pvp server kits.

tag @s add gm4_lt_fill

for variant in ("", "coarse_", "rooted_"):
execute if items block ~ ~ ~ container.0 f"minecraft:{variant}dirt" run function gm4_cement_mixers:item_fill/mud:
Copy link
Member

Choose a reason for hiding this comment

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

You could just use an item tag with these 3 dirt variants

data modify block ~ ~ ~ Items[{Slot:0b}] set from storage gm4_liquid_tanks:temp/tank output
item_modifier gm4_liquid_tanks:apply_output_count:
function: "minecraft:set_count"
count:
Copy link
Member

Choose a reason for hiding this comment

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

I get wanting to use bolt, but what is the advantage of defining the item modifier here inline using the bolt syntax? I would move it out to a separate json file, or if you really want it here, use the vanilla inline item modifier syntax.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's not really any advantage. It's a part of experimenting with the bolt syntax to see what feels most useful for gm4. Since this is the only place this modifier is used, it makes sense to define it here instead of in another file for clarity, and that's what this syntax does in build time.

Is there any theoretical downsides to vanilla inlining? Like in repeated parsings for example?

Copy link
Member

Choose a reason for hiding this comment

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

Performance wise, vanilla inlining should perform just as well as a reference. During load they're converted to equivalent data structures.

@@ -2,7 +2,7 @@
#run from liquid_tanks:process

# get stack count for smart interface
execute store result score $stack_size gm4_lt_value run data get storage gm4_liquid_tanks:temp/tank input_slot.count 1.0
execute store result score $stack_size gm4_lt_value run data get block ~ ~ ~ Items[{Slot:0b}].count 1.0
Copy link
Member

Choose a reason for hiding this comment

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

To avoid NBT, you can use execute store ... if items block ~ ~ ~ container.0 * to get the count

scoreboard players add @s gm4_lt_util 1
execute if score @s gm4_lt_util matches ..12 teleport @s ~ ~0.060 ~
Copy link
Member

Choose a reason for hiding this comment

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

Missing run

Copy link
Member Author

Choose a reason for hiding this comment

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

Well thats a fun way to find out bolt will add implicit runs to execute chains

execute unless score $level_calc gm4_lt_util matches 0 playsound minecraft:entity.experience_orb.pickup block @s
from itertools import product, count
c = count(0)
for offset in product([0, -0.05, 0.05], repeat=2):
Copy link
Member

Choose a reason for hiding this comment

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

This could use a comment explaining what it does

@@ -0,0 +1,2 @@
# macro-function to add/remove a dynamic number of experience points
$experience add @s $(points) points
Copy link
Member

Choose a reason for hiding this comment

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

Missing "run from" header

liquid.init()
liquid.item_drain('ink_sac', 'air', 1)
@bottle('minecraft:potion[custom_data~{gm4_standard_liquids:{potion:"blindness"}}]')
def ink_bottle():
Copy link
Member

Choose a reason for hiding this comment

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

Add an empty line between each function call or function definition (more in this file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-update An additional feature has been added to a module needs-testing Requires in-game testing quality-update Improves efficiency or structure without affecting functionality of a module
Projects
Status: Upcoming Changes
Development

Successfully merging this pull request may close these issues.

3 participants