本文整理汇总了Java中net.minecraftforge.event.world.ChunkDataEvent.Save方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkDataEvent.Save方法的具体用法?Java ChunkDataEvent.Save怎么用?Java ChunkDataEvent.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.world.ChunkDataEvent
的用法示例。
在下文中一共展示了ChunkDataEvent.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
Map<BlockPos, List<ISemiBlock>> map = semiBlocks.get(event.getChunk());
if (map != null && map.size() > 0) {
NBTTagList tagList = new NBTTagList();
for (Map.Entry<BlockPos, List<ISemiBlock>> entry : map.entrySet()) {
for(ISemiBlock semiBlock : entry.getValue()){
NBTTagCompound t = new NBTTagCompound();
semiBlock.writeToNBT(t);
NBTUtil.setPos(t, entry.getKey());
t.setString("type", getKeyForSemiBlock(semiBlock));
tagList.appendTag(t);
}
}
event.getData().setTag("SemiBlocks", tagList);
}
}
示例2: onChunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkSave(ChunkDataEvent.Save event) {
if (!event.getWorld().isRemote) {
int dim = event.getWorld().provider.getDimension();
ChunkPos pos = event.getChunk().getPos();
StabilityData stability = getChunkData(dim, pos);
if (stability != StabilityData.NO_DATA) {
event.getData().setTag(STABILITY_KEY, stability.writeToNBT());
}
if (!event.getChunk().isLoaded()) {
removeChunkData(dim, pos);
}
}
}
示例3: saveChunk
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void saveChunk(ChunkDataEvent.Save event) {
long index = Chunk2Index(event.getChunk());
NBTTagCompound nbt = VintageTG.proxy.getChunkNbt(index); // chunkextranbt_savequeue.get(index);
if (nbt != null) {
event.getData().setTag("vintagecraft", nbt);
mark(event.getChunk().xPosition, event.getChunk().zPosition, "save " + nbt.hasKey("climate"));
} else {
mark(event.getChunk().xPosition, event.getChunk().zPosition, "save-no nbt?");
}
if (!event.getChunk().isLoaded()) {
mark(event.getChunk().xPosition, event.getChunk().zPosition, "removed from list");
// TODO
//VintageCraft.proxy.removeChunkNbt(Chunk2Index(event.getChunk()));
}
}
示例4: onDataSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDataSave(ChunkDataEvent.Save event)
{
if (!event.world.isRemote && CWTFC_Core.getCDM(event.world) != null)
{
NBTTagCompound levelTag = event.getData().getCompoundTag("Level");
int x = levelTag.getInteger("xPos");
int z = levelTag.getInteger("zPos");
ChunkData data = CWTFC_Core.getCDM(event.world).getData(x, z);
if(data != null)
{
NBTTagCompound CWTFCTag = data.getTag();
event.getData().setTag("CWTFCData", CWTFCTag);
if(data.isUnloaded)
CWTFC_Core.getCDM(event.world).removeData(x, z);
}
}
}
示例5: saveChunk
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void saveChunk(ChunkDataEvent.Save event) {
long index = Chunk2Index(event.getChunk());
NBTTagCompound nbt = VintageCraft.proxy.getChunkNbt(index); // chunkextranbt_savequeue.get(index);
if (nbt != null) {
event.getData().setTag("vintagecraft", nbt);
mark(event.getChunk().xPosition, event.getChunk().zPosition, "save " + nbt.hasKey("climate"));
} else {
mark(event.getChunk().xPosition, event.getChunk().zPosition, "save-no nbt?");
}
if (!event.getChunk().isLoaded()) {
mark(event.getChunk().xPosition, event.getChunk().zPosition, "removed from list");
// FIXME: Make this work (seems to be causing issues at random where removed nbts were still needed)
//VintageCraft.proxy.removeChunkNbt(Chunk2Index(event.getChunk()));
}
}
示例6: chunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkSave(ChunkDataEvent.Save event) {
NBTTagCompound oresPlusRegen = new NBTTagCompound();
int dimId = event.world.provider.dimensionId;
NBTTagCompound oreRegenArray = new NBTTagCompound();
ArrayList<WorldGenOre> oreGenArray = WorldGenCore.oreGenerators.get(dimId);
if (oreGenArray != null) {
for (WorldGenOre oreGen : oreGenArray) {
oreRegenArray.setString(oreGen.getOreName(), oreGen.regenKey);
}
}
oresPlusRegen.setTag("oreRegenArray", oreRegenArray);
oresPlusRegen.setString("ores", OresPlus.regenKeyOre);
oresPlusRegen.setString("oil", OresPlus.regenKeyOil);
oresPlusRegen.setString("rubberTree", OresPlus.regenKeyRubberTree);
oresPlusRegen.setString("beehives", OresPlus.regenKeyBeehives);
event.getData().setTag("OresPlus", oresPlusRegen);
}
示例7: onChunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event){
Map<ChunkPosition, ISemiBlock> map = semiBlocks.get(event.getChunk());
if(map != null && map.size() > 0) {
NBTTagList tagList = new NBTTagList();
for(Map.Entry<ChunkPosition, ISemiBlock> entry : map.entrySet()) {
NBTTagCompound t = new NBTTagCompound();
entry.getValue().writeToNBT(t);
t.setInteger("x", entry.getKey().chunkPosX);
t.setInteger("y", entry.getKey().chunkPosY);
t.setInteger("z", entry.getKey().chunkPosZ);
t.setString("type", getKeyForSemiBlock(entry.getValue()));
tagList.appendTag(t);
}
event.getData().setTag("SemiBlocks", tagList);
}
}
示例8: onChunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkSave(ChunkDataEvent.Save event)
{
IChunkLevel chunkLevel = getChunkLevel(event.getChunk());
if (!(chunkLevel instanceof ChunkLevel)) return;
event.getData().setTag(ID.toString(), ((ChunkLevel) chunkLevel).serializeNBT());
}
示例9: onChunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
Vec v = new Vec(event.getChunk().x, 0, event.getChunk().z);
D d = memory.get(v);
if (d != null) {
Path p = tmpDir.resolve(fileName(v));
try (DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(Files.newOutputStream(p)))) {
codec.save(stream, d);
memory.remove(v);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
示例10: onChunkDataSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkDataSave(ChunkDataEvent.Save e)
{
try
{
e.getData().setFloat("sif_power", PurMag.INSTANCE.sif_storage.get(GlobalChunkPos.fromChunk(e.getChunk())));
}
catch (Exception ex)
{
PurMag.INSTANCE.log.error("Can't save the SIF chunk data!", ex);
}
}
示例11: onChunkSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
ChunkListOfPlayers chunk = AllChunks.getChunk(event.getChunk());
if (chunk != null) {
NBTTagList nbt = new NBTTagList();
AllChunks.getChunk(event.getChunk()).writeToNBT(nbt);;
event.getData().setTag("PlayerInChunk", nbt);
}
}
示例12: getChunkData
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void getChunkData(final ChunkDataEvent.Save event) {
final Chunk chunk = event.getChunk();
final int i = this.chunkmap.get(new ChunkLocation(chunk.worldObj.provider.dimensionId, chunk.xPosition, chunk.zPosition));
if (i != 0) {
event.getData().setInteger("XU_SoulDrain", i);
}
}
示例13: chunkSaved
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkSaved(ChunkDataEvent.Save event)
{
Chunk chunk = event.getChunk();
NBTTagCompound compound = event.getData();
compound.setBoolean("terratorial_tag", true);
}
示例14: onChunkDataSave
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkDataSave(ChunkDataEvent.Save event)
{
for(WorldExtension extension : worldMap.get(event.world))
extension.saveChunkData(event.getChunk(), event.getData());
if(!event.getChunk().isChunkLoaded)
removeChunk(event.world, event.getChunk());
}
示例15: handleChunkSaveEvent
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
if(areAnyRetroGensEnabled()){
NBTTagCompound nbt = new NBTTagCompound();
event.getData().setTag(NBT_RETRO, nbt);
nbt.setBoolean(Config.retrogenID, true);
}
}