Jump to content

[SOLVED]Glow-Stone Generation


tamanor

Recommended Posts

Hi how would i go about making more than two type's of glow stone generate in the nether i have my red Glow-Stone working but can not figure out how to get more after that. because when i add more to the code for each glow stone it starts to only spawn only one at a time

 

Glow-Stone Generation

 

 

package net.TMP.worldgen;

import java.util.Random;

import net.TMP.block.TMPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;

public class tmpNetherGlowStoneGen extends WorldGenerator
{
    private Block field_150519_a;
    /** The number of blocks to generate. */
    private int numberOfBlocks;
    private Block field_150518_c;
    private static final String __OBFID = "CL_00000426";
    private int mineableBlockMeta;

    public tmpNetherGlowStoneGen(Block p_i45459_1_, int p_i45459_2_)
    {
//        this(p_i45459_1_, p_i45459_2_, Blocks.glowstone);
    }

    public tmpNetherGlowStoneGen(Block p_i45460_1_, int p_i45460_2_, Block p_i45460_3_)
    {
        this.field_150519_a = p_i45460_1_;
        this.numberOfBlocks = p_i45460_2_;
        this.field_150518_c = p_i45460_3_;
    }

    public tmpNetherGlowStoneGen(Block block, int meta, int number, Block target)
    {
        this(block, number, target);
        this.mineableBlockMeta = meta;
    }

    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    {
        if (!par1World.isAirBlock(par3, par4, par5))
        {
            return false;
        }
        else if (par1World.getBlock(par3, par4 + 1, par5) != Blocks.netherrack)
        {
            return false;
        }
        else
        {
            par1World.setBlock(par3, par4, par5, TMPBlocks.redGlowStone, 0, 2);

            for (int l = 0; l < 1500; ++l)
            {
                int i1 = par3 + par2Random.nextInt( - par2Random.nextInt(;
                int j1 = par4 - par2Random.nextInt(12);
                int k1 = par5 + par2Random.nextInt( - par2Random.nextInt(;

                if (par1World.getBlock(i1, j1, k1).getMaterial() == Material.air)
                {
                    int l1 = 0;

                    for (int i2 = 0; i2 < 6; ++i2)
                    {
                        Block block = null;

                        if (i2 == 0)
                        {
                            block = par1World.getBlock(i1 - 1, j1, k1);
                        }

                        if (i2 == 1)
                        {
                            block = par1World.getBlock(i1 + 1, j1, k1);
                        }

                        if (i2 == 2)
                        {
                            block = par1World.getBlock(i1, j1 - 1, k1);
                        }

                        if (i2 == 3)
                        {
                            block = par1World.getBlock(i1, j1 + 1, k1);
                        }

                        if (i2 == 4)
                        {
                            block = par1World.getBlock(i1, j1, k1 - 1);
                        }

                        if (i2 == 5)
                        {
                            block = par1World.getBlock(i1, j1, k1 + 1);
                        }

                        if (block == TMPBlocks.redGlowStone)
                        {
                            ++l1;
                        }
                    }

                    if (l1 == 1)
                    {
                        par1World.setBlock(i1, j1, k1, TMPBlocks.redGlowStone, 0, 2);
                    }
                }
            }

            return true;
        }
    
    }
}

 

 

World Generation

 

package net.TMP.worldgen;

import java.util.Random;

import net.TMP.block.TMPBlocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;

public class tmpWorldGeneration implements IWorldGenerator

{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider) 
{

	switch(world.provider.dimensionId) {
	case -1:
	generateNether(world, random, chunkX*16, chunkZ*16);
	break;
	case 0:
	generateSurface(world, random, chunkX*16, chunkZ*16);
	break;
	case 1:
	generateEnd(world, random, chunkX*16, chunkZ*16);
	break;
	}


}

private void generateEnd(World world, Random random, int i, int j) {
	// TODO Auto-generated method stub

}

private void generateSurface(World world, Random random, int i, int j) {
	// TODO Auto-generated method stub

}

private void generateNether(World world, Random random, int i, int j) {

	for (int k = 0; k < 25; k++) {
		int chunkX1 = i + random.nextInt(16);
		int chunkY1 = random.nextInt(256);
		int chunkZ1 = j + random.nextInt(16);

		(new tmpNetherGlowStoneGen(TMPBlocks.redGlowStone, 50)).generate(world, random, chunkX1, chunkY1, chunkZ1);

	}
}



}

 

Link to comment
Share on other sites

just copy your for loop in the generateNether and change the random.nextInt() values and change the block it spawns in (new ... ) and you should be good to go....

 

Thanks i got it working now i was doing something similar but i was only copying the "(new tmpNetherGlowStoneGen(TMPBlocks.redGlowStone, 50)).generate(world, random, chunkX1, chunkY1, chunkZ1);" bit of if and not the full loop xD

 

 

Thanks Again

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Here's the newest crash: https://pastebin.com/mumDeWzW Seems to have something to do with JEI Also delete that server file? Also the newest log: https://pastebin.com/ATH8dbWc
    • Recently started to attempt 1.20.1 modding, in registering idle, walk and attack animations in the mob entity class i've run into two issues:   a) idle and walk animations seem to play simultaneously  + the mob itself does not seem to walk private static final EntityDataAccessor<Boolean> ATTACKING = SynchedEntityData.defineId(MugaEntity.class, EntityDataSerializers.BOOLEAN); public MugaEntity(EntityType<? extends Monster > pEntityType, Level pLevel) { super(pEntityType, pLevel); } public final AnimationState idleAnimationState = new AnimationState(); private int idleAnimationTimeout = 1; public final AnimationState attackAnimationState = new AnimationState(); public int attackAnimationTimeout = 0; @Override public void tick() { super.tick(); if(this.level().isClientSide()) { setupAnimationStates(); } } private void setupAnimationStates () { if(this.idleAnimationTimeout <= 0) { this.idleAnimationTimeout = this.random.nextInt(30) + 60; this.idleAnimationState.start(this.tickCount); } else { --this.idleAnimationTimeout; } if (this.isAttacking() && attackAnimationTimeout <= 0 ) { attackAnimationTimeout = 20; attackAnimationState.start(this.tickCount); } else { --this.attackAnimationTimeout; } if(this.isAttacking()) { attackAnimationState.stop(); } } @Override protected void updateWalkAnimation(float pPartialTick) { float f; if(this.getPose() == Pose.STANDING) { f=Math.min(pPartialTick * 3.0F, 1.0F); } else { f= 0.0F; } this.walkAnimation.update(f, 0.2F); } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(ATTACKING, false); } public void setAttacking(boolean attacking) { this.entityData.set(ATTACKING, attacking); } public boolean isAttacking() { return this.entityData.get(ATTACKING); } b) the attack animation is never played on attack, despite being registered  @Override public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); this.animateWalk(ModAnimationDefinitions.MUGA_WALKING, limbSwing, limbSwingAmount, 1f, 1f ); this.animate(((MugaEntity)entity).idleAnimationState, ModAnimationDefinitions.MUGA_IDLE, ageInTicks, 1f); this.animate(((MugaEntity)entity).attackAnimationState, ModAnimationDefinitions.MUGA_ATTACK, ageInTicks, 1f); }
    • Maybe there are some more broken files - check the new crash-report - the file name is mentioned in the first lines   If it is another crash, add it here
    • Thanks. Found and deleted it, but it doesn't change anything. When joining a new file is created, the screen freezes/ does not respond in typical manner and I have to close it then. I deleted it in curseforge>minecraft>instances>Modpack>saves>World>serverconfig Should I have deleted it anywhere else?
  • Topics

×
×
  • Create New...

Important Information

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