use of net.minecraft.world.WorldProvider in project Galacticraft by micdoodle8.
the class GalacticraftCore method init.
@EventHandler
public void init(FMLInitializationEvent event) {
GCBlocks.doOtherModsTorches();
GalacticraftCore.handler.registerItemChanges();
GalacticraftCore.galacticraftBlocksTab.setItemForTab(Item.getItemFromBlock(GCBlocks.machineBase2));
GalacticraftCore.galacticraftItemsTab.setItemForTab(GCItems.rocketTier1);
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
GCBlocks.finalizeSort();
GCItems.finalizeSort();
}
GalacticraftCore.proxy.init(event);
GalacticraftCore.packetPipeline = GalacticraftChannelHandler.init();
GalacticraftCore.solarSystemSol = new SolarSystem("sol", "milky_way").setMapPosition(new Vector3(0.0F, 0.0F, 0.0F));
Star starSol = (Star) new Star("sol").setParentSolarSystem(GalacticraftCore.solarSystemSol).setTierRequired(-1);
starSol.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/sun.png"));
GalacticraftCore.solarSystemSol.setMainStar(starSol);
GalacticraftCore.planetOverworld = (Planet) new Planet("overworld").setParentSolarSystem(GalacticraftCore.solarSystemSol).setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(0.0F);
GalacticraftCore.planetOverworld.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/earth.png"));
GalacticraftCore.planetOverworld.setDimensionInfo(ConfigManagerCore.idDimensionOverworld, WorldProvider.class, false).setTierRequired(1);
GalacticraftCore.planetOverworld.atmosphereComponent(EnumAtmosphericGas.NITROGEN).atmosphereComponent(EnumAtmosphericGas.OXYGEN).atmosphereComponent(EnumAtmosphericGas.ARGON).atmosphereComponent(EnumAtmosphericGas.WATER);
GalacticraftCore.planetOverworld.addChecklistKeys("equip_parachute");
GalacticraftCore.moonMoon = (Moon) new Moon("moon").setParentPlanet(GalacticraftCore.planetOverworld).setRelativeSize(0.2667F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(13F, 13F)).setRelativeOrbitTime(1 / 0.01F);
GalacticraftCore.moonMoon.setDimensionInfo(ConfigManagerCore.idDimensionMoon, WorldProviderMoon.class).setTierRequired(1);
GalacticraftCore.moonMoon.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/moon.png"));
GalacticraftCore.moonMoon.setAtmosphere(new AtmosphereInfo(false, false, false, 0.0F, 0.0F, 0.0F));
GalacticraftCore.moonMoon.setBiomeInfo(BiomeGenBaseMoon.moonFlat);
GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3));
GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3));
GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3));
GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3));
GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedEnderman.class, 10, 1, 4));
GalacticraftCore.moonMoon.addChecklistKeys("equip_oxygen_suit");
// Satellites must always have a WorldProvider implementing IOrbitDimension
GalacticraftCore.satelliteSpaceStation = (Satellite) new Satellite("spacestation.overworld").setParentBody(GalacticraftCore.planetOverworld).setRelativeSize(0.2667F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(9F, 9F)).setRelativeOrbitTime(1 / 0.05F);
GalacticraftCore.satelliteSpaceStation.setDimensionInfo(ConfigManagerCore.idDimensionOverworldOrbit, ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOverworldOrbit.class).setTierRequired(1);
GalacticraftCore.satelliteSpaceStation.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/space_station.png"));
GalacticraftCore.satelliteSpaceStation.setAtmosphere(new AtmosphereInfo(false, false, false, 0.0F, 0.1F, 0.02F));
GalacticraftCore.satelliteSpaceStation.addChecklistKeys("equip_oxygen_suit", "create_grapple");
ForgeChunkManager.setForcedChunkLoadingCallback(GalacticraftCore.instance, new ChunkLoadingCallback());
MinecraftForge.EVENT_BUS.register(new ConnectionEvents());
SchematicRegistry.registerSchematicRecipe(new SchematicRocketT1());
SchematicRegistry.registerSchematicRecipe(new SchematicMoonBuggy());
SchematicRegistry.registerSchematicRecipe(new SchematicAdd());
ChunkPowerHandler.initiate();
EnergyConfigHandler.initGas();
CompatibilityManager.registerMicroBlocks();
this.registerCreatures();
this.registerOtherEntities();
this.registerTileEntities();
GalaxyRegistry.registerSolarSystem(GalacticraftCore.solarSystemSol);
GalaxyRegistry.registerPlanet(GalacticraftCore.planetOverworld);
GalaxyRegistry.registerMoon(GalacticraftCore.moonMoon);
GalaxyRegistry.registerSatellite(GalacticraftCore.satelliteSpaceStation);
GalacticraftRegistry.registerProvider(ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOverworldOrbit.class, false, 0);
GalacticraftRegistry.registerProvider(ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOverworldOrbit.class, true, 0);
GalacticraftRegistry.registerTeleportType(WorldProviderSurface.class, new TeleportTypeOverworld());
GalacticraftRegistry.registerTeleportType(WorldProviderOverworldOrbit.class, new TeleportTypeOrbit());
GalacticraftRegistry.registerTeleportType(WorldProviderMoon.class, new TeleportTypeMoon());
GalacticraftRegistry.registerRocketGui(WorldProviderOverworldOrbit.class, new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/overworld_rocket_gui.png"));
GalacticraftRegistry.registerRocketGui(WorldProviderSurface.class, new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/overworld_rocket_gui.png"));
GalacticraftRegistry.registerRocketGui(WorldProviderMoon.class, new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/moon_rocket_gui.png"));
GalacticraftRegistry.addDungeonLoot(1, new ItemStack(GCItems.schematic, 1, 0));
GalacticraftRegistry.addDungeonLoot(1, new ItemStack(GCItems.schematic, 1, 1));
if (ConfigManagerCore.enableCopperOreGen) {
GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 5, 24, 0, 75, 7), 4);
}
if (ConfigManagerCore.enableTinOreGen) {
GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 6, 22, 0, 60, 7), 4);
}
if (ConfigManagerCore.enableAluminumOreGen) {
GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 7, 18, 0, 45, 7), 4);
}
if (ConfigManagerCore.enableSiliconOreGen) {
GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 8, 3, 0, 25, 7), 4);
}
FMLInterModComms.sendMessage("OpenBlocks", "donateUrl", "http://www.patreon.com/micdoodle8");
registerCoreGameScreens();
GCFluids.registerLegacyFluids();
GCFluids.registerDispenserBehaviours();
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_MASK, EnumExtendedInventorySlot.MASK, GCItems.oxMask);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_GEAR, EnumExtendedInventorySlot.GEAR, GCItems.oxygenGear);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_LIGHT, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxTankLight);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_LIGHT, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxTankLight);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_MEDIUM, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxTankMedium);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_MEDIUM, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxTankMedium);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_HEAVY, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxTankHeavy);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_HEAVY, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxTankHeavy);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_INFINITE, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxygenCanisterInfinite);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_INFINITE, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxygenCanisterInfinite);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_PARACHUTE, EnumExtendedInventorySlot.PARACHUTE, GCItems.parachute);
GalacticraftRegistry.registerGear(Constants.GEAR_ID_FREQUENCY_MODULE, EnumExtendedInventorySlot.FREQUENCY_MODULE, new ItemStack(GCItems.basicItem, 1, 19));
GalacticraftCore.proxy.registerFluidTexture(GCFluids.fluidOil, new ResourceLocation(Constants.ASSET_PREFIX, "textures/misc/underoil.png"));
GalacticraftCore.proxy.registerFluidTexture(GCFluids.fluidFuel, new ResourceLocation(Constants.ASSET_PREFIX, "textures/misc/underfuel.png"));
// switch (this.getSlotIndex())
// {
// case 0:
// return itemstack.getItem() instanceof ItemOxygenMask;
// case 1:
// return itemstack.getItem() == GCItems.oxygenGear;
// case 2:
// case 3:
// return itemstack.getItem() instanceof ItemOxygenTank || itemstack.getItem() instanceof ItemCanisterOxygenInfinite;
// case 4:
// return itemstack.getItem() instanceof ItemParaChute;
// case 5:
// return itemstack.getItem() == GCItems.basicItem && itemstack.getItemDamage() == 19;
// case 6:
// return this.thermalArmorSlotValid(itemstack, 0);
// case 7:
// return this.thermalArmorSlotValid(itemstack, 1);
// case 8:
// return this.thermalArmorSlotValid(itemstack, 2);
// case 9:
// return this.thermalArmorSlotValid(itemstack, 3);
// case 10:
// return this.shieldControllerSlotValid(itemstack);
// }
}
use of net.minecraft.world.WorldProvider in project Galacticraft by micdoodle8.
the class OreGenOtherMods method onPlanetDecorated.
@SubscribeEvent
public void onPlanetDecorated(GCCoreEventPopulate.Post event) {
this.worldObj = event.worldObj;
this.randomGenerator = event.rand;
this.pos = event.pos;
int dimDetected = 0;
WorldProvider prov = worldObj.provider;
if (!(prov instanceof IGalacticraftWorldProvider) || (prov instanceof WorldProviderSpaceStation)) {
return;
}
Block stoneBlock = null;
int stoneMeta = 0;
if (prov instanceof WorldProviderMoon) {
stoneBlock = GCBlocks.blockMoon;
stoneMeta = 4;
dimDetected = 1;
} else if (GalacticraftCore.isPlanetsLoaded && prov instanceof WorldProviderMars) {
stoneBlock = MarsBlocks.marsBlock;
stoneMeta = 9;
dimDetected = 2;
}
if (stoneBlock == null) {
return;
}
for (OreGenData ore : OreGenOtherMods.data) {
if (ore.dimRestrict == 0 || ore.dimRestrict == dimDetected) {
this.oreGen = new WorldGenMinableMeta(ore.oreBlock, ore.sizeCluster, ore.oreMeta, true, stoneBlock, stoneMeta);
this.genStandardOre1(ore.numClusters, this.oreGen, ore.minHeight, ore.maxHeight);
}
}
}
use of net.minecraft.world.WorldProvider in project Galacticraft by micdoodle8.
the class GameScreenCelestial method render.
@Override
public void render(int type, float ticks, float scaleX, float scaleY, IScreenManager scr) {
centreX = scaleX / 2;
centreY = scaleY / 2;
frameBx = scaleX - frameA;
frameBy = scaleY - frameA;
this.scale = Math.max(scaleX, scaleY) - 0.2F;
drawBlackBackground(0.0F);
planeEquation(frameA, frameA, 0, frameA, frameBy, 0, frameA, frameBy, 1);
GL11.glClipPlane(GL11.GL_CLIP_PLANE0, planes);
GL11.glEnable(GL11.GL_CLIP_PLANE0);
planeEquation(frameBx, frameBy, 0, frameBx, frameA, 0, frameBx, frameA, 1);
GL11.glClipPlane(GL11.GL_CLIP_PLANE1, planes);
GL11.glEnable(GL11.GL_CLIP_PLANE1);
planeEquation(frameA, frameBy, 0, frameBx, frameBy, 0, frameBx, frameBy, 1);
GL11.glClipPlane(GL11.GL_CLIP_PLANE2, planes);
GL11.glEnable(GL11.GL_CLIP_PLANE2);
planeEquation(frameBx, frameA, 0, frameA, frameA, 0, frameA, frameA, 1);
GL11.glClipPlane(GL11.GL_CLIP_PLANE3, planes);
GL11.glEnable(GL11.GL_CLIP_PLANE3);
switch(type) {
case 2:
WorldProvider wp = scr.getWorldProvider();
CelestialBody body = null;
if (wp instanceof IGalacticraftWorldProvider) {
body = ((IGalacticraftWorldProvider) wp).getCelestialBody();
}
if (body == null) {
body = GalacticraftCore.planetOverworld;
}
drawCelestialBodies(body, ticks);
break;
case 3:
drawCelestialBodiesZ(GalacticraftCore.planetOverworld, ticks);
break;
case 4:
drawPlanetsTest(ticks);
break;
}
GL11.glDisable(GL11.GL_CLIP_PLANE3);
GL11.glDisable(GL11.GL_CLIP_PLANE2);
GL11.glDisable(GL11.GL_CLIP_PLANE1);
GL11.glDisable(GL11.GL_CLIP_PLANE0);
}
use of net.minecraft.world.WorldProvider in project Galacticraft by micdoodle8.
the class GuiCelestialSelection method teleportToSelectedBody.
protected void teleportToSelectedBody() {
if (this.selectedBody != null) {
if (this.selectedBody.getReachable() && this.possibleBodies != null && this.possibleBodies.contains(this.selectedBody)) {
try {
String dimension;
int dimensionID;
if (this.selectedBody instanceof Satellite) {
if (this.spaceStationMap == null) {
GCLog.severe("Please report as a BUG: spaceStationIDs was null.");
return;
}
Satellite selectedSatellite = (Satellite) this.selectedBody;
Integer mapping = this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).get(this.selectedStationOwner).getStationDimensionID();
// No need to check lowercase as selectedStationOwner is taken from keys.
if (mapping == null) {
GCLog.severe("Problem matching player name in space station check: " + this.selectedStationOwner);
return;
}
dimensionID = mapping;
WorldProvider spacestation = WorldUtil.getProviderForDimensionClient(dimensionID);
if (spacestation != null) {
dimension = WorldUtil.getDimensionName(spacestation);
} else {
GCLog.severe("Failed to find a spacestation with dimension " + dimensionID);
return;
}
} else {
dimensionID = this.selectedBody.getDimensionID();
dimension = WorldUtil.getDimensionName(WorldUtil.getProviderForDimensionClient(dimensionID));
}
if (dimension.contains("$")) {
this.mc.gameSettings.thirdPersonView = 0;
}
GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_TELEPORT_ENTITY, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { dimension }));
mc.displayGuiScreen(new GuiTeleporting(dimensionID));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of net.minecraft.world.WorldProvider in project Galacticraft by micdoodle8.
the class FreefallHandler method postVanillaMotion.
@SideOnly(Side.CLIENT)
public void postVanillaMotion(EntityPlayerSP p) {
World world = p.worldObj;
WorldProvider worldProvider = world.provider;
if (!(worldProvider instanceof IZeroGDimension)) {
return;
}
ZeroGravityEvent zeroGEvent = new ZeroGravityEvent.Motion(p);
MinecraftForge.EVENT_BUS.post(zeroGEvent);
if (zeroGEvent.isCanceled()) {
return;
}
boolean freefall = stats.isInFreefall();
freefall = this.testFreefall(p, freefall);
stats.setInFreefall(freefall);
stats.setInFreefallFirstCheck(true);
SpinManager spinManager = null;
if (worldProvider instanceof WorldProviderSpaceStation && !stats.getPlatformControlled()) {
spinManager = ((WorldProviderSpaceStation) worldProvider).getSpinManager();
}
boolean doCentrifugal = spinManager != null;
if (freefall) {
this.pjumpticks = 0;
// Reverse effects of deceleration
p.motionX /= 0.91F;
p.motionZ /= 0.91F;
p.motionY /= 0.9800000190734863D;
if (spinManager != null) {
doCentrifugal = spinManager.updatePlayerForSpin(p, 1F);
}
// Do freefall motion
if (!p.capabilities.isCreativeMode) {
this.freefallMotion(p);
} else {
p.capabilities.isFlying = true;
// Half the normal acceleration in Creative mode
double dx = p.motionX - this.pPrevMotionX;
double dy = p.motionY - this.pPrevMotionY;
double dz = p.motionZ - this.pPrevMotionZ;
p.motionX -= dx / 2;
p.motionY -= dy / 2;
p.motionZ -= dz / 2;
if (p.motionX > 1.2F) {
p.motionX = 1.2F;
}
if (p.motionX < -1.2F) {
p.motionX = -1.2F;
}
if (p.motionY > 0.7F) {
p.motionY = 0.7F;
}
if (p.motionY < -0.7F) {
p.motionY = -0.7F;
}
if (p.motionZ > 1.2F) {
p.motionZ = 1.2F;
}
if (p.motionZ < -1.2F) {
p.motionZ = -1.2F;
}
}
// TODO: Think about endless drift?
// Player may run out of oxygen - that will kill the player eventually if can't get back to SS
// Could auto-kill + respawn the player if floats too far away (config option whether to lose items or not)
// But we want players to be able to enjoy the view of the spinning space station from the outside
// Arm and leg movements could start tumbling the player?
} else // Not freefall - within arm's length of something or jumping
{
double dy = p.motionY - this.pPrevMotionY;
// if (p.motionY != 0) p.motionY = this.pPrevMotionY;
if (p.movementInput.jump) {
if ((p.onGround || stats.isSsOnGroundLast()) && !p.capabilities.isCreativeMode) {
if (this.pjumpticks < 25)
this.pjumpticks++;
p.motionY -= dy;
} else {
p.motionY += 0.015D;
if (this.pjumpticks == 0) {
p.motionY -= dy;
}
}
} else if (this.pjumpticks > 0) {
p.motionY += 0.0145D * this.pjumpticks;
this.pjumpticks = 0;
} else if (p.movementInput.sneak) {
if (!p.onGround) {
p.motionY -= 0.015D;
}
this.pjumpticks = 0;
}
}
// Artificial gravity
if (doCentrifugal && !p.onGround) {
spinManager.applyCentrifugalForce(p);
}
this.pPrevMotionX = p.motionX;
this.pPrevMotionY = p.motionY;
this.pPrevMotionZ = p.motionZ;
}
Aggregations