Skip to content

Commit

Permalink
Add a game controller icon for the game portal opener item
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugman76 committed Dec 16, 2024
1 parent ea25ffe commit 0a392ae
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ dependencies {

//modCompileOnly "com.viaversion:viaversion-api:4.7.0-SNAPSHOT"
modCompileOnly "dev.gegy:player-roles-api:1.6.13"

modImplementation "eu.pb4:polymer-autohost:${project.autohost_version}"
}

test {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ fabric_version=0.110.5+1.21.4
mod_version=1.3.2
maven_group=xyz.nucleoid
archives_base_name=nucleoid-extras

autohost_version=0.11.2+1.21.4
7 changes: 7 additions & 0 deletions src/main/java/xyz/nucleoid/extras/NucleoidExtras.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xyz.nucleoid.extras;

import eu.pb4.playerdata.api.PlayerDataApi;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
Expand Down Expand Up @@ -65,6 +66,12 @@ public void onInitialize() {
ServerLifecycleEvents.SERVER_STOPPED.register(NucleoidExtras::onServerStopped);
ServerPlayConnectionEvents.JOIN.register(NucleoidExtras::onPlayerJoin);
NucleoidExtrasNetworking.register();

if (PolymerResourcePackUtils.addModAssets(ID)) {
LOGGER.info("Successfully added mod assets for " + ID);
} else {
LOGGER.error("Failed to add mod assets for " + ID);
}
}

private static void onServerStopped(MinecraftServer server) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package xyz.nucleoid.extras.lobby.item;

import com.mojang.authlib.GameProfile;
import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -11,6 +13,7 @@
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import xyz.nucleoid.extras.NucleoidExtras;
import xyz.nucleoid.extras.component.GamePortalComponent;
import xyz.nucleoid.extras.component.NEDataComponentTypes;
import xyz.nucleoid.packettweaker.PacketContext;
Expand Down Expand Up @@ -45,6 +48,9 @@ public Item getPolymerItem(ItemStack stack, PacketContext context) {

@Override
public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
if(PolymerResourcePackUtils.hasMainPack(context)) {
return NucleoidExtras.identifier("controller");
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "nucleoid_extras:item/controller"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "nucleoid_extras:item/controller"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0a392ae

Please sign in to comment.