当前位置: 首页>>代码示例>>Java>>正文


Java DimensionManager.getWorld方法代码示例

本文整理汇总了Java中net.minecraftforge.common.DimensionManager.getWorld方法的典型用法代码示例。如果您正苦于以下问题:Java DimensionManager.getWorld方法的具体用法?Java DimensionManager.getWorld怎么用?Java DimensionManager.getWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.DimensionManager的用法示例。


在下文中一共展示了DimensionManager.getWorld方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAllowedToEdit

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private boolean isAllowedToEdit(EntityPlayer player, ItemStack remote) {
    NBTTagCompound tag = remote.getTagCompound();
    if (tag != null) {
        if (tag.hasKey("securityX")) {
            int x = tag.getInteger("securityX");
            int y = tag.getInteger("securityY");
            int z = tag.getInteger("securityZ");
            int dimensionId = tag.getInteger("securityDimension");
            WorldServer world = DimensionManager.getWorld(dimensionId);
            if (world != null) {
                TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
                if (te instanceof TileEntitySecurityStation) {
                    boolean canAccess = ((TileEntitySecurityStation) te).doesAllowPlayer(player);
                    if (!canAccess) {
                        player.sendStatusMessage(new TextComponentTranslation("gui.remote.noEditRights", x, y, z), false);
                    }
                    return canAccess;
                }
            }
        }
    }
    return true;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:24,代码来源:ItemRemote.java

示例2: onUpdate

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack remote, World worl, Entity entity, int slot, boolean holdingItem) {
    if (!worl.isRemote) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag != null) {
            if (tag.hasKey("securityX")) {
                int x = tag.getInteger("securityX");
                int y = tag.getInteger("securityY");
                int z = tag.getInteger("securityZ");
                int dimensionId = tag.getInteger("securityDimension");
                WorldServer world = DimensionManager.getWorld(dimensionId);
                if (world != null) {
                    TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
                    if (!(te instanceof TileEntitySecurityStation)) {
                        tag.removeTag("securityX");
                        tag.removeTag("securityY");
                        tag.removeTag("securityZ");
                        tag.removeTag("securityDimension");
                    }
                }
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:25,代码来源:ItemRemote.java

示例3: startNewDay

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public void startNewDay() {
    if (oldHandler != null) oldHandler.startNewDay(); //Start the new day

    if (FirstAidConfig.externalHealing.sleepHealing == 0F) return;

    WorldSleepState sleepState = Morpheus.playerSleepStatus.get(0);
    if (sleepState == null) return;

    if (areEnoughPlayersAsleep(sleepState)) {
        World world = DimensionManager.getWorld(0);
        for (EntityPlayer player : world.playerEntities) {
            if (player.isPlayerFullyAsleep()) {
                HealthDistribution.distributeHealth(FirstAid.activeHealingConfig.sleepHealing, player, true); //heal the player who did sleep
            }
        }
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:19,代码来源:MorpheusHelper.java

示例4: handleData

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public void handleData(NBTTagCompound data)
{
	Biome b = Biome.getBiome(data.getInteger("biomeID"));
	DimBlockPos dbp = SerializationUtils.deserialize(data.getByteArray("blockPosData"));
	if (MC.getSide() == Side.CLIENT)
	{
		VoidApi.proxy.getClientListener().addScheduledTask(() -> {
				if (VoidApi.proxy.getClientWorld().isBlockLoaded(dbp.pos))
					ChunkUtils.setBiomeAt(b, dbp.pos, VoidApi.proxy.getClientWorld());}
		);
	}
	else
	{
		WorldServer ws = DimensionManager.getWorld(dbp.dim);
		ws.addScheduledTask(() -> {
				if (ws.isBlockLoaded(dbp.pos))
					ChunkUtils.setBiomeAt(b, dbp.pos, ws);}
		);
	}
}
 
开发者ID:V0idWa1k3r,项目名称:VoidApi,代码行数:22,代码来源:HandlerBiome.java

示例5: set

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public void set(GlobalChunkPos pos, float value)
{
    if (loaded.containsKey(pos))
        if (loaded.get(pos).equals(value))
            return;
    loaded.put(pos, value);
    WorldServer wrld = DimensionManager.getWorld(pos.getDimension());
    wrld.getChunkFromChunkCoords(pos.getX(), pos.getZ()).markDirty();
    PlayerChunkMapEntry map = wrld.getPlayerChunkMap().getEntry(pos.getX(), pos.getZ());
    if (map != null)
    {
        for (EntityPlayerMP p : map.players)
        {
            NetworkManager.sendTo(new CPacketSyncSif(pos, value), p);
        }
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:19,代码来源:SifStorageServer.java

示例6: unregisterCustomDimensions

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public void unregisterCustomDimensions()
{
    Set<Integer> toRemove = new HashSet<Integer>();

    for (int dimension : this.registeredDimensions)
    {
        if (dimension != 0 && DimensionManager.isDimensionRegistered(dimension) && DimensionManager.getWorld(dimension) == null)
        {
            JustEnoughDimensions.logInfo("Unregistering dimension {}...", dimension);
            DimensionManager.unregisterDimension(dimension);
            toRemove.add(dimension);
        }
    }

    this.registeredDimensions.removeAll(toRemove);
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:17,代码来源:DimensionConfig.java

示例7: deleteDimension

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public void deleteDimension(ICommandSender sender, int dimensionID)
{
	if (!dimensionInfo.containsKey(dimensionID))
	{
		sender.sendMessage(new TextComponentString("The dimension associated with that id is not from the SimpleDimensions mod").setStyle(new Style().setColor(TextFormatting.RED)));
		return;
	}

	World worldObj = DimensionManager.getWorld(dimensionID);

	if (worldObj.playerEntities.size() > 0)
	{
		sender.sendMessage(new TextComponentString("Can't delete a dimension with players inside it").setStyle(new Style().setColor(TextFormatting.RED)));
		return;
	}

	Entity entitySender = sender.getCommandSenderEntity();
	toBeDeleted.put(dimensionID, entitySender != null ? entitySender.getUniqueID() : null);

	DimensionManager.unloadWorld(dimensionID);
}
 
开发者ID:lumien231,项目名称:Simple-Dimensions,代码行数:22,代码来源:DimensionHandler.java

示例8: call

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
void call(String[] args) {
    DSTeleporter tp = getTp();
    int targetDimId = 0;
    if (args.length == 1) {
        targetDimId = Integer.parseInt(args[0]);
    }
    World w = DimensionManager.getWorld(targetDimId);
    BlockPos target = player.getBedLocation(targetDimId);
    if (target == null) {
        target = w.getSpawnPoint(); 
    }
    if (target != null) {
        tp.destination.set(target);
    }
    manager.transferPlayerToDimension(player, 0, tp);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:18,代码来源:FZDSCommand.java

示例9: onMessage

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public IMessage onMessage(ArmourStandInteractMessage message, MessageContext ctx) {
	World world = DimensionManager.getWorld(message.dimID);
	EntityArmourStand stand = (EntityArmourStand) world.getEntityByID(message.standID);
	EntityPlayer player = (EntityPlayer) world.getEntityByID(message.playerID);

	stand.interact(player, message.hitPos);
	return null;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:10,代码来源:ArmourStandInteractHandler.java

示例10: getManager

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Nonnull
public static CleanAirManager getManager() {
    WorldServer world = DimensionManager.getWorld(0);
    if (instance != null) {
        return instance;
    }
    instance = (CleanAirManager) world.loadData(CleanAirManager.class, NAME);
    if (instance == null) {
        instance = new CleanAirManager(NAME);
    }
    return instance;
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:13,代码来源:CleanAirManager.java

示例11: getWorld

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
 * Get world instance by dimension name or id, case insensitive
 * @param dimension Dimension name or id
 * @return World instance
 */
public static UWorld getWorld(String dimension) {
    for (int dim : DimensionManager.getStaticDimensionIDs()) {
        if (DimensionManager.getWorld(dim) == null) {
            DimensionManager.initDimension(dim);
        }
    }
    for (World world : DimensionManager.getWorlds()) {
        UWorld uWorld = new UWorld(world);
        if (uWorld.getDimensionName().equalsIgnoreCase(dimension) || String.valueOf(uWorld.getDimensionID()).equalsIgnoreCase(dimension)) {
            return uWorld;
        }
    }
    return null;
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:20,代码来源:UWorld.java

示例12: getWorld

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public World getWorld()
{
    if (this.world == null)
    {
        this.world = DimensionManager.getWorld(getDimId());
    }
    return this.world;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:BlockSnapshot.java

示例13: isPlayerLeader_2

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private static boolean isPlayerLeader_2(int worldID, int entityID)
{
	//List players = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
	//List players = MinecraftServer.getServer().getPlayerList();
	World world = DimensionManager.getWorld(worldID);

	if (world == null) { return false; }	// Don't know where you are.

	List players = world.playerEntities;

	if (players.isEmpty()) { return false; }	// No players? Who called this? D:

	Iterator<EntityPlayerMP> it = players.iterator();
	EntityPlayerMP player;

	while (it.hasNext())
	{
		player = it.next();

		if (player.getEntityId() == entityID)
		{
			// Found 'em!
			if (TerritoryHandler.getFactionPlayerIsLeaderOf(player) == null)
			{
				return false;
			}
			else
			{
				return true;
			}
		}
		// else, not the one I'm looking for
	}

	return false;
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:37,代码来源:ServerHelper.java

示例14: tick

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public void tick() {
    save();
    List<ActionOptions> newlist = new ArrayList<>();
    Map<Integer, ActionOptions> newmap = new HashMap<>();
    for (ActionOptions option : options) {
        EntityMeeCreeps meeCreep = findMeeCreep(DimensionManager.getWorld(0), option.getActionId());
        boolean keep = true;

        World world = meeCreep == null ? DimensionManager.getWorld(option.getDimension()) : meeCreep.getEntityWorld();
        BlockPos meeCreepPos = meeCreep == null ? option.getTargetPos() : meeCreep.getPosition();
        if (world != null && world.isBlockLoaded(meeCreepPos)) {
            if (!option.tick(world)) {
                keep = false;
            }
        } else {
            if (option.getStage() != Stage.OPENING_GUI && option.getStage() != Stage.WAITING_FOR_PLAYER_INPUT && option.getStage() != Stage.WAITING_FOR_SPAWN) {
                keep = false;
            }
        }
        if (meeCreep != null) {
            stayWithPlayer(option, meeCreep);
        } else if (option.getStage() != Stage.OPENING_GUI && option.getStage() != Stage.WAITING_FOR_PLAYER_INPUT && option.getStage() != Stage.WAITING_FOR_SPAWN) {
            keep = false;
        }

        if (keep) {
            newlist.add(option);
            newmap.put(option.getActionId(), option);
        } else if (world != null) {
            dropRemainingDrops(option, world);
        }
    }
    options = newlist;
    optionMap = newmap;
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:36,代码来源:ServerActionManager.java

示例15: getWorld

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public World getWorld(int dim) {
	if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
		return Minecraft.getMinecraft().world != null && Minecraft.getMinecraft().world.provider.getDimension() == dim ? Minecraft.getMinecraft().world : null;
	else
		return DimensionManager.getWorld(dim);
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:8,代码来源:ClientProxy.java


注:本文中的net.minecraftforge.common.DimensionManager.getWorld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。