本文整理汇总了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;
}
示例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");
}
}
}
}
}
}
示例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
}
}
}
}
示例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);}
);
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例12: getWorld
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public World getWorld()
{
if (this.world == null)
{
this.world = DimensionManager.getWorld(getDimId());
}
return this.world;
}
示例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;
}
示例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;
}
示例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);
}