From 76929e9c8ff45afea579b0514979b6b88e2f7c67 Mon Sep 17 00:00:00 2001 From: glowredman Date: Sat, 5 Feb 2022 00:53:42 +0100 Subject: [PATCH] Planar Conjunction https: //github.com/SpitefulFox/Avaritia/commit/ff6ab98288aba77c2c7b362c7f1480c02c4623bc Co-Authored-By: SpitefulFox <6055143+SpitefulFox@users.noreply.github.com> --- .../java/fox/spiteful/avaritia/Avaritia.java | 6 +- .../java/fox/spiteful/avaritia/Config.java | 6 + .../avaritia/compat/botania/Tsundere.java | 5 +- .../compat/botania/alfheim/Alfheim.java | 29 ++ .../compat/botania/alfheim/AlfheimBlocks.java | 13 + .../compat/botania/alfheim/AlfheimEvents.java | 182 ++++++++ .../compat/botania/alfheim/AlfheimNoise.java | 190 +++++++++ .../alfheim/ApocalypseCloudRenderer.java | 17 + .../alfheim/ApocalypseSkyRenderer.java | 84 ++++ .../botania/alfheim/BasicTeleporter.java | 25 ++ .../compat/botania/alfheim/BlockDeadrock.java | 67 +++ .../botania/alfheim/ChunkProviderAlfheim.java | 183 ++++++++ .../botania/alfheim/ComponentCityParts.java | 165 ++++++++ .../botania/alfheim/MapGenAlfheimRavines.java | 49 +++ .../compat/botania/alfheim/MapGenCity.java | 186 ++++++++ .../avaritia/compat/botania/alfheim/Ruin.java | 397 ++++++++++++++++++ .../botania/alfheim/TeleportHelper.java | 102 +++++ .../botania/alfheim/WorldProviderAlfheim.java | 131 ++++++ .../avaritia/items/ItemMorvInABox.java | 22 + 19 files changed, 1855 insertions(+), 4 deletions(-) create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Alfheim.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimBlocks.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimEvents.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimNoise.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/ApocalypseCloudRenderer.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/ApocalypseSkyRenderer.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/BasicTeleporter.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/BlockDeadrock.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/ChunkProviderAlfheim.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/ComponentCityParts.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/MapGenAlfheimRavines.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/MapGenCity.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Ruin.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/TeleportHelper.java create mode 100644 src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/WorldProviderAlfheim.java diff --git a/src/main/java/fox/spiteful/avaritia/Avaritia.java b/src/main/java/fox/spiteful/avaritia/Avaritia.java index a20ca71..1792735 100644 --- a/src/main/java/fox/spiteful/avaritia/Avaritia.java +++ b/src/main/java/fox/spiteful/avaritia/Avaritia.java @@ -13,6 +13,7 @@ import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.avaritia.achievements.Achievements; import fox.spiteful.avaritia.blocks.LudicrousBlocks; import fox.spiteful.avaritia.compat.Compat; +import fox.spiteful.avaritia.compat.botania.alfheim.Alfheim; import fox.spiteful.avaritia.crafting.Gregorizer; import fox.spiteful.avaritia.crafting.Grinder; import fox.spiteful.avaritia.crafting.Mincer; @@ -21,10 +22,7 @@ import fox.spiteful.avaritia.gui.GooeyHandler; import fox.spiteful.avaritia.items.ItemFracturedOre; import fox.spiteful.avaritia.items.LudicrousItems; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; @Mod(modid = "Avaritia", name = "Avaritia", dependencies = "after:Thaumcraft;after:AWWayofTime;after:Botania") @@ -62,6 +60,8 @@ public class Avaritia { LudicrousEntities.letLooseTheDogsOfWar(); proxy.prepareForPretty(); + if(Compat.botan && Config.alfheim) + Alfheim.packYourBags(); } @EventHandler diff --git a/src/main/java/fox/spiteful/avaritia/Config.java b/src/main/java/fox/spiteful/avaritia/Config.java index 0e11843..51ee145 100644 --- a/src/main/java/fox/spiteful/avaritia/Config.java +++ b/src/main/java/fox/spiteful/avaritia/Config.java @@ -40,6 +40,9 @@ public class Config { public static boolean extracells = true; public static boolean witch = true; public static boolean rotisserie = true; + + public static boolean alfheim = false; + public static int alfheimID; public static boolean copper = true; public static boolean tin = true; @@ -91,6 +94,9 @@ public class Config { extracells = conf.get("compatibility", "Extra Cells", true).getBoolean(true); witch = conf.get("compatibility", "Witchery", true).getBoolean(true); rotisserie = conf.get("compatibility", "Rotarycraft", true).getBoolean(true); + + alfheim = conf.get("compatibility", "Alfheim", false).getBoolean(false); + alfheimID = conf.get("compatibility", "AlfheimID", 13).getInt(13); conf.addCustomCategoryComment("materials", "Disable to stop using that material in recipes. Useful if a mod adds unobtainable placeholder ores."); copper = conf.get("materials", "Copper", true).getBoolean(true); diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java b/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java index 47a5839..816babd 100644 --- a/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java @@ -1,10 +1,10 @@ package fox.spiteful.avaritia.compat.botania; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.GameRegistry; import fox.spiteful.avaritia.Config; import fox.spiteful.avaritia.blocks.LudicrousBlocks; import fox.spiteful.avaritia.compat.Compat; +import fox.spiteful.avaritia.compat.botania.alfheim.Alfheim; import fox.spiteful.avaritia.compat.nei.NotEnough; import fox.spiteful.avaritia.crafting.ExtremeCraftingManager; import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe; @@ -42,6 +42,9 @@ public class Tsundere { SubTileCheaty.lexicon = new LudicrousLexicon("asgardandelion", BotaniaAPI.categoryGenerationFlowers); SubTileCheaty.lexicon.addPage(BotaniaAPI.internalHandler.textPage("avaritia.lexicon.asgardandelion.0")); SubTileCheaty.lexicon.setIcon(cheaty); + + if(Config.alfheim) + Alfheim.vacationTime(); ExtremeCraftingManager.getInstance().addRecipe(cheaty, new Object[]{ " III ", diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Alfheim.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Alfheim.java new file mode 100644 index 0000000..1866dc2 --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Alfheim.java @@ -0,0 +1,29 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import net.minecraft.world.gen.structure.MapGenStructureIO; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.common.FMLCommonHandler; + +public class Alfheim { + public static void vacationTime() { + AlfheimBlocks.alfheimify(); + + if(FMLCommonHandler.instance().getSide().isClient()) { + AlfheimEvents alfevents = new AlfheimEvents(); + FMLCommonHandler.instance().bus().register(alfevents); + MinecraftForge.EVENT_BUS.register(alfevents); + } + } + + // this stuff needs to happen whether or not botania is active it seems D: + // DON'T LIE LIKE THAT, CUTS >:P + public static void packYourBags() { + int dim = WorldProviderAlfheim.dimensionID; + DimensionManager.registerProviderType(dim, WorldProviderAlfheim.class, false); + DimensionManager.registerDimension(dim, dim); + + MapGenStructureIO.registerStructure(MapGenCity.Start.class, "AlfCity"); + ComponentCityParts.registerParts(); + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimBlocks.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimBlocks.java new file mode 100644 index 0000000..42cb9d8 --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimBlocks.java @@ -0,0 +1,13 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import net.minecraft.block.Block; +import cpw.mods.fml.common.registry.GameRegistry; +import fox.spiteful.avaritia.blocks.ItemBlockWithMetadataUnderp; + +public class AlfheimBlocks { + public static Block deadrock; + + public static void alfheimify() { + deadrock = GameRegistry.registerBlock(new BlockDeadrock(), ItemBlockWithMetadataUnderp.class, "Alf_Deadrock"); + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimEvents.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimEvents.java new file mode 100644 index 0000000..20172c1 --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimEvents.java @@ -0,0 +1,182 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.logging.log4j.Level; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.util.Timer; +import net.minecraft.world.World; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Phase; +import cpw.mods.fml.relauncher.ReflectionHelper; +import fox.spiteful.avaritia.FieldHelper; +import fox.spiteful.avaritia.Lumberjack; + +public class AlfheimEvents { + public static Field lightmapUpdateNeededField; + public static Field mcTimerField; + public static Field torchFlickerField; + public static Field lightmapColorsField; + public static Field lightmapTextureField; + public static Field bossColorModifierField; + public static Field bossColorModifierPrevField; + public static Method getNightVisionBrightnessMethod = ReflectionHelper.findMethod(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, new String[]{"getNightVisionBrightness", "func_82830_a"}, EntityPlayer.class, float.class); + + static { + try { + mcTimerField = ReflectionHelper.findField(Minecraft.class, "timer", "field_71428_T"); + lightmapUpdateNeededField = ReflectionHelper.findField(EntityRenderer.class, "lightmapUpdateNeeded", "field_78536_aa"); + torchFlickerField = ReflectionHelper.findField(EntityRenderer.class, "torchFlickerX", "field_78514_e"); + lightmapColorsField = ReflectionHelper.findField(EntityRenderer.class, "lightmapColors", "field_78504_Q"); + lightmapTextureField = ReflectionHelper.findField(EntityRenderer.class, "lightmapTexture", "field_78513_d"); + bossColorModifierField = ReflectionHelper.findField(EntityRenderer.class, "bossColorModifier", "field_82831_U"); + bossColorModifierPrevField = ReflectionHelper.findField(EntityRenderer.class, "bossColorModifierPrev", "field_82832_V"); + //getNightVisionBrightnessMethod = ReflectionHelper.findMethod(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, new String[]{"getNightVisionBrightness", "func_82830_a"}, Float.class); + } catch(Exception e) { + Lumberjack.log(Level.ERROR, e); + } + } + + @SubscribeEvent + public void onRenderStart(TickEvent.RenderTickEvent event) { + if (event.phase == Phase.START) { + Minecraft mc = Minecraft.getMinecraft(); + + if (mc.theWorld == null) { + return; + } + World world = mc.theWorld; + if (world.provider == null || !(world.provider instanceof WorldProviderAlfheim)) { + return; + } + EntityRenderer er = mc.entityRenderer; + + boolean needsupdate = FieldHelper.get(lightmapUpdateNeededField, er); + + if (needsupdate) { + updateLightmapRedGiant(); + } + } + } + + public void updateLightmapRedGiant() { + //Lumberjack.info("Lightmap update"); + Minecraft mc = Minecraft.getMinecraft(); + EntityRenderer er = mc.entityRenderer; + Timer timer = FieldHelper.get(mcTimerField, mc); + float partialTicks = timer.renderPartialTicks; + float flicker = FieldHelper.get(torchFlickerField, er); + float bossColorModifier = FieldHelper.get(bossColorModifierField, er); + float bossColorModifierPrev = FieldHelper.get(bossColorModifierPrevField, er); + int[] lightmapColors = FieldHelper.get(lightmapColorsField, er); + DynamicTexture lightmapTexture = FieldHelper.get(lightmapTextureField, er); + + WorldClient worldclient = mc.theWorld; + + if (worldclient != null) + { + for (int i = 0; i < 256; ++i) + { + float brightness = worldclient.getSunBrightness(1.0F) * 0.95F + 0.05F; + float sun = worldclient.provider.lightBrightnessTable[i / 16] * brightness; + float torch = worldclient.provider.lightBrightnessTable[i % 16] * (flicker * 0.1F + 1.5F); + + if (worldclient.lastLightningBolt > 0) + { + sun = worldclient.provider.lightBrightnessTable[i / 16]; + } + + float sunr = sun * (worldclient.getSunBrightness(1.0F) * 0.65F + 0.35F); + float sung = sun * (worldclient.getSunBrightness(1.0F) * 0.65F + 0.35F); + float torchg = torch * ((torch * 0.6F + 0.4F) * 0.6F + 0.4F); + float torchb = torch * (torch * torch * 0.6F + 0.4F); + float fr = sunr + torch; + float fg = sung * 0.3f + torchg; + float fb = sun * 0.2f + torchb; + fr = fr * 0.96F + 0.03F; + fg = fg * 0.96F + 0.03F; + fb = fb * 0.96F + 0.03F; + float modifier; + + if (bossColorModifier > 0.0F) + { + modifier = bossColorModifierPrev + (bossColorModifier - bossColorModifierPrev) * partialTicks; + fr = fr * (1.0F - modifier) + fr * 0.7F * modifier; + fg = fg * (1.0F - modifier) + fg * 0.6F * modifier; + fb = fb * (1.0F - modifier) + fb * 0.6F * modifier; + } + + if (worldclient.provider.dimensionId == 1) + { + fr = 0.22F + torch * 0.75F; + fg = 0.28F + torchg * 0.75F; + fb = 0.25F + torchb * 0.75F; + } + + if (mc.thePlayer.isPotionActive(Potion.nightVision)) + { + modifier = FieldHelper.invoke(getNightVisionBrightnessMethod, er, mc.thePlayer, partialTicks); + + float nightvision = 1.0F / fr; + + if (nightvision > 1.0F / fg) + { + nightvision = 1.0F / fg; + } + + if (nightvision > 1.0F / fb) + { + nightvision = 1.0F / fb; + } + + fr = fr * (1.0F - modifier) + fr * nightvision * modifier; + fg = fg * (1.0F - modifier) + fg * nightvision * modifier; + fb = fb * (1.0F - modifier) + fb * nightvision * modifier; + } + + if (fr > 1.0F) { fr = 1.0F; } + if (fg > 1.0F) { fg = 1.0F; } + if (fb > 1.0F) { fb = 1.0F; } + + modifier = mc.gameSettings.gammaSetting; + float gr = 1.0F - fr; + float gg = 1.0F - fg + 0.25f*sun; + float gb = 1.0F - fb + 0.2f*sun; + gr = 1.0F - gr * gr * gr * gr; + gg = 1.0F - gg * gg * gg * gg; + gb = 1.0F - gb * gb * gb * gb; + fr = fr * (1.0F - modifier) + gr * modifier; + fg = fg * (1.0F - modifier) + gg * modifier; + fb = fb * (1.0F - modifier) + gb * modifier; + fr = fr * 0.96F + 0.03F; + fg = fg * 0.96F + 0.03F; + fb = fb * 0.96F + 0.03F; + + if (fr > 1.0F) { fr = 1.0F; } + if (fg > 1.0F) { fg = 1.0F; } + if (fb > 1.0F) { fb = 1.0F; } + + if (fr < 0.0F) { fr = 0.0F; } + if (fg < 0.0F) { fg = 0.0F; } + if (fb < 0.0F) { fb = 0.0F; } + + short alpha = 255; + int r = (int)(fr * 255.0F); + int g = (int)(fg * 255.0F); + int b = (int)(fb * 255.0F); + lightmapColors[i] = alpha << 24 | r << 16 | g << 8 | b; + } + + lightmapTexture.updateDynamicTexture(); + FieldHelper.set(lightmapUpdateNeededField, er, false); + } + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimNoise.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimNoise.java new file mode 100644 index 0000000..6ed939a --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/AlfheimNoise.java @@ -0,0 +1,190 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import java.util.Random; + +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + + + +public class AlfheimNoise { + + public final long seed; + private final double[] randomSource; + + private static int XSEED = 1619; + private static int ZSEED = 31337; + private static int NSEED = 1013; + private static int NSHIFT = 8; + + public AlfheimNoise(long seed) { + this.seed = seed; + this.randomSource = new double[256*2]; + Random randy = new Random(this.seed); + for (int i=0; i<256; i++) { + double r = randy.nextDouble(); + double a = randy.nextDouble()*2*Math.PI; + + this.randomSource[i*2] = Math.sin(a)*r; + this.randomSource[i*2+1] = Math.cos(a)*r; + } + } + + private double getNoise(double x, double z, double period, long seed) { + double frequency = period == 0 ? 1.0 : 1.0/period; + return this.calcNoise(x * frequency, z * frequency, seed); + } + + private double calcNoise(double x, double z, long seed) { + int x0 = (x > 0 ? MathHelper.floor_double(x) : MathHelper.floor_double(x)-1); + int x1 = x0 + 1; + int z0 = (z > 0 ? MathHelper.floor_double(z) : MathHelper.floor_double(z)-1); + int z1 = z0 + 1; + + double xs = deriv1(x-x0); + double zs = deriv1(z-z0); + + double tl = this.gradientNoise(x,z, x0,z0, seed); + double tr = this.gradientNoise(x,z, x1,z0, seed); + double top = lerp(tl,tr, xs); + + double bl = this.gradientNoise(x,z, x0,z1, seed); + double br = this.gradientNoise(x,z, x1,z1, seed); + double bot = lerp(bl,br, xs); + + return lerp(top, bot, zs); + } + + private double gradientNoise(double fx, double fz, int ix, int iz, long seed) { + Vec3 grad = this.getGradient(ix, iz, seed); + Vec3 point = Vec3.createVectorHelper(fx-ix, fz-iz, 0); + + return grad.dotProduct(point) * 2.12; + } + + private Vec3 getGradient(int x, int z, long seed) { + long vectorindex = ( + XSEED * x + + ZSEED * z + + NSEED * seed + ) & 0xffffffff; + vectorindex ^= (vectorindex >> NSHIFT); + vectorindex &= 0xff; + int vi = (int)vectorindex; + + return Vec3.createVectorHelper(this.randomSource[vi*2], this.randomSource[vi*2+1], 0); + } + + private Vec3 calcDerivative(double x, double z, long seed) { + int ix = MathHelper.floor_double(x); + int iz = MathHelper.floor_double(z); + double fx = x-ix; + double fz = z-iz; + + double wx = deriv1(fx); + double wz = deriv1(fz); + + double dwx = deriv2(fx); + double dwz = deriv2(fz); + + double dwpx = deriv3(fx); + double dwpz = deriv3(fz); + + Vec3 vtl = getGradient(ix, iz, seed); + Vec3 vtr = getGradient(ix+1, iz, seed); + Vec3 vbl = getGradient(ix, iz+1, seed); + Vec3 vbr = getGradient(ix+1, iz+1, seed); + + double tl = vtl.xCoord * (x - ix) + vtl.yCoord * (z - iz); + double tr = vtr.xCoord * (x - (ix+1)) + vtr.yCoord * (z - iz); + double bl = vbl.xCoord * (x - ix) + vbl.yCoord * (z - (iz+1)); + double br = vbr.xCoord * (x - (ix+1)) + vbr.yCoord * (z - (iz+1)); + + double top = lerp(tl,tr,wx); + double bot = lerp(bl,br,wx); + double n = lerp(top,bot,wz); + + double dx = (vtl.xCoord + (vbl.xCoord-vtl.xCoord)*wz) + ((vtr.yCoord-vtl.yCoord)*fz - vtr.xCoord + + ((vtl.yCoord-vtr.yCoord-vbl.yCoord+vbr.yCoord)*fz + vtr.xCoord + vbl.yCoord - vbr.xCoord - vbr.yCoord)*wz)* + dwx + ((vtr.xCoord-vtl.xCoord) + (vtl.xCoord-vtr.xCoord-vbl.xCoord+vbr.xCoord)*wz)*dwpx; + + double dz = (vtl.yCoord + (vtr.yCoord-vtl.yCoord)*wx) + ((vbl.xCoord-vtl.xCoord)*fx - vbl.yCoord + ((vtl.xCoord- + vtr.xCoord-vbl.xCoord+vbr.xCoord)*fx + vtr.xCoord + vbl.yCoord - vbr.xCoord - vbr.yCoord)*wx)*dwz + + ((vbl.yCoord-vtl.yCoord) + (vtl.yCoord-vtr.yCoord-vbl.yCoord+vbr.yCoord)*wx)*dwpz; + + return Vec3.createVectorHelper(n*2, dx*2, dz*2); + } + + private double getNoiseOctaves(double x, double z, int octaves, double period, double lacunarity, double gain, long seed) { + double sum = 0.0; + double freq = period == 0 ? 1.0 : 1.0 / period; + double amp = 1.0; + + for (int i=0; i= 0) + { + return true; + } + else + { + int j = 0; + int k = 0; + + for (int l = this.boundingBox.minZ; l <= this.boundingBox.maxZ; ++l) + { + for (int i1 = this.boundingBox.minX; i1 <= this.boundingBox.maxX; ++i1) + { + if (bounds.isVecInside(i1, 64, l)) + { + j += Math.max(world.getTopSolidOrLiquidBlock(i1, l), world.provider.getAverageGroundLevel()); + ++k; + } + } + } + + if (k == 0) + { + return false; + } + else + { + this.partPosY = j / k; + this.boundingBox.offset(0, this.partPosY - this.boundingBox.minY + offset, 0); + return true; + } + } + } + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/MapGenAlfheimRavines.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/MapGenAlfheimRavines.java new file mode 100644 index 0000000..97ae315 --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/MapGenAlfheimRavines.java @@ -0,0 +1,49 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import fox.spiteful.avaritia.Lumberjack; +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraft.world.gen.MapGenRavine; + +public class MapGenAlfheimRavines extends MapGenRavine { + + @Override + protected void func_151538_a(World world, int originChunkX, int originChunkZ, int chunkX, int chunkZ, Block[] blocks) + { + if (this.rand.nextInt(6) == 0) { + Lumberjack.info("crack!"); + double x = (double)(originChunkX * 16 + this.rand.nextInt(16)); + double y = 67;//(double)(this.rand.nextInt(20) + 50); + double z = (double)(originChunkZ * 16 + this.rand.nextInt(16)); + + int angles = this.rand.nextInt(4)+3; + double angleinc = (Math.PI*2.0) / angles; + double baseangle = this.rand.nextDouble() * Math.PI * 2.0; + + for (int i=0; i cells = new ArrayList(); + int[] cellfill = new int[BLOCKS*BLOCKS]; + for (int i=0; i BLOCKS/2-3 && bx < BLOCKS/2+2 && bz > BLOCKS/2-3 && bz < BLOCKS/2+2) { + continue; + } + int x = origin + (BLOCKSIZE + ROADSIZE) * bx; + int z = origin + (BLOCKSIZE + ROADSIZE) * bz; + + double cx = x + BLOCKSIZE * 0.5; + double cz = z + BLOCKSIZE * 0.5; + + double rad = Math.sqrt(cx*cx + cz*cz) / (CITYRADIUS - (BLOCKSIZE*0.75)); + + if (rad < 1.0) { + if (rand.nextDouble() > rad - 0.4) { + cells.add(new ChunkCoordinates(bx,bz,0)); + cellfill[bz*BLOCKS + bx] = 1; + } + } + } + } + + Collections.shuffle(cells); + + while (cells.size() > 0) { + ChunkCoordinates cell = cells.remove(0); + int bx = cell.posX; + int bz = cell.posY; + int index = bz * BLOCKS + bx; + if (cellfill[index] != 1) { + continue; + } + + int dx = BLOCKS/2 - bx; + int dz = BLOCKS/2 - bz; + double dist = Math.sqrt(dx*dx + dz*dz) / (BLOCKS*0.5); + + int width = 1; + int height = 1; + + if (rand.nextDouble() < 1.5 * (1-dist) - 0.05) { + width += 1; + height += 1; + + if (rand.nextDouble() < 0.1) { + width += 1; + } + if (rand.nextDouble() < 0.1) { + height += 1; + } + } + + while(true) { + if (width == 1 && height == 1) { + break; + } + + boolean ok = true; + for (int cx = 0; cx < width; cx++) { + for (int cz = 0; cz < height; cz++) { + if (bx+cx >= BLOCKS || bz+cz >= BLOCKS) { + ok = false; + break; + } + if ((bx < BLOCKS/2 && bx+cx >= BLOCKS/2) || (bz < BLOCKS/2 && bz+cz >= BLOCKS/2)) { + ok = false; + break; + } + int cindex = (bz+cz)*BLOCKS + (bx+cx); + if (cellfill[cindex] != 1) { + ok = false; + break; + } + } + } + + if (ok) { + break; + } else { + if (width > 1 && height > 1) { + if (rand.nextBoolean()) { + width--; + } else { + height--; + } + } else if (width > 1) { + width--; + } else { + height--; + } + } + } + + for (int cx = 0; cx < width; cx++) { + for (int cz = 0; cz < height; cz++) { + int cindex = (bz+cz)*BLOCKS + (bx+cx); + cellfill[cindex] = 2; + } + } + + double size = Math.sqrt(width*height); + int floors = (int)Math.round(0.5 + (size * 1.45 * ((1-dist) + 0.3) * (rand.nextDouble() * rand.nextDouble())) + (rand.nextDouble() * (1-dist) * 0.6) + rand.nextDouble() * 0.2); + + int x = origin + (BLOCKSIZE+ROADSIZE) * bx; + int z = origin + (BLOCKSIZE+ROADSIZE) * bz; + int structurewidth = width * BLOCKSIZE + (width-1) * ROADSIZE; + int structureheight = height * BLOCKSIZE + (height-1) * ROADSIZE; + + /*ComponentScatteredFeaturePieces.SwampHut swamphut = new ComponentScatteredFeaturePieces.SwampHut(rand, x, z); + this.components.add(swamphut);*/ + + ComponentCityParts.CityRuin ruin = new ComponentCityParts.CityRuin(rand, x, z, structurewidth, structureheight, floors); + this.components.add(ruin); + } + + + + //ComponentScatteredFeaturePieces.SwampHut swamphut = new ComponentScatteredFeaturePieces.SwampHut(rand, (chunkX) * 16, (chunkZ) * 16); + //this.components.add(swamphut); + + this.updateBoundingBox(); + } + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Ruin.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Ruin.java new file mode 100644 index 0000000..a26e7bd --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/Ruin.java @@ -0,0 +1,397 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import fox.spiteful.avaritia.compat.botania.alfheim.Ruin.BlockRuinPalette.BlockPaletteInfo; + +import net.minecraft.block.Block; + +public class Ruin { + public BlockArray blocks; + public double ruinLevel; + public Random rand; + public BlockRuinPalette palette; + + public int xSize; + public int ySize; + public int zSize; + public int xOffset; + public int yOffset; + public int zOffset; + + public Ruin(BlockArray blocks, double ruinLevel, Random rand) { + this(blocks, ruinLevel, rand, new BlockRuinPalette()); + } + public Ruin(BlockArray blocks, double ruinLevel, Random rand, BlockRuinPalette palette) { + this (blocks, ruinLevel, rand, blocks.xSize, blocks.ySize, blocks.zSize, 0,0,0, palette); + } + public Ruin(BlockArray blocks, double ruinLevel, Random rand, int xSize, int ySize, int zSize, int xOffset, int yOffset, int zOffset) { + this (blocks, ruinLevel, rand, xSize, ySize, zSize, xOffset,yOffset,zOffset, new BlockRuinPalette()); + } + public Ruin(BlockArray blocks, double ruinLevel, Random rand, int xSize, int ySize, int zSize, int xOffset, int yOffset, int zOffset, BlockRuinPalette palette) { + this.blocks = blocks; + this.ruinLevel = ruinLevel; + this.rand = rand; + this.palette = palette; + + this.xSize = xSize; + this.ySize = ySize; + this.zSize = zSize; + + this.xOffset = xOffset; + this.yOffset = yOffset; + this.zOffset = zOffset; + + int volume = this.xSize * this.ySize * this.zSize; + int breaks = (int) Math.ceil((volume/16.0) * ruinLevel); + + for (int i=0; i falldirs = new ArrayList(); + if (!blocks.outOfBounds(x-1,y,z) && blocks.getBlock(x-1,y,z) == null && blocks.getBlock(x-1,y-1,z) == null) { + falldirs.add(0); + } + if (!blocks.outOfBounds(x+1,y,z) && blocks.getBlock(x+1,y,z) == null && blocks.getBlock(x+1,y-1,z) == null) { + falldirs.add(1); + } + if (!blocks.outOfBounds(x,y,z-1) && blocks.getBlock(x,y,z-1) == null && blocks.getBlock(x,y-1,z-1) == null) { + falldirs.add(2); + } + if (!blocks.outOfBounds(x,y,z+1) && blocks.getBlock(x,y,z+1) == null && blocks.getBlock(x,y-1,z+1) == null) { + falldirs.add(3); + } + + if (!falldirs.isEmpty()) { + slide = true; + slidedir = falldirs.get(rand.nextInt(falldirs.size())); + } + + if (slide) { + impact(x,y-1,z, falldistance/4, block); + if (slidedir == 0) { + x--; + } else if (slidedir == 1) { + x++; + } else if (slidedir == 2) { + z--; + } else { + z++; + } + } else { + BlockPaletteInfo blockinfo = this.palette.get(block); + double breakchance = fallBreakChance(falldistance) * blockinfo.breakchance; + if (rand.nextDouble() <= breakchance) { + blocks.setBlock(x,y,z,blockinfo.broken); + } else { + if (blockinfo.hardness >= 1) { + blocks.setBlock(x,y,z,block); + } + } + impact(x,y-1,z, falldistance, block); + break; + } + } + } + } + + protected void impact(int x, int y, int z, int falldistance, BlockMeta fallingblock) { + BlockMeta block = blocks.getBlock(x,y,z); + BlockPaletteInfo blockinfo = this.palette.get(block); + double smashchance = fallBreakChance(falldistance) * blockinfo.smashchance; + + if (rand.nextDouble() <= smashchance) { + blocks.setBlock(x,y,z, null); + dropBlock(x,y+1,z, falldistance/3); + } + + double breakchance = fallBreakChance(falldistance) * blockinfo.breakchance; + if (blocks.getBlock(x,y-1,z) != null) { + breakchance *= 0.75; + } + + if (rand.nextDouble() <= breakchance) { + if (blockinfo.broken != null) { + blocks.setBlock(x,y,z, blockinfo.broken); + impact(x,y,z, falldistance/2, fallingblock); + } else { + dropBlock(x,y,z); + dropBlock(x,y+1,z, falldistance/3); + } + } + } + + protected void ruinArea(int ox, int oy, int oz, double radius) { + int range = (int)Math.ceil(radius*2); + int offset = range/2; + + for (int y = 0; y<=range; y++) { + List coords = new ArrayList(); + for (int x = 0; x<=range; x++) { + if (x < 0 || x >= blocks.xSize) { + continue; + } + for (int z = 0; z<=range; z++) { + if (z < 0 || z >= blocks.zSize) { + continue; + } + BlockMeta block = blocks.getBlock(ox+x-offset,oy+y-offset,oz+z-offset); + if (block == null) { + continue; + } + + BlockPaletteInfo blockinfo = this.palette.get(block); + + double rx = (x - range/2); + double ry = (y - range/2); + double rz = (z - range/2); + + double dist = Math.sqrt(rx*rx+ry*ry+rz*rz) / radius; + if(dist <= 1.0) { + if (dist > .75) { + double dchance = (dist - 0.75)*4; + if (rand.nextDouble() > dchance) { + coords.add(new Coord(x,y,z)); + } else if (blockinfo.broken != null || blockinfo.hardness < 1) { + blocks.setBlock(ox+x-offset,oy+y-offset,oz+z-offset,blockinfo.broken); + } + } else { + coords.add(new Coord(x,y,z)); + } + } + } + } + Collections.shuffle(coords, rand); + for (int i=0; i open = new ArrayList(); + open.add(new Coord(ox,0,oz)); + + while(!open.isEmpty()) { + Coord c = open.remove(open.size()-1); + if (!blocks.outOfBounds(c.x, c.y, c.z) && blocks.getBlock(c.x, c.y, c.z) != null) { + connected[blocks.index(c.x,c.y,c.z)] = true; + + if(!blocks.outOfBounds(c.x-1, c.y, c.z) && blocks.getBlock(c.x-1, c.y, c.z) != null && connected[blocks.index(c.x-1,c.y,c.z)] == false) { + open.add(new Coord(c.x-1,c.y,c.z)); + } + if(!blocks.outOfBounds(c.x+1, c.y, c.z) && blocks.getBlock(c.x+1, c.y, c.z) != null && connected[blocks.index(c.x+1,c.y,c.z)] == false) { + open.add(new Coord(c.x+1,c.y,c.z)); + } + if(!blocks.outOfBounds(c.x, c.y, c.z-1) && blocks.getBlock(c.x, c.y, c.z-1) != null && connected[blocks.index(c.x,c.y,c.z-1)] == false) { + open.add(new Coord(c.x,c.y,c.z-1)); + } + if(!blocks.outOfBounds(c.x, c.y, c.z+1) && blocks.getBlock(c.x, c.y, c.z+1) != null && connected[blocks.index(c.x,c.y,c.z+1)] == false) { + open.add(new Coord(c.x,c.y,c.z+1)); + } + if(!blocks.outOfBounds(c.x, c.y-1, c.z) && blocks.getBlock(c.x, c.y-1, c.z) != null && connected[blocks.index(c.x,c.y-1,c.z)] == false) { + open.add(new Coord(c.x,c.y-1,c.z)); + } + if(!blocks.outOfBounds(c.x, c.y+1, c.z) && blocks.getBlock(c.x, c.y+1, c.z) != null && connected[blocks.index(c.x,c.y+1,c.z)] == false) { + open.add(new Coord(c.x,c.y+1,c.z)); + } + } + } + + for (int y = 0; y<=blocks.ySize; y++) { + List coords = new ArrayList(); + for (int x = 0; x<=blocks.xSize; x++) { + for (int z = 0; z<=blocks.zSize; z++) { + if (blocks.getBlock(x,y,z) != null && !connected[blocks.index(x,y,z)]) { + coords.add(new Coord(x,y,z)); + } + } + } + Collections.shuffle(coords, rand); + for (int i=0; i=xSize||y<0||y>=ySize||z<0||z>=zSize); + } + + public void setBlock(int x, int y, int z, BlockMeta block) { + if (outOfBounds(x,y,z)) { + return; + } + + blocks[index(x,y,z)] = block; + } + + public BlockMeta getBlock(int x, int y, int z) { + if (outOfBounds(x,y,z)) { + return null; + } + + return blocks[index(x,y,z)]; + } + + public void fillBlocks(int x, int y, int z, int x2, int y2, int z2, BlockMeta block) { + for (int ix = x; ix<=x2; ix++) { + for (int iy = y; iy<=y2; iy++) { + for (int iz = z; iz<=z2; iz++) { + setBlock(ix,iy,iz, block); + } + } + } + } + + protected int index(int x, int y, int z) { + return y * zSize * xSize + z * xSize + x; + } + } + + public static class BlockMeta { + public Block block; + public byte meta; + + public BlockMeta(Block block, int meta) { + this.block = block; + this.meta = (byte)(meta & 0xFF); + } + + @Override + public String toString() { + return this.block.toString()+"#"+this.meta; + } + + @Override + public int hashCode() { + return this.block.hashCode() + this.meta; + } + } + + public static class BlockRuinPalette { + protected Map infomap = new HashMap(); + + public BlockPaletteInfo get(BlockMeta block) { + if (infomap.containsKey(block)) { + return infomap.get(block); + } + return BlockPaletteInfo.DEFAULT; + } + + public void set(BlockMeta block, double hardness, double breakchance, double smashchance) { + this.set(block, hardness, breakchance, smashchance, null); + } + public void set(BlockMeta block, double hardness, double breakchance, double smashchance, BlockMeta broken) { + infomap.put(block, new BlockPaletteInfo(hardness, breakchance, smashchance, broken)); + } + + public static class BlockPaletteInfo { + public static final BlockPaletteInfo DEFAULT = new BlockPaletteInfo(1.0, 0.2, 0.2, null); + + public final double hardness; + public final double breakchance; + public final double smashchance; + public final BlockMeta broken; + + public BlockPaletteInfo(double hardness, double breakchance, double smashchance, BlockMeta broken) { + this.hardness = hardness; + this.breakchance = breakchance; + this.smashchance = smashchance; + this.broken = broken; + } + } + } + + // ################################################################################# + // Internal Classes + // ################################################################################# + protected static class Coord { + int x; + int y; + int z; + + public Coord(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/TeleportHelper.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/TeleportHelper.java new file mode 100644 index 0000000..b8b97eb --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/TeleportHelper.java @@ -0,0 +1,102 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; + +public class TeleportHelper { + public static void travelToDimension(Entity ent, int x, int y, int z, int dim){ + if(ent instanceof EntityPlayerMP){ + MinecraftServer minecraftserver = MinecraftServer.getServer(); + WorldServer newWorldServer = minecraftserver.worldServerForDimension(dim); + minecraftserver.getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)ent, dim, new BasicTeleporter(newWorldServer)); + ((EntityPlayer)ent).setPositionAndUpdate(x+0.5, y+0.5, z+0.5); + return; + } + + + if (!ent.worldObj.isRemote && !ent.isDead) + { + ent.worldObj.theProfiler.startSection("changeDimension"); + MinecraftServer minecraftserver = MinecraftServer.getServer(); + int j = ent.dimension; + WorldServer worldserver = minecraftserver.worldServerForDimension(j); + WorldServer worldserver1 = minecraftserver.worldServerForDimension(dim); + ent.dimension = dim; + + if (j == 1 && dim == 1) + { + worldserver1 = minecraftserver.worldServerForDimension(0); + ent.dimension = 0; + } + + ent.worldObj.removeEntity(ent); + ent.isDead = false; + ent.worldObj.theProfiler.startSection("reposition"); + minecraftserver.getConfigurationManager().transferEntityToWorld(ent, j, worldserver, worldserver1); + ent.worldObj.theProfiler.endStartSection("reloading"); + Entity entity = EntityList.createEntityByName(EntityList.getEntityString(ent), worldserver1); + + if (entity != null) + { + entity.copyDataFrom(ent, true); + + if (j == 1 && dim == 1) + { + entity.setLocationAndAngles(x+0.5, y+0.5, z+0.5, entity.rotationYaw, entity.rotationPitch); + } + + worldserver1.spawnEntityInWorld(entity); + entity.setPosition(x+0.5, y+0.5, z+0.5); + } + + ent.isDead = true; + ent.worldObj.theProfiler.endSection(); + worldserver.resetUpdateEntityTick(); + worldserver1.resetUpdateEntityTick(); + ent.worldObj.theProfiler.endSection(); + } + } + + public static void travelToOrFromAlfheim(EntityPlayer player) { + if (DimensionManager.getWorld(0) == player.worldObj) { + // overworld to alfheim + travelToDimension(player, 0, 85, 0, WorldProviderAlfheim.dimensionID); + } else { + // alfheim to overworld + sendPlayerHome(player); + } + } + + public static void sendPlayerHome(EntityPlayer player) { + World world = DimensionManager.getWorld(0); + ChunkCoordinates coord = player.getBedLocation(0); + + if (coord == null) { + coord = world.getSpawnPoint(); + } + + coord = forceLocation(world, coord); + + if (coord == null) { + coord = world.getSpawnPoint(); + } + + travelToDimension(player, coord.posX, coord.posY, coord.posZ, 0); + + while (!world.getCollidingBoundingBoxes(player, player.boundingBox).isEmpty()) + { + player.setPositionAndUpdate(player.posX, player.posY + 1.0D, player.posZ); + } + } + + public static ChunkCoordinates forceLocation(World world, ChunkCoordinates coord) { + return null; + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/WorldProviderAlfheim.java b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/WorldProviderAlfheim.java new file mode 100644 index 0000000..65bf242 --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/alfheim/WorldProviderAlfheim.java @@ -0,0 +1,131 @@ +package fox.spiteful.avaritia.compat.botania.alfheim; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import fox.spiteful.avaritia.FieldHelper; +import fox.spiteful.avaritia.Lumberjack; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.Timer; +import net.minecraft.util.Vec3; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManagerHell; +import net.minecraft.world.chunk.IChunkProvider; + +public class WorldProviderAlfheim extends WorldProvider { + + public static int dimensionID = 13; + + @Override + public void registerWorldChunkManager() + { + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.hell, 0.0F); + this.isHellWorld = true; + this.hasNoSky = false; + if(FMLCommonHandler.instance().getSide().isClient()) { + this.setCloudRenderer(new ApocalypseCloudRenderer()); + this.setSkyRenderer(new ApocalypseSkyRenderer()); + } + } + + /** + * Return Vec3D with biome specific fog color + */ + @Override + @SideOnly(Side.CLIENT) + public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) + { + /*double r = 0.1; + double g = 0.04; + double b = 0; + + double nr = 1.0; + double ng = 0.5; + double nb = 0.0; + + Minecraft mc = Minecraft.getMinecraft(); + Timer t = FieldHelper.get(AlfheimEvents.mcTimerField, mc); + float partialTicks = t.renderPartialTicks; + + float n = FieldHelper.invoke(AlfheimEvents.getNightVisionBrightnessMethod, mc.entityRenderer, mc.thePlayer, partialTicks); + double notn = 1.0 - n; + + return Vec3.createVectorHelper(n*nr + notn*r, n*ng + notn*g, n*nb + notn*b);*/ + return Vec3.createVectorHelper(0.1, 0.04, 0.0); + } + + /** + * Returns a new chunk provider which generates chunks for this world + */ + @Override + public IChunkProvider createChunkGenerator() + { + return new ChunkProviderAlfheim(this.worldObj, this.worldObj.getSeed()); + } + + /** + * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. + */ + @Override + public boolean isSurfaceWorld() + { + return false; + } + + /** + * Will check if the x, z position specified is alright to be set as the map spawn point + */ + @Override + public boolean canCoordinateBeSpawn(int x, int z) + { + return true; // need to improve + } + + /** + * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) + */ + @Override + public float calculateCelestialAngle(long tick, float partialTick) + { + return 1f;//0.425F; + } + + /** + * True if the player can respawn in this dimension (true = overworld, false = nether). + */ + @Override + public boolean canRespawnHere() + { + return true; + } + + /** + * Returns true if the given X,Z coordinate should show environmental fog. + */ + @Override + @SideOnly(Side.CLIENT) + public boolean doesXZShowFog(int x, int z) + { + return false; + //return true; + } + + @Override + public String getDimensionName() { + return "Alfheim Eternal"; + } + + @Override + public float getSunBrightnessFactor(float par1) + { + return 0.6f; + } + + @Override + public ChunkCoordinates getEntrancePortalLocation() + { + return new ChunkCoordinates(0, 85, 0); + } +} diff --git a/src/main/java/fox/spiteful/avaritia/items/ItemMorvInABox.java b/src/main/java/fox/spiteful/avaritia/items/ItemMorvInABox.java index 3248120..a6e259a 100644 --- a/src/main/java/fox/spiteful/avaritia/items/ItemMorvInABox.java +++ b/src/main/java/fox/spiteful/avaritia/items/ItemMorvInABox.java @@ -6,6 +6,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fox.spiteful.avaritia.Avaritia; +import fox.spiteful.avaritia.compat.botania.alfheim.TeleportHelper; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -41,4 +42,25 @@ public class ItemMorvInABox extends Item { this.nameoverlay = ir.registerIcon("avaritia:morvinabox2"); } + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + /*//if (world.isRemote) { + Lumberjack.info("DESTROY SPACE"); + WorldProvider p = world.provider;//DimensionManager.getProvider(0); + Lumberjack.info(p); + p.setSkyRenderer(new ApocalypseSkyRenderer()); + p.setCloudRenderer(new ApocalypseCloudRenderer()); + Lumberjack.info(p.getCloudRenderer()); + //}*/ + /*if (DimensionManager.getWorld(0) == world) { + player.travelToDimension(13); + } else { + player.travelToDimension(0); + }*/ + + TeleportHelper.travelToOrFromAlfheim(player); + return stack; + } + }