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


Java TileEntity.getPos方法代碼示例

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


在下文中一共展示了TileEntity.getPos方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTileEntitiesIn

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public List<TileEntity> getTileEntitiesIn(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
{
    List<TileEntity> list = Lists.<TileEntity>newArrayList();

    for (int i = 0; i < this.loadedTileEntityList.size(); ++i)
    {
        TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i);
        BlockPos blockpos = tileentity.getPos();

        if (blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ)
        {
            list.add(tileentity);
        }
    }

    return list;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:WorldServer.java

示例2: addTileEntity

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public boolean addTileEntity(TileEntity tile)
{
    if (tile.getWorld() != null) // Forge - set the world early as vanilla doesn't set it until next tick
        tile.setWorldObj(this);

    List<TileEntity> dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList;
    boolean flag = dest.add(tile);

    if (flag && tile instanceof ITickable)
    {
        this.tickableTileEntities.add(tile);
    }

    if (this.isRemote)
    {
        BlockPos blockpos = tile.getPos();
        IBlockState iblockstate = this.getBlockState(blockpos);
        this.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 2);
    }

    return flag;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:World.java

示例3: addTileEntity

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public boolean addTileEntity(TileEntity tile)
{
    boolean flag = this.loadedTileEntityList.add(tile);

    if (flag && tile instanceof ITickable)
    {
        this.tickableTileEntities.add(tile);
    }

    if (this.isRemote)
    {
        BlockPos blockpos = tile.getPos();
        IBlockState iblockstate = this.getBlockState(blockpos);
        this.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 2);
    }

    return flag;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:World.java

示例4: renderTileEntity

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage)
{
    if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared())
    {
        RenderHelper.enableStandardItemLighting();
        boolean flag = true;

        if (Reflector.ForgeTileEntity_hasFastRenderer.exists())
        {
            flag = !this.drawingBatch || !Reflector.callBoolean(tileentityIn, Reflector.ForgeTileEntity_hasFastRenderer, new Object[0]);
        }

        if (flag)
        {
            int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0);
            int j = i % 65536;
            int k = i / 65536;
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        }

        BlockPos blockpos = tileentityIn.getPos();
        this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:TileEntityRendererDispatcher.java

示例5: GhostSlotUpdateMessage

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public GhostSlotUpdateMessage(EntityPlayerSP player, TileEntity entity, int slot, ItemStack itemStack) {
	this.playerId = player.getUniqueID().toString();
	
	BlockPos pos = entity.getPos();
	this.x = pos.getX();
	this.y = pos.getY();
	this.z = pos.getZ();
	
	this.slot = slot;
	this.stack = itemStack;
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:12,代碼來源:GhostSlotUpdateMessage.java

示例6: sendButtonPacket

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static void sendButtonPacket(TileEntity tile, int buttonID) {
	NBTTagCompound tag = new NBTTagCompound();
	BlockPos pos = tile.getPos();
	
	tag.setInteger("x", pos.getX());
	tag.setInteger("y", pos.getY());
	tag.setInteger("z", pos.getZ());
	
	tag.setInteger("PlayerID", Minecraft.getMinecraft().player.getEntityId());
	tag.setInteger("ButtonID", buttonID);
	
	network.sendToServer(new PacketToServer(tag, ButtonHandler.GUI_BUTTON_HANDLER));
}
 
開發者ID:Arez0101,項目名稱:Dynamic-GUIs,代碼行數:15,代碼來源:ButtonHandler.java

示例7: onRender

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
@SubscribeEvent
public void onRender(RenderEvent event) {
    event.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);

    for(TileEntity tileEntity : getWorld().loadedTileEntityList) {
        if(tileEntity instanceof TileEntityMobSpawner) {
            BlockPos pos = tileEntity.getPos();
            GeometryTessellator.drawCuboid(event.getBuffer(), pos, GeometryMasks.Line.ALL, Utils.Colors.RED);
        }
    }

    event.getTessellator().draw();
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:14,代碼來源:SpawnerEspMod.java

示例8: renderTileEntity

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage)
{
    if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared())
    {
        int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0);
        int j = i % 65536;
        int k = i / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        BlockPos blockpos = tileentityIn.getPos();
        this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:TileEntityRendererDispatcher.java

示例9: canPlayerSilkHarvestChest

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public static boolean canPlayerSilkHarvestChest(TileEntity te, EntityPlayer player) {
	if (!Mods.IRONCHESTS.isLoaded()) {
		return false;
	}
	BlockPos pos = te.getPos();
	Block block = te.getWorld() == null ? null : te.getWorld().getBlockState(pos).getBlock();
	return te != null && block != null && isIronChest(block) && player != null && player.getHeldItemMainhand() != null && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItemMainhand()) > 0 && !player.isCreative();
}
 
開發者ID:p455w0rd,項目名稱:EndermanEvolution,代碼行數:9,代碼來源:IronChests.java

