Giter VIP home page Giter VIP logo

magna's Introduction

Magna

Magna is a library that assists with tools that break more than 1 block (Hammers, Excavators, etc). It powers the mods Vanilla Hammers and Vanilla Excavators.

For Developers

Basics

Magna provides 2 base tools: HammerItem and ExcavatorItem. Registering an instance of one of these will offer a fully featured tool that is effective on dirt or stone.

public class MyMod implements ModInitializer {

    public static final HammerItem EPIC_HAMMER = Registry.register(
        Registry.ITEM,
        new Identifier("mymod", "epic_hammer"),
        new HammerItem(
            ToolMaterials.DIAMOND,
            1,
            -2.8f,
            new Item.Settings()
        )
    );

    @Override
    public void onInitialize() {
  
    }
}

Curse of Gigantism

The Curse of Gigantism is a feature used by both Vanilla Hammers and Vanilla Excavators. If a relevant tool has the curse, it will gain +1 break radius, but lose 80% speed.

Custom Tool

If you want to create a custom tool with extended breaking mechanics, you can implement the MagnaTool interface on your Item class. The only thing you'll have to do is override getRadius(ItemStack stack) and playBreakEffects(), which help define behavior related to your tool.

For more information, see implementation in HammerItem or ExcavatorItem.

Custom Breaking

If you don't want to use a tool for large breaking, you use the BlockBreaker findPositions method to gather positions relative to where a player is looking in a certain radius.

Events

Magna provides 2 custom events.

Existing Mod Integration

If you want to only add a Hammer or Excavator while Vanilla Hammers / Vanilla Excavators is installed, you can call Magna#isVanillaHammersInstalled() or Magna#isVanillaExcavatorsInstalled().

For Users

Magna provides nothing out of the box for users, and developers should JIJ it.

Magna does provide a unified set of config options to keep all your large-break-tools consistent. You can either edit the config file at /run/magna.json, or edit the config through Mod Menu.

License

Magna is licensed under CC0-1.0.

magna's People

Contributors

draylar avatar shedaniel avatar ptom76 avatar gabrielolvh avatar platymemo avatar ashtonqlb avatar lucaargolo 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.