當前位置: 首頁>>代碼示例>>Java>>正文


Java IWailaDataAccessor.getTileEntity方法代碼示例

本文整理匯總了Java中mcp.mobius.waila.api.IWailaDataAccessor.getTileEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java IWailaDataAccessor.getTileEntity方法的具體用法?Java IWailaDataAccessor.getTileEntity怎麽用?Java IWailaDataAccessor.getTileEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mcp.mobius.waila.api.IWailaDataAccessor的用法示例。


在下文中一共展示了IWailaDataAccessor.getTileEntity方法的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: getWailaBody

import mcp.mobius.waila.api.IWailaDataAccessor; //導入方法依賴的package包/類
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) 
{
	NBTTagCompound tag = accessor.getNBTData();
	TileEntity tileEntity = accessor.getTileEntity();
	
	if(Loader.isModLoaded("Steamcraft") && ConfigSettings.FSPWailaIntegration)
	{
		if (tileEntity != null && tileEntity instanceof TEBoiler)
		{
			currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.watertank") + ": " + tag.getInteger("water") + " / " + ((TEBoiler)tileEntity).myTank.getCapacity());
			currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.steamtank") + ": " + tag.getInteger("steam") + " / " + ((TEBoiler)tileEntity).getCapacity());
		}
		else if (tileEntity != null && tileEntity instanceof TEFlashBoiler && ((TEFlashBoiler)tileEntity).hasMaster())
		{
			currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.watertank") + ": " + ((TEFlashBoiler)tileEntity).getMasterTileEntity().getTank().getFluidAmount() + " / " + ((TEFlashBoiler)tileEntity).getMasterTileEntity().getTank().getCapacity());
			currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.steamtank") + ": "+ tag.getInteger("steam") + " / " + ((TEFlashBoiler)tileEntity).getMasterTileEntity().getCapacity());
		}
	}
	
	return currenttip;
}
 
開發者ID:StrayWolfe,項目名稱:TerrafirmaPunk-Tweaks,代碼行數:23,代碼來源:WAILAInfo.java

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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 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;
}
 
開發者ID:Maxwell-lt,項目名稱:MobBlocker,代碼行數:23,代碼來源:BlockAreaProtector.java

示例14: getWailaStack

import mcp.mobius.waila.api.IWailaDataAccessor; //導入方法依賴的package包/類
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
	ItemStack stack = new ItemStack(ModBlocks.DANKNULL_DOCK);
	TileEntity tile = accessor.getTileEntity();
	if (tile != null && tile instanceof TileDankNullDock) {
		TileDankNullDock te = (TileDankNullDock) tile;
		NBTTagCompound nbttagcompound = new NBTTagCompound();
		te.writeToNBT(nbttagcompound);
		stack.setTagInfo("BlockEntityTag", nbttagcompound);
	}
	return stack;
}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:13,代碼來源:WAILADankNullDockProvider.java

示例15: getWailaBody

import mcp.mobius.waila.api.IWailaDataAccessor; //導入方法依賴的package包/類
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
	EntityPlayer player = accessor.getPlayer();
	TileDankNullDock dankDock = (TileDankNullDock) accessor.getTileEntity();
	currenttip.add(WAILA.toolTipEnclose);
	if (player.isSneaking()) {
		currenttip.add("Extraction Mode: " + (dankDock.getExtractionMode() == ExtractionMode.SELECTED ? "Only Selected Item" : "All Items") + " Extracted");
		currenttip.add(" ");
		currenttip.add("Right-click with empty hand");
		currenttip.add("to change extraction mode");
		InventoryDankNull dankDockInventory = dankDock.getInventory();
		if (dankDockInventory != null) {
			ItemStack dockedDankNull = dankDockInventory.getDankNull();
			if (!dockedDankNull.isEmpty()) {
				currenttip.add(" ");
				currenttip.add(dockedDankNull.getDisplayName() + " Docked");
				ItemStack selectedStack = DankNullUtils.getSelectedStack(dankDock.getInventory());
				if (!selectedStack.isEmpty()) {
					currenttip.add(selectedStack.getDisplayName() + " Selected");
				}
			}
		}
	}
	else {
		currenttip.add(WAILA.doSneak);
	}
	currenttip.add(WAILA.toolTipEnclose);
	return currenttip;
}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:30,代碼來源:WAILADankNullDockProvider.java


注:本文中的mcp.mobius.waila.api.IWailaDataAccessor.getTileEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。