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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
  • Topics

×
×
  • Create New...

Important Information

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