ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java

63 lines
2.2 KiB
Java
Raw Normal View History

2015-04-26 20:07:57 +02:00
package ellpeck.actuallyadditions.waila;
2015-05-20 22:39:43 +02:00
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
2015-05-22 17:48:50 +02:00
import ellpeck.actuallyadditions.util.BlockUtil;
2015-04-26 20:07:57 +02:00
import ellpeck.actuallyadditions.util.Util;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
2015-05-20 22:39:43 +02:00
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
2015-05-20 22:39:43 +02:00
import net.minecraft.item.Item;
2015-04-26 20:07:57 +02:00
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.List;
@SuppressWarnings("unused")
public class WailaDataProvider implements IWailaDataProvider{
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){
return null;
}
@Override
2015-05-20 22:39:43 +02:00
public List<String> getWailaHead(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
if(ConfigBoolValues.DO_WAILA_INFO.isEnabled()){
2015-05-27 21:57:53 +02:00
if(BlockUtil.wailaRegisterList.contains(accessor.getBlock())){
2015-05-20 22:39:43 +02:00
Item.getItemFromBlock(accessor.getBlock()).addInformation(stack, accessor.getPlayer(), currentTip, true);
}
}
2015-04-26 20:07:57 +02:00
return currentTip;
}
@Override
2015-05-20 22:39:43 +02:00
public List<String> getWailaBody(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
return currentTip;
}
2015-04-26 21:09:25 +02:00
2015-04-26 20:07:57 +02:00
@Override
2015-05-20 22:39:43 +02:00
public List<String> getWailaTail(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
2015-04-26 20:07:57 +02:00
return currentTip;
}
2015-04-26 21:09:25 +02:00
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z){
2015-04-26 20:07:57 +02:00
return tag;
}
public static void register(IWailaRegistrar registrar){
Util.logInfo("Initializing Waila Plugin...");
2015-05-20 22:39:43 +02:00
WailaDataProvider provider = new WailaDataProvider();
2015-05-22 17:48:50 +02:00
for(Block theBlock : BlockUtil.wailaRegisterList){
2015-05-20 22:39:43 +02:00
registrar.registerHeadProvider(provider, theBlock.getClass());
}
2015-04-26 20:07:57 +02:00
}
}