示例10: PacketUpdateTextfield

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public PacketUpdateTextfield(TileEntity te, int textfieldID) {
    super(te.getPos());
    textFieldID = textfieldID;
    text = ((IGUITextFieldSensitive) te).getText(textfieldID);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:6,代碼來源:PacketUpdateTextfield.java

示例11: PacketSecurityStation

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public PacketSecurityStation(TileEntity te, String player) {
    super(te.getPos());
    this.username = player;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:5,代碼來源:PacketSecurityStation.java

示例12: PacketRenderRangeLines

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public PacketRenderRangeLines(TileEntity te) {
    super(te.getPos());
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:4,代碼來源:PacketRenderRangeLines.java

示例13: PacketSendNBTPacket

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
public PacketSendNBTPacket(TileEntity te) {
    super(te.getPos());
    tag = new NBTTagCompound();
    te.writeToNBT(tag);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:6,代碼來源:PacketSendNBTPacket.java

示例14: updateTrackedItems

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
private void updateTrackedItems() {
    if (trackedItemIds != null) {
        trackedItems.clear();
        for (Entity entity : getWorld().loadedEntityList) {
            if (trackedItemIds.contains(entity.getUniqueID()) && entity instanceof EntityItem) {
                trackedItems.add((EntityItem) entity);
            }
        }
        trackedItemIds = null;
    }
    Iterator<EntityItem> iterator = trackedItems.iterator();
    while (iterator.hasNext()) {
        EntityItem item = iterator.next();
        if (item.world != getWorld() || item.isDead) {
            iterator.remove();
        } else {
            Map<BlockPos, EnumFacing> positions = new HashMap<>();
            double range = 0.2;
            for (EnumFacing d : EnumFacing.VALUES) {
                double posX = item.posX + d.getFrontOffsetX() * range;
                double posY = item.posY + d.getFrontOffsetY() * range;
                double posZ = item.posZ + d.getFrontOffsetZ() * range;
                positions   .put(new BlockPos((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ)), d.getOpposite());
            }
            for (Entry<BlockPos, EnumFacing> entry : positions.entrySet()) {
                BlockPos pos = entry.getKey();
                TileEntity te = getWorld().getTileEntity(pos);
                if (te == null) continue;
                IItemHandler inv = IOHelper.getInventoryForTE(te, entry.getValue());
                ItemStack remainder = ItemHandlerHelper.insertItem(inv, item.getItem(), false);
                if (!remainder.isEmpty()) {
                    item.setItem(remainder);
                } else {
                    item.setDead();
                    iterator.remove();
                    lastInsertingInventory = te.getPos();
                    lastInsertingInventorySide = entry.getValue();
                    break;
                }
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:44,代碼來源:TileEntityAirCannon.java

示例15: spawnDummyTracks

import net.minecraft.tileentity.TileEntity; //導入方法依賴的package包/類
/**
 * Spawns dummy tracks based on flag linking.
 * 
 * @return {@code null} if successful, otherwise the {@link net.minecraft.util.math.BlockPos BlockPos} of the first obstructing block.
 */
public BlockPos spawnDummyTracks() {

	/*
	 * Make sure other tile entity is a flag.
	 */
	TileEntity tile = worldObj.getTileEntity(this.pos.add(linkedCurve.endPos));
	if (!(tile instanceof TileEntitySurveyFlag)) {
		return tile.getPos();
	}

	float width = getSleeperType().getDefaultWidth() - 1.0F;
	if (width <= 0.0F) {
		width = 0.0F;
	}

	final int ballast = MathHelper.ceiling_float_int( width / 2.0F );
	final OFTCurve thisFlagCurve = linkedCurve;
	final OFTCurve otherFlagCurve = ((TileEntitySurveyFlag) tile).linkedCurve;
	final Map<BlockPos, Byte> blockMap = new HashMap<BlockPos, Byte>();

	/*
	 * Need to see which end of the curve is higher.
	 * If we go top-down, the fake tracks are too high and ballast looks weird.
	 * On the other hand, if we went from the other direction we might miss ballast below the track.
	 * Steep hills tend to do this, so go in both directions just in case.
	 */
	BlockPos blockingBlock = addFakeTracksToMap(thisFlagCurve, this.pos, blockMap, ballast);
	if(blockingBlock != null){
		return blockingBlock;
	}
	blockingBlock = addFakeTracksToMap(otherFlagCurve, this.pos.add(linkedCurve.endPos), blockMap, ballast);
	if(blockingBlock != null){
		return blockingBlock;
	}

	/*
	 * Finally create fake tracks.
	 */
	BlockTrackFake.toggleMainTrackBreakage(false);
	{
		/* Set block states at selected positions. */
		IBlockState defState = OFTRegistry.trackStructureFake.getDefaultState();

		for (BlockPos placementPos : blockMap.keySet()) {
			worldObj.setBlockState(placementPos, defState.withProperty(BlockTrackFake.height, (int) blockMap.get(placementPos)));			
		}

		/* Set block states and tile entities at start and end. */
		worldObj.setBlockState(this.pos, OFTRegistry.trackStructure.getDefaultState());
		worldObj.setBlockState(this.pos.add(thisFlagCurve.endPos), OFTRegistry.trackStructure.getDefaultState());
		TileEntityTrack startTile = new TileEntityTrack(thisFlagCurve);
		TileEntityTrack endTile = new TileEntityTrack(otherFlagCurve);
		startTile.setFakeTracks(new ArrayList<BlockPos>(blockMap.keySet()));
		endTile.setFakeTracks(new ArrayList<BlockPos>(blockMap.keySet()));
		worldObj.setTileEntity(this.pos, startTile);
		worldObj.setTileEntity(this.pos.add(thisFlagCurve.endPos), endTile);
	}
	BlockTrackFake.toggleMainTrackBreakage(true);

	return null;
}
 
開發者ID:DonBruce64,項目名稱:OpenFlexiTrack,代碼行數:67,代碼來源:TileEntitySurveyFlag.java


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