Re-implement Waila compat
This commit is contained in:
parent
cfa40e9bfb
commit
8283047bf1
|
@ -60,9 +60,9 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
|
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
|
||||||
// deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}"
|
deobfCompile "mcp.mobius.waila:Waila:${waila_version}_${mc_version}:dev"
|
||||||
|
|
||||||
// compile "mcp.mobius.waila:Waila:${waila_version}_1.8.8:dev"
|
// deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}"
|
||||||
// compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar"
|
// compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar"
|
||||||
// compile name: 'Baubles', version: "${baubles_version}", ext: 'jar'
|
// compile name: 'Baubles', version: "${baubles_version}", ext: 'jar'
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ curse_id=224791
|
||||||
mappings_version=snapshot_20160424
|
mappings_version=snapshot_20160424
|
||||||
|
|
||||||
jei_version=3.3.2.196
|
jei_version=3.3.2.196
|
||||||
waila_version=1.6.0-B3
|
waila_version=1.7.0-B2
|
||||||
thaumcraft_version=5.1.5
|
thaumcraft_version=5.1.5
|
||||||
baubles_version=1.1.3.0
|
baubles_version=1.1.3.0
|
||||||
guideapi_version=2.0.0-27
|
guideapi_version=2.0.0-27
|
|
@ -0,0 +1,26 @@
|
||||||
|
package WayofTime.bloodmagic.compat.waila;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||||
|
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||||
|
|
||||||
|
public class CompatibilityWaila implements ICompatibility
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void loadCompatibility(InitializationPhase phase)
|
||||||
|
{
|
||||||
|
if (phase == InitializationPhase.INIT)
|
||||||
|
FMLInterModComms.sendMessage(getModId(), "register", "WayofTime.bloodmagic.compat.waila.WailaCallbackHandler.callbackRegister");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModId()
|
||||||
|
{
|
||||||
|
return "Waila";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean enableCompat()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package WayofTime.bloodmagic.compat.waila;
|
||||||
|
|
||||||
|
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class WailaCallbackHandler
|
||||||
|
{
|
||||||
|
public static void callbackRegister(IWailaRegistrar registrar)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package WayofTime.bloodmagic.compat.waila.provider;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
package WayofTime.bloodmagic.compat.waila.provider;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||||
|
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||||
|
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
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.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.block.BlockAltar;
|
||||||
|
import WayofTime.bloodmagic.item.sigil.ItemSigilDivination;
|
||||||
|
import WayofTime.bloodmagic.item.sigil.ItemSigilSeer;
|
||||||
|
import WayofTime.bloodmagic.registry.ModItems;
|
||||||
|
import WayofTime.bloodmagic.tile.TileAltar;
|
||||||
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integrated from WailaPlugins by <a
|
||||||
|
* href="https://github.com/tterrag1098">tterrag1098</a>. Originally implemented
|
||||||
|
* in ImLookingAtBlood by <a href="https://github.com/Pokefenn">Pokefenn</a>.
|
||||||
|
*/
|
||||||
|
public class DataProviderBloodAltar implements IWailaDataProvider
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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_ALTAR))
|
||||||
|
return currenttip;
|
||||||
|
|
||||||
|
boolean hasSigil = false;
|
||||||
|
boolean hasSeer = false;
|
||||||
|
|
||||||
|
switch (ConfigHandler.wailaAltarDisplayMode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
hasSigil = hasSeer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
hasSeer = holdingSeerSigil(accessor.getPlayer());
|
||||||
|
hasSigil = hasSeer || holdingDivinationSigil(accessor.getPlayer());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
hasSeer = hasStack(new ItemStack(ModItems.sigilSeer), accessor.getPlayer());
|
||||||
|
hasSigil = hasSeer || hasStack(new ItemStack(ModItems.sigilDivination), accessor.getPlayer());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasSeer && !hasSigil)
|
||||||
|
return currenttip;
|
||||||
|
|
||||||
|
if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK))
|
||||||
|
{
|
||||||
|
if (accessor.getBlock() instanceof BlockAltar && accessor.getTileEntity() instanceof TileAltar)
|
||||||
|
{
|
||||||
|
TileAltar altar = (TileAltar) accessor.getTileEntity();
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.seer.currentAltarTier", altar.getTier().toInt()));
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.seer.currentAltarCapacity", altar.getCapacity()));
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.seer.currentEssence", altar.getCurrentBlood()));
|
||||||
|
|
||||||
|
if (hasSeer)
|
||||||
|
{
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.sigil.seer.currentAltarProgress.percent", ((int) ((double) altar.getProgress() / (double) altar.getLiquidRequired() * 100)) + "%"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasStack(ItemStack stack, EntityPlayer player)
|
||||||
|
{
|
||||||
|
for (ItemStack inventoryStack : player.inventory.mainInventory)
|
||||||
|
if (inventoryStack != null && inventoryStack.isItemEqual(stack))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean holdingSeerSigil(EntityPlayer player) {
|
||||||
|
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilSeer)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ItemSigilSeer)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean holdingDivinationSigil(EntityPlayer player) {
|
||||||
|
if (player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof ItemSigilDivination)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ItemSigilDivination)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
package WayofTime.bloodmagic.compat.waila.provider;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||||
|
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||||
|
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||||
|
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.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.BlockStack;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
|
||||||
|
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||||
|
import WayofTime.bloodmagic.block.BlockRitualController;
|
||||||
|
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
|
||||||
|
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
||||||
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
|
public class DataProviderRitualController implements IWailaDataProvider
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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_RITUAL))
|
||||||
|
return currenttip;
|
||||||
|
|
||||||
|
if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK))
|
||||||
|
{
|
||||||
|
if (accessor.getBlock() instanceof BlockRitualController)
|
||||||
|
{
|
||||||
|
if (accessor.getBlock().getMetaFromState(accessor.getBlockState()) == 0 && accessor.getTileEntity() instanceof TileMasterRitualStone)
|
||||||
|
{
|
||||||
|
TileMasterRitualStone mrs = (TileMasterRitualStone) accessor.getTileEntity();
|
||||||
|
|
||||||
|
if (mrs.getCurrentRitual() != null)
|
||||||
|
{
|
||||||
|
currenttip.add(TextHelper.localizeEffect(mrs.getCurrentRitual().getUnlocalizedName()));
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.currentOwner", PlayerHelper.getUsernameFromUUID(mrs.getOwner())));
|
||||||
|
if (!RitualRegistry.ritualEnabled(mrs.getCurrentRitual()))
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.config.disabled"));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.deactivated"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accessor.getBlock().getMetaFromState(accessor.getBlockState()) == 1 && accessor.getTileEntity() instanceof TileImperfectRitualStone)
|
||||||
|
{
|
||||||
|
if (accessor.getWorld().getBlockState(accessor.getPosition().up()).getBlock() != null)
|
||||||
|
{
|
||||||
|
Block up = accessor.getWorld().getBlockState(accessor.getPosition().up()).getBlock();
|
||||||
|
int meta = up.getMetaFromState(accessor.getWorld().getBlockState(accessor.getPosition().up()));
|
||||||
|
BlockStack blockStack = new BlockStack(up, meta);
|
||||||
|
ImperfectRitual ritual = ImperfectRitualRegistry.getRitualForBlock(blockStack);
|
||||||
|
|
||||||
|
if (ritual != null)
|
||||||
|
{
|
||||||
|
currenttip.add(TextHelper.localizeEffect(ritual.getUnlocalizedName()));
|
||||||
|
if (!ImperfectRitualRegistry.ritualEnabled(ritual))
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.config.disabled"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package WayofTime.bloodmagic.compat.waila.provider;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.block.BlockTeleposer;
|
||||||
|
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
||||||
|
import WayofTime.bloodmagic.tile.TileTeleposer;
|
||||||
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
|
public class DataProviderTeleposer implements IWailaDataProvider
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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_TELEPOSER))
|
||||||
|
return currenttip;
|
||||||
|
|
||||||
|
if (accessor.getPlayer().isSneaking() || config.getConfig(Constants.Compat.WAILA_CONFIG_BYPASS_SNEAK))
|
||||||
|
{
|
||||||
|
if (accessor.getBlock() instanceof BlockTeleposer && accessor.getTileEntity() instanceof TileTeleposer)
|
||||||
|
{
|
||||||
|
TileTeleposer teleposer = (TileTeleposer) accessor.getTileEntity();
|
||||||
|
if (teleposer.getStackInSlot(0) != null)
|
||||||
|
{
|
||||||
|
ItemStack contained = teleposer.getStackInSlot(0);
|
||||||
|
BlockPos toPos = ((ItemTelepositionFocus) contained.getItem()).getBlockPos(contained);
|
||||||
|
int dimensionID = contained.getTagCompound().getInteger(Constants.NBT.DIMENSION_ID);
|
||||||
|
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.telepositionFocus.coords", toPos.getX(), toPos.getY(), toPos.getZ()));
|
||||||
|
currenttip.add(TextHelper.localizeEffect("tooltip.BloodMagic.telepositionFocus.dimension", dimensionID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package WayofTime.bloodmagic.registry;
|
package WayofTime.bloodmagic.registry;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.compat.ICompatibility;
|
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||||
|
import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems;
|
||||||
|
import WayofTime.bloodmagic.compat.waila.CompatibilityWaila;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -11,8 +13,8 @@ public class ModCompatibility
|
||||||
|
|
||||||
public static void registerModCompat()
|
public static void registerModCompat()
|
||||||
{
|
{
|
||||||
// compatibilities.add(new CompatibilityJustEnoughItems());
|
compatibilities.add(new CompatibilityJustEnoughItems());
|
||||||
// compatibilities.add(new CompatibilityWaila());
|
compatibilities.add(new CompatibilityWaila());
|
||||||
// compatibilities.add(new CompatibilityThaumcraft());
|
// compatibilities.add(new CompatibilityThaumcraft());
|
||||||
// compatibilities.add(new CompatibilityGuideAPI());
|
// compatibilities.add(new CompatibilityGuideAPI());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue