Skip to content

Commit

Permalink
More betterer tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed Mar 10, 2024
1 parent 230c866 commit 5ac0ab1
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"parent": "minecraft:item/handheld",
"overrides": [
{
"model": "justdirethings:item/blazegold_pickaxe_active",
"predicate": {
"justdirethings:enabled": 1.0
}
}
],
"textures": {
"layer0": "justdirethings:item/blazegold_pickaxe"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "justdirethings:item/blazegold_pickaxe_active"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.direwolf20.justdirethings.JustDireThings;
import com.direwolf20.justdirethings.setup.Registration;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;

Expand Down Expand Up @@ -38,7 +39,22 @@ protected void registerModels() {

public void registerTools() {
for (var tool : Registration.TOOLS.getEntries()) {
singleTexture(tool.getId().getPath(), mcLoc("item/handheld"), "layer0", modLoc("item/" + tool.getId().getPath()));
if (!tool.is(Registration.BlazegoldPickaxe.getId()))
singleTexture(tool.getId().getPath(), mcLoc("item/handheld"), "layer0", modLoc("item/" + tool.getId().getPath()));
else {
ResourceLocation enabledModelPath = modLoc("item/" + tool.getId().getPath() + "_active"); // Path to your enabled model
ResourceLocation defaultModelPath = modLoc("item/" + tool.getId().getPath()); // Path to your default model

// Start building your item model
getBuilder(tool.getId().getPath()) // This should match your item's registry name
.parent(getExistingFile(mcLoc("item/handheld")))
.texture("layer0", defaultModelPath)
.override()
.predicate(new ResourceLocation("justdirethings", "enabled"), 1.0F) // Using custom property
.model(singleTexture(tool.getId().getPath() + "_active", mcLoc("item/handheld"), "layer0", modLoc("item/" + tool.getId().getPath() + "_active")))
.end();

}
}
}
}
15 changes: 11 additions & 4 deletions src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import com.direwolf20.justdirethings.client.screens.FuelCanisterScreen;
import com.direwolf20.justdirethings.client.screens.PocketGeneratorScreen;
import com.direwolf20.justdirethings.client.screens.ToolSettingScreen;
import com.direwolf20.justdirethings.common.items.tools.utils.ToggleableTool;
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
Expand All @@ -29,10 +32,14 @@ public static void init(final FMLClientSetupEvent event) {
NeoForge.EVENT_BUS.register(EventKeyInput.class);
NeoForge.EVENT_BUS.register(RenderHighlight.class);

//Screens
/*event.enqueueWork(() -> {
MenuScreens.register(Registration.FuelCanister_Container.get(), FuelCanisterScreen::new); // Attach our container to the screen
});*/
//Item Properties
event.enqueueWork(() -> {
ItemProperties.register(Registration.BlazegoldPickaxe.get(),
new ResourceLocation(JustDireThings.MODID, "enabled"), (stack, level, living, id) -> {
return ToggleableTool.getEnabled(stack) ? 1.0f : 0.0f;
});
});

}

@SubscribeEvent
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"animation": {
"frametime": 80,
"interpolate": true
}
}

0 comments on commit 5ac0ab1

Please sign in to comment.