Jump to content

Register quartz pillar (EDIT: For structure)


Betterjakers

Recommended Posts

Hello everyone! I am currently making a mod, and am wanting to use a quartz pillar in my recipe. I have found out how to register dyes (Like cocoa beans) but not blocks. Here is the cocoa beans code:

 

public static ItemStack cocoaBeans = new ItemStack(Item.dyePowder, 1, 3);

 

Does anyone know how I could change that into a quartz pillar? I tried changing Item.dyePowder to Block.blockNetherQuartz, but that did not work.

 

EDIT: I would like to add a block, quartz pillar, to my structure. I am currently on 1.6.4. Can anybody help?

Link to comment
Share on other sites

Hello! That did not work. This worked (No errors): Block.blockNetherQuartz

I used it in this code: public static ItemStack quartzPillar = new ItemStack(Block.blockNetherQuartz, 1, 2);

Using this worked. Though one question, I want to generate this now, also, in a structure, but I need to turn this into a block. Right now, I assume, it is trying to spawn it in the structure as an item, but I need it to spawn as the actual block. Is there any way to do that?

Link to comment
Share on other sites

Okay, but why are you making a static ItemStack? That doesn't make sense either for registering a recipe, nor for placing a block. If you want to reuse it, that's fine, but just use a local variable inside the method rather than a class field.

 

Anyway, you haven't mentioned Minecraft version, but here you go:

Block block =  block you want to use, e.g. Blocks.blockNetherQuartz
World world and either BlockPos or x/y/z coordinates assumed from method

// 1.7.10
world.setBlock(x, y, z, block, metadata, 2);

// 1.8+
world.setBlockState(blockPos, block.getDefaultState().withProperty(someProperty), 2);

Link to comment
Share on other sites

I am a bit new to this, so I am downright confused. How would I add it to this code?

 

 

 

package mymod.structures;

 

import java.util.ArrayList;

import java.util.List;

import java.util.Random;

 

import mymod.Main;

import mymod.dimension.MyDimensionBiome_1;

import net.minecraft.block.Block;

import net.minecraft.block.BlockQuartz;

import net.minecraft.block.material.Material;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.chunk.IChunkProvider;

import api.Structure;

 

public class MyStructure_1 extends Structure {

 

public List<BiomeGenBase> biomesToGenIn;

   

    public void initStructure() {

        biomesToGenIn = new ArrayList<BiomeGenBase>();

       

        //Generation

        biomesToGenIn.add(Main.MyDimensionBiome_1);

        //biomesToGenIn.add(BiomeGenBase.mushroomIsland);

        setChanceToGenerateInChunk(1);

                 

        //Schematic

        setStructureShape (new Object[] {

 

               

            "XX  XX",               

            "X    X",         

            "XXXXXXX",

            " QQQQQ ",

            " GQ QG ",

            " QQ QQ ",

            "XXXXXXX", SLICE,

           

            "XX  XX",               

            "X    X",         

            "XXXXXXX",

            " QQQQQ ",

            " G  G ",

            " Q  Q ",

            "XXXXXXX", SLICE,

           

            "XX  XX",               

            "X    X",         

            "XXXXXXX",

            " QQQQQ ",

            " G  G ",

            " Q  Q ",

            "XXXXXXX", SLICE,

           

            "XX  XX",               

            "X    X",         

            "XXXXXXX",

            " QQQQQ ",

            " G  G ",

            " QC EQ ",

            "XXXXXXX", SLICE,

           

            "XX  XX",               

            "X    X",         

            "XXXXXXX",

            " QQQQQ ",

            " GQQQG ",

            " QQQQQ ",

            "XXXXXXX",

             

             

            'X', Main.MyDimensionBlock_1,

            'G', Item.ingotGold,

            'Q', Block.blockNetherQuartz,

            'C', Block.workbench,

            'E', Block.enchantmentTable,

            'P', Block.flowerPot,

           

        });

       

    }

   

    @Override

    public void generate(Random random, int chunkX, int chunkZ, World world,

            IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

       

        int rotation = random.nextInt(5);

       

        float chance = (float)getChanceToGenerateInChunk() / 100F;

       

        if (random.nextFloat() <= chance) {

            int xCoord = (chunkX * 16) + random.nextInt(16);

            int zCoord = (chunkZ * 16) + random.nextInt(16);

            int yCoord = getBiomeTopBlock(world, xCoord, zCoord);

           

            if (yCoord != -1) {

                //check if biome is in our list

                BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);

                if (biomesToGenIn.contains(biome)) {

                    generateStructure(random, xCoord, yCoord, zCoord, world, rotation);

                }

            }

        }

    }

 

}

 

 

Link to comment
Share on other sites

Just fyi, that's not a recipe, that's a structure.  Recipes use itemstacks.  I don't know about structures.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

  • 2 weeks later...

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



×
×
  • Create New...

Important Information

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