Giter VIP home page Giter VIP logo

trajectory-preview's Introduction

Trajectory preview shows possible trajectory of shootable and throwable items.

If you want to make a plugin for Trajectory Preview, set up the API:

  1. Add maven repository:
    maven {
        url 'https://mymavenrepo.com/repo/XXNTQu0VdMr93BjoOV1S/'
    }
    
  2. Add API dependency:
    implementation('dev.buildtool:trajectory-preview:[version]:api')
    
  3. Optionally, add a runtime dependency on Trajectory Preview to run your project with the mod:
    runtimeOnly fg.deobf('dev.buildtool:trajectory-preview:[version]:unobf')
    

Read the Javadoc and source of the basic plugin on how to create your own previews

trajectory-preview's People

Contributors

alexiyorlov avatar

Stargazers

 avatar

Watchers

 avatar

trajectory-preview's Issues

5v does not work

Forge
1.19.4
mod v5.0.1

It just doesn't work, no errors, no crashes, just the trajectory is not displayed anywhere

Plugin does not register

Hey, I tried to create a plugin but it does not register
I also cannot find the log message Loaded and prepared {} plugin(s) (debug or latest) even though the Main plugin is loaded / working

The log I added is also not appearing
Am I missing something?

@TrajectoryPlugin
public class TrialErrorPlugin implements PreviewProvider {
    public TrialErrorPlugin() {}

    @Override
    public Class<? extends PreviewEntity<? extends Entity>> getPreviewEntityFor(final Player player, final Item shootable) {
        Main.LOG.info("Called `getPreviewEntityFor` with: " + shootable.getDescriptionId() + " " + shootable.getClass());
        if (shootable instanceof SpearItem) {
            return CactemSpearPreview.class;
        }

        return null;
    }
}
public class CactemSpearPreview extends BowArrowPreview implements PreviewEntity<AbstractArrow> {
    public CactemSpearPreview(final Level level) {
        super(level);
    }

    @Override
    public List<AbstractArrow> initializeEntities(final Player player, final ItemStack associatedItem) {
        if (associatedItem.getItem() instanceof SpearItem) {
            int timeLeft = player.getUseItemRemainingTicks();

            if (timeLeft > 0) {
                int maxDuration = player.getMainHandItem().getUseDuration();
                int difference = maxDuration - timeLeft;

                if (difference >= 10) {
                    ThrownCactemSpearEntity cactemSpear = new ThrownCactemSpearEntity(level, player, associatedItem);
                    cactemSpear.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 2.5F, 0);

                    return Collections.singletonList(cactemSpear);
                }
            }
        }

        return null;
    }

    @Override
    public void simulateShot(final AbstractArrow simulatedEntity) {
        super.simulateShot(simulatedEntity);
    }
}

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.