Temporary fix for the "Waiting for chunk..." lag

This commit is contained in:
Runemoro 2018-01-02 04:10:01 -05:00
parent 21e0003871
commit 3ea7e958f0
4 changed files with 14 additions and 14 deletions

View file

@ -77,6 +77,6 @@ public class VirtualLocation {
}
public Location projectToWorld() {
return transformDepth(0).location;
return new Location(0, transformDepth(0).getPos());
}
}

View file

@ -6,7 +6,6 @@ import org.dimdev.ddutils.Location;
import org.dimdev.ddutils.TeleportUtils;
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderDungeonPocket;
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPublicPocket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.SharedMonsterAttributes;
@ -207,20 +206,20 @@ public class EntityMonolith extends EntityFlying implements IMob {
/**
* Plays sounds at different levels of aggro, using soundTime to prevent too many sounds at once.
*
* @param entityPlayer
* @param player
*/
private void playSounds(EntityPlayer entityPlayer) {
private void playSounds(EntityPlayer player) {
float aggroPercent = getAggroProgress();
if (soundTime <= 0) {
playSound(ModSounds.MONK, 1F, 1F);
soundTime = 100;
}
if (aggroPercent > 0.70 && soundTime < 100) {
world.playSound(entityPlayer, entityPlayer.getPosition(), ModSounds.TEARING, SoundCategory.HOSTILE, 1F, (float) (1 + rand.nextGaussian()));
world.playSound(player, player.getPosition(), ModSounds.TEARING, SoundCategory.HOSTILE, 1F, (float) (1 + rand.nextGaussian()));
soundTime = 100 + rand.nextInt(75);
}
if (aggroPercent > 0.80 && soundTime < MAX_SOUND_COOLDOWN) {
world.playSound(entityPlayer, entityPlayer.getPosition(), ModSounds.TEARING, SoundCategory.HOSTILE, 7, 1F);
world.playSound(player, player.getPosition(), ModSounds.TEARING, SoundCategory.HOSTILE, 7, 1F);
soundTime = 250;
}
soundTime--;
@ -272,13 +271,9 @@ public class EntityMonolith extends EntityFlying implements IMob {
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(this, new AxisAlignedBB(posX - 15, posY - 4, posZ - 15, posX + 15, posY + 15, posZ + 15));
if (world.provider instanceof WorldProviderLimbo) {
if (list.size() > 0) {
return false;
}
} else if (world.provider instanceof WorldProviderPublicPocket) { // TODO
if (list.size() > 5 || world.canBlockSeeSky(new BlockPos(posX, posY, posZ))) {
return false;
}
return list.size() <= 0;
} else if (world.provider instanceof WorldProviderDungeonPocket) { // TODO
return list.size() <= 5 && !world.canBlockSeeSky(new BlockPos(posX, posY, posZ));
}
return true;

View file

@ -2,6 +2,7 @@ package org.dimdev.dimdoors.shared.rifts;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.VirtualLocation;
import org.dimdev.dimdoors.shared.world.ModDimensions;
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import org.dimdev.ddutils.Location;
import org.dimdev.ddutils.TeleportUtils;
@ -29,6 +30,10 @@ public class EscapeDestination extends RiftDestination {
@Override
public boolean teleport(TileEntityRift rift, Entity entity) {
if (!ModDimensions.isDimDoorsPocketDimension(entity.world)) {
DimDoors.chat(entity, "Can't escape from a non-pocket dimension!");
return false;
}
String uuid = entity.getCachedUniqueIdString();
if (uuid != null) {
Location destLoc = RiftRegistry.getOverworldRift(uuid);

View file

@ -16,7 +16,7 @@ public abstract class WorldProviderPocket extends WorldProvider {
@Override
public void init() {
// TODO: save pocket registry nbt here? (see WorldProviderEnd)
hasSkyLight = true;
hasSkyLight = false; // TODO: this is only a temporary fix
DimDoors.proxy.setCloudRenderer(this, new CloudRenderBlank());
}