当前位置: 首页>>代码示例>>Java>>正文


Java IWailaDataAccessor类代码示例

本文整理汇总了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()));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:21,代码来源:WailaRedstoneControl.java

示例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;
}
 
开发者ID:Maxwell-lt,项目名称:MobBlocker,代码行数:24,代码来源:BlockChunkProtector.java

示例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;
}
 
开发者ID:McJty,项目名称:AquaMunda,代码行数:21,代码来源:TankBlock.java

示例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;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:19,代码来源:WailaTank.java

示例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();
	}
}
 
开发者ID:sblectric,项目名称:EverythingBlocks,代码行数:21,代码来源:WailaTileHandler.java

示例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);
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:25,代码来源:DarkUtilsTileProvider.java

示例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;
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:18,代码来源:DarkUtilsTileProvider.java

示例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;
}
 
开发者ID:Shurgent,项目名称:TFCTech,代码行数:17,代码来源:WAILAData.java

示例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;
}
 
开发者ID:Shurgent,项目名称:TFCTech,代码行数:17,代码来源:WAILAData.java

示例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;
}
 
开发者ID:sblectric,项目名称:LightningCraft,代码行数:17,代码来源:WailaTileHandler.java

示例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; 
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:32,代码来源:WailaCompat.java

示例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"));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:13,代码来源:WailaPneumaticHandler.java

示例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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:11,代码来源:WailaCamoHandler.java

示例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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:WailaSemiBlockHandler.java

示例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));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:WailaHeatHandler.java


注:本文中的mcp.mobius.waila.api.IWailaDataAccessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。