本文整理汇总了Java中net.minecraft.world.Teleporter.PortalPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Teleporter.PortalPosition方法的具体用法?Java Teleporter.PortalPosition怎么用?Java Teleporter.PortalPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.Teleporter
的用法示例。
在下文中一共展示了Teleporter.PortalPosition方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
/**
* called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
* WorldServer.getTotalWorldTime() value.
*/
@Override
public void removeStalePortalLocations(long worldTime)
{
if (worldTime % 100L == 0L)
{
long i = worldTime - 300L;
ObjectIterator<Teleporter.PortalPosition> objectiterator = this.destinationCoordinateCache.values().iterator();
while (objectiterator.hasNext())
{
Teleporter.PortalPosition teleporter$portalposition = (Teleporter.PortalPosition)objectiterator.next();
if (teleporter$portalposition == null || teleporter$portalposition.lastUpdateTime < i)
{
objectiterator.remove();
}
}
}
}
示例2: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
/**
* called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
* WorldServer.getTotalWorldTime() value.
*/
@Override
public void removeStalePortalLocations(long worldTime)
{
if (worldTime % 100L == 0L)
{
long i = worldTime - 600L;
ObjectIterator<Teleporter.PortalPosition> objectiterator = this.destinationCoordinateCache.values().iterator();
while (objectiterator.hasNext())
{
Teleporter.PortalPosition teleporter$portalposition = (Teleporter.PortalPosition)objectiterator.next();
if (teleporter$portalposition == null || teleporter$portalposition.lastUpdateTime < i)
{
objectiterator.remove();
}
}
}
}
示例3: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
/**
* called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
* WorldServer.getTotalWorldTime() value.
*/
@Override
public void removeStalePortalLocations(long worldTime) {
if (worldTime % 100L == 0L) {
long i = worldTime - 300L;
ObjectIterator<Teleporter.PortalPosition> objectiterator = this.destinationCoordinateCache.values().iterator();
while (objectiterator.hasNext()) {
Teleporter.PortalPosition teleporter$portalposition = (Teleporter.PortalPosition)objectiterator.next();
if (teleporter$portalposition == null || teleporter$portalposition.lastUpdateTime < i) {
objectiterator.remove();
}
}
}
}
示例4: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
/**
* called periodically to remove out-of-date portal locations from the cache
* list. Argument par1 is a WorldServer.getTotalWorldTime() value.
*/
@Override
public void removeStalePortalLocations(long p_85189_1_) {
if (p_85189_1_ % 100L == 0L) {
Iterator iterator = this.destinationCoordinateKeys.iterator();
long j = p_85189_1_ - 600L;
while (iterator.hasNext()) {
Long olong = (Long) iterator.next();
Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue());
if (portalposition == null || portalposition.lastUpdateTime < j) {
iterator.remove();
this.destinationCoordinateCache.remove(olong.longValue());
}
}
}
}
示例5: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void removeStalePortalLocations(long worldTime)
{
if (worldTime % 100L == 0L)
{
long i = worldTime - 300L;
ObjectIterator<Teleporter.PortalPosition> objectiterator = destinationCoordinateCache.values().iterator();
while (objectiterator.hasNext())
{
Teleporter.PortalPosition teleporter$portalposition = objectiterator.next();
if (teleporter$portalposition == null || teleporter$portalposition.lastUpdateTime < i)
objectiterator.remove();
}
}
}
示例6: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
public void removeStalePortalLocations(long par1) {
if (par1 % 100L == 0L) {
Iterator<Long> iterator = this.destinationCoordinateKeys.iterator();
long j = par1 - 600L;
while (iterator.hasNext()) {
Long olong = (Long)iterator.next();
Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue());
if (portalposition == null || portalposition.lastUpdateTime < j) {
iterator.remove();
this.destinationCoordinateCache.remove(olong.longValue());
}
}
}
}
示例7: readCachedPortal
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
private void readCachedPortal(PortalSearchState search) {
Teleporter.PortalPosition portalposition = destinationCoordinateCache.get(search.longXZPair);
search.distance = 0.0D;
search.portalPos = portalposition;
portalposition.lastUpdateTime = world.getTotalWorldTime();
search.notCached = false;
}
示例8: removeStalePortalLocations
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
@Override
public void removeStalePortalLocations(long totalWorldTime) {
if(totalWorldTime % 100L == 0L) {
Iterator iterator = destinationCoordinateKeys.iterator();
long j = totalWorldTime - 600L;
while(iterator.hasNext()) {
Long olong = (Long) iterator.next();
Teleporter.PortalPosition position = (Teleporter.PortalPosition) destinationCoordinateCache.getValueByKey(olong.longValue());
if(position == null || position.lastUpdateTime < j) {
iterator.remove();
destinationCoordinateCache.remove(olong.longValue());
}
}
}
}
示例9: placeInExistingPortal
import net.minecraft.world.Teleporter; //导入方法依赖的package包/类
@Override
public boolean placeInExistingPortal(Entity entityIn, float rotationYaw)
{
boolean flag = true;
int playerX = MathHelper.floor(entityIn.posX);
int playerZ = MathHelper.floor(entityIn.posZ);
boolean shouldAddPortalPosition = true;
boolean foundPortal = false;
BlockPos object = new BlockPos(entityIn);
long k = ChunkPos.asLong(playerX, playerZ);
IslandMap islandMap = Core.getMapForWorld(worldServerInstance, entityIn.getPosition());
Center closest = islandMap.getClosestCenter(new Point((playerX*8) % 4096,(playerZ*8) % 4096));
//Check if we already have a portal position cached here
if (this.destinationCoordinateCache.containsKey(k))
{
Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition)this.destinationCoordinateCache.get(k);
object = portalposition;
portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
shouldAddPortalPosition = false;
}
else //If not then we do a simple search for the closest portal block
{
object = this.findPortal(new BlockPos(entityIn));
}
//If we found a portal location then we need to move the player to it
if (object != null)
{
if (shouldAddPortalPosition)
{
this.destinationCoordinateCache.put(k, new Teleporter.PortalPosition((BlockPos)object, this.worldServerInstance.getTotalWorldTime()));
//this.destinationCoordinateKeys.add(Long.valueOf(k));
}
EnumFacing enumfacing = null;
BlockPos pos = object;
PortalAttribute attr = (PortalAttribute) closest.getAttribute(Attribute.Portal);
if(this.checkRoomForPlayer(pos.north()))
pos = pos.north();
else if(this.checkRoomForPlayer(pos.south()))
pos = pos.south();
else if(this.checkRoomForPlayer(pos.east()))
pos = pos.east();
else if(this.checkRoomForPlayer(pos.west()))
pos = pos.west();
entityIn.setLocationAndAngles(pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, rotationYaw, entityIn.rotationPitch);
return true;
}
else
{
return false;
}
}