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

The following examples show how to use net.minecraft.world.World#getWorldInfo() . 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 check out the related API usage on the sidebar.
Example 1
Source File: ItemRainStick.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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 File: FlatWorldGeneratorImplementation.java    From malmo with 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
Source File: ShipStorage.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
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
Source File: FakeWorldServer.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: VoidWorldBiomeProvider.java    From YUNoMakeGoodMap with Apache License 2.0 4 votes vote down vote up
public VoidWorldBiomeProvider(World world)
{
    super(world.getWorldInfo());
    this.world = world;
}