本文整理汇总了Java中net.minecraftforge.event.world.ChunkDataEvent.Load方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkDataEvent.Load方法的具体用法?Java ChunkDataEvent.Load怎么用?Java ChunkDataEvent.Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.world.ChunkDataEvent
的用法示例。
在下文中一共展示了ChunkDataEvent.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChunkLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@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);
}
示例2: onChunkLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event) {
try {
if (!event.getWorld().isRemote) {
if (event.getData().hasKey("SemiBlocks")) {
Map<BlockPos, List<ISemiBlock>> map = getOrCreateMap(event.getChunk());
map.clear();
NBTTagList tagList = event.getData().getTagList("SemiBlocks", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound t = tagList.getCompoundTagAt(i);
ISemiBlock semiBlock = getSemiBlockForKey(t.getString("type"));
if (semiBlock != null) {
semiBlock.readFromNBT(t);
addSemiBlock(event.getWorld(), NBTUtil.getPos(t), semiBlock, event.getChunk());
}
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
示例3: onChunkLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkLoad(ChunkDataEvent.Load event) {
if (!event.getWorld().isRemote) {
int dim = event.getWorld().provider.getDimension();
ChunkPos pos = event.getChunk().getPos();
StabilityData stability;
if (event.getData().hasKey(STABILITY_KEY, 10)) {
stability = new StabilityData(event.getData().getCompoundTag(STABILITY_KEY));
} else {
stability = generateChunkStability(event.getWorld().rand);
}
addChunkData(dim, pos, stability);
}
}
示例4: chunkLoaded
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkLoaded(ChunkDataEvent.Load event)
{
Chunk chunk = event.getChunk();
NBTTagCompound compound = event.getData();
if(!compound.hasKey("terratorial_tag"))
{
Random rand = chunk.getRandomWithSeed(chunk.getWorld().getSeed());
if(rand.nextInt(100) < 4)
{
}
chunk.setChunkModified();
}
}
示例5: loadChunk
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void loadChunk(ChunkDataEvent.Load event) {
Chunk chunk = event.getChunk();
FlatChunkLayer layer = ((IExtraChunkData) chunk).getFlatLayer();
NBTTagCompound chunkData = event.getData();
if (!chunkData.hasKey(NBT_KEY)) return;
NBTTagList list = chunkData.getTagList(NBT_KEY, Constants.NBT.TAG_COMPOUND);
if (list == null || list.hasNoTags()) return;
Coord at = new Coord(chunk.getWorld(), 0, 0, 0);
int tagEnd = list.tagCount();
for (int i = 0; i < tagEnd; i++) {
NBTTagCompound tag = (NBTTagCompound) list.get(i);
at.x = tag.getInteger("x");
at.y = tag.getInteger("y");
at.z = tag.getInteger("z");
byte faceOrdinal = tag.getByte("side");
EnumFacing face = EnumFacing.VALUES[faceOrdinal];
FlatFace flat = construct(tag);
if (flat != null) {
layer.set(at, face, flat, FlatChunkLayer.FLAGS_SEAMLESS);
}
}
}
示例6: enqueueRetrogen
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void enqueueRetrogen(ChunkDataEvent.Load event) {
// See also: http://minecraft.curseforge.com/projects/simpleretrogen
if (!FzConfig.enable_retrogen) {
return;
}
final NBTTagCompound data = event.getData();
final String oldKey = data.getString("fzRetro");
if (FzConfig.retrogen_key.equals(oldKey)) {
return;
}
if (event.getChunk().getWorld().isRemote) return;
if (retrogen_active.get() == Boolean.TRUE) {
recursively_loaded.add(event.getChunk());
return;
}
if (FzConfig.retrogen_copper_geyser || FzConfig.retrogen_dark_iron) {
retrogenQueue.add(event.getChunk());
}
}
示例7: onChunkDataLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public synchronized void onChunkDataLoad(ChunkDataEvent.Load event)
{
if(!event.world.isRemote)
{
if(general.enableWorldRegeneration)
{
NBTTagCompound loadData = event.getData();
if(loadData.getInteger("MekanismWorldGen") == baseWorldGenVersion && loadData.getInteger("MekanismUserWorldGen") == general.userWorldGenVersion)
{
return;
}
ChunkCoordIntPair coordPair = event.getChunk().getChunkCoordIntPair();
worldTickHandler.addRegenChunk(event.world.provider.dimensionId, coordPair);
}
}
}
示例8: onDataLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDataLoad(ChunkDataEvent.Load event)
{
if(!event.world.isRemote)
{
NBTTagCompound eventTag = event.getData();
if(eventTag.hasKey("CWTFCData"))
{
NBTTagCompound CWTFCData = eventTag.getCompoundTag("CWTFCData");
if(CWTFC_Core.getCDM(event.world) != null)
CWTFC_Core.getCDM(event.world).addData(event.getChunk(), new ChunkData(CWTFCData));
}
else
{
if(CWTFC_Core.getCDM(event.world) != null)
CWTFC_Core.getCDM(event.world).addData(event.getChunk(), new ChunkData());
}
}
}
示例9: chunkLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkLoad(ChunkDataEvent.Load event)
{
int dim = event.world.provider.dimensionId;
ChunkCoordIntPair loc = event.getChunk().getChunkCoordIntPair();
if (!event.getData().getCompoundTag(this.getModTag()).hasKey(ConfigHandler.regenKey()) && ConfigHandler.regen())
{
LogHandler.log("Worlg gen was never run for chunk at " + loc);
ArrayList<ChunkLoc> chunks = WorldTicker.chunksToGenerate.get(dim);
if (chunks == null)
{
WorldTicker.chunksToGenerate.put(dim, new ArrayList<ChunkLoc>());
chunks = WorldTicker.chunksToGenerate.get(dim);
}
if (chunks != null)
{
chunks.add(new ChunkLoc(loc.chunkXPos, loc.chunkZPos));
WorldTicker.chunksToGenerate.put(dim, chunks);
}
}
}
示例10: onChunkLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event){
try {
if(!event.world.isRemote) {
if(event.getData().hasKey("SemiBlocks")) {
Map<ChunkPosition, ISemiBlock> map = getOrCreateMap(event.getChunk());
map.clear();
NBTTagList tagList = event.getData().getTagList("SemiBlocks", 10);
for(int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound t = tagList.getCompoundTagAt(i);
ISemiBlock semiBlock = getSemiBlockForKey(t.getString("type"));
if(semiBlock != null) {
semiBlock.readFromNBT(t);
setSemiBlock(event.world, t.getInteger("x"), t.getInteger("y"), t.getInteger("z"), semiBlock, event.getChunk());
}
}
}
}
} catch(Throwable e) {
e.printStackTrace();
}
}
示例11: onChunkDataLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkDataLoad(ChunkDataEvent.Load e)
{
try
{
PurMag.INSTANCE.sif_storage.set(GlobalChunkPos.fromChunk(e.getChunk()), e.getData().getFloat("sif_power"));
}
catch (Exception ex)
{
PurMag.INSTANCE.log.error("Can't load the SIF chunk data!", ex);
}
}
示例12: onChunkLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event) {
if (event.getData().hasKey("PlayerInChunk")) {
ChunkListOfPlayers chunk = new ChunkListOfPlayers(event.getChunk());
AllChunks.addChunk(chunk);
chunk.readFromNBT(event.getData().getTagList("PlayerInChunk", Constants.NBT.TAG_COMPOUND));
}
}
示例13: loadData
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
public void loadData(final ChunkDataEvent.Load event) {
if (ExtraUtils.enderLilyRetrogenId > 0 && event.world.provider.dimensionId == 1 && event.world instanceof WorldServer && event.getData().getInteger(WorldGenEnderLillies.retrogen) != ExtraUtils.enderLilyRetrogenId) {
final long worldSeed = event.world.getSeed();
final Random random = new Random(worldSeed);
final long xSeed = random.nextLong() >> 3;
final long zSeed = random.nextLong() >> 3;
final long chunkSeed = xSeed * event.getChunk().xPosition + zSeed * event.getChunk().zPosition ^ worldSeed;
random.setSeed(chunkSeed);
gen(random, event.getChunk());
}
}
示例14: getChunkData
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void getChunkData(final ChunkDataEvent.Load event) {
final int i = event.getData().getInteger("XU_SoulDrain");
if (i == 0) {
return;
}
final Chunk chunk = event.getChunk();
this.chunkmap.put(new ChunkLocation(chunk.worldObj.provider.dimensionId, chunk.xPosition, chunk.zPosition), i);
}
示例15: onChunkDataLoad
import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkDataLoad(ChunkDataEvent.Load event)
{
if(!worldMap.containsKey(event.world))
WorldExtensionManager.onWorldLoad(event.world);
createChunkExtension(event.world, event.getChunk());
for(WorldExtension extension : worldMap.get(event.world))
extension.loadChunkData(event.getChunk(), event.getData());
}