Giter Club home page Giter Club logo

mc-gold's Introduction

mc-gold

With this project you can add loot to other loot tables without overwriting them.

Overview

This beet project gives you the opportunity to add to foreign loot tables without modifying them in any way.

A full data pack gets generated, that can directly be merged with your own project and your pack automatically will be compatible with all other packs using mc-gold!

Configure

  1. At the top of the main.bolt file, you can see the variables lootTables, insertTables and yourNamespace. Adjust, remove and add to these to achive your desired result.

    The first loot table in the lootTables list corresponds to, and will generate, all the loot tables specified in the first row of the insertTables list.

    yourNamespace is the namespace of your own pack. This namespace is used for a single .mcfunction file to enable compatibility between different data packs using mc-gold.

    lootTables = [ # add a loot table to add items to
        "minecraft:chests/simple_dungeon",
        "minecraft:chests/bastion_treasure",
    ]
    
    insertTables = [ # add the loot tables that will be added to the loot table with    the same index
        [ "myCoolPack:artifact", "myCoolPack:weapon" ],
        [ "minecraft:chests/buried_treasure", "minecraft:blocks/diamond_block" ],
    ]
    
    yourNamespace = "myCoolPack" # the namespace the insersion functions can be     found under for compatibilty reasons
    • In this example the loot tables myCoolPack:artifact and myCoolPack:weapon will be added to normal dungeons using the minecraft:chests/simple_dungeon loot table
    • And the minecraft:chests/buried_treasure and minecraft:blocks/diamond_block loot tables can also be found in chests using the minecraft:chests/bastion_treasure loot table.

  2. Once these variables are configured, build the project using beet.

  3. After that, you should copy the the folder gold from /build/mc-gold/data/ into the .../data/ folder of your data pack.

  4. You also have to copy the folder gold from /buid/mc-gold/data/<yourNamespace>/functions/ into your pack to .../data/<yourNamespace>/functions/.

  5. Lastly you must run the gold:_technical/load function when loading your pack. This can be done by adding it as a new line into your .../data/minecraft/tags/functions/load.json file.

How it Works

  1. The pack checks when a player opens a loot table that should be modified.

    • For this a player_generates_container_loot loot table per unique loot table, that should be modified, is used.
  2. When the pack detects a loot table that should be modified, it adds two tags to the player.

    • A tag to identify, that the player should check for a container and
    • The name and namespace of the loot table that should be replaced
  3. Next an item_used_on_block advancement is used to check for the player opening a chest while having the identifier tag.

    • This executes right after the other advancement, but still in the same tick.
    • The next steps have to happen a little after the first advancement, because at that time, the chest content has not been generated yet. This leeds to items overwriting other items and other jank.
  4. A raycast is used to locate the chest.

  5. The content of the chest gets removed.

    • This is done, to stack the items of the original loot table as with this, there can be a lot more different items in the chest.
  6. The original loot table and all additional loot tables get inserted into the chest.

    • The original loot table gets determined by the tag of the player and
    • Additional loot tables get inserted through a tag calling a function in the packs own namespace. This is done, to allow multiple packs to modify the same original loot table.
  7. Lastly, all the chest content gets shuffled.

    • If the contents are not shuffled, all the loot would be in order of insertion.
    • This also insures the items to be spread in the chest, even if not all slots are filled.

Known Limitations

This pack only works if a player is opening the container, so breaking the container or placing a hopper underneath it only gives items of the original loot table.

Loot will (only) be inserted into both chest types, barrels and all shulker boxes.

Once the chest is full, additional loot tables won't be inserted. So some loot may not generate if too many loot tables are added using this method.

Dependencies

This project uses beet, bolt and mecha.


check me out on Planet Minecraft

mc-gold's People

Contributors

puckisilver avatar

Stargazers

AmericanBagel avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.