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


Java BlockPos.fromLong方法代碼示例

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


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

示例1: readFromNBT

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    timeout = compound.getInteger("timeout");
    portalSide = EnumFacing.VALUES[compound.getByte("portalSide")];
    BlockPos pos = BlockPos.fromLong(compound.getLong("pos"));
    int dim = compound.getInteger("dim");
    EnumFacing side = EnumFacing.VALUES[compound.getByte("side")];
    other = new TeleportDestination("", dim, pos, side);
    NBTTagList list = compound.getTagList("bl", Constants.NBT.TAG_COMPOUND);
    blackListed.clear();
    for (int i = 0 ; i < list.tagCount() ; i++) {
        NBTTagCompound tc = list.getCompoundTagAt(i);
        UUID uuid = new UUID(tc.getLong("m"), tc.getLong("l"));
        blackListed.add(uuid);
    }
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:18,代碼來源:PortalTileEntity.java

示例2: readFromNBT

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag) {
    NBTTagList list = tag.getTagList("blocks", Constants.NBT.TAG_LONG);
    blocks.clear();
    for (int i = 0; i < list.tagCount(); i++) {
        blocks.add(BlockPos.fromLong(((NBTTagLong) list.get(i)).getLong()));
    }
    list = tag.getTagList("leaves", Constants.NBT.TAG_COMPOUND);
    leavesToTick.clear();
    for (int i = 0; i < list.tagCount(); i++) {
        NBTTagCompound tc = list.getCompoundTagAt(i);
        BlockPos pos = BlockPos.fromLong(tc.getLong("p"));
        int counter = tc.getInteger("c");
        leavesToTick.put(pos, counter);
    }
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:17,代碼來源:ChopTreeActionWorker.java

示例3: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
	int dim = buf.readInt();
	BlockPos pos = BlockPos.fromLong(buf.readLong());
	
	World world = SimpleTubes.proxy.getWorld(dim);
	this.tile = world.getTileEntity(pos);

	this.id = buf.readInt();
}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:11,代碼來源:PacketItemRemove.java

示例4: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
	int dim = buf.readInt();
	BlockPos pos = BlockPos.fromLong(buf.readLong());

	World world = SimpleTubes.proxy.getWorld(dim);
	if(world != null)
	this.tile = world.getTileEntity(pos);

	this.id = buf.readInt();
	this.progress = buf.readFloat();
	this.direction = buf.readByte();
	this.color = buf.readInt();
}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:15,代碼來源:PacketItemSync.java

示例5: isValid

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public boolean isValid(World world, long pos) {
    if (pos == -1L) {
        return false;
    }
    BlockPos p = BlockPos.fromLong(pos);
    IBlockState state = world.getBlockState(p);
    Block block = state.getBlock();

    if (Config.getBlocksBlocking().contains(block.getRegistryName())) {
        // Special case for doors
        if (block instanceof BlockDoor) {
            return state.getValue(BlockDoor.OPEN);
        }
        if (block instanceof BlockTrapDoor) {
            return state.getValue(BlockTrapDoor.OPEN);
        }

        return false;
    }
    if (Config.getBlocksNonBlocking().contains(block.getRegistryName())) {
        return true;
    }

    if (block.isAir(state, world, p)) {
        return true;
    } else {
        AxisAlignedBB box = state.getCollisionBoundingBox(world, p);
        if (box == null) {
            return true;
        }
        return !block.isOpaqueCube(state);
    }
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:34,代碼來源:DimensionData.java

示例6: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
	int dim = buf.readInt();
	BlockPos pos = BlockPos.fromLong(buf.readLong());

	World world = SimpleTubes.proxy.getWorld(dim);
	this.tile = world.getTileEntity(pos);

	this.id = buf.readInt();
	this.stack = ByteBufUtils.readItemStack(buf);
	this.progress = buf.readFloat();
	this.direction = buf.readByte();
	this.color = buf.readInt();
}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:15,代碼來源:PacketItemAdd.java

示例7: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
    selectedBlock = BlockPos.fromLong(buf.readLong());
    selectedSide = EnumFacing.VALUES[buf.readByte()];
    destination = new TeleportDestination(NetworkTools.readStringUTF8(buf), buf.readInt(), BlockPos.fromLong(buf.readLong()),
            EnumFacing.VALUES[buf.readByte()]);
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:8,代碼來源:PacketMakePortals.java

