本文整理汇总了Java中net.minecraft.world.Teleporter类的典型用法代码示例。如果您正苦于以下问题:Java Teleporter类的具体用法?Java Teleporter怎么用?Java Teleporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Teleporter类属于net.minecraft.world包,在下文中一共展示了Teleporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changePlayerDimension
import net.minecraft.world.Teleporter; //导入依赖的package包/类
private static boolean changePlayerDimension(EntityPlayerMP player, int dimId, TeleportorType type) {
if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(player, dimId)) {
return false;
}
if (player == null) {
return false;
}
WorldServer world = player.mcServer.getWorld(dimId);
Teleporter teleporter = getTeleporter(world, type);
TeleToroUtil.setInvulnerableDimensionChange(player);
player.timeUntilPortal = 10;
player.mcServer.getPlayerList().transferPlayerToDimension(player, dimId, teleporter);
// player.connection.sendPacket(new SPacketEffect(1032, BlockPos.ORIGIN,
// 0, false));
TeleToroUtil.resetStatusFields(player);
return true;
}
示例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 - 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();
}
}
}
}
示例3: rightClick
import net.minecraft.world.Teleporter; //导入依赖的package包/类
/** Makes portals if config. */
@SubscribeEvent
public void rightClick(RightClickBlock event) {
EntityPlayer player = event.getEntityPlayer();
World world = event.getWorld();
ItemStack stack = event.getItemStack();
Item item = stack.getItem();
BlockPos pos = event.getPos();
if (GeoConfig.compatibility.portals && item == GeoItems.FIREOPAL &&
world instanceof WorldServer) {
new Teleporter((WorldServer) world).makePortal(player);
stack.shrink(1);
}
if (GeoConfig.compatibility.portals && item == GeoItems.AMETHYST) {
Items.ENDER_EYE.onItemUse(player, world, pos,
event.getHand(), event.getFace(), 0, 0, 0);
}
}
示例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 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();
}
}
}
}
示例5: 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();
}
}
}
}
示例6: 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());
}
}
}
}
示例7: 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();
}
}
}
示例8: transferPlayerToDimension
import net.minecraft.world.Teleporter; //导入依赖的package包/类
public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, Teleporter teleporter)
{
int j = p_72356_1_.dimension;
WorldServer worldserver = this.mcServer.worldServerForDimension(p_72356_1_.dimension);
p_72356_1_.dimension = p_72356_2_;
WorldServer worldserver1 = this.mcServer.worldServerForDimension(p_72356_1_.dimension);
p_72356_1_.playerNetServerHandler.sendPacket(new S07PacketRespawn(p_72356_1_.dimension, p_72356_1_.worldObj.difficultySetting, p_72356_1_.worldObj.getWorldInfo().getTerrainType(), p_72356_1_.theItemInWorldManager.getGameType()));
worldserver.removePlayerEntityDangerously(p_72356_1_);
p_72356_1_.isDead = false;
this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter);
this.func_72375_a(p_72356_1_, worldserver);
p_72356_1_.playerNetServerHandler.setPlayerLocation(p_72356_1_.posX, p_72356_1_.posY, p_72356_1_.posZ, p_72356_1_.rotationYaw, p_72356_1_.rotationPitch);
p_72356_1_.theItemInWorldManager.setWorld(worldserver1);
this.updateTimeAndWeatherForPlayer(p_72356_1_, worldserver1);
this.syncPlayerInventory(p_72356_1_);
Iterator iterator = p_72356_1_.getActivePotionEffects().iterator();
while (iterator.hasNext())
{
PotionEffect potioneffect = (PotionEffect)iterator.next();
p_72356_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(p_72356_1_.getEntityId(), potioneffect));
}
FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_);
}
示例9: transferPlayerToDimension
import net.minecraft.world.Teleporter; //导入依赖的package包/类
public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2, Teleporter teleporter)
{
int j = par1EntityPlayerMP.dimension;
WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
par1EntityPlayerMP.dimension = par2;
WorldServer worldserver1 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, worldserver1.getWorldInfo().getTerrainType(), worldserver1.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
worldserver.removePlayerEntityDangerously(par1EntityPlayerMP);
par1EntityPlayerMP.isDead = false;
this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1, teleporter);
this.func_72375_a(par1EntityPlayerMP, worldserver);
par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
par1EntityPlayerMP.theItemInWorldManager.setWorld(worldserver1);
this.updateTimeAndWeatherForPlayer(par1EntityPlayerMP, worldserver1);
this.syncPlayerInventory(par1EntityPlayerMP);
Iterator iterator = par1EntityPlayerMP.getActivePotionEffects().iterator();
while (iterator.hasNext())
{
PotionEffect potioneffect = (PotionEffect)iterator.next();
par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(par1EntityPlayerMP.entityId, potioneffect));
}
GameRegistry.onPlayerChangedDimension(par1EntityPlayerMP);
}
示例10: onCollideWithPlayer
import net.minecraft.world.Teleporter; //导入依赖的package包/类
@Override
public void onCollideWithPlayer(EntityPlayer player) {
if (player.ridingEntity == null && player.riddenByEntity == null && player.timeUntilPortal == 0) {
if (player instanceof EntityPlayerMP) { // && !this.worldObj.isRemote) {
//200 tick duration is ten seconds. There are 20 ticks a second
PotionEffect effect = new PotionEffect(Potion.confusion.id, 200);
player.addPotionEffect(effect);
EntityPlayerMP mpPlayer = (EntityPlayerMP) player;
mpPlayer.timeUntilPortal = 200;
int targetDimension = 0; // 0 = Overworld dimension ID
if (mpPlayer.dimension != ConfigHandler.DIM_ID) {
targetDimension = ConfigHandler.DIM_ID;
}
Teleporter tele = new TeleporterXthuoth(mpPlayer.mcServer.worldServerForDimension(targetDimension));
mpPlayer.mcServer.getConfigurationManager().transferPlayerToDimension(mpPlayer, targetDimension, tele);
}
}
}
示例11: 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());
}
}
}
}
示例12: getDefaultTeleporter
import net.minecraft.world.Teleporter; //导入依赖的package包/类
@Override
public Teleporter getDefaultTeleporter() {
if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
return m_proxyWorld.getDefaultTeleporter();
} else if (m_realWorld != null) {
return m_realWorld.getDefaultTeleporter();
} else {
return super.getDefaultTeleporter();
}
}
示例13: transferPlayerToDimension
import net.minecraft.world.Teleporter; //导入依赖的package包/类
@Override
public void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, Teleporter teleporter) {
if (player instanceof EntityPlayerMPProxy)
{
player = ((EntityPlayerMPProxy)player).getRealPlayer();
}
super.transferPlayerToDimension(player, dimensionIn, teleporter);
}
示例14: transferPlayer
import net.minecraft.world.Teleporter; //导入依赖的package包/类
public boolean transferPlayer(final World world, final int x, final int y, final int z, final Entity entity) {
if (entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP) {
final EntityPlayerMP thePlayer = (EntityPlayerMP)entity;
if (XUHelper.isPlayerFake(thePlayer)) {
return false;
}
final int type = world.getBlockMetadata(x, y, z) >> 1;
if (type == 0) {
if (ExtraUtils.underdarkDimID == 0) {
return false;
}
if (thePlayer.dimension != ExtraUtils.underdarkDimID) {
thePlayer.setLocationAndAngles(x + 0.5, thePlayer.posY, z + 0.5, thePlayer.rotationYaw, thePlayer.rotationPitch);
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, ExtraUtils.underdarkDimID, (Teleporter)new TeleporterUnderdark(thePlayer.mcServer.worldServerForDimension(ExtraUtils.underdarkDimID)));
}
else {
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, (Teleporter)new TeleporterUnderdark(thePlayer.mcServer.worldServerForDimension(0)));
}
return true;
}
else if (type == 1) {
if (ExtraUtils.endoftimeDimID == 0) {
return false;
}
if (thePlayer.dimension != ExtraUtils.endoftimeDimID) {
thePlayer.setLocationAndAngles(x + 0.5, thePlayer.posY, z + 0.5, thePlayer.rotationYaw, thePlayer.rotationPitch);
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, ExtraUtils.endoftimeDimID, (Teleporter)new TeleporterEndOfTime(thePlayer.mcServer.worldServerForDimension(ExtraUtils.endoftimeDimID)));
}
else {
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, (Teleporter)new TeleporterEndOfTime(thePlayer.mcServer.worldServerForDimension(0)));
}
return true;
}
}
return false;
}
示例15: travelToDimension
import net.minecraft.world.Teleporter; //导入依赖的package包/类
/**
* Teleports the entity to another dimension. Params: Dimension number to teleport to, Dungeon true or false if the player was or not in a dungeon
*/
public void travelToDimension(int to_dim, int from_dim)
{
EntityPlayerMP thePlayer;
Teleporter teleporter;
PlayerData data;
thePlayer = (EntityPlayerMP)player;
if ((from_dim == Main.DIM_ID && to_dim == 0) || (from_dim == 0 && to_dim == Main.DIM_ID))
teleporter = new TeleporterDim(thePlayer.mcServer.worldServerForDimension(to_dim));
else
teleporter = new TeleportDungeon(to_dim, from_dim, this);
data = new PlayerData(this);
ServerPlayerBaseMagic.PLAYER_DATA.put(this.getPlayer().getCommandSenderName(), data);
if ((player.ridingEntity == null) && (player.riddenByEntity == null) && ((player instanceof EntityPlayerMP)))
{
if (thePlayer.timeUntilPortal > 0)
thePlayer.timeUntilPortal = 10;
else
{
thePlayer.timeUntilPortal = 10;
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, to_dim, teleporter);
}
this.onRespawn();
}
}