本文整理汇总了Java中mcp.mobius.waila.api.IWailaConfigHandler类的典型用法代码示例。如果您正苦于以下问题:Java IWailaConfigHandler类的具体用法?Java IWailaConfigHandler怎么用?Java IWailaConfigHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IWailaConfigHandler类属于mcp.mobius.waila.api包,在下文中一共展示了IWailaConfigHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
/**
* Called by WAILA/HWYLA compatibility handler
* @param itemStack
* @param currenttip
* @param accessor
* @param config
* @return
*/
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileEntity te = accessor.getTileEntity();
if (te instanceof TileEntityChunkProtector) {
TileEntityChunkProtector chunkprotector = (TileEntityChunkProtector) te;
int secondsLeft = chunkprotector.getSecondsBeforeDestroyed();
int ticksLeft = chunkprotector.getTicksBeforeDestroyed();
if (ticksLeft != -1) {
if (accessor.getPlayer().isSneaking()) {
currenttip.add(TextFormatting.BLUE + Integer.toString(ticksLeft) + " ticks left in world");
} else currenttip.add(TextFormatting.BLUE + Integer.toString(secondsLeft) + " seconds left in world");
} else currenttip.add(TextFormatting.GRAY + "Won't decay");
}
return currenttip;
}
示例2: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
TankTE tankTE = (TankTE) accessor.getTileEntity();
int blockID = tankTE.getID();
if (blockID != -1) {
IMultiBlockClientInfo clientInfo = ImmersiveCraftHandler.tankNetwork.getClientInfo(blockID);
if (clientInfo != null) {
TankClientInfo tankClientInfo = (TankClientInfo) clientInfo;
currenttip.add(TextFormatting.GREEN + "Id: " + blockID);
Fluid fluid = tankClientInfo.getFluid();
if (fluid != null) {
currenttip.add(TextFormatting.GREEN + "Liquid: " + Tank.getFluidName(fluid));
}
currenttip.add(TextFormatting.GREEN + "Contents: " + tankClientInfo.getContents() + " (" + tankClientInfo.getBlockCount() * TankTE.MAX_CONTENTS + ")");
}
}
return currenttip;
}
示例3: getWailaHead
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (WailaHandler.hasMultimeter(accessor, config)) {
try {
FluidStack fluid = FluidStack.loadFluidStackFromNBT(accessor.getNBTData().getCompoundTag("fluid"));
String name = currenttip.get(0);
try {
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
} catch (NullPointerException f) {
name += " " + I18n.format("tomsMod.waila.empty");
}
currenttip.set(0, name);
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
}
return currenttip;
}
示例4: getWailaStack
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
/** Change tooltip item stack */
@Override
@Optional.Method(modid = "Waila")
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
// get the icon from the tile entity
TileEntity te = accessor.getTileEntity();
if(te instanceof TileEntityBlockEverything) {
TileEntityBlockEverything tile = (TileEntityBlockEverything)te;
if(tile.contains == null) return accessor.getStack();
ItemStack stack = new ItemStack(accessor.getBlock());
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
tile.contains.writeToNBT(tags);
stack.getTagCompound().setTag("contains", tags);
return stack;
} else {
return accessor.getStack();
}
}
示例5: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
DesalinationBoilerTE te = (DesalinationBoilerTE) accessor.getTileEntity();
long time = System.currentTimeMillis();
if ((time - lastUpdateTime) > 200) {
lastUpdateTime = time;
PacketHandler.INSTANCE.sendToServer(new PacketGetInfoFromServer(new BoilerContentsInfoPacketServer(te.getPos())));
}
DecimalFormat decimalFormat = new DecimalFormat("#.#");
currenttip.add(TextFormatting.GREEN + "Liquid: " + FluidRegistry.getFluidName(te.getSupportedFluid()));
currenttip.add(TextFormatting.GREEN + "Contents: " + te.getContents() + " (" + DesalinationBoilerTE.MAX_CONTENTS + ")");
currenttip.add(TextFormatting.GREEN + "Temperature: " + decimalFormat.format(te.getTemperature()));
return currenttip;
}
示例6: getWailaStack
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public ItemStack getWailaStack (IWailaDataAccessor data, IWailaConfigHandler cfg) {
final Block block = Block.getBlockFromItem(data.getStack().getItem());
if (block instanceof BlockSneaky && !data.getTileEntity().isInvalid()) {
final TileEntitySneaky tile = (TileEntitySneaky) data.getTileEntity();
if (cfg.getConfig(CONFIG_SNEAKY_OWNERS) && tile.playerID != null && !tile.playerID.isEmpty() && data.getPlayer().getUniqueID().toString().equals(tile.playerID)) {
return data.getStack();
}
if (tile.heldState != null) {
return new ItemStack(tile.heldState.getBlock(), 1, tile.heldState.getBlock().getMetaFromState(tile.heldState));
}
}
else if (data.getBlock() instanceof BlockFakeTNT) {
return new ItemStack(Blocks.TNT, 1, 0);
}
return new ItemStack(data.getStack().getItem(), 1, 0);
}
示例7: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public List<String> getWailaBody (ItemStack stack, List<String> tip, IWailaDataAccessor data, IWailaConfigHandler cfg) {
if (data.getBlock() instanceof BlockFilter && cfg.getConfig(CONFIG_FILTER_TYPE) && !(stack.getMetadata() > FilterType.getTypes().length)) {
tip.add(I18n.format("tooltip.darkutils.filter.type") + ": " + TextFormatting.AQUA + I18n.format("tooltip.darkutils.filter.type." + FilterType.getTypes()[stack.getMetadata()]));
}
else if (data.getBlock() instanceof BlockTimer && cfg.getConfig(CONFIG_TIMER_TIME) && data.getTileEntity() instanceof TileEntityTimer && !data.getTileEntity().isInvalid()) {
final int delay = data.getNBTData().getInteger("TickRate");
final int currentTime = data.getNBTData().getInteger("CurrentTime");
tip.add(I18n.format("gui.darkutils.timer.delay") + ": " + delay);
tip.add(I18n.format("gui.darkutils.timer.remaining") + ": " + StringUtils.ticksToElapsedTime(delay - currentTime));
}
return tip;
}
示例8: oreStack
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
private ItemStack oreStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
int meta = accessor.getMetadata();
TEModOre te = (TEModOre) accessor.getTileEntity();
ItemStack itemstack = null;
if (accessor.getBlock() == ModBlocks.ore) {
if (config.getConfig("tfc.oreQuality"))
itemstack = new ItemStack(ModItems.oreChunk, 1, getOreGrade(te, meta)); // Shows specific quality ore.
else
itemstack = new ItemStack(ModItems.oreChunk, 1, meta); // All normal quality ores.
return itemstack;
}
return null;
}
示例9: latexExtractorBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
private List<String> latexExtractorBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TELatexExtractor te = (TELatexExtractor) accessor.getTileEntity();
if (te.isBowlInstalled()) {
int latexAmt = te.getLatexAmount();
if (latexAmt > 0) {
currenttip.add(TFC_Core.translate("gui.latexAmt") + " : " + latexAmt + " mB / 200 mB");
}
if (latexAmt >= 200 && te.isFlowing()) {
currenttip.add("\247c" + TFC_Core.translate("gui.loosingLatex"));
}
}
return currenttip;
}
示例10: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
@Optional.Method(modid = "Waila")
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
int maxPower = 0;
if(!(itemStack.getItem() instanceof ItemBlockLightningCell && (maxPower = (int)accessor.getNBTData().getDouble("maxPower")) > 0)) {
itemStack.getItem().addInformation(itemStack, accessor.getPlayer(), currenttip, false);
} else {
currenttip.add("Capacity: " + maxPower + " LE");
}
TileEntity t = accessor.getTileEntity();
if(t != null && t.hasCapability(LCCapabilities.LIGHTNING_UPGRADABLE, null) &&
t.getCapability(LCCapabilities.LIGHTNING_UPGRADABLE, null).isUpgraded()) {
currenttip.add("(Upgraded)");
}
return currenttip;
}
示例11: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
BlockPos pos = accessor.getPosition();
World world = accessor.getWorld();
IBlockState bs = world.getBlockState(pos);
Block block = bs.getBlock();
TileEntity te = world.getTileEntity(pos);
ITooltipHint hint = null;
if (te instanceof ITooltipHint) {
hint = (ITooltipHint)te;
} else if (block instanceof ITooltipHint) {
hint = (ITooltipHint)block;
}
if (hint != null) {
String tooltip = hint.getTooltipHint(itemStack);
String[] strs = tooltip.split("\n");
for (String line : strs)
currenttip.add(line);
}
return currenttip;
}
示例12: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Nonnull
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileEntity te = accessor.getTileEntity();
if (te instanceof ICamouflageableTE && ((ICamouflageableTE) te).getCamouflage() != null) {
String str = ItemCamoApplicator.getCamoStateDisplayName(((ICamouflageableTE) te).getCamouflage());
currenttip.add(TextFormatting.YELLOW + "[ Camo: " + str + "]");
}
return currenttip;
}
示例13: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
List<SemiBlockBasic> semiBlocks = SemiBlockManager.getInstance(accessor.getWorld()).getSemiBlocksAsList(SemiBlockBasic.class, accessor.getWorld(), accessor.getPosition());
NBTTagList tagList = accessor.getNBTData().getTagList("semiBlocks", Constants.NBT.TAG_COMPOUND);
for(int i = 0; i < semiBlocks.size(); i++){
semiBlocks.get(i).addWailaTooltip(currenttip, tagList.getCompoundTagAt(i));
}
return currenttip;
}
示例14: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
Block block = accessor.getBlock();
if (block instanceof WailaInfoProvider) {
return ((WailaInfoProvider) block).getWailaBody(itemStack, currenttip, accessor, config);
}
return currenttip;
}
示例15: getWailaBody
import mcp.mobius.waila.api.IWailaConfigHandler; //导入依赖的package包/类
/**
* Called by WAILA/HWYLA compatibility handler
* @param itemStack
* @param currenttip
* @param accessor
* @param config
* @return
*/
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileEntity te = accessor.getTileEntity();
if (te instanceof TileEntityAreaProtector) {
int xrange = Config.areaProtectorX;
int yrange = Config.areaProtectorY;
int zrange = Config.areaProtectorZ;
currenttip.add(TextFormatting.BOLD + "Range:");
currenttip.add(TextFormatting.YELLOW + " X" + TextFormatting.RESET + " = " + TextFormatting.GREEN + "±" + Integer.toString(xrange));
currenttip.add(TextFormatting.YELLOW + " Y" + TextFormatting.RESET + " = " + TextFormatting.GREEN + "±" + Integer.toString(yrange));
currenttip.add(TextFormatting.YELLOW + " Z" + TextFormatting.RESET + " = " + TextFormatting.GREEN + "±" + Integer.toString(zrange));
}
return currenttip;
}