Jump to content

tiffit

Forge Modder
  • Posts

    242
  • Joined

  • Last visited

Everything posted by tiffit

  1. I was able to get it to work by rotating on the x and y axis. Thanks for the help!
  2. I was able to get it to work by rotating on the x and y axis. Thanks for the help!
  3. I am trying to make my custom block model rotate on the z axis for certain blockstates but it doesn't seem to be working. The other rotations seem to be working and it places down the block with the blockstates east and west. So only the rotations isn't working and just placing down the normal model. { "variants": { "active=false,facing=up": { "model": "talecraft:spikeblock", "x": 180 }, "active=false,facing=down": { "model": "talecraft:spikeblock"}, "active=false,facing=south": { "model": "talecraft:spikeblock", "x": 90 }, "active=false,facing=north": { "model": "talecraft:spikeblock", "x": 270 }, "active=false,facing=east": { "model": "talecraft:spikeblock", "z": 90}, "active=false,facing=west": { "model": "talecraft:spikeblock", "z": 270 }, "active=true,facing=up": { "model": "talecraft:spikeblock", "x": 180 }, "active=true,facing=down": { "model": "talecraft:spikeblock"}, "active=true,facing=south": { "model": "talecraft:spikeblock", "x": 90 }, "active=true,facing=north": { "model": "talecraft:spikeblock", "x": 270 }, "active=true,facing=east": { "model": "talecraft:spikeblock", "z": 90}, "active=true,facing=west": { "model": "talecraft:spikeblock", "z": 270 } } }
  4. I am trying to make my custom block model rotate on the z axis for certain blockstates but it doesn't seem to be working. The other rotations seem to be working and it places down the block with the blockstates east and west. So only the rotations isn't working and just placing down the normal model. { "variants": { "active=false,facing=up": { "model": "talecraft:spikeblock", "x": 180 }, "active=false,facing=down": { "model": "talecraft:spikeblock"}, "active=false,facing=south": { "model": "talecraft:spikeblock", "x": 90 }, "active=false,facing=north": { "model": "talecraft:spikeblock", "x": 270 }, "active=false,facing=east": { "model": "talecraft:spikeblock", "z": 90}, "active=false,facing=west": { "model": "talecraft:spikeblock", "z": 270 }, "active=true,facing=up": { "model": "talecraft:spikeblock", "x": 180 }, "active=true,facing=down": { "model": "talecraft:spikeblock"}, "active=true,facing=south": { "model": "talecraft:spikeblock", "x": 90 }, "active=true,facing=north": { "model": "talecraft:spikeblock", "x": 270 }, "active=true,facing=east": { "model": "talecraft:spikeblock", "z": 90}, "active=true,facing=west": { "model": "talecraft:spikeblock", "z": 270 } } }
  5. I am trying to render a custom block for my mod but when the block gets rendered, the places where its supposed to be transparent is black. SpikeBlock.java SpikeBlock.json
  6. I am trying to render a custom block for my mod but when the block gets rendered, the places where its supposed to be transparent is black. SpikeBlock.java SpikeBlock.json
  7. How Would I make a chunk generator generate with less noise for the noise. I don't want it to generate mountains or anything like that. package tiffit.JASM.worldProvider; import java.util.ArrayList; import java.util.List; import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.gen.ChunkProviderSettings; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorPerlin; import net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld; import net.minecraftforge.event.terraingen.TerrainGen; import tiffit.JASM.JASMBlocks; public class MoonChunkGenerator implements IChunkGenerator { protected static final IBlockState moonRock = JASMBlocks.moonRock.getDefaultState(); private final Random rand; private NoiseGeneratorOctaves octavePerlin1; private NoiseGeneratorOctaves octavePerlin2; private NoiseGeneratorOctaves octavePerlin; private NoiseGeneratorPerlin perlinHeight; public NoiseGeneratorOctaves octaveScale; public NoiseGeneratorOctaves octaveDepth; public NoiseGeneratorOctaves octaveForest; private final World worldObj; private final double[] heightMap; private final float[] float_array; private ChunkProviderSettings settings; private IBlockState oceanBlock = Blocks.stone.getDefaultState(); private double[] biomeArray = new double[256]; private BiomeGenBase[] biomesForGeneration; double[] field_185986_e; double[] field_185987_f; double[] field_185988_g; double[] field_185989_h; public MoonChunkGenerator(World world, long seed, String data){ this.worldObj = world; this.rand = new Random(seed); this.octavePerlin1 = new NoiseGeneratorOctaves(rand, 16); this.octavePerlin2 = new NoiseGeneratorOctaves(rand, 16); this.octavePerlin = new NoiseGeneratorOctaves(rand, ; this.perlinHeight = new NoiseGeneratorPerlin(rand, 4); this.octaveScale = new NoiseGeneratorOctaves(rand, 10); this.octaveDepth = new NoiseGeneratorOctaves(rand, 16); this.octaveForest = new NoiseGeneratorOctaves(rand, ; this.heightMap = new double[825]; this.float_array = new float[25]; for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { float f = 10.0F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F); this.float_array[i + 2 + (j + 2) * 5] = f; } } if (data != null){ ChunkProviderSettings.Factory factory = ChunkProviderSettings.Factory.jsonToFactory(data); this.settings = factory.func_177864_b(); world.setSeaLevel(this.settings.seaLevel); } ContextOverworld ctx = new ContextOverworld(octavePerlin1, octavePerlin2, octavePerlin, perlinHeight, octaveScale, octaveDepth, octaveForest); ctx = TerrainGen.getModdedNoiseGenerators(world, this.rand, ctx); this.octavePerlin1 = ctx.getLPerlin1(); this.octavePerlin2 = ctx.getLPerlin2(); this.octavePerlin = ctx.getPerlin(); this.perlinHeight = ctx.getHeight(); this.octaveScale = ctx.getScale(); this.octaveDepth = ctx.getDepth(); this.octaveForest = ctx.getForest(); } public void setBlocksInChunk(int x, int z, ChunkPrimer primer) { this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, x * 4 - 2, z * 4 - 2, 10, 10); this.generateHeightmap(x * 4, 0, z * 4); for (int i = 0; i < 4; ++i) { int j = i * 5; int k = (i + 1) * 5; for (int l = 0; l < 4; ++l) { int i1 = (j + l) * 33; int j1 = (j + l + 1) * 33; int k1 = (k + l) * 33; int l1 = (k + l + 1) * 33; for (int i2 = 0; i2 < 32; ++i2) { double d0 = 0.125D; double d1 = this.heightMap[i1 + i2]; double d2 = this.heightMap[j1 + i2]; double d3 = this.heightMap[k1 + i2]; double d4 = this.heightMap[l1 + i2]; double d5 = (this.heightMap[i1 + i2 + 1] - d1) * d0; double d6 = (this.heightMap[j1 + i2 + 1] - d2) * d0; double d7 = (this.heightMap[k1 + i2 + 1] - d3) * d0; double d8 = (this.heightMap[l1 + i2 + 1] - d4) * d0; for (int j2 = 0; j2 < 8; ++j2) { double d9 = 0.25D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for (int k2 = 0; k2 < 4; ++k2) { double d14 = 0.25D; double d16 = (d11 - d10) * d14; double lvt_45_1_ = d10 - d16; for (int l2 = 0; l2 < 4; ++l2) { if ((lvt_45_1_ += d16) > 0.0D) { primer.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, moonRock); } else if (i2 * 8 + j2 < this.settings.seaLevel) { primer.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, moonRock); } } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } public void replaceBiomeBlocks(int x, int z, ChunkPrimer primer, BiomeGenBase[] biomesIn){ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, x, z, primer, this.worldObj)) return; double d0 = 0.03125D; this.biomeArray = this.perlinHeight.func_151599_a(this.biomeArray, (double)(x * 16), (double)(z * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { BiomeGenBase biomegenbase = biomesIn[j + i * 16]; biomegenbase.genTerrainBlocks(this.worldObj, this.rand, primer, x * 16 + i, z * 16 + j, this.biomeArray[j + i * 16]); } } } public Chunk provideChunk(int x, int z){ this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.setBlocksInChunk(x, z, chunkprimer); this.biomesForGeneration = this.worldObj.getBiomeProvider().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.replaceBiomeBlocks(x, z, chunkprimer, this.biomesForGeneration); Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { abyte[i] = (byte)BiomeGenBase.getIdForBiome(this.biomesForGeneration[i]); } chunk.generateSkylightMap(); return chunk; } private void generateHeightmap(int p_185978_1_, int p_185978_2_, int p_185978_3_){ this.field_185989_h = this.octaveDepth.generateNoiseOctaves(this.field_185989_h, p_185978_1_, p_185978_3_, 5, 5, (double)this.settings.depthNoiseScaleX, (double)this.settings.depthNoiseScaleZ, (double)this.settings.depthNoiseScaleExponent); float f = this.settings.coordinateScale; float f1 = this.settings.heightScale; this.field_185986_e = this.octavePerlin.generateNoiseOctaves(this.field_185986_e, p_185978_1_, p_185978_2_, p_185978_3_, 5, 33, 5, (double)(f / this.settings.mainNoiseScaleX), (double)(f1 / this.settings.mainNoiseScaleY), (double)(f / this.settings.mainNoiseScaleZ)); this.field_185987_f = this.octavePerlin1.generateNoiseOctaves(this.field_185987_f, p_185978_1_, p_185978_2_, p_185978_3_, 5, 33, 5, (double)f, (double)f1, (double)f); this.field_185988_g = this.octavePerlin2.generateNoiseOctaves(this.field_185988_g, p_185978_1_, p_185978_2_, p_185978_3_, 5, 33, 5, (double)f, (double)f1, (double)f); p_185978_3_ = 0; p_185978_1_ = 0; int i = 0; int j = 0; for (int k = 0; k < 5; ++k) { for (int l = 0; l < 5; ++l) { float f2 = 0.0F; float f3 = 0.0F; float f4 = 0.0F; int i1 = 2; BiomeGenBase biomegenbase = this.biomesForGeneration[k + 2 + (l + 2) * 10]; for (int j1 = -i1; j1 <= i1; ++j1) { for (int k1 = -i1; k1 <= i1; ++k1) { BiomeGenBase biomegenbase1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10]; float f5 = this.settings.biomeDepthOffSet + biomegenbase1.getBaseHeight() * this.settings.biomeDepthWeight; float f6 = this.settings.biomeScaleOffset + biomegenbase1.getHeightVariation() * this.settings.biomeScaleWeight; float f7 = this.float_array[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F); if (biomegenbase1.getBaseHeight() > biomegenbase.getBaseHeight()) { f7 /= 2.0F; } f2 += f6 * f7; f3 += f5 * f7; f4 += f7; } } f2 = f2 / f4; f3 = f3 / f4; f2 = f2 * 0.9F + 0.1F; f3 = (f3 * 4.0F - 1.0F) / 8.0F; double d7 = this.field_185989_h[j] / 8000.0D; if (d7 < 0.0D) { d7 = -d7 * 0.3D; } d7 = d7 * 3.0D - 2.0D; if (d7 < 0.0D) { d7 = d7 / 2.0D; if (d7 < -1.0D) { d7 = -1.0D; } d7 = d7 / 1.4D; d7 = d7 / 2.0D; } else { if (d7 > 1.0D) { d7 = 1.0D; } d7 = d7 / 8.0D; } ++j; double d8 = (double)f3; double d9 = (double)f2; d8 = d8 + d7 * 0.2D; d8 = d8 * (double)this.settings.baseSize / 8.0D; double d0 = (double)this.settings.baseSize + d8 * 4.0D; for (int l1 = 0; l1 < 33; ++l1) { double d1 = ((double)l1 - d0) * (double)this.settings.stretchY * 128.0D / 256.0D / d9; if (d1 < 0.0D) { d1 *= 4.0D; } double d2 = this.field_185987_f[i] / (double)this.settings.lowerLimitScale; double d3 = this.field_185988_g[i] / (double)this.settings.upperLimitScale; double d4 = (this.field_185986_e[i] / 10.0D + 1.0D) / 2.0D; double d5 = MathHelper.denormalizeClamp(d2, d3, d4) - d1; if (l1 > 29) { double d6 = (double)((float)(l1 - 29) / 3.0F); d5 = d5 * (1.0D - d6) + -10.0D * d6; } this.heightMap[i] = d5; ++i; } } } } public void populate(int x, int z){ } public boolean generateStructures(Chunk chunkIn, int x, int z){ return false; } public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos){ return new ArrayList<SpawnListEntry>(); } public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) { return null; } public void recreateStructures(Chunk chunkIn, int x, int z) { } }
  8. Dear diary, It has been 6 days without a response. I am running low on food and water. The bucket is almost full. Bump
  9. Bump Here are some images of the problem
  10. I am having trouble with rending a box. There is a weird "quad" that is rendering at (0, 0, 0). It seems to only happen when I render more than 1 quad. Here is the rendering code: public static final void renderSelectionBox( Tessellator tessellator, VertexBuffer ren, float minX, float minY, float minZ, float maxX, float maxY, float maxZ, float a ) { float U = Math.round(maxX - minX); float V = Math.round(maxY - minY); float W = Math.round(maxZ - minZ); float VOLUME = U*V*W; float SPEED = 10000; float UVW_DIVIDE = 1; if(VOLUME > (128*128*128)) { UVW_DIVIDE = 128f; SPEED = 10000; } else if(VOLUME > (16*16*16)) { UVW_DIVIDE = 16f; SPEED = 7500; } else { UVW_DIVIDE = 1; SPEED = 3000; } // divide U /= UVW_DIVIDE; V /= UVW_DIVIDE; W /= UVW_DIVIDE; float u0 = 0; float u1 = U; float v0 = 0; float v1 = V; float w0 = 0; float w1 = W; { final long speedL = (long) SPEED; final float speedF = SPEED; float f4 = Minecraft.getSystemTime() % speedL / speedF; float ADD = f4; u0 += ADD; u1 += ADD; v0 += ADD; v1 += ADD; w0 += ADD; w1 += ADD; } float r = 1; float g = 0.5f; float b = 0; if(a == -1) { a = 1; r = 0; g = 0; b = 0; } if(a == -2) { a = 1; r = 0; g = 1; b = 0; } if(a == -3) { a = 1; r = 1; g = 0.25f; b = 0.25f; } VertexBufferHelper vertexbuffer = new VertexBufferHelper(ren); // top vertexbuffer.startDrawingQuads(); vertexbuffer.color(r, g, b, a); vertexbuffer.normal(0, 1, 0); vertexbuffer.addVertexWithUV(minX, maxY, maxZ, u0, w0); vertexbuffer.addVertexWithUV(maxX, maxY, maxZ, u1, w0); vertexbuffer.addVertexWithUV(maxX, maxY, minZ, u1, w1); vertexbuffer.addVertexWithUV(minX, maxY, minZ, u0, w1); // bottom vertexbuffer.normal(0, -1, 0); vertexbuffer.addVertexWithUV(minX, minY, minZ, u0, w0); vertexbuffer.addVertexWithUV(maxX, minY, minZ, u1, w0); vertexbuffer.addVertexWithUV(maxX, minY, maxZ, u1, w1); vertexbuffer.addVertexWithUV(minX, minY, maxZ, u0, w1); // negative z | north vertexbuffer.normal(0, 0, -1); vertexbuffer.addVertexWithUV(minX, maxY, minZ, u0, v0); vertexbuffer.addVertexWithUV(maxX, maxY, minZ, u1, v0); vertexbuffer.addVertexWithUV(maxX, minY, minZ, u1, v1); vertexbuffer.addVertexWithUV(minX, minY, minZ, u0, v1); // positive z | south vertexbuffer.normal(0, 0, 1); vertexbuffer.addVertexWithUV(maxX, maxY, maxZ, u0, v0); vertexbuffer.addVertexWithUV(minX, maxY, maxZ, u1, v0); vertexbuffer.addVertexWithUV(minX, minY, maxZ, u1, v1); vertexbuffer.addVertexWithUV(maxX, minY, maxZ, u0, v1); //positive x | east vertexbuffer.normal(1, 0, 0); vertexbuffer.addVertexWithUV(maxX, maxY, minZ, w0, v0); vertexbuffer.addVertexWithUV(maxX, maxY, maxZ, w1, v0); vertexbuffer.addVertexWithUV(maxX, minY, maxZ, w1, v1); vertexbuffer.addVertexWithUV(maxX, minY, minZ, w0, v1); //negative x | west vertexbuffer.normal(-1, 0, 0); vertexbuffer.addVertexWithUV(minX, maxY, maxZ, w0, v0); vertexbuffer.addVertexWithUV(minX, maxY, minZ, w1, v0); vertexbuffer.addVertexWithUV(minX, minY, minZ, w1, v1); vertexbuffer.addVertexWithUV(minX, minY, maxZ, w0, v1); tessellator.draw(); } private static class VertexBufferHelper { private VertexBuffer rend; public VertexBufferHelper(VertexBuffer rend) { this.rend = rend; } public void startDrawingQuads() { rend.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); } public VertexBuffer pos(double x, double y, double z) { return rend.pos(x, y, z); } public void setTranslation(int x, int y, int z) { rend.setTranslation(x, y, z); } public void addVertexWithUV(double x, double y, double z, float u, float v) { rend.pos(x, y, z).tex(u, v).endVertex(); } public void normal(float x, float y, float z) { rend.normal(x, y, z); } public void color(float r, float g, float b, float a) { rend.color(r, g, b, a); } }
  11. Before you say, "Oh, you OnBlockActivated runs twice! Once on the server and client!" That is NOT my problem. The client runs twice and the server runs twice. OnBlockActivated: @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { System.out.println("Is Remote: " + world.isRemote); LockedDoorTileEntity te = (LockedDoorTileEntity) world.getTileEntity(pos); DoorCorner corner = te.corner; if(playerIn.isSneaking() && playerIn.isCreative() && !world.isRemote){ if(corner == DoorCorner.BottomLeftX){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(1, 0, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(1, 1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.BottomRightX){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(-1, 0, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(-1, 1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.TopLeftX){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(1, 0, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, -1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(1, -1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.TopRightX){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(-1, 0, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, -1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(-1, -1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.BottomLeftZ){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 0, 1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 1, 1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.BottomRightZ){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 0, -1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 1, -1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.TopLeftZ){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 0, 1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, -1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, -1, 1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } if(corner == DoorCorner.TopRightZ){ ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, 0, -1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, -1, 0))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos.add(0, -1, -1))).toggleKey(); ((LockedDoorTileEntity) world.getTileEntity(pos)).toggleKey(); } LockedDoorTileEntity tehere = (LockedDoorTileEntity)world.getTileEntity(pos); String keyName = tehere.useSilverKey ? TextFormatting.DARK_GRAY + "silver " : TextFormatting.GOLD + "gold "; playerIn.addChatComponentMessage(new TextComponentString("This door now takes the " + keyName + TextFormatting.RESET + "key.")); TaleCraft.network.sendToDimension(new DoorPacket(pos, tehere.useSilverKey), world.provider.getDimension()); return false; } if(world.isRemote){ if(heldItem != null && heldItem.getItem() instanceof KeyItem){ if((heldItem.getItem() == TaleCraftItems.silverKey && te.useSilverKey) || (heldItem.getItem() == TaleCraftItems.goldKey && !te.useSilverKey))world.playSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.block_chest_open, SoundCategory.BLOCKS, 100f, 1f, false); } return false; } if(heldItem != null && heldItem.getItem() instanceof KeyItem){ if((heldItem.getItem() == TaleCraftItems.silverKey && te.useSilverKey) || (heldItem.getItem() == TaleCraftItems.goldKey && !te.useSilverKey)){ world.setBlockToAir(pos); onBlockDestroyedByPlayer(world, pos, state); heldItem.stackSize--; return false; } } return true; } Console Output: Can't seem to find the solution to this, but it is toggling and then immediately retoggling a boolean thus keeping it the same.
  12. Well that sucks, I'll probably allow custom ints then as that allows more customization
  13. I have looked at TextFormatting and I was not able to find anything like this. I tried to look at the mc GUIs that can handle colored texts (world selector, resource pack selector, etc) but I was not able to find anything that could help me.
  14. My mod has a feature that reads a text files and displays the content in a gui. Now, I need to check if the string contains any color codes (section symbol + color). My problem is how do I turn the color code into an int so I can draw the string.
  15. There is guiLeft and guiTop but I believe those are for normal sized (256x256) GUIs. You can just do: width/2-768/2 for centering on x. Y is the same thing (except with height).
  16. When you are done calculating the results of the itemstack, check to see if the size < 0. If it is, set the slot contents to null else just set it to the itemstack.
  17. You probably want to create a new class. Putting everything into the main file is a terrible idea. Have the newly created class implement IWorldGenerator. You will need to implement the method generate(); The generate method gives you the chunk and world that it should generate in. Now, adding any code into the generate method will run in all dimensions. If you want to only generate in the overworld, you make sure that the world's ID is 0. You can get the current world's ID with "world.provider.dimensionId". -1 is the nether and 1 is the end. Next you want to make a for loop that loops through the intergers 0 to any number of your choosing. The higher the number, the more common your ore will spawn.Then add this inside of the for loop: int firstBlockXCoord = i + random.nextInt(16); int firstBlockYCoord = random.nextInt(maxHeight); int firstBlockZCoord = j + random.nextInt(16); This will choose a random block to start generating the vein. Finally, you will want to create a new WorldGenMinable and give it your block and max vein size and then call the generate method in the WorldGenMinable. Now, to make forge use this generator, you will want to add this into your init() method. GameRegistry.registerWorldGenerator(new OreGenerator(), generationWeight); NOTE: I wrote this using 1.7.10, so things might be different but not much should have changed.
  18. This should help get you started: amazing tool
×
×
  • Create New...

Important Information

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