Jump to content

blaytz

Members
  • Posts

    12
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

blaytz's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hey guys! I've got a problem in my mod. When I place down my portal block, I go to my dimension, but it doesn't create a protal on th other side and when I place two portal blocks next to each other, they disappear... But the dimension works perfectly! Here's my code: WorldProviderMegaPlains: package mods.morestuff.common; 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 WorldProviderMegaPlains extends WorldProvider{ public String getDimensionName() { return "MegaPlains"; } public String getSaveFolder(){ return "DIM-MegaPlains"; } public String getWelcomeMessage(){ return "Welcome to the Mega Plains dimension!"; } public String getDepartMessage(){ return "Leaving the Mega Plains dimension"; } public boolean canRespawnHere() { return true; } public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.8F, 0F); this.dimensionId = Morestuff.megaPlains; } @Override public IChunkProvider createChunkGenerator() { return new ChunkProviderMorestuff(worldObj, worldObj.getSeed(), true); } } BlockPortalPlains: package mods.morestuff.common; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockPortal; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; public class BlockPortalPlains extends BlockPortal{ public BlockPortalPlains(int par1, Material par2Material) { super(par1); this.setCreativeTab(Morestuff.MoreStuffCreativeTab); } @Override public void registerIcons(IconRegister reg){ this.blockIcon = reg.registerIcon("morestuff:PortalPlains"); } public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); } public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4) { byte b0 = 0; byte b1 = 0; if (par1World.getBlockId(par2 - 1, par3, par4) == Morestuff.rubyBlock.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Morestuff.rubyBlock.blockID) { b0 = 1; } if (par1World.getBlockId(par2, par3, par4 - 1) == Morestuff.rubyBlock.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Morestuff.rubyBlock.blockID) { b1 = 1; } if (b0 == b1) { return false; } else { if (par1World.getBlockId(par2 - b0, par3, par4 - b1) == 0) { par2 -= b0; par4 -= b1; } int l; int i1; for (l = -1; l <= 2; ++l) { for (i1 = -1; i1 <= 3; ++i1) { boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3; if (l != -1 && l != 2 || i1 != -1 && i1 != 3) { int j1 = par1World.getBlockId(par2 + b0 * l, par3 + i1, par4 + b1 * l); if (flag) { if (j1 != Morestuff.rubyBlock.blockID) { return false; } } else if (j1 != 0 && j1 != Block.fire.blockID) { return false; } } } } for (l = 0; l < 2; ++l) { for (i1 = 0; i1 < 3; ++i1) { par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, Morestuff.portalPlains.blockID, 0, 2); } } return true; } } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { byte b0 = 0; byte b1 = 1; if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID) { b0 = 1; b1 = 0; } int i1; for (i1 = par3; par1World.getBlockId(par2, i1 - 1, par4) == this.blockID; --i1) { ; } if (par1World.getBlockId(par2, i1 - 1, par4) != Morestuff.rubyBlock.blockID) { par1World.setBlockToAir(par2, par3, par4); } else { int j1; for (j1 = 1; j1 < 4 && par1World.getBlockId(par2, i1 + j1, par4) == this.blockID; ++j1) { ; } if (j1 == 3 && par1World.getBlockId(par2, i1 + j1, par4) == Morestuff.rubyBlock.blockID) { boolean flag = par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID; boolean flag1 = par1World.getBlockId(par2, par3, par4 - 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID; if (flag && flag1) { par1World.setBlockToAir(par2, par3, par4); } else { if ((par1World.getBlockId(par2 + b0, par3, par4 + b1) != Morestuff.rubyBlock.blockID || par1World.getBlockId(par2 - b0, par3, par4 - b1) != this.blockID) && (par1World.getBlockId(par2 - b0, par3, par4 - b1) != Morestuff.rubyBlock.blockID || par1World.getBlockId(par2 + b0, par3, par4 + b1) != this.blockID)) { par1World.setBlockToAir(par2, par3, par4); } } } else { par1World.setBlockToAir(par2, par3, par4); } } } public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null) { if(par5Entity instanceof EntityPlayerMP) { EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity; if(par5Entity.dimension != Morestuff.megaPlains){ thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Morestuff.megaPlains, new TeleporterMorestuff(thePlayer.mcServer.worldServerForDimension(Morestuff.megaPlains))); }else{ thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterMorestuff(thePlayer.mcServer.worldServerForDimension(0))); } } } } } BlockRubyBlock: package mods.morestuff.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; public class BlockRubyBlock extends Block{ public BlockRubyBlock(int par1, Material par2Material) { super(par1, par2Material); this.setCreativeTab(Morestuff.MoreStuffCreativeTab); this.setLightValue(1.0F); this.setHardness(3.0F); this.setResistance(5.0F); } @Override public void registerIcons(IconRegister reg){ this.blockIcon = reg.registerIcon("morestuff:RubyBlock"); } } ChunkProviderMorestuff: package mods.morestuff.common; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD; import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.entity.EnumCreatureType; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkPosition; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.MapGenBase; import net.minecraft.world.gen.MapGenCaves; import net.minecraft.world.gen.MapGenRavine; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.feature.MapGenScatteredFeature; import net.minecraft.world.gen.feature.WorldGenDungeons; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.TerrainGen; public class ChunkProviderMorestuff implements IChunkProvider { /** RNG. */ private Random rand; /** A NoiseGeneratorOctaves used in generating terrain */ private NoiseGeneratorOctaves noiseGen1; /** A NoiseGeneratorOctaves used in generating terrain */ private NoiseGeneratorOctaves noiseGen2; /** A NoiseGeneratorOctaves used in generating terrain */ private NoiseGeneratorOctaves noiseGen3; /** A NoiseGeneratorOctaves used in generating terrain */ private NoiseGeneratorOctaves noiseGen4; /** A NoiseGeneratorOctaves used in generating terrain */ public NoiseGeneratorOctaves noiseGen5; /** A NoiseGeneratorOctaves used in generating terrain */ public NoiseGeneratorOctaves noiseGen6; public NoiseGeneratorOctaves mobSpawnerNoise; /** Reference to the World object. */ private World worldObj; /** are map structures going to be generated (e.g. strongholds) */ private final boolean mapFeaturesEnabled; /** Holds the overall noise array used in chunk generation */ private double[] noiseArray; private double[] stoneNoise = new double[256]; private MapGenBase caveGenerator = new MapGenCaves(); /** Holds Stronghold Generator */ private MapGenStronghold strongholdGenerator = new MapGenStronghold(); /** Holds Village Generator */ private MapGenVillage villageGenerator = new MapGenVillage(); /** Holds Mineshaft Generator */ private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); /** Holds ravine generator */ private MapGenBase ravineGenerator = new MapGenRavine(); /** The biomes that are used to generate the chunk */ private BiomeGenBase[] biomesForGeneration; /** A double array that hold terrain noise from noiseGen3 */ double[] noise3; /** A double array that hold terrain noise */ double[] noise1; /** A double array that hold terrain noise from noiseGen2 */ double[] noise2; /** A double array that hold terrain noise from noiseGen5 */ double[] noise5; /** A double array that holds terrain noise from noiseGen6 */ double[] noise6; /** * Used to store the 5x5 parabolic field that is used during terrain generation. */ float[] parabolicField; int[][] field_73219_j = new int[32][32]; { caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD); villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE); mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); } public ChunkProviderMorestuff(World par1World, long par2, boolean par4) { this.worldObj = par1World; this.mapFeaturesEnabled = par4; this.rand = new Random(par2); this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, ; this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4); this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, ; NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens); this.noiseGen1 = noiseGens[0]; this.noiseGen2 = noiseGens[1]; this.noiseGen3 = noiseGens[2]; this.noiseGen4 = noiseGens[3]; this.noiseGen5 = noiseGens[4]; this.noiseGen6 = noiseGens[5]; this.mobSpawnerNoise = noiseGens[6]; } /** * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the * temperature is low enough */ public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) { byte b0 = 4; byte b1 = 16; byte b2 = 63; int k = b0 + 1; byte b3 = 17; int l = b0 + 1; this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, k + 5, l + 5); this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * b0, 0, par2 * b0, k, b3, l); for (int i1 = 0; i1 < b0; ++i1) { for (int j1 = 0; j1 < b0; ++j1) { for (int k1 = 0; k1 < b1; ++k1) { double d0 = 0.125D; double d1 = this.noiseArray[((i1 + 0) * l + j1 + 0) * b3 + k1 + 0]; double d2 = this.noiseArray[((i1 + 0) * l + j1 + 1) * b3 + k1 + 0]; double d3 = this.noiseArray[((i1 + 1) * l + j1 + 0) * b3 + k1 + 0]; double d4 = this.noiseArray[((i1 + 1) * l + j1 + 1) * b3 + k1 + 0]; double d5 = (this.noiseArray[((i1 + 0) * l + j1 + 0) * b3 + k1 + 1] - d1) * d0; double d6 = (this.noiseArray[((i1 + 0) * l + j1 + 1) * b3 + k1 + 1] - d2) * d0; double d7 = (this.noiseArray[((i1 + 1) * l + j1 + 0) * b3 + k1 + 1] - d3) * d0; double d8 = (this.noiseArray[((i1 + 1) * l + j1 + 1) * b3 + k1 + 1] - d4) * d0; for (int l1 = 0; l1 < 8; ++l1) { double d9 = 0.25D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for (int i2 = 0; i2 < 4; ++i2) { int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1; short short1 = 128; j2 -= short1; double d14 = 0.25D; double d15 = (d11 - d10) * d14; double d16 = d10 - d15; for (int k2 = 0; k2 < 4; ++k2) { if ((d16 += d15) > 0.0D) { par3ArrayOfByte[j2 += short1] = (byte)Block.stone.blockID; } else if (k1 * 8 + l1 < b2) { par3ArrayOfByte[j2 += short1] = (byte)Block.waterStill.blockID; } else { par3ArrayOfByte[j2 += short1] = 0; } } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } /** * Replaces the stone that was placed in with blocks that match the biome */ public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) { ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase); MinecraftForge.EVENT_BUS.post(event); if (event.getResult() == Result.DENY) return; byte b0 = 63; double d0 = 0.03125D; this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); for (int k = 0; k < 16; ++k) { for (int l = 0; l < 16; ++l) { BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[l + k * 16]; float f = biomegenbase.getFloatTemperature(); int i1 = (int)(this.stoneNoise[k + l * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int j1 = -1; byte b1 = biomegenbase.topBlock; byte b2 = biomegenbase.fillerBlock; for (int k1 = 127; k1 >= 0; --k1) { int l1 = (l * 16 + k) * 128 + k1; if (k1 <= 0 + this.rand.nextInt(5)) { par3ArrayOfByte[l1] = (byte)Block.bedrock.blockID; } else { byte b3 = par3ArrayOfByte[l1]; if (b3 == 0) { j1 = -1; } else if (b3 == Block.stone.blockID) { if (j1 == -1) { if (i1 <= 0) { b1 = 0; b2 = (byte)Block.stone.blockID; } else if (k1 >= b0 - 4 && k1 <= b0 + 1) { b1 = biomegenbase.topBlock; b2 = biomegenbase.fillerBlock; } if (k1 < b0 && b1 == 0) { if (f < 0.15F) { b1 = (byte)Block.ice.blockID; } else { b1 = (byte)Block.waterStill.blockID; } } j1 = i1; if (k1 >= b0 - 1) { par3ArrayOfByte[l1] = b1; } else { par3ArrayOfByte[l1] = b2; } } else if (j1 > 0) { --j1; par3ArrayOfByte[l1] = b2; if (j1 == 0 && b2 == Block.sand.blockID) { j1 = this.rand.nextInt(4); b2 = (byte)Block.sandStone.blockID; } } } } } } } } /** * loads or generates the chunk at the chunk location specified */ public Chunk loadChunk(int par1, int par2) { return this.provideChunk(par1, par2); } /** * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the * specified chunk from the map seed and chunk seed */ public Chunk provideChunk(int par1, int par2) { this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); byte[] abyte = new byte[32768]; this.generateTerrain(par1, par2, abyte); this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); this.replaceBlocksForBiome(par1, par2, abyte, this.biomesForGeneration); this.caveGenerator.generate(this, this.worldObj, par1, par2, abyte); this.ravineGenerator.generate(this, this.worldObj, par1, par2, abyte); if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, abyte); this.villageGenerator.generate(this, this.worldObj, par1, par2, abyte); this.strongholdGenerator.generate(this, this.worldObj, par1, par2, abyte); this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, abyte); } Chunk chunk = new Chunk(this.worldObj, abyte, par1, par2); byte[] abyte1 = chunk.getBiomeArray(); for (int k = 0; k < abyte1.length; ++k) { abyte1[k] = (byte)this.biomesForGeneration[k].biomeID; } chunk.generateSkylightMap(); return chunk; } /** * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the * size. */ private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); MinecraftForge.EVENT_BUS.post(event); if (event.getResult() == Result.DENY) return event.noisefield; if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } if (this.parabolicField == null) { this.parabolicField = new float[25]; for (int k1 = -2; k1 <= 2; ++k1) { for (int l1 = -2; l1 <= 2; ++l1) { float f = 10.0F / MathHelper.sqrt_float((float)(k1 * k1 + l1 * l1) + 0.2F); this.parabolicField[k1 + 2 + (l1 + 2) * 5] = f; } } } double d0 = 684.412D; double d1 = 684.412D; this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D); this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D); this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, d0, d1, d0); this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, d0, d1, d0); boolean flag = false; boolean flag1 = false; int i2 = 0; int j2 = 0; for (int k2 = 0; k2 < par5; ++k2) { for (int l2 = 0; l2 < par7; ++l2) { float f1 = 0.0F; float f2 = 0.0F; float f3 = 0.0F; byte b0 = 2; BiomeGenBase biomegenbase = this.biomesForGeneration[k2 + 2 + (l2 + 2) * (par5 + 5)]; for (int i3 = -b0; i3 <= b0; ++i3) { for (int j3 = -b0; j3 <= b0; ++j3) { BiomeGenBase biomegenbase1 = this.biomesForGeneration[k2 + i3 + 2 + (l2 + j3 + 2) * (par5 + 5)]; float f4 = this.parabolicField[i3 + 2 + (j3 + 2) * 5] / (biomegenbase1.minHeight + 2.0F); if (biomegenbase1.minHeight > biomegenbase.minHeight) { f4 /= 2.0F; } f1 += biomegenbase1.maxHeight * f4; f2 += biomegenbase1.minHeight * f4; f3 += f4; } } f1 /= f3; f2 /= f3; f1 = f1 * 0.9F + 0.1F; f2 = (f2 * 4.0F - 1.0F) / 8.0F; double d2 = this.noise6[j2] / 8000.0D; if (d2 < 0.0D) { d2 = -d2 * 0.3D; } d2 = d2 * 3.0D - 2.0D; if (d2 < 0.0D) { d2 /= 2.0D; if (d2 < -1.0D) { d2 = -1.0D; } d2 /= 1.4D; d2 /= 2.0D; } else { if (d2 > 1.0D) { d2 = 1.0D; } d2 /= 8.0D; } ++j2; for (int k3 = 0; k3 < par6; ++k3) { double d3 = (double)f2; double d4 = (double)f1; d3 += d2 * 0.2D; d3 = d3 * (double)par6 / 16.0D; double d5 = (double)par6 / 2.0D + d3 * 4.0D; double d6 = 0.0D; double d7 = ((double)k3 - d5) * 12.0D * 128.0D / 128.0D / d4; if (d7 < 0.0D) { d7 *= 4.0D; } double d8 = this.noise1[i2] / 512.0D; double d9 = this.noise2[i2] / 512.0D; double d10 = (this.noise3[i2] / 10.0D + 1.0D) / 2.0D; if (d10 < 0.0D) { d6 = d8; } else if (d10 > 1.0D) { d6 = d9; } else { d6 = d8 + (d9 - d8) * d10; } d6 -= d7; if (k3 > par6 - 4) { double d11 = (double)((float)(k3 - (par6 - 4)) / 3.0F); d6 = d6 * (1.0D - d11) + -10.0D * d11; } par1ArrayOfDouble[i2] = d6; ++i2; } } } return par1ArrayOfDouble; } /** * Checks to see if a chunk exists at x, y */ public boolean chunkExists(int par1, int par2) { return true; } /** * Populates chunk with ores etc etc */ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockSand.fallInstantly = true; int k = par2 * 16; int l = par3 * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); this.rand.setSeed(this.worldObj.getSeed()); long i1 = this.rand.nextLong() / 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed()); boolean flag = false; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag)); if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); } int k1; int l1; int i2; if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE) && !flag && this.rand.nextInt(4) == 0) { k1 = k + this.rand.nextInt(16) + 8; l1 = this.rand.nextInt(128); i2 = l + this.rand.nextInt(16) + 8; (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2); } if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt( == 0) { k1 = k + this.rand.nextInt(16) + 8; l1 = this.rand.nextInt(this.rand.nextInt(120) + ; i2 = l + this.rand.nextInt(16) + 8; if (l1 < 63 || this.rand.nextInt(10) == 0) { (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, k1, l1, i2); } } boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON); for (k1 = 0; doGen && k1 < 8; ++k1) { l1 = k + this.rand.nextInt(16) + 8; i2 = this.rand.nextInt(128); int j2 = l + this.rand.nextInt(16) + 8; if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2)) { ; } } biomegenbase.decorate(this.worldObj, this.rand, k, l); SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); k += 8; l += 8; doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE); for (k1 = 0; doGen && k1 < 16; ++k1) { for (l1 = 0; l1 < 16; ++l1) { i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1); if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) { this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Block.ice.blockID, 0, 2); } if (this.worldObj.canSnowAt(k1 + k, i2, l1 + l)) { this.worldObj.setBlock(k1 + k, i2, l1 + l, Block.snow.blockID, 0, 2); } } } MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); BlockSand.fallInstantly = false; } /** * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. * Return true if all chunks have been saved. */ public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { return true; } /** * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. */ public boolean unloadQueuedChunks() { return false; } /** * Returns if the IChunkProvider supports saving. */ public boolean canSave() { return true; } /** * Converts the instance data to a readable string. */ public String makeString() { return "RandomLevelSource"; } /** * Returns a list of creatures of the specified type that can spawn at the given location. */ public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4); return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType)); } /** * Returns the location of the closest structure of the specified type. If not found returns null. */ public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) { return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null; } public int getLoadedChunkCount() { return 0; } public void recreateStructures(int par1, int par2) { if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); this.villageGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); this.strongholdGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); } } } TeleporterMorestuff: package mods.morestuff.common; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.util.Direction; import net.minecraft.util.LongHashMap; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.PortalPosition; import net.minecraft.world.Teleporter; import net.minecraft.world.WorldServer; public class TeleporterMorestuff extends Teleporter { private final WorldServer field_85192_a; private final Random random; private final LongHashMap field_85191_c = new LongHashMap(); private final List field_85190_d = new ArrayList(); public TeleporterMorestuff(WorldServer par1WorldServer) { super(par1WorldServer); this.field_85192_a = par1WorldServer; this.random = new Random(par1WorldServer.getSeed()); } @Override public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) { if (this.field_85192_a.provider.dimensionId != 1) { if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8)) { this.placeInExistingPortal(par1Entity, par2, par4, par6, par8); } } else { int var9 = MathHelper.floor_double(par1Entity.posX); int var10 = MathHelper.floor_double(par1Entity.posY) - 1; int var11 = MathHelper.floor_double(par1Entity.posZ); byte var12 = 1; byte var13 = 0; for (int var14 = -2; var14 <= 2; ++var14) { for (int var15 = -2; var15 <= 2; ++var15) { for (int var16 = -1; var16 < 3; ++var16) { int var17 = var9 + var15 * var12 + var14 * var13; int var18 = var10 + var16; int var19 = var11 + var15 * var13 - var14 * var12; boolean var20 = var16 < 0; this.field_85192_a.setBlock(var17, var18, var19, var20 ? Morestuff.rubyBlock.blockID : 0); } } } par1Entity.setLocationAndAngles((double) var9, (double) var10, (double) var11, par1Entity.rotationYaw, 0.0F); par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D; } } @Override public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8) { short var9 = 128; double var10 = -1.0D; int var12 = 0; int var13 = 0; int var14 = 0; int var15 = MathHelper.floor_double(par1Entity.posX); int var16 = MathHelper.floor_double(par1Entity.posZ); long var17 = ChunkCoordIntPair.chunkXZ2Int(var15, var16); boolean var19 = true; double var27; int var48; if (this.field_85191_c.containsItem(var17)) { PortalPosition var20 = (PortalPosition) this.field_85191_c.getValueByKey(var17); var10 = 0.0D; var12 = var20.posX; var13 = var20.posY; var14 = var20.posZ; var20.field_85087_d = this.field_85192_a.getTotalWorldTime(); var19 = false; } else { for (var48 = var15 - var9; var48 <= var15 + var9; ++var48) { double var21 = (double) var48 + 0.5D - par1Entity.posX; for (int var23 = var16 - var9; var23 <= var16 + var9; ++var23) { double var24 = (double) var23 + 0.5D - par1Entity.posZ; for (int var26 = this.field_85192_a.getActualHeight() - 1; var26 >= 0; --var26) { if (this.field_85192_a.getBlockId(var48, var26, var23) == Morestuff.portalPlains.blockID) { while (this.field_85192_a.getBlockId(var48, var26 - 1, var23) == Morestuff.portalPlains.blockID) { --var26; } var27 = (double) var26 + 0.5D - par1Entity.posY; double var29 = var21 * var21 + var27 * var27 + var24 * var24; if (var10 < 0.0D || var29 < var10) { var10 = var29; var12 = var48; var13 = var26; var14 = var23; } } } } } } if (var10 >= 0.0D) { if (var19) { this.field_85191_c.add(var17, new PortalPosition(this, var12, var13, var14, this.field_85192_a.getTotalWorldTime())); this.field_85190_d.add(Long.valueOf(var17)); } double var49 = (double) var12 + 0.5D; double var25 = (double) var13 + 0.5D; var27 = (double) var14 + 0.5D; int var50 = -1; if (this.field_85192_a.getBlockId(var12 - 1, var13, var14) == Morestuff.portalPlains.blockID) { var50 = 2; } if (this.field_85192_a.getBlockId(var12 + 1, var13, var14) == Morestuff.portalPlains.blockID) { var50 = 0; } if (this.field_85192_a.getBlockId(var12, var13, var14 - 1) == Morestuff.portalPlains.blockID) { var50 = 3; } if (this.field_85192_a.getBlockId(var12, var13, var14 + 1) == Morestuff.portalPlains.blockID) { var50 = 1; } int var30 = par1Entity.func_82148_at(); if (var50 > -1) { int var31 = Direction.field_71578_g[var50]; int var32 = Direction.offsetX[var50]; int var33 = Direction.offsetZ[var50]; int var34 = Direction.offsetX[var31]; int var35 = Direction.offsetZ[var31]; boolean var36 = !this.field_85192_a.isAirBlock(var12 + var32 + var34, var13, var14 + var33 + var35) || !this.field_85192_a.isAirBlock(var12 + var32 + var34, var13 + 1, var14 + var33 + var35); boolean var37 = !this.field_85192_a.isAirBlock(var12 + var32, var13, var14 + var33) || !this.field_85192_a.isAirBlock(var12 + var32, var13 + 1, var14 + var33); if (var36 && var37) { var50 = Direction.footInvisibleFaceRemap[var50]; var31 = Direction.footInvisibleFaceRemap[var31]; var32 = Direction.offsetX[var50]; var33 = Direction.offsetZ[var50]; var34 = Direction.offsetX[var31]; var35 = Direction.offsetZ[var31]; var48 = var12 - var34; var49 -= (double) var34; int var22 = var14 - var35; var27 -= (double) var35; var36 = !this.field_85192_a.isAirBlock(var48 + var32 + var34, var13, var22 + var33 + var35) || !this.field_85192_a.isAirBlock(var48 + var32 + var34, var13 + 1, var22 + var33 + var35); var37 = !this.field_85192_a.isAirBlock(var48 + var32, var13, var22 + var33) || !this.field_85192_a.isAirBlock(var48 + var32, var13 + 1, var22 + var33); } float var38 = 0.5F; float var39 = 0.5F; if (!var36 && var37) { var38 = 1.0F; } else if (var36 && !var37) { var38 = 0.0F; } else if (var36 && var37) { var39 = 0.0F; } var49 += (double) ((float) var34 * var38 + var39 * (float) var32); var27 += (double) ((float) var35 * var38 + var39 * (float) var33); float var40 = 0.0F; float var41 = 0.0F; float var42 = 0.0F; float var43 = 0.0F; if (var50 == var30) { var40 = 1.0F; var41 = 1.0F; } else if (var50 == Direction.footInvisibleFaceRemap[var30]) { var40 = -1.0F; var41 = -1.0F; } else if (var50 == Direction.enderEyeMetaToDirection[var30]) { var42 = 1.0F; var43 = -1.0F; } else { var42 = -1.0F; var43 = 1.0F; } double var44 = par1Entity.motionX; double var46 = par1Entity.motionZ; par1Entity.motionX = var44 * (double) var40 + var46 * (double) var43; par1Entity.motionZ = var44 * (double) var42 + var46 * (double) var41; par1Entity.rotationYaw = par8 - (float) (var30 * 90) + (float) (var50 * 90); } else { par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D; } par1Entity.setLocationAndAngles(var49 + 3, var25, var27 + 3, par1Entity.rotationYaw, par1Entity.rotationPitch); return true; } else { return false; } } @Override public boolean makePortal(Entity par1Entity) { byte var2 = 16; double var3 = -1.0D; int var5 = MathHelper.floor_double(par1Entity.posX); int var6 = MathHelper.floor_double(par1Entity.posY); int var7 = MathHelper.floor_double(par1Entity.posZ); int var8 = var5; int var9 = var6; int var10 = var7; int var11 = 0; int var12 = this.random.nextInt(4); int var13; double var14; double var17; int var16; int var19; int var21; int var20; int var23; int var22; int var25; int var24; int var27; int var26; double var31; double var32; for (var13 = var5 - var2; var13 <= var5 + var2; ++var13) { var14 = (double) var13 + 0.5D - par1Entity.posX; for (var16 = var7 - var2; var16 <= var7 + var2; ++var16) { var17 = (double) var16 + 0.5D - par1Entity.posZ; label274: for (var19 = this.field_85192_a.getActualHeight() - 1; var19 >= 0; --var19) { if (this.field_85192_a.isAirBlock(var13, var19, var16)) { while (var19 > 0 && this.field_85192_a.isAirBlock(var13, var19 - 1, var16)) { --var19; } for (var20 = var12; var20 < var12 + 4; ++var20) { var21 = var20 % 2; var22 = 1 - var21; if (var20 % 4 >= 2) { var21 = -var21; var22 = -var22; } for (var23 = 0; var23 < 3; ++var23) { for (var24 = 0; var24 < 4; ++var24) { for (var25 = -1; var25 < 4; ++var25) { var26 = var13 + (var24 - 1) * var21 + var23 * var22; var27 = var19 + var25; int var28 = var16 + (var24 - 1) * var22 - var23 * var21; if (var25 < 0 && !this.field_85192_a.getBlockMaterial(var26, var27, var28).isSolid() || var25 >= 0 && !this.field_85192_a.isAirBlock(var26, var27, var28)) { continue label274; } } } } var32 = (double) var19 + 0.5D - par1Entity.posY; var31 = var14 * var14 + var32 * var32 + var17 * var17; if (var3 < 0.0D || var31 < var3) { var3 = var31; var8 = var13; var9 = var19; var10 = var16; var11 = var20 % 4; } } } } } } if (var3 < 0.0D) { for (var13 = var5 - var2; var13 <= var5 + var2; ++var13) { var14 = (double) var13 + 0.5D - par1Entity.posX; for (var16 = var7 - var2; var16 <= var7 + var2; ++var16) { var17 = (double) var16 + 0.5D - par1Entity.posZ; label222: for (var19 = this.field_85192_a.getActualHeight() - 1; var19 >= 0; --var19) { if (this.field_85192_a.isAirBlock(var13, var19, var16)) { while (var19 > 0 && this.field_85192_a.isAirBlock(var13, var19 - 1, var16)) { --var19; } for (var20 = var12; var20 < var12 + 2; ++var20) { var21 = var20 % 2; var22 = 1 - var21; for (var23 = 0; var23 < 4; ++var23) { for (var24 = -1; var24 < 4; ++var24) { var25 = var13 + (var23 - 1) * var21; var26 = var19 + var24; var27 = var16 + (var23 - 1) * var22; if (var24 < 0 && !this.field_85192_a.getBlockMaterial(var25, var26, var27).isSolid() || var24 >= 0 && !this.field_85192_a.isAirBlock(var25, var26, var27)) { continue label222; } } } var32 = (double) var19 + 0.5D - par1Entity.posY; var31 = var14 * var14 + var32 * var32 + var17 * var17; if (var3 < 0.0D || var31 < var3) { var3 = var31; var8 = var13; var9 = var19; var10 = var16; var11 = var20 % 2; } } } } } } } int var29 = var8; int var15 = var9; var16 = var10; int var30 = var11 % 2; int var18 = 1 - var30; if (var11 % 4 >= 2) { var30 = -var30; var18 = -var18; } boolean var33; if (var3 < 0.0D) { if (var9 < 70) { var9 = 70; } if (var9 > this.field_85192_a.getActualHeight() - 10) { var9 = this.field_85192_a.getActualHeight() - 10; } var15 = var9; for (var19 = -1; var19 <= 1; ++var19) { for (var20 = 1; var20 < 3; ++var20) { for (var21 = -1; var21 < 3; ++var21) { var22 = var29 + (var20 - 1) * var30 + var19 * var18; var23 = var15 + var21; var24 = var16 + (var20 - 1) * var18 - var19 * var30; var33 = var21 < 0; this.field_85192_a.setBlock(var22, var23, var24, var33 ? Morestuff.rubyBlock.blockID : 0); } } } } for (var19 = 0; var19 < 4; ++var19) { for (var20 = 0; var20 < 4; ++var20) { for (var21 = -1; var21 < 4; ++var21) { var22 = var29 + (var20 - 1) * var30; var23 = var15 + var21; var24 = var16 + (var20 - 1) * var18; var33 = var20 == 0 || var20 == 3 || var21 == -1 || var21 == 3; this.field_85192_a.setBlock(var22, var23, var24, var33 ? Morestuff.rubyBlock.blockID : Morestuff.portalPlains.blockID); } } for (var20 = 0; var20 < 4; ++var20) { for (var21 = -1; var21 < 4; ++var21) { var22 = var29 + (var20 - 1) * var30; var23 = var15 + var21; var24 = var16 + (var20 - 1) * var18; this.field_85192_a.notifyBlocksOfNeighborChange(var22, var23, var24, this.field_85192_a.getBlockId(var22, var23, var24)); } } } return true; } @Override public void func_85189_a(long par1) { if (par1 % 100L == 0L) { Iterator var3 = this.field_85190_d.iterator(); long var4 = par1 - 600L; while (var3.hasNext()) { Long var6 = (Long) var3.next(); PortalPosition var7 = (PortalPosition) this.field_85191_c.getValueByKey(var6.longValue()); if (var7 == null || var7.field_85087_d < var4) { var3.remove(); this.field_85191_c.remove(var6.longValue()); } } } } }
  2. Ok tried what Mazetar said, it worked for the boots because I had just writen a file name wrong. But I still can't see the items in my inventory
  3. Thanks for the advice but i have already added the texture files but they dont show up even without the miniature
  4. Yeah... It show the boots but not the rest in my inventory and when I wear those boots they are like white pants... :'(
  5. Thank you SO much for your help!! It doesn't give me any errors anymore and I will try it and tell you if it works and... I LOVE YOU Mazetar!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! No seriously you have solved my probleem and I will never thank you enough!
  6. Haha! Thanks for the tutorials! What a coincidence! I am watching thenewboston tutorials! Here is the pastebin link: http://pastebin.com/mZV9JCU5
  7. Thank you Mazetar. I do not consider what you said as an insult, I consider it like a very nice act. Anyways, I do not have any constructor method like that, but I do not quite understand what you mean by saying "adding the textureID into the lines where you are calling the constructor". EDIT: This is my first minecraft/forge mod and I am currently learning java so I am not very good at it
  8. Thanks but thats not all :'( Now it discovered new errors in my main mod class (MiscBlocksAndItems.java): http://bayimg.com/GajICAaEE
  9. thanks for the advice Here is my pastebin link: http://pastebin.com/kAMpKijj It doesn't actually give me an error it just underlines it in red with these possibilities: http://bayimg.com/iAJhdAaee
  10. Thank you, I tried that but now it gives me an error on the shiftedIndex... :'(
  11. Thanks for the prompt response but that is not the problem because when I hover with my mouse over the error it doesn't propose to import ITextureProvider and I know thats not the problem caus' it already gave me that error even before i wrote anything...
  12. Hello everybody, I've got a problem: i've been modding with forge and i just tried adding an armor set so i put this code in: but it says "ITextureProvider cannot be resolved as a type." So i would need some help because without ITextureProvider i cannot create an armor set wich would be stupid since that is the goal of my mod. Thanks for your help, Mr Blaytz
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.