示例8: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
    destination = new TeleportDestination(NetworkTools.readStringUTF8(buf), buf.readInt(),
            BlockPos.fromLong(buf.readLong()),
            EnumFacing.VALUES[buf.readByte()]);
    destinationIndex = buf.readInt();
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:8,代碼來源:PacketSetDestination.java

示例9: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
	int dim = buf.readInt();
	BlockPos pos = BlockPos.fromLong(buf.readLong());

	World world = SimpleTubes.proxy.getWorld(dim);
	this.tile = world.getTileEntity(pos);

	this.mode = buf.readInt();
}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:11,代碼來源:PacketDisplacerGuiMode.java

示例10: removePreviousProbe

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private void removePreviousProbe(NBTTagCompound data, MessageUsingProbe message, EntityPlayerMP player) {
  if (data.hasKey(NBT_KEY)) {
    BlockPos pos = BlockPos.fromLong(data.getLong(NBT_KEY));
    if (!pos.equals(message.target)) {
      removeProbe(player.world, pos);
    }
  }
}
 
開發者ID:ToroCraft,項目名稱:PowerProbe,代碼行數:9,代碼來源:MessageUsingProbe.java

示例11: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
  pos = BlockPos.fromLong(buf.readLong());
  enable = buf.readBoolean();
}
 
開發者ID:ToroCraft,項目名稱:Minecoprocessors,代碼行數:6,代碼來源:MessageEnableGuiUpdates.java

示例12: readCustomNBT

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void readCustomNBT(NBTTagCompound tag) {
	
	this.core = BlockPos.fromLong(tag.getLong("Core"));
	inv.deserializeNBT(tag.getCompoundTag("inventory"));
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:7,代碼來源:TileArtisia.java

示例13: fromBytes

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf)
{
	pos = BlockPos.fromLong(buf.readLong());
	storedXP = buf.readInt();
}
 
開發者ID:bl4ckscor3,項目名稱:GlobalXP,代碼行數:7,代碼來源:SPacketUpdateXPBlock.java

示例14: readFromNBT

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	isCooking = compound.getBoolean("cooking");
	parentRange = BlockPos.fromLong(compound.getLong("parent"));
}
 
開發者ID:ArtixAllMighty,項目名稱:ExSartagine,代碼行數:7,代碼來源:TileEntityRangeExtension.java

示例15: renderHighlightedBlocks

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private static void renderHighlightedBlocks(RenderWorldLastEvent evt, EntityPlayerSP p, Map<Long, Byte> cleanAir) {
    double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * evt.getPartialTicks();
    double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * evt.getPartialTicks();
    double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * evt.getPartialTicks();

    GlStateManager.pushMatrix();
    GlStateManager.translate(-doubleX, -doubleY, -doubleZ);

    GlStateManager.disableDepth();
    GlStateManager.enableTexture2D();

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();

    Minecraft.getMinecraft().getTextureManager().bindTexture(BLUEGLOW);

    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);

    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    for (Map.Entry<Long, Byte> entry : cleanAir.entrySet()) {
        int value = entry.getValue() & 0xff;
        BlockPos coordinate = BlockPos.fromLong(entry.getKey());
        float x = coordinate.getX();
        float y = coordinate.getY();
        float z = coordinate.getZ();
        buffer.setTranslation(buffer.xOffset + x, buffer.yOffset + y, buffer.zOffset + z);

        int alpha = value;
        float mult = 0.4f;          // 1.1f
        if (alpha < 25) {
            mult = 0.025f;
        } else if (alpha < 50) {
            mult = 0.05f;
        } else if (alpha < 80) {
            mult = 0.1f;
        } else if (alpha < 110) {
            mult = 0.15f;
        } else if (alpha < 130) {
            mult = 0.2f;
        } else if (alpha < 150) {
            mult = 0.25f;
        } else if (alpha < 180) {
            mult = 0.3f;
        } else if (alpha < 210) {
            mult = 0.35f;
        }

        float offset = 0.5f - (mult/2);

        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.UP.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.DOWN.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.NORTH.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.SOUTH.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.WEST.ordinal(), mult, offset, alpha);
        RenderGlowEffect.addSideFullTexture(buffer, EnumFacing.EAST.ordinal(), mult, offset, alpha);
        buffer.setTranslation(buffer.xOffset - x, buffer.yOffset - y, buffer.zOffset - z);
    }
    tessellator.draw();

    GlStateManager.disableBlend();

    GlStateManager.popMatrix();
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:66,代碼來源:NTBOverlayRenderer.java


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