Waila handler for Alchemy Array

This commit is contained in:
Nick 2016-02-04 17:07:53 -08:00
parent 2bf401f1d6
commit ef6e066d94
4 changed files with 81 additions and 0 deletions

View file

@ -130,6 +130,7 @@ public class Constants
public static final String WAILA_CONFIG_ALTAR = Mod.MODID + ".bloodAltar";
public static final String WAILA_CONFIG_TELEPOSER = Mod.MODID + ".teleposer";
public static final String WAILA_CONFIG_RITUAL = Mod.MODID + ".ritualController";
public static final String WAILA_CONFIG_ARRAY = Mod.MODID + ".array";
public static final String THAUMCRAFT_HAS_GOGGLES = "hasGoggles";
public static final Item THAUMCRAFT_GOGGLES = GameRegistry.findItem("Thaumcraft", "goggles");

View file

@ -1,9 +1,11 @@
package WayofTime.bloodmagic.compat.waila;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.BlockAlchemyArray;
import WayofTime.bloodmagic.block.BlockAltar;
import WayofTime.bloodmagic.block.BlockRitualController;
import WayofTime.bloodmagic.block.BlockTeleposer;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderAlchemyArray;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderBloodAltar;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderRitualController;
import WayofTime.bloodmagic.compat.waila.provider.DataProviderTeleposer;
@ -16,10 +18,13 @@ public class WailaCallbackHandler
registrar.registerBodyProvider(new DataProviderBloodAltar(), BlockAltar.class);
registrar.registerBodyProvider(new DataProviderTeleposer(), BlockTeleposer.class);
registrar.registerBodyProvider(new DataProviderRitualController(), BlockRitualController.class);
registrar.registerBodyProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
registrar.registerStackProvider(new DataProviderAlchemyArray(), BlockAlchemyArray.class);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK, false);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_ALTAR, true);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_TELEPOSER, true);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_RITUAL, true);
registrar.addConfig(Constants.Mod.MODID, Constants.Compat.WAILA_CONFIG_ARRAY, true);
}
}

View file

@ -0,0 +1,71 @@
package WayofTime.bloodmagic.compat.waila.provider;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class DataProviderAlchemyArray implements IWailaDataProvider
{
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return new ItemStack(ModItems.arcaneAshes).setStackDisplayName(TextHelper.getFormattedText(ModBlocks.alchemyArray.getLocalizedName()));
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
if (!config.getConfig(Constants.Compat.WAILA_CONFIG_ARRAY))
return currenttip;
if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK))
{
TileEntity tile = accessor.getTileEntity();
if (tile instanceof TileAlchemyArray)
{
TileAlchemyArray tileArray = (TileAlchemyArray) tile;
if (tileArray.getStackInSlot(0) != null)
currenttip.add(TextHelper.localize("waila.BloodMagic.array.reagent", tileArray.getStackInSlot(0).getDisplayName()));
if (tileArray.getStackInSlot(1) != null)
currenttip.add(TextHelper.localize("waila.BloodMagic.array.catalyst", tileArray.getStackInSlot(1).getDisplayName()));
}
} else
{
currenttip.add(TextHelper.localizeEffect("waila.BloodMagic.sneak"));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos)
{
return null;
}
}

View file

@ -141,6 +141,8 @@ tile.BloodMagic.stone.ritual.master.name=Master Ritual Stone
tile.BloodMagic.stone.ritual.imperfect.name=Imperfect Ritual Stone
tile.BloodMagic.altar.name=Blood Altar
tile.BloodMagic.alchemyArray.name=&r&fAlchemy Array
tile.BloodMagic.rune.blank.name=Blank Rune
tile.BloodMagic.rune.speed.name=Speed Rune
tile.BloodMagic.rune.efficiency.name=Efficiency Rune
@ -342,6 +344,8 @@ jei.BloodMagic.desc.demonicWill=An imprint of a demonic entity attached to a cre
# WAILA
waila.BloodMagic.sneak=&oSneak for Information
waila.BloodMagic.array.reagent=Reagent: %s
waila.BloodMagic.array.catalyst=Catalyst: %s
option.BloodMagic.bypassSneak=Bypass Sneak
option.BloodMagic.bloodAltar=Blood Altar
option.BloodMagic.ritualController=Ritual Stones