本文整理汇总了Java中mcp.mobius.waila.api.IWailaDataAccessor类的典型用法代码示例。如果您正苦于以下问题:Java IWailaDataAccessor类的具体用法?Java IWailaDataAccessor怎么用?Java IWailaDataAccessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IWailaDataAccessor类属于mcp.mobius.waila.api包,在下文中一共展示了IWailaDataAccessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTipToMachine
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的package包/类
public static void addTipToMachine(List<String> currenttip, IWailaDataAccessor accessor) {
NBTTagCompound tag = accessor.getNBTData();
//This is used so that we can split values later easier and have them all in the same layout.
Map<String, String> values = new HashMap<>();
if (tag.hasKey("redstoneMode")) {
int mode = tag.getInteger("redstoneMode");
GuiPneumaticContainerBase gui = (GuiPneumaticContainerBase) PneumaticCraftRepressurized.proxy.getClientGuiElement(((BlockPneumaticCraft) accessor.getBlock()).getGuiID().ordinal(),
accessor.getPlayer(), accessor.getWorld(), accessor.getPosition().getX(), accessor.getPosition().getY(), accessor.getPosition().getZ());
TileEntity te = accessor.getTileEntity();
if (te instanceof TileEntityBase) {
values.put(((TileEntityBase) te).getRedstoneString(), ((TileEntityBase) te).getRedstoneButtonText(mode));
}
}
//Get all the values from the map and put them in the list.
for (Map.Entry<String, String> entry : values.entrySet()) {
currenttip.add(TextFormatting.RED + I18n.format(entry.getKey()) + ": " + I18n.format(entry.getValue()));
}
}
示例2: getWailaBody
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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;
}
示例3: getWailaBody
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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;
}
示例4: getWailaHead
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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;
}
示例5: getWailaStack
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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();
}
}
示例6: getWailaStack
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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.IWailaDataAccessor; //导入依赖的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.IWailaDataAccessor; //导入依赖的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.IWailaDataAccessor; //导入依赖的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.IWailaDataAccessor; //导入依赖的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.IWailaDataAccessor; //导入依赖的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: addTipToMachine
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的package包/类
private static void addTipToMachine(List<String> currenttip, IWailaDataAccessor accessor) {
NBTTagCompound tag = accessor.getNBTData();
TileEntity te = accessor.getTileEntity();
if(te instanceof IInfoForwarder){
BlockPos infoPos = new BlockPos(tag.getInteger("infoX"), tag.getInteger("infoY"), tag.getInteger("infoZ"));
te = accessor.getWorld().getTileEntity(infoPos);
}
if (te instanceof IPneumaticMachine) {
addTipToMachine(currenttip, (IPneumaticMachine) te, tag.getFloat("pressure"));
}
}
示例13: getWailaBody
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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;
}
示例14: getWailaBody
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的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;
}
示例15: addTipToMachine
import mcp.mobius.waila.api.IWailaDataAccessor; //导入依赖的package包/类
private static void addTipToMachine(List<String> currenttip, IWailaDataAccessor accessor) {
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("heat")) {
NBTTagList tagList = tag.getTagList("heat", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound heatTag = tagList.getCompoundTagAt(i);
String dir = EnumFacing.getFront(heatTag.getByte("side")).toString().toLowerCase();
currenttip.add(I18n.format("waila.temperature." + dir, heatTag.getInteger("temp") - 273));
}
} else {
currenttip.add(I18n.format("waila.temperature", tag.getInteger("temp") - 273));
}
}