net.minecraft.world.storage.WorldInfo Java Examples

The following examples show how to use net.minecraft.world.storage.WorldInfo. 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: EnvironmentHelper.java    From malmo with MIT License 6 votes vote down vote up
public static void setMissionWeather(MissionInit minit, WorldInfo worldinfo)
{
    ServerSection ss = minit.getMission().getServerSection();
    ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null;
    if (sic != null && sic.getWeather() != null && !sic.getWeather().equalsIgnoreCase("normal"))
    {
        int maxtime = 1000000 * 20; // Max allowed by Minecraft's own Weather Command.
        int cleartime = (sic.getWeather().equalsIgnoreCase("clear")) ? maxtime : 0;
        int raintime = (sic.getWeather().equalsIgnoreCase("rain")) ? maxtime : 0;
        int thundertime = (sic.getWeather().equalsIgnoreCase("thunder")) ? maxtime : 0;

        worldinfo.setCleanWeatherTime(cleartime);
        worldinfo.setRainTime(raintime);
        worldinfo.setThunderTime(thundertime);
        worldinfo.setRaining(raintime + thundertime > 0);
        worldinfo.setThundering(thundertime > 0);
    }
}
 
Example #3
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 #4
Source File: WorldProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
   public void resetRainAndThunder() {

       super.resetRainAndThunder();

       if(this.world.getGameRules().getBoolean("doDaylightCycle"))
       {
           WorldInfo worldInfo = ObfuscationReflectionHelper.getPrivateValue(DerivedWorldInfo.class, (DerivedWorldInfo) world.getWorldInfo(), "theWorldInfo", "field_76115_a");
           long i = worldInfo.getWorldTime() + 24000L;
           worldInfo.setWorldTime(i - i % 24000L);
       }
   }
 
Example #5
Source File: DummyWorld.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public DummyWorld() {
    super(new DummySaveHandler(), new WorldInfo(DEFAULT_SETTINGS, "DummyServer"), new WorldProviderSurface(), new Profiler(), false);
    // Guarantee the dimension ID was not reset by the provider
    this.provider.setDimension(Integer.MAX_VALUE);
    int providerDim = this.provider.getDimension();
    this.provider.setWorld(this);
    this.provider.setDimension(providerDim);
    this.chunkProvider = this.createChunkProvider();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(30000000);
}
 
Example #6
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License 5 votes vote down vote up
public DummyWorld(WorldSettings settings) {
	super(new DummySaveHandler(),
	      new WorldInfo(settings, "DummyWorld"),
	      new WorldProviderSurface(), null, true);
	provider.setWorld(this);
	player = new DummyPlayerSP(this);
}
 
Example #7
Source File: WorldLoaded.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
public WorldLoaded(ServerWorld world) {
    WorldInfo info = world.getWorldInfo();
    this.dimensionId = DimensionId.from(world.getDimension().getType());
    this.seed = info.getSeed();
    this.spawnX = info.getSpawnX();
    this.spawnZ = info.getSpawnZ();
}
 
Example #8
Source File: WorldSaveRow.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
@Override
public void done() {
    String fileName = this.worldSummary.getFileName();
    WorldInfo worldInfo = saveLoader.getWorldInfo(fileName);
    long seed = worldInfo.getSeed();
    ClientInterop.saveLoaded(fileName, seed);
}
 
Example #9
Source File: FakeWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void saveWorldInfo(WorldInfo p_75761_1_) {
}
 
Example #10
Source File: WorldProviderPaths.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockPos getSpawnPoint()
{
	WorldInfo info = this.world.getWorldInfo();
	return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ());
}
 
Example #11
Source File: FakeWorldServer.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WorldInfo loadWorldInfo() {

    return null;
}
 
Example #12
Source File: WorldDummy.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public WorldDummy(Profiler p_i45368_5_, StorageChunk storage) {
	super(new DummySaveHandler(), new WorldInfo(new NBTTagCompound()), dummyProvider, p_i45368_5_, false);
	this.storage = storage;
	this.chunkProvider = new ChunkProviderDummy(this);
}
 
Example #13
Source File: DummySaveHandler.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void saveWorldInfoWithPlayer(WorldInfo p_75755_1_,
		NBTTagCompound p_75755_2_) {
	
}
 
Example #14
Source File: DummySaveHandler.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public WorldInfo loadWorldInfo() {
	return new WorldInfo(DimensionManager.getWorld(0).getWorldInfo());
}
 
Example #15
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public BiomeProviderTofu(WorldInfo info)
{
    this(info.getSeed(), info.getTerrainType());
}
 
Example #16
Source File: FakeWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void saveWorldInfoWithPlayer(WorldInfo p_75755_1_, NBTTagCompound p_75755_2_) {
}
 
Example #17
Source File: FakeWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public WorldInfo loadWorldInfo() {
    return FakeWorldInfo.instance;
}
 
Example #18
Source File: HyperiumWorld.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getHorizon(WorldInfo worldInfo) {
    return Settings.VOID_FLICKER_FIX ? 0.0 : worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D;
}
 
Example #19
Source File: WrapperWorldInfo.java    From ClientBase with MIT License 4 votes vote down vote up
public WorldInfo unwrap() {
    return this.real;
}
 
Example #20
Source File: WrapperWorldInfo.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperWorldInfo(WorldInfo var1) {
    this.real = var1;
}
 
Example #21
Source File: DummySaveHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void saveWorldInfo(WorldInfo worldInformation) {
}
 
Example #22
Source File: DummySaveHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) {
}
 
Example #23
Source File: DummySaveHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public WorldInfo loadWorldInfo() {
    return null;
}
 
Example #24
Source File: DummySaveHandler.java    From AdvancedRocketry with MIT License 2 votes vote down vote up
@Override
public void saveWorldInfo(WorldInfo p_75761_1_) {
	
}
 
Example #25
Source File: FakeWorldServer.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void saveWorldInfoWithPlayer(WorldInfo p_75755_1_, NBTTagCompound p_75755_2_) {

}
 
Example #26
Source File: FakeWorldServer.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void saveWorldInfo(WorldInfo p_75761_1_) {

}
 
Example #27
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License votes vote down vote up
public WorldInfo loadWorldInfo() { return null; } 
Example #28
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License votes vote down vote up
public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) {  } 
Example #29
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License votes vote down vote up
public void saveWorldInfo(WorldInfo worldInformation) {  }