Skip to content

Commit

Permalink
Fix missing Leaf block names in WAILA (#17)
Browse files Browse the repository at this point in the history
* Update buildscript and dependencies

* Fix Leaf block names in WAILA
  • Loading branch information
wlhlm authored Jun 5, 2023
1 parent 2247e0b commit f829b70
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 12 deletions.
18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1683705740
//version: 1685785062
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -69,7 +69,7 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.11'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
}

print("You might want to check out './gradlew :faq' if your build fails.\n")
Expand Down Expand Up @@ -730,7 +730,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
}

java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
Expand Down Expand Up @@ -1276,12 +1276,14 @@ tasks.register('faq') {
description = 'Prints frequently asked questions about building a project'

doLast {
print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " +
"versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" +
"The links can be found in repositories.gradle and build.gradle:repositories, " +
"not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.\n\n" +
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"Or you can manually check if the versions are still on the distributing sites - " +
"the links can be found in repositories.gradle and build.gradle:repositories, " +
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties.")
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
}
}

Expand Down
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Add your dependencies here

dependencies {
api("com.github.GTNewHorizons:Mantle:0.3.6:dev")
api("com.github.GTNewHorizons:Mantle:0.3.7:dev")

compileOnly("com.github.GTNewHorizons:waila:1.6.0:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.3:dev") {
transitive = false
}
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.3.52-GTNH:dev")
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.31-GTNH:dev") {
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.3.54-GTNH:dev")
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.36-GTNH:dev") {
transitive = false
}
compileOnly("curse.maven:minefactory-reloaded-66672:2366150") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class NaturaCropDataProvider implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
Block block = accessor.getBlock();
if (accessor.getBlock() instanceof CropBlock) {
if (block instanceof CropBlock) {
int meta = accessor.getMetadata();
CropBlock cropBlock = (CropBlock) block;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package mods.natura.plugins.waila;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mods.natura.common.NContent;

public class NaturaLeavesDataProvider implements IWailaDataProvider {

@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
Block block = accessor.getBlock();
int metadata = accessor.getMetadata();

if ((block == NContent.floraLeaves || block == NContent.floraLeavesNoColor
|| block == NContent.rareLeaves
|| block == NContent.darkLeaves) && metadata > 3) {
return new ItemStack(block, 1, metadata % 4);
}

return null;
}

@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}

@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}

@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
}
10 changes: 10 additions & 0 deletions src/main/java/mods/natura/plugins/waila/WailaRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import mods.natura.blocks.crops.CropBlock;
import mods.natura.blocks.trees.NLeaves;
import mods.natura.blocks.trees.NLeavesDark;
import mods.natura.blocks.trees.NLeavesNocolor;
import mods.natura.blocks.trees.OverworldLeaves;

public class WailaRegistrar {

public static void wailaCallback(IWailaRegistrar registrar) {
IWailaDataProvider cropProvider = new NaturaCropDataProvider();
IWailaDataProvider leavesProvider = new NaturaLeavesDataProvider();

registrar.registerStackProvider(cropProvider, CropBlock.class);
registrar.registerBodyProvider(cropProvider, CropBlock.class);

registrar.registerStackProvider(leavesProvider, NLeaves.class);
registrar.registerStackProvider(leavesProvider, NLeavesNocolor.class);
registrar.registerStackProvider(leavesProvider, NLeavesDark.class);
registrar.registerStackProvider(leavesProvider, OverworldLeaves.class);
}
}

0 comments on commit f829b70

Please sign in to comment.