diff --git a/gradle.properties b/gradle.properties index 7959e795..cb6e9c30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,14 +2,14 @@ mod_version=4.3.0 minecraft_version=1.12 -forge_version=14.21.0.2383 -mappings_version=snapshot_20170628 +forge_version=14.21.1.2397 +mappings_version=snapshot_20170706 -mantle_version=1.2.0.2 +mantle_version=1.3.+ tconstruct_version=2.7.0.+ jei_version=4.7.+ -hwyla_version=1.8.18-B32 +hwyla_version=1.8.19-B33 mcmultipart_version=2.0.0_+ \ No newline at end of file diff --git a/src/main/java/com/progwml6/natura/plugin/waila/HUDHandlerNatura.java b/src/main/java/com/progwml6/natura/plugin/waila/HUDHandlerNatura.java index 2f57775b..886023f1 100644 --- a/src/main/java/com/progwml6/natura/plugin/waila/HUDHandlerNatura.java +++ b/src/main/java/com/progwml6/natura/plugin/waila/HUDHandlerNatura.java @@ -3,6 +3,8 @@ import java.lang.reflect.Method; import java.util.List; +import javax.annotation.Nonnull; + import com.progwml6.natura.Natura; import com.progwml6.natura.common.block.BlockNaturaDoor; import com.progwml6.natura.nether.NaturaNether; @@ -12,7 +14,6 @@ import com.progwml6.natura.overworld.block.crops.BlockOverworldCrops; import com.progwml6.natura.shared.NaturaCommons; -import mcp.mobius.waila.addons.HUDHandlerBase; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; @@ -20,15 +21,13 @@ import mcp.mobius.waila.cbcore.LangUtil; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.ReflectionHelper; -public class HUDHandlerNatura extends HUDHandlerBase +public class HUDHandlerNatura implements IWailaDataProvider { //@formatter:off static Method getCrop; @@ -63,6 +62,7 @@ public class HUDHandlerNatura extends HUDHandlerBase static Block bloodwoodDoor = NaturaNether.bloodwoodDoor; //@formatter:on + @Nonnull @Override public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { @@ -85,73 +85,33 @@ public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler return new ItemStack(block, 1, accessor.getMetadata() % 8); } - if (config.getConfig("natura.alternatecropitem")) - { - if (block instanceof BlockOverworldCrops) - { - if (getCrop == null) - getCrop = ReflectionHelper.findMethod(BlockOverworldCrops.class, "getCrop", "getCrop"); - - try - { - return new ItemStack((Item) getCrop.invoke(block)); - } - catch (Exception e) - { - return null; - } - } - } - else - { - // Barley crop should display Barley item - if (block == barley) - return NaturaCommons.barley.copy(); + // Barley crop should display Barley item + if (block == barley) + return NaturaCommons.barley.copy(); - // Cotton crop should display Cotton item - if (block == cotton) - return NaturaCommons.cotton.copy(); - } + // Cotton crop should display Cotton item + if (block == cotton) + return NaturaCommons.cotton.copy(); - if (config.getConfig("natura.alternatedooritem")) - { - if (block instanceof BlockNaturaDoor) - { - if (getDoor == null) - getDoor = ReflectionHelper.findMethod(BlockNaturaDoor.class, "getDoor", "getDoor"); - - try - { - return new ItemStack((Item) getDoor.invoke(block)); - } - catch (Exception e) - { - return null; - } - } - } - else - { - // Eucalyptus Door should display Eucalyptus Door item - if (block == eucalyptusDoor) - return NaturaOverworld.eucalyptus_door.copy(); + // Eucalyptus Door should display Eucalyptus Door item + if (block == eucalyptusDoor) + return NaturaOverworld.eucalyptus_door.copy(); - // Hopseed Door should display Hopseed Door item - if (block == hopseedDoor) - return NaturaOverworld.hopseed_door.copy(); + // Hopseed Door should display Hopseed Door item + if (block == hopseedDoor) + return NaturaOverworld.hopseed_door.copy(); - // Sakura Door should display Sakura Door item - if (block == sakuraDoor) - return NaturaOverworld.sakura_door.copy(); + // Sakura Door should display Sakura Door item + if (block == sakuraDoor) + return NaturaOverworld.sakura_door.copy(); - // Redwood Door should display Redwood Door item - if (block == redwoodDoor) - return NaturaOverworld.redwood_door.copy(); + // Redwood Door should display Redwood Door item + if (block == redwoodDoor) + return NaturaOverworld.redwood_door.copy(); - // Redwood Bark Door should display Redwood Bark Door item - if (block == redwoodBarkDoor) - return NaturaOverworld.redwood_bark_door.copy(); - } + // Redwood Bark Door should display Redwood Bark Door item + if (block == redwoodBarkDoor) + return NaturaOverworld.redwood_bark_door.copy(); } if (Natura.pulseManager.isPulseLoaded(NaturaNether.PulseId)) @@ -181,38 +141,19 @@ public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler return new ItemStack(block, 1, accessor.getMetadata() % 8); } - if (config.getConfig("natura.alternatedooritem")) - { - if (block instanceof BlockNaturaDoor) - { - if (getDoor == null) - getDoor = ReflectionHelper.findMethod(BlockNaturaDoor.class, "getDoor", "getDoor"); - - try - { - return new ItemStack((Item) getDoor.invoke(block)); - } - catch (Exception e) - { - return null; - } - } - } - else - { - // Ghostwood Door should display Ghostwood Door item - if (block == ghostwoodDoor) - return NaturaNether.ghostwood_door.copy(); + // Ghostwood Door should display Ghostwood Door item + if (block == ghostwoodDoor) + return NaturaNether.ghostwood_door.copy(); - // Bloodwood Bark Door should display Bloodwood Bark Door item - if (block == bloodwoodDoor) - return NaturaNether.bloodwood_door.copy(); - } + // Bloodwood Bark Door should display Bloodwood Bark Door item + if (block == bloodwoodDoor) + return NaturaNether.bloodwood_door.copy(); } return null; } + @Nonnull @Override public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { @@ -237,19 +178,18 @@ public List getWailaBody(ItemStack itemStack, List currenttip, I return currenttip; } + @Nonnull @Override public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { if (te != null) te.writeToNBT(tag); + return tag; } public static void register(IWailaRegistrar registrar) { - registrar.addConfig("Natura", "natura.alternatecropitem"); - registrar.addConfig("Natura", "natura.alternatedooritem"); - IWailaDataProvider provider = new HUDHandlerNatura(); //Overworld