go-forge

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2022 License: Apache-2.0

README

Library for Forge

Build Status Codacy Badge Go Doc Go Report

This repository provides helpers related to Minecraft Forge.

Development

Make sure you have a working Go environment, for further reference or a guide take a look at the install instructions. This project requires Go >= v1.11 because we are using Go modules. It is also possible to just simply execute the go get github.com/kleister/go-forge/... command, but we prefer to use our Makefile:

go get -d github.com/kleister/go-forge/...
cd $GOPATH/src/github.com/kleister/go-forge
make sync gorunpkg clean generate test

Examples

Fetch available Forge versions
package main

import (
	"fmt"
	"os"

	"github.com/kleister/go-forge/version"
)

func main() {
	fmt.Println("Fetching Forge versions...")
	forge, err := version.FromDefault()

	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}

	for _, version := range forge.Releases {
		fmt.Println(version.ID)
	}
}
Sort Forge versions by ID
package main

import (
	"fmt"
	"os"

	"github.com/kleister/go-forge/version"
)

func main() {
	fmt.Println("Fetching Forge versions...")
	forge, err := version.FromDefault()

	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}

	version.ByVersion(forge.Releases).Sort()

	for _, version := range forge.Releases {
		fmt.Println(version.ID)
	}
}
Filter versions by constraints
package main

import (
	"fmt"
	"os"

	"github.com/kleister/go-forge/version"
)

func main() {
	fmt.Println("Fetching Forge versions...")
	forge, err := version.FromDefault()

	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}

	f := &version.Filter{
		Version: ">=13.20,<14.23.4",
	}

	for _, version := range forge.Releases.Filter(f) {
		fmt.Println(version.ID)
	}
}

Security

If you find a security issue please contact kleister@webhippie.de first.

Contributing

Fork -> Patch -> Push -> Pull Request

Authors

License

Apache-2.0

Copyright (c) 2018 Thomas Boerger <thomas@webhippie.de>

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL