Java Code Examples for net.minecraft.world.World#getWorldInfo()

The following examples show how to use net.minecraft.world.World#getWorldInfo() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack heldStack = player.getHeldItem(hand);

    if (!player.capabilities.isCreativeMode) heldStack.shrink(1);

    world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_SKELETON_DEATH, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!world.isRemote) {
        WorldInfo worldinfo = world.getWorldInfo();
        worldinfo.setCleanWeatherTime(0);
        worldinfo.setRainTime(1200);
        worldinfo.setThunderTime(1200);
        worldinfo.setRaining(true);
        worldinfo.setThundering(false);
    } else player.sendMessage(new TextComponentString("Dark clouds start forming in the sky"));

    return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, heldStack);
}
 
Example 2
Source Project: malmo   File: FlatWorldGeneratorImplementation.java    License: MIT License 6 votes vote down vote up
@Override
public boolean shouldCreateWorld(MissionInit missionInit, World world)
{
	if (this.fwparams != null && this.fwparams.isForceReset())
	    return true;
	
    if (Minecraft.getMinecraft().world == null || world == null)
        return true;    // Definitely need to create a world if there isn't one in existence!

    WorldInfo worldInfo =  world.getWorldInfo();
    if (worldInfo == null)
        return true;

    String genOptions = worldInfo.getGeneratorOptions();
    if (genOptions == null)
        return true;

    if (!genOptions.equals(this.fwparams.getGeneratorString()))
        return true;    // Generation doesn't match, so recreate.
    
    return false;
}
 
Example 3
public ShipStorage(BlockPos bp, World hostWorld) {
	super(hostWorld.getSaveHandler(), hostWorld.getWorldInfo(), hostWorld.provider, hostWorld.profiler,
			hostWorld.isRemote);
	blockMap = new HashMap<BlockPos, BlockStorage>();
	offset = bp;
	tesrs = new ArrayList<TileEntity>();
	host = hostWorld;
}
 
Example 4
private FakeWorldServer(World world) {

        super(MinecraftServer.getServer(), new NonSavingHandler(), world.getWorldInfo().getWorldName(), world.provider.dimensionId,
                new WorldSettings(world.getWorldInfo()), world.theProfiler);
        DimensionManager.setWorld(world.provider.dimensionId, (WorldServer) world);

        chunkProvider = world.getChunkProvider();
    }
 
Example 5
public VoidWorldBiomeProvider(World world)
{
    super(world.getWorldInfo());
    this.world = world;
}