universe cleanup
This commit is contained in:
parent
9b5eab4f57
commit
e289dc7d5b
41 changed files with 440 additions and 599 deletions
|
@ -27,7 +27,7 @@ public class EntityAIMoveIndoors extends EntityAIBase
|
|||
{
|
||||
BlockPos blockpos = new BlockPos(this.entityObj);
|
||||
|
||||
if ((!((AWorldServer)this.entityObj.worldObj).isDaytime() /* || this.entityObj.worldObj.isRaining() && !this.entityObj.worldObj.getBiomeGenForCoords(blockpos).canRain() */) && !this.entityObj.worldObj.dimension.hasNoLight())
|
||||
if ((!((AWorldServer)this.entityObj.worldObj).isDaytime() /* || this.entityObj.worldObj.isRaining() && !this.entityObj.worldObj.getBiomeGenForCoords(blockpos).canRain() */) && this.entityObj.worldObj.dimension.hasSkyLight())
|
||||
{
|
||||
if (this.entityObj.getRNG().zrange(50) != 0)
|
||||
{
|
||||
|
|
|
@ -53,11 +53,11 @@ public class BlockDaylightDetector extends Block implements ITileEntityProvider
|
|||
|
||||
public void updatePower(AWorldServer worldIn, BlockPos pos)
|
||||
{
|
||||
if (!worldIn.dimension.hasNoLight())
|
||||
if (worldIn.dimension.hasSkyLight() && worldIn.dimension.hasDaylight())
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
int i = worldIn.getLightFor(LightType.SKY, pos) - worldIn.getSkylightSubtracted();
|
||||
float f = worldIn.getCelestialAngleRadians(1.0F);
|
||||
float f = worldIn.getDayPhase(1.0F);
|
||||
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
|
||||
f = f + (f1 - f) * 0.2F;
|
||||
i = Math.round((float)i * ExtMath.cos(f));
|
||||
|
|
|
@ -23,4 +23,12 @@ public final class Area extends Dimension {
|
|||
public final DimType getType() {
|
||||
return DimType.AREA;
|
||||
}
|
||||
|
||||
public boolean hasVoidFog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasSky() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,31 +5,18 @@ import java.util.Map;
|
|||
import common.collect.Maps;
|
||||
|
||||
public enum DimType {
|
||||
STAR("star", true, false, false, false, false, true),
|
||||
PLANET("planet", true, true, true, true, true, true),
|
||||
MOON("moon", true, false, false, true, false, true),
|
||||
SPACE("space", false, false, false, false, false, true),
|
||||
SEMI("semi", false, false, true, false, true, true),
|
||||
AREA("area", false, false, false, false, false, false);
|
||||
STAR("star"),
|
||||
PLANET("planet"),
|
||||
MOON("moon"),
|
||||
SEMI("semi"),
|
||||
AREA("area");
|
||||
|
||||
private static final Map<String, DimType> LOOKUP = Maps.newHashMap();
|
||||
|
||||
private final String name;
|
||||
public final boolean celestial;
|
||||
public final boolean days;
|
||||
public final boolean weather;
|
||||
public final boolean celestials;
|
||||
public final boolean clouds;
|
||||
public final boolean sky;
|
||||
|
||||
private DimType(String name, boolean time, boolean days, boolean weather, boolean celestials, boolean clouds, boolean sky) {
|
||||
private DimType(String name) {
|
||||
this.name = name;
|
||||
this.celestial = time;
|
||||
this.days = days;
|
||||
this.weather = weather;
|
||||
this.celestials = celestials;
|
||||
this.clouds = clouds;
|
||||
this.sky = sky;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -20,7 +20,7 @@ import common.world.State;
|
|||
import common.world.Weather;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class Dimension extends Nameable {
|
||||
public abstract class Dimension extends Section {
|
||||
public class GeneratorSettings {
|
||||
public float coordinateScale = 684.412F;
|
||||
public float heightScale = 684.412F;
|
||||
|
@ -779,6 +779,35 @@ public abstract class Dimension extends Nameable {
|
|||
public boolean isBaseDestroyed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasVoidFog() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSeasons() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasDaylight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSkyLight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isCelestial() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasWeather() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSky() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public final int getSunColor() {
|
||||
return this.sunColor != 0xffffffff ? this.sunColor : this.calcSunColor();
|
||||
|
@ -857,10 +886,6 @@ public abstract class Dimension extends Nameable {
|
|||
return this.populated;
|
||||
}
|
||||
|
||||
|
||||
public final boolean hasNoLight() {
|
||||
return !this.getType().days;
|
||||
}
|
||||
|
||||
public final void setBaseNames(String[] names) {
|
||||
this.baseNames = names;
|
||||
|
@ -869,6 +894,8 @@ public abstract class Dimension extends Nameable {
|
|||
public final String[] getBaseNames() {
|
||||
if(this.baseNames != null)
|
||||
return this.baseNames;
|
||||
if(this == Space.INSTANCE)
|
||||
return new String[0];
|
||||
String planet = null;
|
||||
String star = null;
|
||||
Dimension dim = this;
|
||||
|
@ -898,7 +925,7 @@ public abstract class Dimension extends Nameable {
|
|||
|
||||
|
||||
public static Dimension create(DimType type) {
|
||||
if(type == null || type == DimType.SPACE)
|
||||
if(type == null)
|
||||
return null;
|
||||
switch(type) {
|
||||
case STAR:
|
||||
|
@ -916,6 +943,8 @@ public abstract class Dimension extends Nameable {
|
|||
}
|
||||
|
||||
public final Dimension makeCustomCopy() {
|
||||
if(this == Space.INSTANCE)
|
||||
return null;
|
||||
Dimension dim = create(this.getType());
|
||||
TagObject tag = new TagObject();
|
||||
this.toTags(tag);
|
||||
|
@ -938,7 +967,7 @@ public abstract class Dimension extends Nameable {
|
|||
tag.setBool("Exterminated", this.exterminated);
|
||||
if(this.isCustom())
|
||||
this.toTags(tag);
|
||||
if(!this.exterminated && this.getType().weather)
|
||||
if(!this.exterminated && this.hasWeather())
|
||||
tag.setString("Weather", this.weather.getName());
|
||||
return tag;
|
||||
}
|
||||
|
@ -962,7 +991,7 @@ public abstract class Dimension extends Nameable {
|
|||
if(this.exterminated) {
|
||||
this.weather = Weather.CLEAR;
|
||||
}
|
||||
else if(this.getType().weather) {
|
||||
else if(this.hasWeather()) {
|
||||
this.weather = Weather.getByName(tag.getString("Weather"));
|
||||
if(this.weather == null)
|
||||
this.weather = this.defaultWeather;
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package common.dimension;
|
||||
|
||||
public final class Domain extends Nameable implements Comparable<Domain> {
|
||||
public final String id;
|
||||
|
||||
public Domain(String id, boolean custom) {
|
||||
public final class Domain extends Section {
|
||||
public Domain(boolean custom) {
|
||||
super(custom);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int compareTo(Domain other) {
|
||||
return other == null ? -1 : this.id.compareTo(other.id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package common.dimension;
|
||||
|
||||
public final class Galaxy extends Nameable implements Comparable<Galaxy> {
|
||||
public final String id;
|
||||
|
||||
public Galaxy(String id, boolean custom) {
|
||||
public final class Galaxy extends Section {
|
||||
public Galaxy(boolean custom) {
|
||||
super(custom);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int compareTo(Galaxy other) {
|
||||
return other == null ? -1 : this.id.compareTo(other.id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,4 +51,12 @@ public final class Moon extends Dimension {
|
|||
public boolean isBaseDestroyed() {
|
||||
return (this.getSunColor() & 0xff000000) != 0;
|
||||
}
|
||||
|
||||
public boolean hasVoidFog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCelestial() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,28 @@ public final class Planet extends Dimension {
|
|||
public boolean isBaseDestroyed() {
|
||||
return (this.getSunColor() & 0xff000000) != 0;
|
||||
}
|
||||
|
||||
public boolean hasVoidFog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasSeasons() {
|
||||
return this.getOrbitOffset() != 0.0f;
|
||||
}
|
||||
|
||||
public boolean hasDaylight() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasSkyLight() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCelestial() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasWeather() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package common.dimension;
|
||||
|
||||
public abstract class Nameable {
|
||||
public abstract class Section {
|
||||
private final boolean custom;
|
||||
|
||||
private String display = null;
|
||||
|
||||
protected Nameable(boolean custom) {
|
||||
protected Section(boolean custom) {
|
||||
this.custom = custom;
|
||||
}
|
||||
|
|
@ -1,14 +1,7 @@
|
|||
package common.dimension;
|
||||
|
||||
public final class Sector extends Nameable implements Comparable<Sector> {
|
||||
public final String id;
|
||||
|
||||
public Sector(String id, boolean custom) {
|
||||
public final class Sector extends Section {
|
||||
public Sector(boolean custom) {
|
||||
super(custom);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int compareTo(Sector other) {
|
||||
return other == null ? -1 : this.id.compareTo(other.id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,12 @@ public final class Semi extends Dimension {
|
|||
public final DimType getType() {
|
||||
return DimType.SEMI;
|
||||
}
|
||||
|
||||
public boolean hasVoidFog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasWeather() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,134 +13,6 @@ public final class Space extends Dimension {
|
|||
}
|
||||
|
||||
public final DimType getType() {
|
||||
return DimType.SPACE;
|
||||
return null;
|
||||
}
|
||||
|
||||
// public String getDimensionName() {
|
||||
// return "space";
|
||||
// }
|
||||
//
|
||||
// public int getDimensionId() {
|
||||
// return Constants.SPACE_WORLD;
|
||||
// }
|
||||
|
||||
// public Biome getBiome() {
|
||||
// return Biome.space;
|
||||
// }
|
||||
//
|
||||
// public final float getGravity() {
|
||||
// return 0.0f;
|
||||
// }
|
||||
//
|
||||
// public IBlockState getCaveFiller() {
|
||||
// return Blocks.air.getDefaultState();
|
||||
// }
|
||||
//
|
||||
// public IBlockState getFiller() {
|
||||
// return Blocks.air.getDefaultState();
|
||||
// }
|
||||
//
|
||||
// public IBlockState getTop() {
|
||||
// return Blocks.air.getDefaultState();
|
||||
// }
|
||||
//
|
||||
// public IBlockState getSurface() {
|
||||
// return Blocks.air.getDefaultState();
|
||||
// }
|
||||
//
|
||||
// public IBlockState getAltFiller() {
|
||||
// return Blocks.air.getDefaultState();
|
||||
// }
|
||||
//
|
||||
// public IBlockState getLavaFiller() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public boolean hasRavines() {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public ChunkGenerator createChunkGenerator(Random rand) {
|
||||
// return new GeneratorFlat(new IBlockState[0]);
|
||||
// }
|
||||
//
|
||||
// public BlockReplacer createBlockReplacer(Random rand) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// public int getBrightness() {
|
||||
// return 15;
|
||||
// }
|
||||
//
|
||||
// public final int getSkyColor() {
|
||||
// return 0x000000;
|
||||
// }
|
||||
//
|
||||
// public IBlockState getWorldFloor() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public final boolean hasSnow() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public final boolean hasCaves() {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public final float getCloudHeight(float height) {
|
||||
// return height;
|
||||
// }
|
||||
|
||||
// public float getStarBrightness() {
|
||||
// return 1.0f;
|
||||
// }
|
||||
//
|
||||
// public float getDeepStarBrightness() {
|
||||
// return 1.0f;
|
||||
// }
|
||||
//
|
||||
// public float getLavaChance() {
|
||||
// return 0.0f;
|
||||
// }
|
||||
//
|
||||
// public float getWaterChance() {
|
||||
// return 0.0f;
|
||||
// }
|
||||
//
|
||||
// public boolean hasDungeons() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public IBlockState getSurfaceLiquid() {
|
||||
// return Blocks.air.getDefaultState();
|
||||
// }
|
||||
//
|
||||
// public int getSeaLevel() {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// public final int getTimeQualifier() {
|
||||
// return 8;
|
||||
// }
|
||||
//
|
||||
// public final long getOrbitalPeriod() {
|
||||
// return 1L;
|
||||
// }
|
||||
//
|
||||
// public final long getRotationalPeriod() {
|
||||
// return 1L;
|
||||
// }
|
||||
//
|
||||
// public final float getOrbitOffset() {
|
||||
// return 0.0f;
|
||||
// }
|
||||
//
|
||||
// public final int getLevelBelow() {
|
||||
// return this.getDimensionId();
|
||||
// }
|
||||
//
|
||||
// public float getTemperature() {
|
||||
// return 2.7f;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -22,4 +22,8 @@ public final class Star extends Dimension {
|
|||
public final DimType getType() {
|
||||
return DimType.STAR;
|
||||
}
|
||||
|
||||
public boolean isCelestial() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import common.block.liquid.BlockLiquid;
|
|||
import common.color.TextColor;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Space;
|
||||
import common.enchantment.Enchantment;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.effect.EntityLightning;
|
||||
|
@ -356,7 +357,7 @@ public abstract class Entity
|
|||
}
|
||||
|
||||
protected void onVoidUpdate() {
|
||||
if(!this.worldObj.client && this.worldObj.dimension.getType() != DimType.SPACE) {
|
||||
if(!this.worldObj.client && this.worldObj.dimension != Space.INSTANCE) {
|
||||
// this.worldObj.profiler.start("descent");
|
||||
Dimension current = this.worldObj.dimension;
|
||||
Dimension dim = Vars.voidPortal ? ((AWorldServer)this.worldObj).getPortalDest(PortalType.VOID) : current;
|
||||
|
|
|
@ -385,7 +385,7 @@ public class EntitySlime extends EntityNPC
|
|||
// {
|
||||
Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);
|
||||
|
||||
if (biomegenbase == Biome.SWAMPLAND && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
|
||||
if (biomegenbase == Biome.SWAMPLAND && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
|
||||
{
|
||||
return super.getCanSpawnHere();
|
||||
}
|
||||
|
|
|
@ -15,94 +15,114 @@ import common.dimension.Dimension;
|
|||
import common.dimension.Domain;
|
||||
import common.dimension.Galaxy;
|
||||
import common.dimension.Moon;
|
||||
import common.dimension.Section;
|
||||
import common.dimension.Planet;
|
||||
import common.dimension.Sector;
|
||||
import common.dimension.Semi;
|
||||
import common.dimension.Space;
|
||||
import common.dimension.Star;
|
||||
import common.world.Weather;
|
||||
import common.world.World;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class UniverseRegistry {
|
||||
private static final List<Section> SECTIONS = Lists.newArrayList();
|
||||
private static final List<Dimension> DIMENSIONS = Lists.newArrayList();
|
||||
private static final Map<Integer, Dimension> ID_MAP = Maps.newTreeMap();
|
||||
private static final Map<Dimension, Integer> IDS = new IdentityHashMap();
|
||||
private static final Map<String, Dimension> NAME_MAP = Maps.newTreeMap();
|
||||
private static final Map<Dimension, String> NAMES = new IdentityHashMap();
|
||||
private static final Map<String, Section> NAME_MAP = Maps.newTreeMap();
|
||||
private static final Map<Section, String> NAMES = new IdentityHashMap();
|
||||
private static final Set<String> NAME_LIST = Sets.newTreeSet();
|
||||
|
||||
private static final Map<String, Sector> SECTORS = Maps.newHashMap();
|
||||
private static final Map<String, Galaxy> GALAXIES = Maps.newHashMap();
|
||||
private static final Map<String, Domain> DOMAINS = Maps.newHashMap();
|
||||
|
||||
private static final Map<Moon, Planet> MOON_MAP = Maps.newHashMap();
|
||||
private static final Map<Planet, List<Moon>> MOONS_MAP = Maps.newHashMap();
|
||||
private static final Map<Planet, Star> PLANET_MAP = Maps.newHashMap();
|
||||
private static final Map<Star, List<Planet>> PLANETS_MAP = Maps.newHashMap();
|
||||
private static final Map<Star, Sector> STAR_MAP = Maps.newHashMap();
|
||||
private static final Map<Sector, List<Star>> STARS_MAP = Maps.newHashMap();
|
||||
private static final Map<Sector, Galaxy> SECTOR_MAP = Maps.newHashMap();
|
||||
private static final Map<Galaxy, List<Sector>> SECTORS_MAP = Maps.newHashMap();
|
||||
private static final Map<Area, Domain> AREA_MAP = Maps.newHashMap();
|
||||
private static final Map<Domain, List<Area>> AREAS_MAP = Maps.newHashMap();
|
||||
private static final Set<Semi> SEMI_SET = Sets.newHashSet();
|
||||
private static final Map<Moon, Planet> MOON_PLANET = Maps.newHashMap();
|
||||
private static final Map<Planet, List<Moon>> PLANET_MOONS = Maps.newHashMap();
|
||||
private static final Map<Planet, Star> PLANET_STAR = Maps.newHashMap();
|
||||
private static final Map<Star, List<Planet>> STAR_PLANETS = Maps.newHashMap();
|
||||
private static final Map<Star, Sector> STAR_SECTOR = Maps.newHashMap();
|
||||
private static final Map<Sector, List<Star>> SECTOR_STARS = Maps.newHashMap();
|
||||
private static final Map<Sector, Galaxy> SECTOR_GALAXY = Maps.newHashMap();
|
||||
private static final Map<Galaxy, List<Sector>> GALAXY_SECTORS = Maps.newHashMap();
|
||||
private static final Map<Area, Domain> AREA_DOMAIN = Maps.newHashMap();
|
||||
private static final Map<Domain, List<Area>> DOMAIN_AREAS = Maps.newHashMap();
|
||||
private static final Set<Semi> SEMI = Sets.newHashSet();
|
||||
|
||||
public static List<Dimension> getDimensions() {
|
||||
return DIMENSIONS;
|
||||
}
|
||||
|
||||
public static List<Section> getSections() {
|
||||
return SECTIONS;
|
||||
}
|
||||
|
||||
public static Collection<Galaxy> getGalaxies() {
|
||||
return GALAXIES.values();
|
||||
return GALAXY_SECTORS.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Sector> getSectors() {
|
||||
return SECTORS.values();
|
||||
return SECTOR_GALAXY.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Domain> getDomains() {
|
||||
return DOMAINS.values();
|
||||
return DOMAIN_AREAS.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Star> getStars() {
|
||||
return STAR_MAP.keySet();
|
||||
return STAR_SECTOR.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Planet> getPlanets() {
|
||||
return PLANET_MAP.keySet();
|
||||
return PLANET_STAR.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Moon> getMoons() {
|
||||
return MOON_MAP.keySet();
|
||||
return MOON_PLANET.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Area> getAreas() {
|
||||
return AREA_MAP.keySet();
|
||||
return AREA_DOMAIN.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Semi> getSemis() {
|
||||
return SEMI_SET;
|
||||
return SEMI;
|
||||
}
|
||||
|
||||
public static List<Sector> getSectors(Galaxy galaxy) {
|
||||
return SECTORS_MAP.get(galaxy);
|
||||
return GALAXY_SECTORS.get(galaxy);
|
||||
}
|
||||
|
||||
public static List<Star> getStars(Sector sector) {
|
||||
return STARS_MAP.get(sector);
|
||||
return SECTOR_STARS.get(sector);
|
||||
}
|
||||
|
||||
public static List<Planet> getPlanets(Star star) {
|
||||
return PLANETS_MAP.get(star);
|
||||
return STAR_PLANETS.get(star);
|
||||
}
|
||||
|
||||
public static List<Moon> getMoons(Planet planet) {
|
||||
return MOONS_MAP.get(planet);
|
||||
return PLANET_MOONS.get(planet);
|
||||
}
|
||||
|
||||
public static List<Area> getAreas(Domain domain) {
|
||||
return AREAS_MAP.get(domain);
|
||||
return DOMAIN_AREAS.get(domain);
|
||||
}
|
||||
|
||||
public static Star getStar(Planet planet) {
|
||||
return PLANET_STAR.get(planet);
|
||||
}
|
||||
|
||||
public static Planet getPlanet(Moon moon) {
|
||||
return MOON_PLANET.get(moon);
|
||||
}
|
||||
|
||||
public static Sector getSector(Star star) {
|
||||
return STAR_SECTOR.get(star);
|
||||
}
|
||||
|
||||
public static Galaxy getGalaxy(Sector sector) {
|
||||
return SECTOR_GALAXY.get(sector);
|
||||
}
|
||||
|
||||
public static Domain getDomain(Area area) {
|
||||
return AREA_DOMAIN.get(area);
|
||||
}
|
||||
|
||||
public static Dimension getDimension(int dim) {
|
||||
|
@ -116,31 +136,15 @@ public abstract class UniverseRegistry {
|
|||
return id == null ? -1 : id;
|
||||
}
|
||||
|
||||
public static String getName(Dimension dim) {
|
||||
public static String getName(Section dim) {
|
||||
return dim == null ? null : NAMES.get(dim);
|
||||
}
|
||||
|
||||
public static Star getStar(Planet planet) {
|
||||
return PLANET_MAP.get(planet);
|
||||
}
|
||||
|
||||
public static Planet getPlanet(Moon moon) {
|
||||
return MOON_MAP.get(moon);
|
||||
}
|
||||
|
||||
public static Sector getSector(Star star) {
|
||||
return STAR_MAP.get(star);
|
||||
}
|
||||
|
||||
public static Galaxy getGalaxy(Sector sector) {
|
||||
return SECTOR_MAP.get(sector);
|
||||
}
|
||||
|
||||
public static Domain getDomain(Area area) {
|
||||
return AREA_MAP.get(area);
|
||||
}
|
||||
|
||||
public static Dimension getDimension(String name) {
|
||||
return NAME_MAP.get(name) instanceof Dimension dim ? dim : null;
|
||||
}
|
||||
|
||||
public static Section getSection(String name) {
|
||||
return NAME_MAP.get(name);
|
||||
}
|
||||
|
||||
|
@ -149,50 +153,71 @@ public abstract class UniverseRegistry {
|
|||
}
|
||||
|
||||
public static boolean isRegistered(String name) {
|
||||
return GALAXIES.containsKey(name) || SECTORS.containsKey(name) || DOMAINS.containsKey(name) || NAME_MAP.containsKey(name);
|
||||
return NAME_MAP.containsKey(name);
|
||||
}
|
||||
|
||||
public static boolean isType(String name, DimType type) {
|
||||
return NAME_MAP.containsKey(name) && NAME_MAP.get(name).getType() == type;
|
||||
return NAME_MAP.containsKey(name) && NAME_MAP.get(name) instanceof Dimension dim && dim.getType() == type;
|
||||
}
|
||||
|
||||
public static Galaxy registerCustomGalaxy(String name, String display) {
|
||||
return registerGalaxyInt(name, display, true);
|
||||
Galaxy galaxy = new Galaxy(true);
|
||||
registerGalaxyInt(name, display, galaxy);
|
||||
return galaxy;
|
||||
}
|
||||
|
||||
public static Sector registerCustomSector(String name, String display, String galaxy) {
|
||||
return registerSectorInt(name, display, galaxy, true);
|
||||
Section base = NAME_MAP.get(galaxy);
|
||||
if(!(base instanceof Galaxy baseGalaxy))
|
||||
throw new IllegalArgumentException("Galaxie " + galaxy + " existiert nicht");
|
||||
Sector sector = new Sector(true);
|
||||
registerSectorInt(name, display, sector, baseGalaxy);
|
||||
return sector;
|
||||
}
|
||||
|
||||
public static Domain registerCustomDomain(String name, String display) {
|
||||
return registerDomainInt(name, display, true);
|
||||
Domain domain = new Domain(true);
|
||||
registerDomainInt(name, display, domain);
|
||||
return domain;
|
||||
}
|
||||
|
||||
public static Star registerCustomStar(String name, String display, Star dim, String sector) {
|
||||
Section base = NAME_MAP.get(sector);
|
||||
if(!(base instanceof Sector baseSector))
|
||||
throw new IllegalArgumentException("Sektor " + sector + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Star)dim.makeCustomCopy();
|
||||
registerStarInt(name, display, dim, sector);
|
||||
registerStarInt(name, display, dim, baseSector);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Planet registerCustomPlanet(String name, String display, Planet dim, String star) {
|
||||
Section base = NAME_MAP.get(star);
|
||||
if(!(base instanceof Star baseStar))
|
||||
throw new IllegalArgumentException("Stern " + star + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Planet)dim.makeCustomCopy();
|
||||
registerPlanetInt(name, display, dim, star);
|
||||
registerPlanetInt(name, display, dim, baseStar);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Moon registerCustomMoon(String name, String display, Moon dim, String planet) {
|
||||
Section base = NAME_MAP.get(planet);
|
||||
if(!(base instanceof Planet basePlanet))
|
||||
throw new IllegalArgumentException("Planet " + planet + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Moon)dim.makeCustomCopy();
|
||||
registerMoonInt(name, display, dim, planet);
|
||||
registerMoonInt(name, display, dim, basePlanet);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Area registerCustomArea(String name, String display, Area dim, String domain) {
|
||||
Section base = NAME_MAP.get(domain);
|
||||
if(!(base instanceof Domain baseDomain))
|
||||
throw new IllegalArgumentException("Bereich " + domain + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Area)dim.makeCustomCopy();
|
||||
registerAreaInt(name, display, dim, domain);
|
||||
registerAreaInt(name, display, dim, baseDomain);
|
||||
return dim;
|
||||
}
|
||||
|
||||
|
@ -202,158 +227,126 @@ public abstract class UniverseRegistry {
|
|||
registerSemiInt(name, display, dim);
|
||||
return dim;
|
||||
}
|
||||
|
||||
private static void checkRegistered(String name) {
|
||||
if(isRegistered(name))
|
||||
|
||||
|
||||
private static void register(String name, String display, Section obj) {
|
||||
if(NAME_MAP.containsKey(name))
|
||||
throw new IllegalArgumentException("Objekt " + name + " ist bereits registriert");
|
||||
}
|
||||
|
||||
private static Galaxy registerGalaxyInt(String name, String display, boolean custom) {
|
||||
checkRegistered(name);
|
||||
Galaxy galaxy = new Galaxy(name, custom);
|
||||
galaxy.setDisplay(display);
|
||||
GALAXIES.put(name, galaxy);
|
||||
SECTORS_MAP.put(galaxy, Lists.newArrayList());
|
||||
return galaxy;
|
||||
obj.setDisplay(display);
|
||||
NAME_MAP.put(name, obj);
|
||||
NAMES.put(obj, name);
|
||||
SECTIONS.add(obj);
|
||||
if(obj instanceof Dimension dim) {
|
||||
NAME_LIST.add(name);
|
||||
ID_MAP.put(DIMENSIONS.size(), dim);
|
||||
IDS.put(dim, DIMENSIONS.size());
|
||||
DIMENSIONS.add(dim);
|
||||
}
|
||||
}
|
||||
|
||||
private static Sector registerSectorInt(String name, String display, String galaxy, boolean custom) {
|
||||
checkRegistered(name);
|
||||
Galaxy base = GALAXIES.get(galaxy);
|
||||
if(base == null)
|
||||
throw new IllegalArgumentException("Galaxie " + galaxy + " existiert nicht");
|
||||
Sector sector = new Sector(name, custom);
|
||||
sector.setDisplay(display);
|
||||
SECTORS.put(name, sector);
|
||||
SECTOR_MAP.put(sector, base);
|
||||
STARS_MAP.put(sector, Lists.newArrayList());
|
||||
SECTORS_MAP.get(base).add(sector);
|
||||
return sector;
|
||||
private static void registerGalaxyInt(String name, String display, Galaxy galaxy) {
|
||||
register(name, display, galaxy);
|
||||
GALAXY_SECTORS.put(galaxy, Lists.newArrayList());
|
||||
}
|
||||
|
||||
private static Domain registerDomainInt(String name, String display, boolean custom) {
|
||||
checkRegistered(name);
|
||||
Domain domain = new Domain(name, custom);
|
||||
domain.setDisplay(display);
|
||||
DOMAINS.put(name, domain);
|
||||
AREAS_MAP.put(domain, Lists.newArrayList());
|
||||
return domain;
|
||||
private static void registerSectorInt(String name, String display, Sector sector, Galaxy galaxy) {
|
||||
register(name, display, sector);
|
||||
SECTOR_GALAXY.put(sector, galaxy);
|
||||
SECTOR_STARS.put(sector, Lists.newArrayList());
|
||||
GALAXY_SECTORS.get(galaxy).add(sector);
|
||||
}
|
||||
|
||||
private static void registerDimension(String name, String display, Dimension dim) {
|
||||
checkRegistered(name);
|
||||
dim.setDisplay(display);
|
||||
NAME_MAP.put(name, dim);
|
||||
NAMES.put(dim, name);
|
||||
NAME_LIST.add(name);
|
||||
ID_MAP.put(DIMENSIONS.size(), dim);
|
||||
IDS.put(dim, DIMENSIONS.size());
|
||||
DIMENSIONS.add(dim);
|
||||
private static void registerDomainInt(String name, String display, Domain domain) {
|
||||
register(name, display, domain);
|
||||
DOMAIN_AREAS.put(domain, Lists.newArrayList());
|
||||
}
|
||||
|
||||
private static void registerStarInt(String name, String display, Dimension dim, String sector) {
|
||||
Sector base = SECTORS.get(sector);
|
||||
if(base == null)
|
||||
throw new IllegalArgumentException("Sektor " + sector + " existiert nicht");
|
||||
registerDimension(name, display, dim);
|
||||
STAR_MAP.put((Star)dim, base);
|
||||
PLANETS_MAP.put((Star)dim, Lists.newArrayList());
|
||||
STARS_MAP.get(base).add((Star)dim);
|
||||
private static void registerStarInt(String name, String display, Star star, Sector sector) {
|
||||
register(name, display, star);
|
||||
STAR_SECTOR.put(star, sector);
|
||||
STAR_PLANETS.put(star, Lists.newArrayList());
|
||||
SECTOR_STARS.get(sector).add(star);
|
||||
}
|
||||
|
||||
private static void registerPlanetInt(String name, String display, Dimension dim, String star) {
|
||||
Dimension base = NAME_MAP.get(star);
|
||||
if(base == null || base.getType() != DimType.STAR)
|
||||
throw new IllegalArgumentException("Stern " + star + " existiert nicht");
|
||||
registerDimension(name, display, dim);
|
||||
PLANET_MAP.put((Planet)dim, ((Star)base));
|
||||
MOONS_MAP.put((Planet)dim, Lists.newArrayList());
|
||||
PLANETS_MAP.get((Star)base).add((Planet)dim);
|
||||
private static void registerPlanetInt(String name, String display, Planet planet, Star star) {
|
||||
register(name, display, planet);
|
||||
PLANET_STAR.put(planet, star);
|
||||
PLANET_MOONS.put(planet, Lists.newArrayList());
|
||||
STAR_PLANETS.get(star).add(planet);
|
||||
}
|
||||
|
||||
private static void registerMoonInt(String name, String display, Dimension dim, String planet) {
|
||||
Dimension base = NAME_MAP.get(planet);
|
||||
if(base == null || base.getType() != DimType.PLANET)
|
||||
throw new IllegalArgumentException("Planet " + planet + " existiert nicht");
|
||||
registerDimension(name, display, dim);
|
||||
MOON_MAP.put((Moon)dim, ((Planet)base));
|
||||
MOONS_MAP.get((Planet)base).add((Moon)dim);
|
||||
private static void registerMoonInt(String name, String display, Moon moon, Planet planet) {
|
||||
register(name, display, moon);
|
||||
MOON_PLANET.put(moon, planet);
|
||||
PLANET_MOONS.get(planet).add(moon);
|
||||
}
|
||||
|
||||
private static void registerAreaInt(String name, String display, Dimension dim, String domain) {
|
||||
Domain base = DOMAINS.get(domain);
|
||||
if(base == null)
|
||||
throw new IllegalArgumentException("Bereich " + domain + " existiert nicht");
|
||||
registerDimension(name, display, dim);
|
||||
AREA_MAP.put((Area)dim, base);
|
||||
AREAS_MAP.get(base).add((Area)dim);
|
||||
private static void registerAreaInt(String name, String display, Area area, Domain domain) {
|
||||
register(name, display, area);
|
||||
AREA_DOMAIN.put(area, domain);
|
||||
DOMAIN_AREAS.get(domain).add(area);
|
||||
}
|
||||
|
||||
private static void registerSemiInt(String name, String display, Dimension dim) {
|
||||
registerDimension(name, display, dim);
|
||||
SEMI_SET.add((Semi)dim);
|
||||
private static void registerSemiInt(String name, String display, Semi semi) {
|
||||
register(name, display, semi);
|
||||
SEMI.add(semi);
|
||||
}
|
||||
|
||||
|
||||
private static String lastGalaxy;
|
||||
private static String lastSector;
|
||||
private static String lastDomain;
|
||||
private static String lastStar;
|
||||
private static String lastPlanet;
|
||||
private static Galaxy lastGalaxy;
|
||||
private static Sector lastSector;
|
||||
private static Domain lastDomain;
|
||||
private static Star lastStar;
|
||||
private static Planet lastPlanet;
|
||||
|
||||
private static String fromDisplay(String display) {
|
||||
return display.toLowerCase().replace("'", "").replace(' ', '_');
|
||||
}
|
||||
|
||||
private static void registerGalaxy(String name, String display, Runnable sub) {
|
||||
registerGalaxyInt(name, display, false);
|
||||
lastGalaxy = name;
|
||||
registerGalaxyInt(name, display, lastGalaxy = new Galaxy(false));
|
||||
sub.run();
|
||||
lastGalaxy = null;
|
||||
}
|
||||
|
||||
private static void registerSector(String name, String display, Runnable sub) {
|
||||
registerSectorInt(name, display, lastGalaxy, false);
|
||||
lastSector = name;
|
||||
registerSectorInt(name, display, lastSector = new Sector(false), lastGalaxy);
|
||||
sub.run();
|
||||
lastSector = null;
|
||||
}
|
||||
|
||||
private static void registerDomain(String name, String display, Runnable sub) {
|
||||
registerDomainInt(name, display, false);
|
||||
lastDomain = name;
|
||||
registerDomainInt(name, display, lastDomain = new Domain(false));
|
||||
sub.run();
|
||||
lastDomain = null;
|
||||
}
|
||||
|
||||
private static void registerStar(String name, String display, Dimension dim, Runnable sub) {
|
||||
registerStarInt(name, display, dim, lastSector);
|
||||
lastStar = name;
|
||||
registerStarInt(name, display, lastStar = (Star)dim, lastSector);
|
||||
sub.run();
|
||||
lastStar = null;
|
||||
}
|
||||
|
||||
private static void registerPlanet(String name, String display, Dimension dim) {
|
||||
registerPlanetInt(name, display, dim, lastStar);
|
||||
registerPlanetInt(name, display, (Planet)dim, lastStar);
|
||||
}
|
||||
|
||||
private static void registerPlanet(String name, String display, Dimension dim, Runnable sub) {
|
||||
registerPlanet(name, display, dim);
|
||||
lastPlanet = name;
|
||||
registerPlanetInt(name, display, lastPlanet = (Planet)dim, lastStar);
|
||||
sub.run();
|
||||
lastPlanet = null;
|
||||
}
|
||||
|
||||
private static void registerMoon(String name, String display, Dimension dim) {
|
||||
registerMoonInt(name, display, dim, lastPlanet);
|
||||
registerMoonInt(name, display, (Moon)dim, lastPlanet);
|
||||
}
|
||||
|
||||
private static void registerArea(String name, String display, Dimension dim) {
|
||||
registerAreaInt(name, display, dim, lastDomain);
|
||||
registerAreaInt(name, display, (Area)dim, lastDomain);
|
||||
}
|
||||
|
||||
private static void registerSemi(String name, String display, Dimension dim) {
|
||||
registerSemiInt(name, display, dim);
|
||||
registerSemiInt(name, display, (Semi)dim);
|
||||
}
|
||||
|
||||
private static void registerGalaxy(String display, Runnable sub) {
|
||||
|
@ -405,7 +398,7 @@ public abstract class UniverseRegistry {
|
|||
}
|
||||
|
||||
public static void register() {
|
||||
registerDimension("space", "Der Weltraum", Space.INSTANCE);
|
||||
register("space", "Der Weltraum", Space.INSTANCE);
|
||||
|
||||
registerGalaxy("milkyway", "Galaxie Milchstraße", () -> {
|
||||
registerSector("Solar", () -> {
|
||||
|
|
|
@ -16,13 +16,13 @@ public class ItemSpaceNavigator extends ItemMagnetic {
|
|||
|
||||
public String getHotbarText(EntityNPC player, ItemStack stack) {
|
||||
BlockPos pos = player.getPosition();
|
||||
return TextColor.ORANGE + player.worldObj.formatImperialTime(player, false) + " / " +
|
||||
return TextColor.ORANGE + player.worldObj.formatTime(player, false) + " / " +
|
||||
String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + TextColor.ORANGE,
|
||||
pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) {
|
||||
tooltip.add(TextColor.ORANGE + player.worldObj.formatImperialTime(player, true));
|
||||
tooltip.add(TextColor.ORANGE + player.worldObj.formatTime(player, true));
|
||||
String[] dims = player.worldObj.dimension.getBaseNames();
|
||||
for(int z = dims.length - 1; z >= 0; z--) {
|
||||
tooltip.add(TextColor.ORANGE + dims[z]);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ItemWeatherToken extends ItemMagnetic {
|
|||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
if(worldIn.dimension.getType().weather) {
|
||||
if(worldIn.dimension.hasWeather()) {
|
||||
// if (!playerIn.creative)
|
||||
itemStackIn.decrSize();
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.SPELL, 0.5F);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
else {
|
||||
this.dimType = dim.getType();
|
||||
this.dimData = dim.writeData();
|
||||
if(this.dimType.celestials) {
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
this.sunColor = dim.getSunColor();
|
||||
this.moonColors = dim.getMoonColors();
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.dimId = buf.readVarInt();
|
||||
if(this.dimId >= -1) {
|
||||
this.dimType = buf.readEnumValue(DimType.class);
|
||||
this.dimType = buf.readEnumOrNull(DimType.class);
|
||||
this.dimData = buf.readTag();
|
||||
if(this.dimType.celestials) {
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
this.sunColor = buf.readInt();
|
||||
this.moonColors = new int[buf.readVarInt()];
|
||||
for(int z = 0; z < this.moonColors.length; z++) {
|
||||
|
@ -82,9 +82,9 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeVarInt(this.dimId);
|
||||
if(this.dimId >= -1) {
|
||||
buf.writeEnumValue(this.dimType);
|
||||
buf.writeEnumOrNull(this.dimType);
|
||||
buf.writeTag(this.dimData);
|
||||
if(this.dimType.celestials) {
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
buf.writeInt(this.sunColor);
|
||||
buf.writeVarInt(this.moonColors.length);
|
||||
for(int z = 0; z < this.moonColors.length; z++) {
|
||||
|
@ -109,7 +109,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
return null;
|
||||
Dimension dim = this.dimId >= 0 ? UniverseRegistry.getDimension(this.dimId) : Dimension.create(this.dimType);
|
||||
dim.readData(this.dimData);
|
||||
if(this.dimType.celestials) {
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
dim.setSunColor(this.sunColor);
|
||||
dim.setMoonColors(this.moonColors);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public abstract class Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
if(!this.world.dimension.hasNoLight() && top != Integer.MIN_VALUE) {
|
||||
if(this.world.dimension.hasSkyLight() && top != Integer.MIN_VALUE) {
|
||||
int l = 15;
|
||||
int y = top + 16 - 1;
|
||||
|
||||
|
@ -216,7 +216,7 @@ public abstract class Chunk {
|
|||
int cx = this.xPos * 16 + x;
|
||||
int cz = this.zPos * 16 + z;
|
||||
|
||||
if(!this.world.dimension.hasNoLight()) {
|
||||
if(this.world.dimension.hasSkyLight()) {
|
||||
if(cy < h) {
|
||||
for(int n = cy; n < h; ++n) {
|
||||
BlockArray stor = this.getArray(n >> 4);
|
||||
|
@ -275,7 +275,7 @@ public abstract class Chunk {
|
|||
this.minHeight = sh;
|
||||
}
|
||||
|
||||
if(!this.world.dimension.hasNoLight()) {
|
||||
if(this.world.dimension.hasSkyLight()) {
|
||||
for(Facing face : Facing.Plane.HORIZONTAL) {
|
||||
this.updateNeighbor(cx + face.getFrontOffsetX(), cz + face.getFrontOffsetZ(), sy, ey);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public abstract class Chunk {
|
|||
return null;
|
||||
}
|
||||
|
||||
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight(), y < 0 ? this.filler : null);
|
||||
stor = new BlockArray(y >> 4 << 4, this.world.dimension.hasSkyLight(), y < 0 ? this.filler : null);
|
||||
this.setArray(stor);
|
||||
up = y >= h;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ public abstract class Chunk {
|
|||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
if(type == LightType.SKY) {
|
||||
int l = stor == null ? (this.canSeeSky(pos) ? type.defValue : 0) : (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z));
|
||||
int l = stor == null ? (this.canSeeSky(pos) ? type.defValue : 0) : (this.world.dimension.hasSkyLight() ? stor.getSky(x, y & 15, z) : 0);
|
||||
if(y < 0) {
|
||||
int max = y < -64 ? 0 : (y + 64) / 4;
|
||||
l = l > max ? max : l;
|
||||
|
@ -433,7 +433,7 @@ public abstract class Chunk {
|
|||
BlockArray stor = this.getArray(y >> 4);
|
||||
|
||||
if(stor == null) {
|
||||
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight(), y < 0 ? this.filler : null);
|
||||
stor = new BlockArray(y >> 4 << 4, this.world.dimension.hasSkyLight(), y < 0 ? this.filler : null);
|
||||
this.setArray(stor);
|
||||
this.genSkyLight();
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ public abstract class Chunk {
|
|||
this.modified = true;
|
||||
|
||||
if(type == LightType.SKY) {
|
||||
if(!this.world.dimension.hasNoLight()) {
|
||||
if(this.world.dimension.hasSkyLight()) {
|
||||
stor.setSky(x, y & 15, z, value);
|
||||
}
|
||||
}
|
||||
|
@ -455,13 +455,13 @@ public abstract class Chunk {
|
|||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
int l = stor == null ? LightType.SKY.defValue : (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z));
|
||||
int l = stor == null ? LightType.SKY.defValue : (this.world.dimension.hasSkyLight() ? stor.getSky(x, y & 15, z) : 0);
|
||||
if(y < 0) {
|
||||
int max = y < -64 ? 0 : (y + 64) / 4;
|
||||
l = l > max ? max : l;
|
||||
}
|
||||
if(stor == null)
|
||||
return !this.world.dimension.hasNoLight() && amount < l ? l - amount : 0;
|
||||
return this.world.dimension.hasSkyLight() && amount < l ? l - amount : 0;
|
||||
l = l - amount;
|
||||
int b = stor.getLight(x, y & 15, z);
|
||||
return b > l ? b : l;
|
||||
|
@ -658,7 +658,7 @@ public abstract class Chunk {
|
|||
}
|
||||
|
||||
public void update(boolean noGaps) {
|
||||
if(this.gapUpdate && !this.world.dimension.hasNoLight() && !noGaps) {
|
||||
if(this.gapUpdate && this.world.dimension.hasSkyLight() && !noGaps) {
|
||||
this.recheckGaps(this.world.client);
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ public abstract class Chunk {
|
|||
this.lightInit = true;
|
||||
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
|
||||
|
||||
if(!this.world.dimension.hasNoLight()) {
|
||||
if(this.world.dimension.hasSkyLight()) {
|
||||
if(this.world.isAreaLoaded(pos.add(-1, 0, -1), pos.add(16, this.world.getSeaLevel(), 16))) {
|
||||
label92:
|
||||
|
||||
|
|
|
@ -166,15 +166,15 @@ public abstract class World implements IWorldAccess {
|
|||
return 6;
|
||||
}
|
||||
|
||||
public String formatImperialTime(Dimension home, boolean days) {
|
||||
public String formatTime(Dimension home, boolean days) {
|
||||
String qualifier = home != null ? (home.getType() == DimType.PLANET ? this.getTimeQualifier((Planet)home) + "." : "?.") : "";
|
||||
long time = this.daytime;
|
||||
String gtime;
|
||||
if((home == null || !home.getType().celestial) && !this.dimension.getType().celestial) {
|
||||
if((home == null || !home.isCelestial()) && !this.dimension.isCelestial()) {
|
||||
gtime = "???.???.M?";
|
||||
}
|
||||
else {
|
||||
long yearTime = (home != null && home.getType().celestial ? home : this.dimension).getOrbitalPeriod();
|
||||
long yearTime = (home != null && home.isCelestial() ? home : this.dimension).getOrbitalPeriod();
|
||||
long year = time / yearTime;
|
||||
long frac = (time * 1000L / yearTime) % 1000L;
|
||||
gtime = String.format("%03d.%03d.M%d", frac, year % 1000L, year / 1000L + 1L);
|
||||
|
@ -182,7 +182,7 @@ public abstract class World implements IWorldAccess {
|
|||
if(!days)
|
||||
return qualifier + gtime;
|
||||
String ltime;
|
||||
if(!this.dimension.getType().celestial) {
|
||||
if(!this.dimension.isCelestial()) {
|
||||
ltime = " T???.??? D???.???.G?";
|
||||
}
|
||||
else {
|
||||
|
@ -194,8 +194,8 @@ public abstract class World implements IWorldAccess {
|
|||
return qualifier + gtime + ltime;
|
||||
}
|
||||
|
||||
public String formatImperialTime(EntityNPC player, boolean days) {
|
||||
return this.formatImperialTime(player == null ? null : player.getOrigin().getDimension(), days);
|
||||
public String formatTime(EntityNPC player, boolean days) {
|
||||
return this.formatTime(player == null ? null : player.getOrigin().getDimension(), days);
|
||||
}
|
||||
|
||||
public abstract Biome getBiomeGenForCoords(BlockPos pos);
|
||||
|
@ -328,7 +328,7 @@ public abstract class World implements IWorldAccess {
|
|||
x2 = i;
|
||||
}
|
||||
|
||||
if(!this.dimension.hasNoLight()) {
|
||||
if(this.dimension.hasSkyLight()) {
|
||||
for(int j = x2; j <= z2; ++j) {
|
||||
this.checkLightFor(LightType.SKY, new BlockPos(x1, j, z1));
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public int getLightFromNeighborsFor(LightType type, BlockPos pos) {
|
||||
if(this.dimension.hasNoLight() && type == LightType.SKY) {
|
||||
if(!this.dimension.hasSkyLight() && type == LightType.SKY) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
|
@ -934,9 +934,9 @@ public abstract class World implements IWorldAccess {
|
|||
return list;
|
||||
}
|
||||
|
||||
private float calculateCelestialAngle(long worldTime, float partialTicks) {
|
||||
private float calcRotationPhase(long worldTime, float partial) {
|
||||
int i = (int)(worldTime % this.dimension.getRotationalPeriod());
|
||||
float f = ((float)i + partialTicks) / (float)this.dimension.getRotationalPeriod() - 0.5F;
|
||||
float f = ((float)i + partial) / (float)this.dimension.getRotationalPeriod() - 0.5F;
|
||||
|
||||
if(f < 0.0F) {
|
||||
++f;
|
||||
|
@ -951,8 +951,8 @@ public abstract class World implements IWorldAccess {
|
|||
return f;
|
||||
}
|
||||
|
||||
public int calculateSkylightSubtracted(boolean current) {
|
||||
float f = !this.dimension.getType().days || (current && this.dimension.isBaseDestroyed()) ? 0.5f : this.calculateCelestialAngle(current ? this.daytime :
|
||||
public int calcSkylightSubtracted(boolean current) {
|
||||
float f = !this.dimension.hasDaylight() || (current && this.dimension.isBaseDestroyed()) ? 0.5f : this.calcRotationPhase(current ? this.daytime :
|
||||
(this.dimension.getRotationalPeriod() / 4L), 1.0f);
|
||||
float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F);
|
||||
f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
|
||||
|
@ -963,8 +963,8 @@ public abstract class World implements IWorldAccess {
|
|||
return (int)(f1 * 11.0F);
|
||||
}
|
||||
|
||||
public float getCelestialAngle(float partialTicks) {
|
||||
return !this.dimension.getType().days ? 0.5f : this.calculateCelestialAngle(this.daytime, Vars.dayCycle ? partialTicks : 0.0f);
|
||||
public float getCelestialAngle(float partial) {
|
||||
return !this.dimension.isCelestial() ? 180.0f : (this.calcRotationPhase(this.daytime, Vars.dayCycle ? partial : 0.0f) * 360.0F);
|
||||
}
|
||||
|
||||
public int getMoonPhase(int moon) {
|
||||
|
@ -972,12 +972,12 @@ public abstract class World implements IWorldAccess {
|
|||
return (int)(this.daytime / this.dimension.getRotationalPeriod() % 8L + 8L + this.rand.zrange(8)) % 8;
|
||||
}
|
||||
|
||||
public float getCurrentMoonPhaseFactor() {
|
||||
public float getMoonPhase() {
|
||||
return MOON_PHASES[this.getMoonPhase(0)];
|
||||
}
|
||||
|
||||
public float getCelestialAngleRadians(float partialTicks) {
|
||||
return (this.dimension.isBaseDestroyed() ? 0.5f : this.getCelestialAngle(partialTicks)) * (float)Math.PI * 2.0F;
|
||||
public float getDayPhase(float partial) {
|
||||
return !this.dimension.hasDaylight() || this.dimension.isBaseDestroyed() ? (float)Math.PI : (this.calcRotationPhase(this.daytime, Vars.dayCycle ? partial : 0.0f) * (float)Math.PI * 2.0F);
|
||||
}
|
||||
|
||||
public BlockPos getPrecipitationHeight(BlockPos pos) {
|
||||
|
@ -1545,7 +1545,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
protected void calculateInitialSkylight() {
|
||||
int light = this.calculateSkylightSubtracted(false);
|
||||
int light = this.calcSkylightSubtracted(false);
|
||||
if(light != this.subtract)
|
||||
this.subtract = light;
|
||||
}
|
||||
|
@ -1601,7 +1601,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public LeavesType getLeavesGen(BlockPos pos) {
|
||||
return this.canFreezeAt(pos) ? LeavesType.SNOWY : ((!this.dimension.getType().days || this.dimension.getOrbitOffset() == 0.0f) ?
|
||||
return this.canFreezeAt(pos) ? LeavesType.SNOWY : (!this.dimension.hasSeasons() ?
|
||||
this.dimension.getLeavesType() : LeavesType.values()[(int)((this.daytime %
|
||||
this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]);
|
||||
}
|
||||
|
@ -1654,7 +1654,7 @@ public abstract class World implements IWorldAccess {
|
|||
public boolean checkLight(BlockPos pos) {
|
||||
boolean flag = false;
|
||||
|
||||
if(!this.dimension.hasNoLight()) {
|
||||
if(this.dimension.hasSkyLight()) {
|
||||
flag |= this.checkLightFor(LightType.SKY, pos);
|
||||
}
|
||||
|
||||
|
@ -2017,7 +2017,7 @@ public abstract class World implements IWorldAccess {
|
|||
public double getSpaceFactor(double x, double y, double z) {
|
||||
if(this.dimension.getType() == DimType.SEMI)
|
||||
return ExtMath.clampd((y - (double)World.MAX_SIZE_Y) / 16384.0, 0.0, 1.0);
|
||||
else if(!this.dimension.getType().celestial)
|
||||
else if(!this.dimension.isCelestial())
|
||||
return 0.0;
|
||||
double r = (double)this.dimension.getSize();
|
||||
double xm = (Math.abs(x) - r) / 16384.0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue