Java Code Examples for net.minecraft.util.math.BlockPos#fromLong()

The following examples show how to use net.minecraft.util.math.BlockPos#fromLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardWizardryWorld.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void deserializeNBT(NBTTagCompound compound) {
	if (compound.hasKey("spell_object_manager")) {
		spellObjectManager = new SpellObjectManager();
		spellObjectManager.manager.fromNbt(compound.getCompoundTag("spell_object_manager"));
	}

	if (compound.hasKey("drives")) {
		NBTTagList driveNBT = compound.getTagList("drives", Constants.NBT.TAG_COMPOUND);
		for (NBTBase base : driveNBT) {
			if (base instanceof NBTTagCompound) {
				if (((NBTTagCompound) base).hasKey("pos") && ((NBTTagCompound) base).hasKey("drive")) {
					BlockPos pos = BlockPos.fromLong(((NBTTagCompound) base).getLong("pos"));
					NemezTracker tracker = new NemezTracker();
					tracker.deserializeNBT(((NBTTagCompound) base).getTagList("drive", Constants.NBT.TAG_COMPOUND));

					blockNemezDrives.put(pos, tracker);
				}
			}
		}
	}
}
 
Example 2
Source File: SpellDataTypes.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public BlockStateCache deserialize(@NotNull NBTTagList object) {
	HashMap<BlockPos, IBlockState> stateCache = new HashMap<>();

	for (NBTBase base : object) {
		if (base instanceof NBTTagCompound) {

			NBTTagCompound compound = (NBTTagCompound) base;
			if (compound.hasKey("pos") && compound.hasKey("blockstate")) {
				BlockPos pos = BlockPos.fromLong(compound.getLong("pos"));
				IBlockState state = NBTUtil.readBlockState(compound.getCompoundTag("blockstate"));

				stateCache.put(pos, state);

			}
		}
	}

	return new BlockStateCache(stateCache);
}
 
Example 3
Source File: VehicleUpdatePacket.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	ID = buf.readInt();
	int s = buf.readInt();
	blockMap = new HashMap<BlockPos, BlockStorage>();
	for (int i = 0; i < s; ++i) {
		BlockPos bp = BlockPos.fromLong(buf.readLong());
		BlockStorage bs = new BlockStorage();
		bs.fromBuf(buf, Minecraft.getMinecraft().world);
		blockMap.put(bp, bs);
	}
}
 
Example 4
Source File: OreAttrNode.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void readFromNBT(NBTTagCompound nbt, com.bioxx.jmapgen.IslandMap m) 
{
	this.oreType = nbt.getString("oreType");
	this.offset = BlockPos.fromLong(nbt.getLong("offset"));
	this.nextOffset = BlockPos.fromLong(nbt.getLong("nextOffset"));
	this.prevOffset = BlockPos.fromLong(nbt.getLong("prevOffset"));
	if(nbt.hasKey("next"))
		next = m.centers.get(nbt.getInteger("next"));
	if(nbt.hasKey("prev"))
		prev = m.centers.get(nbt.getInteger("prev"));
	nodeWidth = nbt.getInteger("nodeWidth");
	nodeHeight = nbt.getInteger("nodeHeight");
}
 
Example 5
Source File: CaveAttrNode.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void readFromNBT(NBTTagCompound nbt, com.bioxx.jmapgen.IslandMap m) 
{
	this.caveId = nbt.getInteger("caveId");
	this.offset = BlockPos.fromLong(nbt.getLong("offset"));
	this.nextOffset = BlockPos.fromLong(nbt.getLong("nextOffset"));
	this.prevOffset = BlockPos.fromLong(nbt.getLong("prevOffset"));
	if(nbt.hasKey("next"))
		next = m.centers.get(nbt.getInteger("next"));
	if(nbt.hasKey("prev"))
		prev = m.centers.get(nbt.getInteger("prev"));
	nodeWidth = nbt.getInteger("nodeWidth");
	nodeHeight = nbt.getInteger("nodeHeight");
}
 
Example 6
Source File: SAnvilCraftingPacket.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer)
{
	this.pos = BlockPos.fromLong(buffer.readLong());
	this.recipe = buffer.readInt();
	startedCrafting = buffer.readBoolean();
	if(startedCrafting)
		smithID = new UUID(buffer.readLong(), buffer.readLong());
}
 
Example 7
Source File: CAnvilStrikePacket.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer)
{
	pos = BlockPos.fromLong(buffer.readLong());
	strikeIndex = buffer.readInt();
	strikePoint = new AnvilStrikePoint();
	strikePoint.setBirthTime(buffer.readLong());
	strikePoint.setType(AnvilStrikeType.values()[buffer.readInt()]);
	strikePoint.setLifeTime(buffer.readInt());
}
 
Example 8
Source File: MessageBlockDisplayState.java    From Production-Line with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
protected IMessage handlerMessage(MessageBase message, MessageContext ctx) {
    WorldClient world = Minecraft.getMinecraft().world;
    BlockPos pos = BlockPos.fromLong(message.nbt.getLong("pos"));
    TileFacing tilePL = (TileFacing) world.getTileEntity(pos);
    if (tilePL != null) {
        tilePL.active = message.nbt.getBoolean("active");
        tilePL.facing = EnumFacing.getFront(message.nbt.getShort("facing"));
        world.scheduleUpdate(pos, world.getBlockState(pos).getBlock(), 0);
    }
    return null;
}
 
Example 9
Source File: EntityHaloInfusionItem.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void readCustomNBT(NBTTagCompound compound) {
	super.readCustomNBT(compound);
	haloInfusionItem = HaloInfusionItem.deserialize(compound.getString("halo_infusion_item"));
	infuserPos = BlockPos.fromLong(compound.getLong("infuser_pos"));
	slot = compound.getInteger("slot");

	setHaloInfusionItem(haloInfusionItem, true);
}
 
Example 10
Source File: BaseVehicleEntity.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readSpawnData(ByteBuf additionalData) {
	int s = additionalData.readInt();
	for (int i = 0; i < s; ++i) {
		BlockPos bp = BlockPos.fromLong(additionalData.readLong());
		BlockStorage bs = new BlockStorage();
		bs.fromBuf(additionalData, storage);
		storage.blockMap.put(bp, bs);
	}
	storage.setTESRs();
}
 
Example 11
Source File: SpellDataTypes.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public BlockPos deserialize(@NotNull NBTTagLong object) {
	return BlockPos.fromLong(object.getLong());
}
 
Example 12
Source File: MessageProcessorUpdate.java    From Minecoprocessors with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
  processorData = ByteBufUtils.readTag(buf);
  pos = BlockPos.fromLong(buf.readLong());
  name = ByteBufUtils.readUTF8String(buf);
}
 
Example 13
Source File: MessageEnableGuiUpdates.java    From Minecoprocessors with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
  pos = BlockPos.fromLong(buf.readLong());
  enable = buf.readBoolean();
}
 
Example 14
Source File: MessageProcessorAction.java    From Minecoprocessors with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
  action = Action.values()[buf.readInt()];
  pos = BlockPos.fromLong(buf.readLong());
}
 
Example 15
Source File: PacketAltarAnimation.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	this.pos = BlockPos.fromLong(buf.readLong());
	this.altarAnimation = EnumAltarAnimation.values()[buf.readInt()];
}
 
Example 16
Source File: PacketRequestUpdateAltar.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	this.pos = BlockPos.fromLong(buf.readLong());
	this.dimension = buf.readInt();
}
 
Example 17
Source File: PacketUpdateAltar.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	this.pos = BlockPos.fromLong(buf.readLong());
	this.stack = ByteBufUtils.readItemStack(buf);
}