Giter Site home page Giter Site logo

shnupbups / trinkets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emilyploszaj/trinkets

0.0 1.0 0.0 212 KB

A modular accessory mod and API for Minecraft using Fabric.

Home Page: https://www.curseforge.com/minecraft/mc-mods/trinkets-fabric

License: MIT License

Java 100.00%

trinkets's Introduction

Trinkets

A data-driven accessory mod for Minecraft using Fabric.

Image of the Trinkets UI

About

Trinkets adds a slot group and slot system to Minecraft. Slot groups are collections of slots for a certain body part. By default there are 6 slot groups (head, chest, legs, feet, offhand, hand) that can have slots added to them, but more groups can be added if desired. By itself, Trinkets only implements one slot (chest:cape) and reimplements the elytra to use this slot, mods are responsible for adding any slots they plan on using.

Suggested Slots

If you're a developer using Trinkets for your mod, here is the list of slots I suggest you use before creating new ones. These slots are not enabled by default but have textures provided by Trinkets and should be used for the most compatibility between mods. This list will be added to and modified over time.

Slot Examples Texture identifier
head:mask Masks, glasses, monocles new Identifier("trinkets", "textures/item/empty_trinket_slot_mask.png")
chest:backpack Backpack new Identifier("trinkets", "textures/item/empty_trinket_slot_backpack.png")
chest:cape Capes, wings new Identifier("trinkets", "textures/item/empty_trinket_slot_cape.png")
chest:necklace Necklaces, collars new Identifier("trinkets", "textures/item/empty_trinket_slot_necklace.png")
legs:belt Belts new Identifier("trinkets", "textures/item/empty_trinket_slot_belt.png")
feet:aglet Aglets new Identifier("trinkets", "textures/item/empty_trinket_slot_aglet.png")
offhand:ring Rings, other jewelery new Identifier("trinkets", "textures/item/empty_trinket_slot_ring.png")
hand:gloves Gloves new Identifier("trinkets", "textures/item/empty_trinket_slot_gloves.png")
hand:ring Rings, other jewelery new Identifier("trinkets", "textures/item/empty_trinket_slot_ring.png")

Developers

To add Trinkets to your project you need to add jitpack and nerdhubmc to your repositories in your build.gradle

repositories {
	maven {
		url = "https://jitpack.io"
	}
	maven {
		name = "NerdHubMC"
		url = "https://maven.abusedmaster.xyz/"
	}
}

And then to add Trinkets you add it as a dependency in your build.gradle

dependencies {
	modImplementation "com.github.emilyploszaj:trinkets:v2.2.0"
}

All you need to get started with Trinkets is to register a slot and add an item to the game that implementes ITrinket, here is a short example:

//Inside your ModMain
public void onInitialize() {
	//Register your item somewhere
	//Adding the hand:ring slot to Trinkets, as it does not exist by default, note that this uses the provided Trinkets texture
	TrinketSlots.addSlot(SlotGroups.HAND, Slots.RING, new Identifier("trinkets", "textures/item/empty_trinket_slot_ring.png"));
}
//A class for your trinket
public class RingItem extends Item implements ITrinket {

	public RingItem() {
		//Adding the trinket to the TOOLS group and making it not stack
		super(new Settings().group(ItemGroup.TOOLS).maxCount(1));
		//Adding dispenser equip behavior to the new trinket
		DispenserBlock.registerBehavior(this, TRINKET_DISPENSER_BEHAVIOR);
	}

 	@Override
	public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
		//Overriding the use method to equip the trinket when it's used
		return ITrinket.equipTrinket(player, hand);
	}

	@Override
	public boolean canWearInSlot(String group, String slot) {
		//Determines what slots the trinket can be worn in, this makes it usable in the hand:ring slot
		return group.equals(SlotGroups.HAND) && slot.equals(Slots.RING);
	}

	@Override
	public void tick(PlayerEntity player, ItemStack stack) {
		//Just one of the methods you can override in ITrinket, the ring gives you the speed effect while wearing it
		//Though you probably shouldn't give the player a status effect every tick
		player.addPotionEffect(new StatusEffectInstance(StatusEffects.SPEED, 19, 0));
	}
}

Something important to note is that trinkets should override the item use method and add the provided dispenser behavior so that trinkets are equipped in these cases.

Other Information

For a tutorial on rendering trinkets, visit this repository's wiki.

trinkets's People

Contributors

emilyploszaj avatar chloedawn avatar draylar avatar

Watchers

James Cloos 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.