Jump to content

Flenix

Members
  • Posts

    440
  • Joined

  • Last visited

Everything posted by Flenix

  1. So I put the line of code you quoted into my WorldChunkProvider, which lets me specify multiple biomes? As for the GameRegistry think, right now I have "GameRegistry.addBiome(akatoePlainsBiome);" - from following a tutorial. I assumed when I was following it (Granted, not a great tutorial...), that this was just like registering a block and had to be done, but would removing it stop the biome spawning in the overworld, and with the above code you said my biome would only spawn in my custom world?
  2. You shouldn't give up so easily. I'm sure you're already discovering that a real obj gives vastly more customization than a tcn file ever can... The issue with Techne is that you have to work in blocks, you can't even slighlty change the shape of the block to a trapezium or anything like that. Plus you can only change the block sizes in increments of one- Kind of restrictive if you want a detailed single-block model.
  3. I've not looked into multiple biomes just yet. MY mod adds probably around 12 new dimensions when it's done, but the first three you can access are all single-biome places so I've not even experimented with it. So what you're saying is, I'll need to create my own biome and add it to biomegenbase? Am I just getting confused here? I don't want to modify base files if I don't have to.
  4. Hey guys, So I've been working on a model in Techne for a mob I want to add. It's pretty big, so I've been making the arms/legs in two parts so its elbows and knees can move. But, I just had a thought; is that going to be a huge challenge when I try and animate it in the code? Is there a way I can set, for example, the lower leg's pivot point to follow the movement of the upper leg? I know it's very easy in normal animation (eg in 3DS Max) but because we're animating within the game code, it just occured that might be a challenge. Anyone tried something like this before, or know anything that might be helpful?
  5. Look into Reflection. I have no idea how it works, but other people have asked similar questions before and that's usually the response they get..
  6. Hey guys, I have two questions regarding making my own dimension here, I'd love help with either of them. Firstly, my dimension is going to be made entirely from custom blocks. I now know that I can't use IDs over 255 for these blocks; but I've also seen that people can use metadata (Looking at other dimension mods like Galacticraft). So, I could use say ID 240:1 for my stone, 240:2 for my grass and so on. So, to that end; does anyone know how to add functionality to individual metadatas of a block? As in, I want my grass to grow onto dirt etc. Ideally I'd like to just define the metadata on a class (this.setMetaData... if only it existed ), but any way of doing it is fine. Secondly, where do I define what block covers the surface? Right now, my dimension is only generating my custom stone. I have a custom grass too (Currently on its own ID) but I can't find anywhere in the code that says "Set the top layer to this". I've even looked at the source of a couple of mods which do it, and I can't find it anywhere in those either... Any help is great On a side note, if anyone knows a good structure generation tutorial, that'd be really useful too.
  7. Anyone able to help here?
  8. Just tried generating with an ID of 200, and it worked; so that obviously was the issue. I'll have to work some system out though. Part of my mod is I want it to add multiple planets (With an API to users easily create their own), so if I'm restricted to ~100 IDs (minus conflicts with other mods) that's really going to hinder me. I'll try using Data Values but someone on IRC said that wont work; but it was the same guy who told me I could use 4096 IDs
  9. Well that's annoying. The guys on #MinecraftForgeTuts IRC specifically told me the opposite when I asked about that very issue, because I read about it somewhere. They said it was "old and outdated, you can use any ID now". So, that being the case... I have quite a lot of blocks across my mod that will be world-generated. Would it be sensible to use metadata to keep the ID count down? If not, chances are there physically wont be enough free IDs for me to use...
  10. The teleport thing isn't an issue really, that was just in case someone tested my code. That's only there temporarily; you'll actually travel to the dimension by right-clicking a single crafted block and selecting it from a GUI. I just wanted to make sure the dimension worked before I did that
  11. Hey, I've just had my first attempt at making a custom dimension, and clearly something somewhere went very wrong. First, my code: [spoiler=Portal] package co.uk.silvania.Remula.dimensions; import java.util.Random; import co.uk.silvania.Remula.CommonProxy; import co.uk.silvania.Remula.Remula; import net.minecraft.block.Block; import net.minecraft.block.BlockPortal; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; public class AkatoePortalBlock extends BlockPortal { public AkatoePortalBlock(int id, int texture) { super(id, texture); this.setCreativeTab(Remula.tabRemula); } public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { } //Create the portal public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4) { byte var5 = 0; byte var6 = 0; if (par1World.getBlockId(par2 - 1, par3, par4) == Block.sandStone.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Block.sandStone.blockID) { var5 = 1; } if (par1World.getBlockId(par2, par3, par4 - 1) == Block.sandStone.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Block.sandStone.blockID) { var6 = 1; } if (var5 == var6) { return false; } else { if (par1World.getBlockId(par2 - var5, par3, par4 - var6) == 0) { par2 -= var5; par4 -= var6; } int var7; int var8; for (var7 = -1; var7 <= 2; ++var7) { for (var8 = -1; var8 <= 3; ++var8) { boolean var9 = var7 == -1 || var7 == 2 || var8 == -1 || var8 == 3; if (var7 != -1 && var7 != 2 || var8 != -1 && var8 != 3) { int var10 = par1World.getBlockId(par2 + var5 * var7, par3 + var8, par4 + var6 * var7); if (var9) { if (var10 != Block.sandStone.blockID) { return false; } } else if (var10 != 0 && var10 != Block.fire.blockID) { return false; } } } } par1World.editingBlocks = true; for (var7 = 0; var7 < 2; ++var7) { for (var8 = 0; var8 < 3; ++var8) { par1World.setBlockWithNotify(par2 + var5 * var7, par3 + var8, par4 + var6 * var7, this.blockID); } } par1World.editingBlocks = false; return true; } } public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { } //Check the portal is still valid public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { byte var6 = 0; byte var7 = 1; if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID) { var6 = 1; var7 = 0; } int var8; for (var8 = par3; par1World.getBlockId(par2, var8 - 1, par4) == this.blockID; --var8) { ; } if (par1World.getBlockId(par2, var8 - 1, par4) != Block.sandStone.blockID) { par1World.setBlockWithNotify(par2, par3, par4, 0); } else { int var9; for (var9 = 1; var9 < 4 && par1World.getBlockId(par2, var8 + var9, par4) == this.blockID; ++var9) { ; } if (var9 == 3 && par1World.getBlockId(par2, var8 + var9, par4) == Block.sandStone.blockID) { boolean var10 = par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID; boolean var11 = par1World.getBlockId(par2, par3, par4 - 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID; if (var10 && var11) { par1World.setBlockWithNotify(par2, par3, par4, 0); } else { if ((par1World.getBlockId(par2 + var6, par3, par4 + var7) != Block.sandStone.blockID || par1World.getBlockId(par2 - var6, par3, par4 - var7) != this.blockID) && (par1World.getBlockId(par2 - var6, par3, par4 - var7) != Block.sandStone.blockID || par1World.getBlockId(par2 + var6, par3, par4 + var7) != this.blockID)) { par1World.setBlockWithNotify(par2, par3, par4, 0); } } } else { par1World.setBlockWithNotify(par2, par3, par4, 0); } } } // Teleportation Code 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 != Remula.akatoeDimension) { thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Remula.akatoeDimension, new TeleporterAkatoe(thePlayer.mcServer.worldServerForDimension(Remula.akatoeDimension))); } else { //thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Remula.akatoeDimension, new TeleporterAkatoe(thePlayer.mcServer.worldServerForDimension(Remula.akatoeDimension))); thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterAkatoe(thePlayer.mcServer.worldServerForDimension(0))); } } } } @Override public String getTextureFile () { return CommonProxy.AKATOEBLOCKS_PNG; } } [spoiler=WorldProvider] package co.uk.silvania.Remula.dimensions; import co.uk.silvania.Remula.Remula; 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 AkatoeWorldProvider extends WorldProvider { public String getDimensionName() { return "Akatoe"; } public boolean canRespawnHere() { return true; } public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.beach, 0.8F, 0.1F); this.dimensionId = Remula.akatoeDimension; } @Override public IChunkProvider createChunkGenerator() { return new AkatoeChunkProvider(worldObj, worldObj.getSeed(), true); } public String getSaveFolder() { return "Akatoe"; } } [spoiler=ChunkProvider] package co.uk.silvania.Remula.dimensions; 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 co.uk.silvania.Remula.Remula; 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 AkatoeChunkProvider implements IChunkProvider { private Random rand; private NoiseGeneratorOctaves noiseGen1; private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorOctaves noiseGen4; public NoiseGeneratorOctaves noiseGen5; public NoiseGeneratorOctaves noiseGen6; public NoiseGeneratorOctaves mobSpawnerNoise; private World worldObj; private final boolean mapFeaturesEnabled; private double[] noiseArray; private double[] stoneNoise = new double[256]; private MapGenBase caveGenerator = new MapGenCaves(); private MapGenStronghold strongholdGenerator = new MapGenStronghold(); private MapGenVillage villageGenerator = new MapGenVillage(); private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); private MapGenBase ravineGenerator = new MapGenRavine(); private BiomeGenBase[] biomesForGeneration; double[] noise3; double[] noise1; double[] noise2; double[] noise5; double[] noise6; 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 AkatoeChunkProvider(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]; } public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) { byte var4 = 4; byte var5 = 16; byte var6 = 63; int var7 = var4 + 1; byte var8 = 17; int var9 = var4 + 1; this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5); this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9); for (int var10 = 0; var10 < var4; ++var10) { for (int var11 = 0; var11 < var4; ++var11) { for (int var12 = 0; var12 < var5; ++var12) { double var13 = 0.125D; double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; for (int var31 = 0; var31 < 8; ++var31) { double var32 = 0.25D; double var34 = var15; double var36 = var17; double var38 = (var19 - var15) * var32; double var40 = (var21 - var17) * var32; for (int var42 = 0; var42 < 4; ++var42) { int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31; short var44 = 128; var43 -= var44; double var45 = 0.25D; double var49 = (var36 - var34) * var45; double var47 = var34 - var49; for (int var51 = 0; var51 < 4; ++var51) { if ((var47 += var49) > 0.0D) { par3ArrayOfByte[var43 += var44] = (byte)Remula.akatoeStone.blockID; } else if (var12 * 8 + var31 < var6) { par3ArrayOfByte[var43 += var44] = (byte)Block.waterStill.blockID; } else { par3ArrayOfByte[var43 += var44] = 0; } } var34 += var38; var36 += var40; } var15 += var23; var17 += var25; var19 += var27; var21 += var29; } } } } } /** * 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 var5 = 63; double var6 = 0.03125D; this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D); for (int var8 = 0; var8 < 16; ++var8) { for (int var9 = 0; var9 < 16; ++var9) { BiomeGenBase var10 = par4ArrayOfBiomeGenBase[var9 + var8 * 16]; float var11 = var10.getFloatTemperature(); int var12 = (int)(this.stoneNoise[var8 + var9 * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int var13 = -1; byte var14 = var10.topBlock; byte var15 = var10.fillerBlock; for (int var16 = 127; var16 >= 0; --var16) { int var17 = (var9 * 16 + var8) * 128 + var16; if (var16 <= 0 + this.rand.nextInt(5)) { par3ArrayOfByte[var17] = (byte)Block.bedrock.blockID; } else { byte var18 = par3ArrayOfByte[var17]; if (var18 == 0) { var13 = -1; } else if (var18 == Remula.akatoeStone.blockID) { if (var13 == -1) { if (var12 <= 0) { var14 = 0; var15 = (byte)Remula.akatoeStone.blockID; } else if (var16 >= var5 - 4 && var16 <= var5 + 1) { var14 = var10.topBlock; var15 = var10.fillerBlock; } if (var16 < var5 && var14 == 0) { if (var11 < 0.15F) { var14 = (byte)Block.ice.blockID; } else { var14 = (byte)Block.waterStill.blockID; } } var13 = var12; if (var16 >= var5 - 1) { par3ArrayOfByte[var17] = var14; } else { par3ArrayOfByte[var17] = var15; } } else if (var13 > 0) { --var13; par3ArrayOfByte[var17] = var15; if (var13 == 0 && var15 == Remula.akatoeSand.blockID) { var13 = this.rand.nextInt(4); var15 = (byte)Remula.akatoeStone.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[] var3 = new byte[32768]; this.generateTerrain(par1, par2, var3); this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration); this.caveGenerator.generate(this, this.worldObj, par1, par2, var3); this.ravineGenerator.generate(this, this.worldObj, par1, par2, var3); if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, var3); this.villageGenerator.generate(this, this.worldObj, par1, par2, var3); this.strongholdGenerator.generate(this, this.worldObj, par1, par2, var3); this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, var3); } Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); byte[] var5 = var4.getBiomeArray(); for (int var6 = 0; var6 < var5.length; ++var6) { var5[var6] = (byte)this.biomesForGeneration[var6].biomeID; } var4.generateSkylightMap(); return var4; } /** * 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 var8 = -2; var8 <= 2; ++var8) { for (int var9 = -2; var9 <= 2; ++var9) { float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F); this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10; } } } double var44 = 684.412D; double var45 = 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, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D); this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44); this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44); boolean var43 = false; boolean var42 = false; int var12 = 0; int var13 = 0; for (int var14 = 0; var14 < par5; ++var14) { for (int var15 = 0; var15 < par7; ++var15) { float var16 = 0.0F; float var17 = 0.0F; float var18 = 0.0F; byte var19 = 2; BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)]; for (int var21 = -var19; var21 <= var19; ++var21) { for (int var22 = -var19; var22 <= var19; ++var22) { BiomeGenBase var23 = this.biomesForGeneration[var14 + var21 + 2 + (var15 + var22 + 2) * (par5 + 5)]; float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (var23.minHeight + 2.0F); if (var23.minHeight > var20.minHeight) { var24 /= 2.0F; } var16 += var23.maxHeight * var24; var17 += var23.minHeight * var24; var18 += var24; } } var16 /= var18; var17 /= var18; var16 = var16 * 0.9F + 0.1F; var17 = (var17 * 4.0F - 1.0F) / 8.0F; double var47 = this.noise6[var13] / 8000.0D; if (var47 < 0.0D) { var47 = -var47 * 0.3D; } var47 = var47 * 3.0D - 2.0D; if (var47 < 0.0D) { var47 /= 2.0D; if (var47 < -1.0D) { var47 = -1.0D; } var47 /= 1.4D; var47 /= 2.0D; } else { if (var47 > 1.0D) { var47 = 1.0D; } var47 /= 8.0D; } ++var13; for (int var46 = 0; var46 < par6; ++var46) { double var48 = (double)var17; double var26 = (double)var16; var48 += var47 * 0.2D; var48 = var48 * (double)par6 / 16.0D; double var28 = (double)par6 / 2.0D + var48 * 4.0D; double var30 = 0.0D; double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26; if (var32 < 0.0D) { var32 *= 4.0D; } double var34 = this.noise1[var12] / 512.0D; double var36 = this.noise2[var12] / 512.0D; double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D; if (var38 < 0.0D) { var30 = var34; } else if (var38 > 1.0D) { var30 = var36; } else { var30 = var34 + (var36 - var34) * var38; } var30 -= var32; if (var46 > par6 - 4) { double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F); var30 = var30 * (1.0D - var40) + -10.0D * var40; } par1ArrayOfDouble[var12] = var30; ++var12; } } } 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 var4 = par2 * 16; int var5 = par3 * 16; BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); this.rand.setSeed(this.worldObj.getSeed()); long var7 = this.rand.nextLong() / 2L * 2L + 1L; long var9 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed()); boolean var11 = false; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, var11)); if (this.mapFeaturesEnabled) { this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); var11 = 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 var12; int var13; int var14; if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, LAKE) && !var11 && this.rand.nextInt(4) == 0) { var12 = var4 + this.rand.nextInt(16) + 8; var13 = this.rand.nextInt(128); var14 = var5 + this.rand.nextInt(16) + 8; (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14); } if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, LAVA) && !var11 && this.rand.nextInt( == 0) { var12 = var4 + this.rand.nextInt(16) + 8; var13 = this.rand.nextInt(this.rand.nextInt(120) + ; var14 = var5 + this.rand.nextInt(16) + 8; if (var13 < 63 || this.rand.nextInt(10) == 0) { (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14); } } boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, DUNGEON); for (var12 = 0; doGen && var12 < 8; ++var12) { var13 = var4 + this.rand.nextInt(16) + 8; var14 = this.rand.nextInt(128); int var15 = var5 + this.rand.nextInt(16) + 8; if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var13, var14, var15)) { ; } } var6.decorate(this.worldObj, this.rand, var4, var5); SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); var4 += 8; var5 += 8; doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, var11, ICE); for (var12 = 0; doGen && var12 < 16; ++var12) { for (var13 = 0; var13 < 16; ++var13) { var14 = this.worldObj.getPrecipitationHeight(var4 + var12, var5 + var13); if (this.worldObj.isBlockFreezable(var12 + var4, var14 - 1, var13 + var5)) { this.worldObj.setBlockWithNotify(var12 + var4, var14 - 1, var13 + var5, Block.ice.blockID); } if (this.worldObj.canSnowAt(var12 + var4, var14, var13 + var5)) { this.worldObj.setBlockWithNotify(var12 + var4, var14, var13 + var5, Block.snow.blockID); } } } MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, var11)); 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 the 100 oldest chunks from memory, due to a bug with chunkSet.add() never being called it thinks the list * is always empty and will not remove any chunks. */ public boolean unload100OldestChunks() { 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 var5 = this.worldObj.getBiomeGenForCoords(par2, par4); return var5 == null ? null : (var5 == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : var5.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); } } } [spoiler=Teleporter] package co.uk.silvania.Remula.dimensions; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; import co.uk.silvania.Remula.Remula; import net.minecraft.block.Block; 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 TeleporterAkatoe 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 TeleporterAkatoe(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.func_85188_a(par1Entity); 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.setBlockWithNotify(var17, var18, var19, var20 ? Block.sandStone.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) == Remula.akatoePortal.blockID) { while (this.field_85192_a.getBlockId(var48, var26 - 1, var23) == Remula.akatoePortal.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) == Remula.akatoePortal.blockID) { var50 = 2; } if (this.field_85192_a.getBlockId(var12 + 1, var13, var14) == Remula.akatoePortal.blockID) { var50 = 0; } if (this.field_85192_a.getBlockId(var12, var13, var14 - 1) == Remula.akatoePortal.blockID) { var50 = 3; } if (this.field_85192_a.getBlockId(var12, var13, var14 + 1) == Remula.akatoePortal.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 func_85188_a(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.setBlockWithNotify(var22, var23, var24, var33 ? Block.sandStone.blockID : 0); } } } } for (var19 = 0; var19 < 4; ++var19) { this.field_85192_a.editingBlocks = true; 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.setBlockWithNotify(var22, var23, var24, var33 ? Block.sandStone.blockID : Remula.akatoePortal.blockID); } } this.field_85192_a.editingBlocks = false; 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()); } } } } } I wont post my main mod file unless it's needed due to it being very long, but I have these lines: //At the top: public static int akatoeDimension = 20; //In the Load method: DimensionManager.registerProviderType(akatoeDimension, AkatoeWorldProvider.class, false); DimensionManager.registerDimension(akatoeDimension, akatoeDimension); Ok, so what's happening. Firstly, as it is that code doesn't work; the portal simply teleports you back into the same world. If you uncomment the commented line and comment the one that was there, it will work (as a test method) Once you get into the world, the entire terrain is made up of Stone Brick Stairs. Also, your framerate drops to 0 FPS almost instantly - It took me a good few minutes to dig far enough down to see if the stone stairs were just the grass/dirt layer, or if they were everything. I'm guessing it's something in my ChunkProvider class. I was told to not change it, but the dimension I'm making is supposed to be made entirely from new blocks. The blocks are all loading just fine in the game, so that's not the issue. Anyone know what might be going on? (I'm using 1.4.7!)
  12. Can you post a link to the tutorial you followed?
  13. If you could that'd be great Either PM me on here or send to [email protected] Was this supposed to be for me? If so, no idea what you're on about. The block that I want to make using liquid crafting isn't even made yet; all I have is a stub basic block with the name etc, ready to be made.
  14. Whose mod, mine or vroominators? I tried to get mine open source but my laptop does not seem to like git being installed... Yours if that's alright. Are you using the old git command line thing, or Git for windows? The latter is really easy to use but if your laptop doesn't like it obviously you can't get that far. Any chance you could email me a .zip?
  15. Quite off-topic, but is your mod planned to be open source? I'd love to see the source if that's ok with you; one of my mods I'm planning on something similar (An ore has to be refined to a liquid and pumped into a special crafting table in order to use it) and I'd love to see how you do it
  16. This is all irrelevant; I just realized that custom rendered tile entities (for example, a chest) don't get rendered after about 32 blocks. Which makes it totally useless for a road... So unless anyone has an idea of how to force it to be rendered, it's impossible?
  17. Looks pretty useful! How exactly would I go about using this? I know that in general it's good practice. However, I'm sure I mentioned earlier that eventually, these blocks are custom rendered anyway and I was just trying to get something basic together first to help me learn. However, if it's easier to just go tile entity (or the thing Skore mentioned) then that's probably for the best. When the mod is done, the roads would look like this (The blocks are from Redpower as an example) I'm also making road signs which obviously are more important to have rendered.
  18. So, I'm trying to get my head around these tile entity things. The tutorial on Forge Wiki was missing a lot of information, so I took to the internet to find a Forge tutorial (Not as easy as it sounds!) The only up-to-date tutorial I found, was this: http://www.minecraftforum.net/topic/1154044-147forge19213-duckys-modding-tutorials-make-your-blocks-nice/page__st__140 Now, I followed the tutorial word for word (from what I can tell), and only copy-pasted the model (for testing) However, something somewhere has gone wrong with the rendering, as it's not loading any texture, it's just totally invisible. My code: https://github.com/Flenix/TileEntityTest/tree/master/a/tutorials/tutorial Anyone able to help me out a bit? Just a push in the right direction, or a link to a known working tutorial would be nice. I'm using 1.4.7
  19. Please do not do this, it isn't worth the extra save file size cost. I would rather see you make a texture for the two separate possible directions and use the metadata to store the direction. Do you mean the world size? The mod is mainly designed for my server, which we have a 500gb drive dedicated just for minecraft (and a few small things like Jenkins.. if it ever bloody works.), so that's not an issue. The only reason I avoided tile entity at all was because I heard it was more RAM-consuming. However I eventually wanted to make some of the blocks a custom shape, and from what I've seen if I did that, there's no avoiding a tile entity. Maybe I should look into that, but I'll try your NBT thing first. The blocks are entirely cosmetic. It's just a set of road blocks like you'd see in the street; we have a modern server, and we have Flans, it was a huge gap and I'm learning Java to fill it
  20. package co.uk.silvania.roads.block; import co.uk.silvania.roads.CommonProxy; import co.uk.silvania.roads.Roads; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Facing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class RBDoubleYellowStripe extends Block { public RBDoubleYellowStripe(int id) { super(id, Material.rock); this.setCreativeTab(Roads.tabRoads); this.setHardness(1.0F); this.setStepSound(Block.soundStoneFootstep); } @Override public String getTextureFile () { return CommonProxy.BLOCK_PNG; } @SideOnly(Side.CLIENT) public int getBlockTextureFromSideAndMetadata(int par1, int par2) { int var3 = getOrientation(par2); return var3 > 5 ? this.blockIndexInTexture : (par1 == var3 ? (this.blockIndexInTexture + 1 * 1) : (par1 == Facing.faceToSide[var3] ? 1 : 0)); } public int getRenderType() { return 16; } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { int var6 = determineOrientation(par1World, par2, par3, par4, (EntityPlayer)par5EntityLiving); par1World.setBlockMetadataWithNotify(par2, par3, par4, var6); } public static int getOrientation(int par0) { return par0 & 7; } public static int determineOrientation(World par0World, int par1, int par2, int par3, EntityPlayer par4EntityPlayer) { int var7 = MathHelper.floor_double((double)(par4EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; return var7 == 0 ? 2 : (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0))); } } That's the whole class file of a block which has the buggy rotation on. The code I got, I managed to work out from piston. What I did was copied the whole piston code, and commented things out line by line to see what was important, and what wasn't. The code there is what was left at the end, everything "important" (Personally, I see why it's all required except getRenderType. I don't know why it's needed, but if I comment it out it doesn't rotate, so obviously it is )
  21. package co.uk.silvania.roads.block; import co.uk.silvania.roads.CommonProxy; import co.uk.silvania.roads.Roads; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Facing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class RBDoubleYellowStripe extends Block { public RBDoubleYellowStripe(int id) { super(id, Material.rock); this.setCreativeTab(Roads.tabRoads); this.setHardness(1.0F); this.setStepSound(Block.soundStoneFootstep); } @Override public String getTextureFile () { return CommonProxy.BLOCK_PNG; } @SideOnly(Side.CLIENT) public int getBlockTextureFromSideAndMetadata(int par1, int par2) { int var3 = getOrientation(par2); return var3 > 5 ? this.blockIndexInTexture : (par1 == var3 ? (this.blockIndexInTexture + 1 * 1) : (par1 == Facing.faceToSide[var3] ? 1 : 0)); } public int getRenderType() { return 16; } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { int var6 = determineOrientation(par1World, par2, par3, par4, (EntityPlayer)par5EntityLiving); par1World.setBlockMetadataWithNotify(par2, par3, par4, var6); } public static int getOrientation(int par0) { return par0 & 7; } public static int determineOrientation(World par0World, int par1, int par2, int par3, EntityPlayer par4EntityPlayer) { int var7 = MathHelper.floor_double((double)(par4EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; return var7 == 0 ? 2 : (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0))); } } That's the whole class file of a block which has the buggy rotation on. The code I got, I managed to work out from piston. What I did was copied the whole piston code, and commented things out line by line to see what was important, and what wasn't. The code there is what was left at the end, everything "important" (Personally, I see why it's all required except getRenderType. I don't know why it's needed, but if I comment it out it doesn't rotate, so obviously it is )
  22. No offence taken. I admit my Java knowledge is rather limited, but I'm a very hands-on learner and the best way for me to learn is simply trial and error. If I tried to read a book on Java, I'd get bored and give up after about 3 pages of trying to make Hello World, so things like what you just said are exactly what I need to help me learn. However, I do know that when it boils down to it, that solution would be no different to my Piston one, because it's still just a block hacked to be on it's side. I know there must be something with that I can do, it's just a case of working it out. The metadata thing was just a totally different approach at it really
  23. No offence taken. I admit my Java knowledge is rather limited, but I'm a very hands-on learner and the best way for me to learn is simply trial and error. If I tried to read a book on Java, I'd get bored and give up after about 3 pages of trying to make Hello World, so things like what you just said are exactly what I need to help me learn. However, I do know that when it boils down to it, that solution would be no different to my Piston one, because it's still just a block hacked to be on it's side. I know there must be something with that I can do, it's just a case of working it out. The metadata thing was just a totally different approach at it really
  24. I took that approach before. My first attempt was the log code. However, when a log is on it's side, it only has TWO metadata positions, not 4; for north-south and east-west. Whether your facing north or south, it'll place the same texture. I couldn't quite work out why though. My next approach was to try a piston, and that actually worked, but it was quite buggy. I managed to edit the code enough so I could place in the four directions and it would rotate, and it wouldn't rotate for up and down (which was good). However, the top texture mirrored around the left/right/bottom too, and I couldn't figure out why it did that. Also, the held item looked wrong, because technically the top of the block was actually it's side. I can't understand why it's so complicated though. There must just be a simple method to rotate the top texture, surely? Even in Java itself, something to just rotate the image would be enough.
×
×
  • Create New...

Important Information

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