-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e20b57
commit b92ba8b
Showing
10 changed files
with
94 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
src/main/java/io/github/offsetmonkey538/villagerbefriending/item/ModItems.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
package io.github.offsetmonkey538.villagerbefriending.item; | ||
|
||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; | ||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemGroup; | ||
import net.minecraft.item.ItemGroups; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.Rarity; | ||
import net.minecraft.util.registry.Registry; | ||
|
||
import static io.github.offsetmonkey538.villagerbefriending.entrypoint.VillagerBefriendingMain.MOD_ID; | ||
import static io.github.offsetmonkey538.villagerbefriending.entrypoint.VillagerBefriendingMain.*; | ||
|
||
public class ModItems { | ||
|
||
public static final TotemOfBefriendingItem TOTEM_OF_BEFRIENDING_ITEM = register( | ||
new TotemOfBefriendingItem(new FabricItemSettings() | ||
.group(ItemGroup.MISC) | ||
.rarity(Rarity.RARE) | ||
.maxCount(1)), | ||
"totem_of_befriending"); | ||
|
||
private static <T extends Item> T register(T item, String id) { | ||
return Registry.register(Registry.ITEM, new Identifier(MOD_ID, id), item); | ||
return Registry.register(Registries.ITEM, new Identifier(MOD_ID, id), item); | ||
} | ||
|
||
public static void register() { | ||
// Loads all items because the class gets loaded | ||
|
||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(entries -> entries.add(TOTEM_OF_BEFRIENDING_ITEM)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...java/io/github/offsetmonkey538/villagerbefriending/mixin/accessor/ItemEntityAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.github.offsetmonkey538.villagerbefriending.mixin.accessor; | ||
|
||
import java.util.UUID; | ||
import net.minecraft.entity.ItemEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(ItemEntity.class) | ||
public interface ItemEntityAccessor { | ||
|
||
@Accessor | ||
UUID getThrower(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "io.github.offsetmonkey538.villagerbefriending.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"LivingEntityMixin", | ||
"VillagerEntityMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "io.github.offsetmonkey538.villagerbefriending.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"LivingEntityMixin", | ||
"VillagerEntityMixin", | ||
"accessor.ItemEntityAccessor" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |