项目:Loot-Slash-Conquer
文件:CapabilityChunkLevel.java
@SubscribeEvent
public static void onChunkLoad(ChunkDataEvent.Load event)
{
World world = event.getWorld();
ChunkPos chunkPos = event.getChunk().getPos();
IChunkLevelHolder chunkLevelHolder = getChunkLevelHolder(world);
ChunkLevel chunkLevel = new ChunkLevel(world,chunkPos,getAreaLevel(world,chunkPos));
NBTTagCompound nbt = event.getData();
if (nbt.hasKey(ID.toString(),Constants.NBT.TAG_INT))
{
NBTTagInt levelTag = (NBTTagInt) nbt.getTag(ID.toString());
chunkLevel.deserializeNBT(levelTag);
}
chunkLevelHolder.setChunkLevel(null,chunkLevel);
}
项目:pnc-repressurized
文件:HackingImpl.java
@Override
public void readNBT(Capability<IHacking> capability,IHacking instance,EnumFacing side,NBTBase nbt) {
instance.getCurrentHacks().clear();
NBTTagList tagList = ((NBTTagCompound) nbt).getTagList("hackables",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++) {
String hackableId = tagList.getCompoundTagAt(i).getString("id");
Class<? extends IHackableEntity> hackableClass = PneumaticHelmetRegistry.getInstance().stringToEntityHackables.get(hackableId);
if (hackableClass != null) {
try {
instance.getCurrentHacks().add(hackableClass.newInstance());
} catch (Exception e) {
e.printstacktrace();
}
} else {
Log.warning("hackable \"" + hackableId + "\" not found when constructing from NBT. Was it deleted?");
}
}
}
项目:pnc-repressurized
文件:PneumaticCraftUtils.java
/**
* Serialize some tank data onto an ItemStack. Useful to preserve tile entity tank data when breaking
* the block.
*
* @param tank the fluid tank
* @param stack the itemstack to save to
* @param tagName name of the tag in the itemstack's NBT to store the tank data
*/
public static void serializeTank(FluidTank tank,ItemStack stack,String tagName) {
if (tank.getFluidamount() > 0) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (!tag.hasKey(SAVED_TANKS,Constants.NBT.TAG_COMPOUND)) {
tag.setTag(SAVED_TANKS,new NBTTagCompound());
}
NBTTagCompound subTag = tag.getCompoundTag(SAVED_TANKS);
NBTTagCompound tankTag = new NBTTagCompound();
tank.writetoNBT(tankTag);
subTag.setTag(tagName,tankTag);
}
}
项目:ObsidianSuite
文件:PartGroups.java
public void loadData(NBTTagCompound compound,ModelObj model)
{
NBTTagList partList = compound.getTagList("Groups",10);
if (compound.hasKey("PartOrder",Constants.NBT.TAG_LIST))
model.setPartOrderFromList(compound.getTagList("PartOrder",Constants.NBT.TAG_STRING));
for (int i = 0; i < partList.tagCount(); i++)
{
NBTTagCompound partCompound = partList.getCompoundTagAt(i);
PartObj part = model.getPartObjFromName(partCompound.getString("Name"));
part.setdisplayName(partCompound.getString("displayName"));
String group = partCompound.getString("Group");
if(!groups.containsKey(group))
addGroup(group);
setPartGroup(group,part);
}
}
public void readNBT(NBTTagCompound nbt,NBTType type) {
if (type != NBTType.DROP) {
NBTTagCompound caps = nbt.getCompoundTag("TileBaseCapabilities");
for (EnumFacing side : EnumFacing.values()) {
String name = side.toString().toLowerCase(Locale.ROOT);
if (caps.hasKey(name,Constants.NBT.TAG_COMPOUND)) {
this.readCapabilities(caps.getCompoundTag(name),side);
}
}
if (caps.hasKey("default",Constants.NBT.TAG_COMPOUND)) {
this.readCapabilities(caps.getCompoundTag("default"),null);
}
} else if (this.getEnergy(null) != null) {
this.getEnergy(null).receiveEnergy(nbt.getInteger("Energy"),false);
}
}
项目:MeeCreeps
文件:PortalTileEntity.java
@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);
}
}
项目:MeeCreeps
文件:ChopTreeActionWorker.java
@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);
}
}
项目:MeeCreeps
文件:PortalGunItem.java
public static List<TeleportDestination> getDestinations(ItemStack stack) {
List<TeleportDestination> destinations = new ArrayList<>();
if (!stack.hasTagCompound()) {
for (int i = 0; i < 8; i++) {
destinations.add(null);
}
} else {
NBTTagCompound tag = stack.getTagCompound();
NBTTagList dests = tag.getTagList("dests",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < 8; i++) {
NBTTagCompound tc = i < dests.tagCount() ? dests.getCompoundTagAt(i) : null;
if (tc != null && tc.hasKey("dim")) {
destinations.add(new TeleportDestination(tc));
} else {
destinations.add(null);
}
}
}
return destinations;
}
项目:DankNull
文件:DankNullItemHandler.java
@Override
public void deserializeNBT(NBTBase nbtIn) {
if (nbtIn instanceof NBTTagCompound) {
NBTTagCompound nbt = (NBTTagCompound) nbtIn;
setSize(nbt.hasKey("Size",Constants.NBT.TAG_INT) ? nbt.getInteger("Size") : stacks.size());
NBTTagList tagList = nbt.getTagList(getName(),Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound itemTags = tagList.getCompoundTagAt(i);
int slot = itemTags.getInteger("Slot");
if (slot >= 0 && slot < stacks.size()) {
stacks.set(slot,new ItemStack(itemTags));
stacks.get(slot).setCount(itemTags.getInteger("RealCount"));
}
}
CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(this,null,tagList);
onLoad();
}
}
项目:ToolBelt
文件:ToolBeltInventory.java
@Override
public ItemStack getStackInSlot(int slot)
{
validateSlotIndex(slot);
NBTTagList tagList = getTag().getTagList("Items",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound itemTags = tagList.getCompoundTagAt(i);
if (itemTags.getInteger("Slot") != slot)
continue;
return new ItemStack(itemTags);
}
return ItemStack.EMPTY;
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
if (compound.getString("ownerUUID") != null) {
ownerUUID = UUID.fromString(compound.getString("ownerUUID"));
}
shopControllerPos = new BlockPos(compound.getInteger("shopx"),compound.getInteger("shopy"),compound.getInteger("shopz"));
NBTTagList items = compound.getTagList("ItemInventory",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < items.tagCount(); ++i) {
NBTTagCompound item = items.getCompoundTagAt(i);
int slot = item.getInteger("Slot");
if (slot >= 0 && slot < getSizeInventory()) {
inventory.set(slot,new ItemStack(item));
}
}
}
项目:Never-Enough-Currency
文件:InventoryItem.java
/**
* A custom method to read our inventory from an ItemStack's NBT compound
*/
public void readFromNBT(NBTTagCompound compound) {
if ("".equals(uniqueID)) {
// try to read unique ID from NBT
uniqueID = compound.getString("uniqueID");
// if it's still "",assign a new one:
if ("".equals(uniqueID)) {
uniqueID = UUID.randomUUID().toString();
}
}
NBTTagList items = compound.getTagList("ItemInventory",new ItemStack(item));
}
}
}
项目:PurificatiMagicae
文件:BlockCodeStorage.java
@Override
public void onBlockPlacedBy(World worldIn,BlockPos pos,IBlockState state,EntityLivingBase placer,ItemStack stack)
{
TileEntity te = worldIn.getTileEntity(pos);
if (te != null && te instanceof TileCodeStorage)
{
TileCodeStorage storage = (TileCodeStorage) te;
//Meta == 0 - lockable; Meta == 1 - not lockable
storage.setLockable(stack.getMetadata() == 0);
boolean unloc = true;
if (stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound();
if(tag.hasKey("data",Constants.NBT.TAG_COMPOUND))
{
storage.deserializeMin(tag.getCompoundTag("data"));
unloc = false;
}
}
if(unloc)
storage.setUnlocked(true);
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList nbttaglist = nbt.getTagList("Items",10);
inventory = new ItemStack[getSizeInventory()];
for (int i = 0; i < nbttaglist.tagCount(); i++) {
NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
byte b0 = nbt1.getByte("Slot");
if (b0 >= 0 && b0 < inventory.length)
inventory[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
brewTime = nbt.getShort("BrewTime");
if (nbt.hasKey("Fuel",Constants.NBT.TAG_SHORT)) {
fuel = nbt.getShort("Fuel");
if (fuel > 0)
currentFuel = 30;
} else {
fuel = nbt.getInteger("Fuel");
currentFuel = nbt.getInteger("CurrentFuel");
}
}
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onWorldTick(TickEvent.ServerTickEvent event) {
if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER)
return;
if (EtFuturum.enablePlayerSkinOverlay)
if (playerLoggedInCooldown != null)
if (--playerLoggedInCooldown <= 0) {
for (World world : minecraftServer.getServer().worldServers)
for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) {
NBTTagCompound nbt = player.getEntityData();
if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY,Constants.NBT.TAG_BYTE)) {
boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player,isAlex));
}
}
playerLoggedInCooldown = null;
}
}
项目:CustomWorldGen
文件:ForgeChunkManager.java
/**
* Allows dynamically loading world mods to test if there are chunk tickets in the world
* Mods that add dynamically generated worlds (like Mystcraft) should call this method
* to determine if the world should be loaded during server starting.
*
* @param chunkDir The chunk directory to test: should be equivalent to {@link WorldServer#getChunkSaveLocation()}
* @return if there are tickets outstanding for this world or not
*/
public static boolean savedWorldHasForcedChunkTickets(File chunkDir)
{
File chunkLoaderData = new File(chunkDir,"forcedchunks.dat");
if (chunkLoaderData.exists() && chunkLoaderData.isFile())
{
;
try
{
NBTTagCompound forcedChunkData = CompressedStreamTools.read(chunkLoaderData);
return forcedChunkData.getTagList("TicketList",Constants.NBT.TAG_COMPOUND).tagCount() > 0;
}
catch (IOException e)
{
}
}
return false;
}
项目:CustomWorldGen
文件:ItemStackHandler.java
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
setSize(nbt.hasKey("Size",Constants.NBT.TAG_INT) ? nbt.getInteger("Size") : stacks.length);
NBTTagList tagList = nbt.getTagList("Items",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound itemTags = tagList.getCompoundTagAt(i);
int slot = itemTags.getInteger("Slot");
if (slot >= 0 && slot < stacks.length)
{
stacks[slot] = ItemStack.loadItemStackFromNBT(itemTags);
}
}
onLoad();
}
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
if (nbt.hasKey("oreID",Constants.NBT.TAG_BYTE))
{
this.dormantOre = EnumOre.values()[nbt.getByte("oreID")];
}
if (nbt.hasKey("oreAmount",Constants.NBT.TAG_FLOAT))
{
this.dormantOreAmount = nbt.getFloat("oreAmount");
}
if (nbt.hasKey("temperatureData",Constants.NBT.TAG_LIST))
{
this.temperatureData.clear();
StreamSupport.stream(nbt.getTagList("temperatureData",Constants.NBT.TAG_COMPOUND).spliterator(),false).map(tag -> (NBTTagCompound)tag).forEach(tag -> this.temperatureData.put(BlockPos.fromLong(tag.getLong("key")),tag.getFloat("value")));
}
}
项目:StructPro
文件:Tiles.java
/**
* Load inventory data from NBT tag
* @param inventory Target inventory
* @param tag tag to load
* @param seed Loading seed
*/
private static void load(IInventory inventory,NBTTagCompound tag,long seed) {
if (tag == null || !Configurator.NATIVE_LOOT) {
return;
}
Random random = new Random(seed);
NBTTagList items = tag.getTagList("Items",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < items.tagCount() && i < inventory.getSizeInventory(); ++i) {
NBTTagCompound stackTag = items.getCompoundTagAt(i);
String itemName = stackTag.getString("id").replaceAll(".*:","");
itemName = itemName.isEmpty() ? String.valueOf(stackTag.getShort("id")) : itemName;
Pattern iPattern = Pattern.compile(Pattern.quote(itemName),Pattern.CASE_INSENSITIVE);
UItem item = Utils.select(UItems.items.select(iPattern),random.nextLong());
byte count = items.getCompoundTagAt(i).getByte("Count");
int damage = items.getCompoundTagAt(i).getShort("damage");
int slot = stackTag.hasKey("Slot",Constants.NBT.TAG_BYTE) ? stackTag.getByte("Slot") : i;
slot = (slot < 0 || slot >= inventory.getSizeInventory()) ? i : slot;
if (item != null && count > 0 && UItems.getPossibleMeta(item).contains(damage)) {
inventory.setInventorySlotContents(slot,new UItemStack(item,count,damage).getItemStack());
}
}
}
项目:StructPro
文件:Tiles.java
/**
* Load pot data from NBT tag
* @param pot Target pot
* @param tag tag to load
* @param seed Loading seed
*/
private static void load(TileEntityFlowerPot pot,long seed) {
if (tag == null) {
return;
}
Random random = new Random(seed);
if (tag.hasKey("Item",Constants.NBT.TAG_STRING)) {
String itemName = tag.getString("Item").replaceAll(".*:","");
itemName = itemName.isEmpty() ? String.valueOf(tag.getInteger("Item")) : itemName;
Pattern iPattern = Pattern.compile(Pattern.quote(itemName),random.nextLong());
if (item != null) {
pot.setFlowerPotData(item.getItem(),tag.getInteger("Data"));
}
}
}
项目:StructPro
文件:Tiles.java
项目:StructPro
文件:Tiles.java
项目:Possessed
文件:PossessivePlayer.java
public void deserialize(NBTTagCompound compound,EntityPlayer player) {
this.originalHealth = compound.getFloat("OriginalHealth");
this.originalHunger = compound.getInteger("OriginalHunger");
this.originalSaturation = compound.getFloat("OriginalSaturation");
this.isPossessing = compound.getBoolean("IsPossessing");
this.possessAnimation = compound.getInteger("PossessAnimation");
this.originalX = compound.getDouble("OriginalX");
this.originalY = compound.getDouble("OriginalY");
this.originalZ = compound.getDouble("OriginalZ");
NBTTagList originalInventoryTag = compound.getTagList("OriginalInventory",Constants.NBT.TAG_COMPOUND);
this.originalInventory = new InventoryPlayer(player);
this.originalInventory.readFromNBT(originalInventoryTag);
this.originalInventoryContainer = new ContainerPlayer(this.originalInventory,!player.worldobj.isRemote,player);
NBTTagList handlerList = compound.getTagList("Handlers",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < handlerList.tagCount(); i++) {
NBTTagCompound handlerTag = handlerList.getCompoundTagAt(i);
try {
EntityPossessHandler possessHandler = PossessHandler.getPossessHandler(new ResourceLocation(handlerTag.getString("Identifier")));
possessHandler.deserialize(player,handlerTag);
} catch (Exception e) {
System.err.println("Failed to load possess handler: " + handlerTag + "! Skipping.");
e.printstacktrace();
}
}
}
项目:CrystalMod
文件:NBTUtils.java
/**
* Get a compound tag by the given name <b>tagName</b> from the other compound tag <b>nbt</b>.
* If one doesn't exist,then it will be created and added if <b>create</b> is true,otherwise null is returned.
*/
public static NBTTagCompound getCompoundTag(NBTTagCompound nbt,String tagName,boolean create)
{
if (nbt == null)
{
return null;
}
if (create == false)
{
return nbt.hasKey(tagName,Constants.NBT.TAG_COMPOUND) == true ? nbt.getCompoundTag(tagName) : null;
}
// create = true
if (nbt.hasKey(tagName,Constants.NBT.TAG_COMPOUND) == false)
{
nbt.setTag(tagName,new NBTTagCompound());
}
return nbt.getCompoundTag(tagName);
}
项目:CrystalMod
文件:WirelessChestManager.java
@Override
public void readFromNBT(NBTTagCompound nbt)
{
global.deserializeNBT(nbt);
if (nbt.hasKey("Private",Constants.NBT.TAG_LIST))
{
NBTTagList list = nbt.getTagList("Private",Constants.NBT.TAG_COMPOUND);
perPlayer.clear();
for (int i = 0; i < list.tagCount(); ++i)
{
NBTTagCompound containerTag = list.getCompoundTagAt(i);
UUID uuid = PlayerUtil.uuidFromNBT(containerTag);
Container container = new Container();
container.deserializeNBT(containerTag);
perPlayer.put(uuid,container);
}
}
}
项目:CrystalMod
文件:WirelessChestManager.java
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
NBTTagList nbtTagList = nbt.getTagList("Inventories",Constants.NBT.TAG_COMPOUND);
inventories.clear();
for (int i = 0; i < nbtTagList.tagCount(); ++i)
{
NBTTagCompound inventoryTag = nbtTagList.getCompoundTagAt(i);
int code = inventoryTag.getInteger("Code");
WirelessInventory inventory = new WirelessInventory(this);
inventory.deserializeNBT(inventoryTag.getCompoundTag("Contents"));
inventories.put(code,inventory);
}
}
项目:CrystalMod
文件:WirelessChestManager.java
void importNBT(NBTTagCompound nbt)
{
NBTTagList nbtTagList = nbt.getTagList("Inventories",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < nbtTagList.tagCount(); ++i)
{
NBTTagCompound inventoryTag = nbtTagList.getCompoundTagAt(i);
int code = inventoryTag.getInteger("Code");
if (!inventories.containsKey(code))
{
WirelessInventory inventory = new WirelessInventory(this);
inventory.deserializeNBT(inventoryTag.getCompoundTag("Contents"));
inventories.put(code,inventory);
}
}
}
项目:CrystalMod
文件:ItemPattern.java
public static void addOutput(ItemStack pattern,ItemStack stack) {
if (!pattern.hasTagCompound()) {
pattern.setTagCompound(new NBTTagCompound());
}
NBTTagList outputs;
if (!pattern.getTagCompound().hasKey(NBT_OUTPUTS)) {
outputs = new NBTTagList();
} else {
outputs = pattern.getTagCompound().getTagList(NBT_OUTPUTS,Constants.NBT.TAG_COMPOUND);
}
outputs.appendTag(stack.serializeNBT());
pattern.getTagCompound().setTag(NBT_OUTPUTS,outputs);
}
项目:CrystalMod
文件:ItemPattern.java
public static NonNullList<ItemStack> getoutputs(ItemStack pattern) {
if (!isProcessing(pattern)) {
return NonNullList.create();
}
NonNullList<ItemStack> outputs = NonNullList.create();
NBTTagList outputsTag = pattern.getTagCompound().getTagList(NBT_OUTPUTS,Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < outputsTag.tagCount(); ++i) {
ItemStack stack = ItemStackTools.loadFromNBT(outputsTag.getCompoundTagAt(i));
if (ItemStackTools.isValid(stack)) {
outputs.add(stack);
}
}
return outputs;
}
@Override
public boolean readFromNBT(NBTTagCompound tag) {
if(super.readFromNBT(tag)){
if (tag.hasKey(NBT_TO_INSERT)) {
NBTTagList toInsertList = tag.getTagList(NBT_TO_INSERT,Constants.NBT.TAG_COMPOUND);
toInsert = NonNullList.withSize(toInsertList.tagCount(),ItemStackTools.getEmptyStack());
for (int i = 0; i < toInsertList.tagCount(); ++i) {
ItemStack insertStack = ItemStackTools.loadFromNBT(toInsertList.getCompoundTagAt(i));
if (!ItemStackTools.isNullStack(insertStack)) {
toInsert.add(insertStack);
}
}
}
return true;
}
return false;
}
项目:CrystalMod
文件:AttachmentEStorageExport.java
@Override
public void loadFromNBT(NBTTagCompound nbt){
super.loadFromNBT(nbt);
NBTTagList tagList = nbt.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.tagCount(); i++) {
int slot = tagList.getCompoundTagAt(i).getInteger("Slot");
ItemStack stack = ItemStackTools.loadFromNBT(tagList.getCompoundTagAt(i));
filters.insertItem(slot,stack,false);
}
if(nbt.hasKey("RedstoneMode")){
rMode = RedstoneMode.values()[nbt.getInteger("RedstoneMode") % RedstoneMode.values().length];
}else{
rMode = RedstoneMode.ON;
}
if(nbt.hasKey("IOType")){
ioType = AttachmentIOType.values()[nbt.getInteger("IOType") % AttachmentIOType.values().length];
}else{
ioType = AttachmentIOType.ITEM;
}
}
项目:CrystalMod
文件:EnderBufferManager.java
@Override
public void readFromNBT(NBTTagCompound nbt)
{
global.deserializeNBT(nbt);
if (nbt.hasKey("Private",container);
}
}
}
项目:CrystalMod
文件:EnderBufferManager.java
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
NBTTagList nbtTagList = nbt.getTagList("Buffers",Constants.NBT.TAG_COMPOUND);
inventories.clear();
for (int i = 0; i < nbtTagList.tagCount(); ++i)
{
NBTTagCompound inventoryTag = nbtTagList.getCompoundTagAt(i);
int j = inventoryTag.getInteger("BufferId");
EnderBuffer inventory = new EnderBuffer(this);
inventory.deserializeNBT(inventoryTag.getCompoundTag("BufferContents"));
inventories.put(j,inventory);
}
}
项目:CrystalMod
文件:EnderBufferManager.java
void importNBT(NBTTagCompound nbt)
{
NBTTagList nbtTagList = nbt.getTagList("Buffers",Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < nbtTagList.tagCount(); ++i)
{
NBTTagCompound inventoryTag = nbtTagList.getCompoundTagAt(i);
int j = inventoryTag.getInteger("BufferId");
if (!inventories.containsKey(j))
{
EnderBuffer inventory = new EnderBuffer(this);
inventory.deserializeNBT(inventoryTag.getCompoundTag("BufferContents"));
inventories.put(j,inventory);
}
}
}
项目:TRHS_Club_Mod_2016
文件:ForgeChunkManager.java
/**
* Allows dynamically loading world mods to test if there are chunk tickets in the world
* Mods that add dynamically generated worlds (like Mystcraft) should call this method
* to determine if the world should be loaded during server starting.
*
* @param chunkDir The chunk directory to test: should be equivalent to {@link WorldServer#getChunkSaveLocation()}
* @return if there are tickets outstanding for this world or not
*/
public static boolean savedWorldHasForcedChunkTickets(File chunkDir)
{
File chunkLoaderData = new File(chunkDir,"forcedchunks.dat");
if (chunkLoaderData.exists() && chunkLoaderData.isFile())
{
;
try
{
NBTTagCompound forcedChunkData = CompressedStreamTools.func_74797_a(chunkLoaderData);
return forcedChunkData.func_150295_c("TicketList",Constants.NBT.TAG_COMPOUND).func_74745_c() > 0;
}
catch (IOException e)
{
}
}
return false;
}
项目:Age-of-Kingdom
文件:PlayerAokIEEP.java
@Override
public void loadNBTData(NBTTagCompound compound) {
if(compound.hasKey(PROP_NAME,Constants.NBT.TAG_COMPOUND)) {
NBTTagCompound tmp = compound.getCompoundTag(PROP_NAME);
this.lordLevel = tmp.getInteger("LordLevel");
this.landPos.loadNBTData(tmp);
this.lordName = tmp.getString("LordName");
this.aokName = tmp.getString("AokName");
this.aokLevel = tmp.getInteger("AokLevel");
NBTTagList list = (NBTTagList) tmp.getTag("Members");
ArrayList<String> tmpList = new ArrayList<String>();
for(int i = 0; i < list.tagCount(); ++i) {
tmpList.add(list.getStringTagAt(i));
}
this.members = tmpList;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。