本文整理匯總了Java中net.minecraft.util.math.ChunkPos類的典型用法代碼示例。如果您正苦於以下問題:Java ChunkPos類的具體用法?Java ChunkPos怎麽用?Java ChunkPos使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ChunkPos類屬於net.minecraft.util.math包,在下文中一共展示了ChunkPos類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadChunk__Async
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException
{
ChunkPos chunkpos = new ChunkPos(x, z);
NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkpos);
if (nbttagcompound == null)
{
DataInputStream datainputstream = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, x, z);
if (datainputstream == null)
{
return null;
}
nbttagcompound = this.dataFixer.process(FixTypes.CHUNK, CompressedStreamTools.read(datainputstream));
}
return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound);
}
示例2: syncCallback
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
public void syncCallback()
{
if (chunk == null)
{
this.runCallbacks();
return;
}
// Load Entities
this.loader.loadEntities(this.chunkInfo.world, this.nbt.getCompoundTag("Level"), this.chunk);
MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(this.chunk, this.nbt)); // Don't call ChunkDataEvent.Load async
this.chunk.setLastSaveTime(provider.worldObj.getTotalWorldTime());
this.provider.chunkGenerator.recreateStructures(this.chunk, this.chunkInfo.x, this.chunkInfo.z);
provider.id2ChunkMap.put(ChunkPos.asLong(this.chunkInfo.x, this.chunkInfo.z), this.chunk);
this.chunk.onChunkLoad();
this.chunk.populateChunk(provider, provider.chunkGenerator);
this.runCallbacks();
}
示例3: WorldClient
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
public WorldClient(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension, EnumDifficulty difficulty, Profiler profilerIn)
{
super(new SaveHandlerMP(), new WorldInfo(settings, "MpServer"), makeWorldProvider(dimension), profilerIn, true);
this.ambienceTicks = this.rand.nextInt(12000);
this.viewableChunks = Sets.<ChunkPos>newHashSet();
this.connection = netHandler;
this.getWorldInfo().setDifficulty(difficulty);
this.provider.registerWorld(this);
this.setSpawnPoint(new BlockPos(8, 64, 8));
this.chunkProvider = this.createChunkProvider();
this.mapStorage = new SaveDataMemoryStorage();
this.calculateInitialSkylight();
this.calculateInitialWeather();
Reflector.call(this, Reflector.ForgeWorld_initCapabilities, new Object[0]);
Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {this});
if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class)
{
this.mc.playerController = new PlayerControllerOF(this.mc, netHandler);
}
}
示例4: WorldClient
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
public WorldClient(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension, EnumDifficulty difficulty, Profiler profilerIn)
{
super(new SaveHandlerMP(), new WorldInfo(settings, "MpServer"), net.minecraftforge.common.DimensionManager.createProviderFor(dimension), profilerIn, true);
this.ambienceTicks = this.rand.nextInt(12000);
this.viewableChunks = Sets.<ChunkPos>newHashSet();
this.connection = netHandler;
this.getWorldInfo().setDifficulty(difficulty);
this.provider.registerWorld(this);
this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect.
this.chunkProvider = this.createChunkProvider();
this.mapStorage = new SaveDataMemoryStorage();
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.initCapabilities();
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
}
示例5: onEntityJoinWorld
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
if (event.getEntity() instanceof EntityLivingBase && !(event.getEntity() instanceof EntityPlayer))
{
EntityLivingBase entity = (EntityLivingBase) event.getEntity();
World world = entity.getEntityWorld();
IEnemyLevel enemyLevelCap = entity.getCapability(CapabilityEnemyLevel.ENEMY_LEVEL, null);
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
if (enemyLevelCap != null && chunkLevelHolder != null)
{
if (enemyLevelCap.getEnemyLevel() == 0)
{
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(new ChunkPos(entity.getPosition()));
int level = chunkLevel.getChunkLevel();
enemyLevelCap.setEnemyLevel(level);
entity.setCustomNameTag("Level: " + enemyLevelCap.getEnemyLevel());
if (level > 1) setAttributeModifiers(entity, level);
}
}
}
}
示例6: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.LEGENDARY);
nbt.setInteger("Level", level);
// Attributes
WeaponAttribute.DEXTERITY.addAttribute(nbt, 10);
WeaponAttribute.MAX_DAMAGE.addAttribute(nbt, 3);
WeaponAttribute.LIFE_STEAL.addAttribute(nbt, 0.15);
ItemGeneratorHelper.setAttributeModifiers(nbt, stack);
}
示例7: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.LEGENDARY);
nbt.setInteger("Level", level);
// Attributes
WeaponAttribute.FIRE.addAttribute(nbt, 5);
WeaponAttribute.STRENGTH.addAttribute(nbt, 3);
WeaponAttribute.DURABLE.addAttribute(nbt, 0.3);
ItemGeneratorHelper.setAttributeModifiers(nbt, stack);
}
示例8: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.EXOTIC);
nbt.setInteger("Level", level);
// Attributes
WeaponAttribute.STRENGTH.addAttribute(nbt, 10);
WeaponAttribute.FORTITUDE.addAttribute(nbt, 10);
WeaponAttribute.FROST.addAttribute(nbt, 7);
ItemGeneratorHelper.setAttributeModifiers(nbt, stack);
}
示例9: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.LEGENDARY);
nbt.setInteger("Level", level);
// Attributes
WeaponAttribute.FORTITUDE.addAttribute(nbt, 10);
WeaponAttribute.LIGHTNING.addAttribute(nbt, 7);
WeaponAttribute.MANA_STEAL.addAttribute(nbt, 0.2);
ItemGeneratorHelper.setAttributeModifiers(nbt, stack);
}
示例10: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.LEGENDARY);
nbt.setInteger("Level", level);
// Attributes
WeaponAttribute.STRENGTH.addAttribute(nbt, 6);
WeaponAttribute.FORTITUDE.addAttribute(nbt, 4);
WeaponAttribute.CHAINED.addAttribute(nbt, 10);
ItemGeneratorHelper.setAttributeModifiers(nbt, stack);
}
示例11: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.EXOTIC);
nbt.setInteger("Level", level);
// Attributes
WeaponAttribute.FIRE.addAttribute(nbt, 3);
WeaponAttribute.FROST.addAttribute(nbt, 3);
WeaponAttribute.LIGHTNING.addAttribute(nbt, 3);
WeaponAttribute.STRENGTH.addAttribute(nbt, 8);
ItemGeneratorHelper.setAttributeModifiers(nbt, stack);
}
示例12: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.LEGENDARY);
nbt.setInteger("Level", level);
ItemGeneratorHelper.setRune(nbt);
// Attributes
WeaponAttribute.FIRE.addAttribute(nbt, 3);
WeaponAttribute.FROST.addAttribute(nbt, 3);
WeaponAttribute.LIGHTNING.addAttribute(nbt, 3);
// Damage and Attack Speed
double baseDamage = this.getBaseDamage();
double baseAttackSpeed = this.getBaseAttackSpeed();
double weightedDamage = ItemGeneratorHelper.getWeightedDamage(nbt, Rarity.getRarity(nbt), baseDamage);
double weightedAttackSpeed = ItemGeneratorHelper.getWeightedAttackSpeed(Rarity.getRarity(nbt), baseAttackSpeed);
ItemGeneratorHelper.setMinMaxDamage(nbt, weightedDamage);
nbt.setDouble("AttackSpeed", weightedAttackSpeed);
}
示例13: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.EXOTIC);
nbt.setInteger("Level", level);
ItemGeneratorHelper.setRune(nbt);
// Attributes
WeaponAttribute.FIRE.addAttribute(nbt, 5);
WeaponAttribute.MIN_DAMAGE.addAttribute(nbt, 3);
WeaponAttribute.FORTITUDE.addAttribute(nbt, 5);
WeaponAttribute.CHAINED.addAttribute(nbt, 15);
// Damage and Attack Speed
double baseDamage = this.getBaseDamage();
double baseAttackSpeed = this.getBaseAttackSpeed();
double weightedDamage = ItemGeneratorHelper.getWeightedDamage(nbt, Rarity.getRarity(nbt), baseDamage);
double weightedAttackSpeed = ItemGeneratorHelper.getWeightedAttackSpeed(Rarity.getRarity(nbt), baseAttackSpeed);
ItemGeneratorHelper.setMinMaxDamage(nbt, weightedDamage);
nbt.setDouble("AttackSpeed", weightedAttackSpeed);
}
示例14: createSpecial
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public void createSpecial(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
int level = chunkLevel.getChunkLevel();
Rarity.setRarity(nbt, Rarity.LEGENDARY);
nbt.setInteger("Level", level);
ItemGeneratorHelper.setRune(nbt);
// Attributes
WeaponAttribute.INTELLIGENCE.addAttribute(nbt, 3);
WeaponAttribute.WISDOM.addAttribute(nbt, 3);
WeaponAttribute.LIGHTNING.addAttribute(nbt, 5);
// Damage and Attack Speed
double baseDamage = this.getBaseDamage();
double baseAttackSpeed = this.getBaseAttackSpeed();
double weightedDamage = ItemGeneratorHelper.getWeightedDamage(nbt, Rarity.getRarity(nbt), baseDamage);
double weightedAttackSpeed = ItemGeneratorHelper.getWeightedAttackSpeed(Rarity.getRarity(nbt), baseAttackSpeed);
ItemGeneratorHelper.setMinMaxDamage(nbt, weightedDamage);
nbt.setDouble("AttackSpeed", weightedAttackSpeed);
}
示例15: provideChunk
import net.minecraft.util.math.ChunkPos; //導入依賴的package包/類
@Override
public Chunk provideChunk(int x, int z) {
Chunk chunk = this.loadChunk(x, z);
if (chunk == null) {
long i = ChunkPos.asLong(x, z);
try {
chunk = ((IChunkProvider) chunkGenerator).provideChunk(x, z);
}
catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated");
crashreportcategory.addCrashSection("Location",
String.format("%d,%d", new Object[] { Integer.valueOf(x), Integer.valueOf(z) }));
crashreportcategory.addCrashSection("Position hash", Long.valueOf(i));
crashreportcategory.addCrashSection("Generator", chunkGenerator);
throw new ReportedException(crashreport);
}
id2ChunkMap.put(i, chunk);
chunk.onLoad();
}
return chunk;
}