Jump to content

Recommended Posts

Posted (edited)

Actually i get this error-log:

  Reveal hidden contents

 

It includes two areas, wich include java-files in my mod:

  Reveal hidden contents

 

and

  Reveal hidden contents

but i don´t know, what that means...

 

here is my BalloonBlock:

  Reveal hidden contents

 

my BlockInit:

  Reveal hidden contents

 

and my Main:

  Reveal hidden contents

 

Edited by Drachenbauer
Posted

now i found this in my error-log:

  Reveal hidden contents

what does that mean?

Posted

Your block is calling a method in ItemBlock at a time that it should not be. 

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.

Posted
  On 2/19/2019 at 9:50 PM, Drachenbauer said:
public BalloonBlock(String name, Properties class1) 
	{
		super(class1);
		this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH));
		BlockInit.BLOCKS.add(this);
		ItemInit.ITEMS.add(new ItemBlock(this, null).setRegistryName(this.getRegistryName()));
	}

 

Expand  

You never set the Registryname of the Block
 

this.setRegistryName(name);

 

Posted

actual i get this in the log:

  Reveal hidden contents

 

and how do i add specific properties like stacksize and itemgroup to the item-block?

Posted

Here is the whole new error log

  Reveal hidden contents

 

I added the registry name thing to all my blocks.

what also goes wrong here?

Posted

The error leads me to the iteminit-line in the constructor of my block class.

do i need to add something in my iteminit-class too?

 

And if yes, how do i set itam-properties like stacksize and ItemGroup without having an itembase?.

 

Posted
  On 2/20/2019 at 8:36 PM, Drachenbauer said:

And if yes, how do i set itam-properties like stacksize and ItemGroup without having an itembase?.

Expand  

ItemBase is not magical. That thing you want put in ItemBase can instead (gasp!) go in your item's constructor. 

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.

Posted

but if i start the properties for the ItemBlock with

(Item.Properties.

in

ItemInit.ITEMS.add(new ItemBlock(this, null).setRegistryName(this.getRegistryName()));

instead of "null" in my block class, the dropdown-menu holds only the options:

-class:Class<net.minecraft.item.Item.Properties>

-super

-this

 

for Block properties in the blockinit it will show me things like material, sound or hardness/resistance

Posted

For Example:

    private Item.Properties getDefaultProperties() {
        return new Item.Properties()
                .defaultMaxDamage(0)
                .group(nimox.ITEM_GROUP_NIMOX)
                .maxStackSize(64)
                .rarity(EnumRarity.COMMON)
                .setNoRepair()
                ;
    }

    public Item getItemBlock() {
        return new ItemBlock(this, getDefaultProperties()).setRegistryName(this.getRegistryName().getPath());
    }
Posted (edited)

now i have no mor errors in the log and i can enter my test-world.

 

But my custom blocks don´t appear in my creative-inventar...

 

My Main-class:

  Reveal hidden contents

 

My BlockInit-class:

  Reveal hidden contents

 

My BalloonBlock-class (the other blocks are very similar):

  Reveal hidden contents

 

My ItemInit-class:

  Reveal hidden contents

 

What must i change to make my blocks appear in the creative-inventory?

Edited by Drachenbauer
Posted

i changed the ItemBlock-line in the constructor of the BalloonBlock into this:

ItemInit.ITEMS.add(new ItemBlock(this, getDefaultProperties()).setRegistryName(this.getRegistryName()));

 

but the block still does not appear in my creative-inventory...

Posted

 

I do it this way: 

Events:

    private void onBlocksRegistry(final RegistryEvent.Register<Block> event) {
        LOGGER.info("Registering Blocks...");
        ModBlocks.register(event);
    }

    private void onItemsRegistry(final RegistryEvent.Register<Item> event) {
        LOGGER.info("Registering Items...");
        ModItems.register(event);
    }

 

ModBlocks:

@ObjectHolder(nimox.ModId)
public class ModBlocks {

    public static NonNullList<BlockBase> BLOCKS = NonNullList.create();

    @ObjectHolder("test")
    public static final BlockTest BLOCK_TEST = null;

    public static void register(RegistryEvent.Register<Block> blockRegistryEvent){
        // Create Instances and add to BLOCKS List.
        BLOCKS.add(new BlockTest());

        // Registering all
        for(Block b : BLOCKS) {
            blockRegistryEvent.getRegistry().register(b);
        }
    }

}

 

ModItems:

@ObjectHolder(nimox.ModId)
public class ModItems {

    public static NonNullList<Item> ITEMS = NonNullList.create();

    @ObjectHolder("ocd_torcher")
    public static final ItemOCDTorcher ITEM_OCD_TORCHER = null;

    public static void register(RegistryEvent.Register<Item> itemRegistryEvent) {

        // Own Items
        ITEMS.add(new ItemOCDTorcher());

        // Itemblocks for Blocks
        for(BlockBase b : ModBlocks.BLOCKS) {
            ITEMS.add(b.getItemBlock());
        }

        // Register Items
        for(Item i : ITEMS) {
            itemRegistryEvent.getRegistry().register(i);
        }
    }

}

 

Blocks:

    private Item.Properties getDefaultProperties() {
        return new Item.Properties()
                .defaultMaxDamage(0)
                .group(nimox.ITEM_GROUP_NIMOX)
                .maxStackSize(64)
                .rarity(EnumRarity.COMMON)
                .setNoRepair()
                ;
    }

    public Item getItemBlock() {
        return new ItemBlock(this, getDefaultProperties()).setRegistryName(this.getRegistryName().getPath());
    }

 

Create the instances at event time, not construction time.

 

and for the Jsons

JSONS

Posted (edited)

And where do i set the blockproperties in this registration style?

 

for the Blockinit.

I get an error:

Syntax error, insert "}" to complete ClassBody

at the open curly brace of the registry event...

But i have all curly braces, wich are shown in the sample

Edited by Drachenbauer
Posted

Replace BlockBase with Block.

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.

Posted

i made it this way now:

		ITEMS.add(BlockInit.BALLOON_BLOCK.getItemBlock());
		ITEMS.add(BlockInit.EGG_BLOCK.getItemBlock());
		ITEMS.add(BlockInit.NEST_BLOCK.getItemBlock());
		ITEMS.add(BlockInit.SLINGSHOT_BLOCK.getItemBlock());
		ITEMS.add(BlockInit.SLINGSHOT2_BLOCK.getItemBlock());

, without the

 for(BlockBase b : ModBlocks.BLOCKS)
{
}

around them

Posted (edited)
  On 2/25/2019 at 3:41 PM, Drachenbauer said:

That makes problems with the getItemBlock command.

 

seems like it is not pre written in the common Block-class

Expand  

BlockBase is not magic. What does the getItemBlock method do?

Why Item.getFromBlock. This function is itself, public, as is the parameter it passes. 

 

For (Block b : ModBlocks)

  ModItems.add (Item.getFromBlock (b));

 

Amazing. 

Edited by Draco18s

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.

Posted

i have all my blocks from different selfmade block-classes, because i use differenr custom models with diferent sizes for them and want to have fitting boundingboxes.

 

So i see no way to do that by going through the list in my BlockInit.

So i made an ItemBlick line for each of my blocks in the ItemInit.

 

But i wonder, why i still cannot find them in my inventory...

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.