Jump to content

load_registry event phase


Guest

Recommended Posts

23 minutes ago, DrMDGG said:

following Harry Talks

I wouldn't use his tutorials.

 

Something is null here.

Quote
java.lang.NullPointerException

    at drmdgg.tutorialmod.tutorialmod$RegistryEvents.registerItems(tutorialmod.java:79)

If you need help with this show your code. Mind you I will probably have a lot for you to change.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

4 minutes ago, Animefan8888 said:

I wouldn't use his tutorials.

 

Something is null here.

If you need help with this show your code. Mind you I will probably have a lot for you to change.

well, I don't have many options as there are few tutorials for 1.14 atm.

i'd be happy to share my code with you through emails rather than here for my own reasons. PM me your email for the other way around if you're willing to help me.

thank you

Link to comment
Share on other sites

Just now, DrMDGG said:

i'd be happy to share my code with you through emails rather than here for my own reasons.

It's not like we are going to steal your code. Plus after you post it and the problem is found you can edit your post and remove your code from here.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

3 minutes ago, Animefan8888 said:

It's not like we are going to steal your code. Plus after you post it and the problem is found you can edit your post and remove your code from here.

that's not what I meant. I just figured it'd be easier to send you the whole package to take a look at

Link to comment
Share on other sites

1 minute ago, DrMDGG said:

that's not what I meant. I just figured it'd be easier to send you the whole package to take a look at

Use github.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

3 minutes ago, DrMDGG said:

no thanks, I think i'll just post the main class here.

I looks like a copy paste error here, but also I don't know where you initialize BlockList.butane. Do you ever do this?
 

Quote

ItemList.butane = new BlockItem(BlockList.tblock, new Item.Properties().group(tutorialitems)).setRegistryName(BlockList.butane.getRegistryName()),

That might be a typo I'm not sure.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

7 minutes ago, Animefan8888 said:

I looks like a copy paste error here, but also I don't know where you initialize BlockList.butane. Do you ever do this?
 

That might be a typo I'm not sure.

that was a typo for sure, thanks for catching that.

alas, that is not the problem. I get the same error

Link to comment
Share on other sites

Just now, DrMDGG said:

alas, that is not the problem. I get the same error

Is BlockList.butane ever given a value? If it is done in a static initializer don't do that initialize it in the registry event.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

10 minutes ago, Animefan8888 said:

Is BlockList.butane ever given a value? If it is done in a static initializer don't do that initialize it in the registry event.

now i'm getting "error during the common_setup phase"

Link to comment
Share on other sites

Just now, DrMDGG said:

now i'm getting "error during the common_setup phase"

Log and what did you change in the code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, DrMDGG said:

okay. and now im too lazy to change the code in a text editor:

Quote
java.lang.NullPointerException

    at drmdgg.marijuanacraft.world.OreGeneration.setupOreGeneration(OreGeneration.java:19)

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, DrMDGG said:

how do I rectify that?

Something is null on line 19 I can't tell you what cause I can't see your OreGeneration class.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, DrMDGG said:

I removed that line and the game ran. but I doubt the ore was there.

I didn't ask to see OreGenConfig I asked to see OreGeneration.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, DrMDGG said:

my bad.

Do you ever call OreGenConfig.init? If you don't then the values you set in there are always null.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

1 minute ago, DrMDGG said:

call it in the main class?

This is how I have mine set up.
 

	public static CrystalConfig CONFIG;
	
	public CrystalMod() {
		Pair<CrystalConfig, ForgeConfigSpec> pair = new ForgeConfigSpec.Builder().configure(CrystalConfig::new);
		CONFIG = pair.getLeft();
		ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, pair.getRight(), "modid.toml");
    }

// Where CrystalConfig is a class that looks like this.
	public CrystalConfig(ForgeConfigSpec.Builder builder) {
		// DO config stuff.
	}

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

36 minutes ago, Animefan8888 said:

This is how I have mine set up.
 


	public static CrystalConfig CONFIG;
	
	public CrystalMod() {
		Pair<CrystalConfig, ForgeConfigSpec> pair = new ForgeConfigSpec.Builder().configure(CrystalConfig::new);
		CONFIG = pair.getLeft();
		ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, pair.getRight(), "modid.toml");
    }

// Where CrystalConfig is a class that looks like this.
	public CrystalConfig(ForgeConfigSpec.Builder builder) {
		// DO config stuff.
	}

 

call it anything you want, but i'm pretty new (again) to all this.

how should I implement this into my code?

Link to comment
Share on other sites

4 minutes ago, DrMDGG said:

public CrystalMod() {

This is the constructor to my @Mod class.

 

4 minutes ago, DrMDGG said:

Pair<CrystalConfig, ForgeConfigSpec> pair = new ForgeConfigSpec.Builder().configure(CrystalConfig::new);

I create a Pair variable and set it equal to ForgeConfigSpec.Builder#configure

CrystalConfig is a class that has this as it's constructor.

41 minutes ago, Animefan8888 said:

public CrystalConfig(ForgeConfigSpec.Builder builder) { // DO config stuff. }

It takes in a Builder and inside this constructor I create my config file using Builder#push(...) Builder#comment etc. I store the config values here as well.

 

8 minutes ago, DrMDGG said:

CONFIG = pair.getLeft();

Now I store the CrystalConfig value from the pair into my @Mod class.

44 minutes ago, Animefan8888 said:

ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, pair.getRight(), "modid.toml");

Then I register the other value as a config.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

17 hours ago, Animefan8888 said:

This is the constructor to my @Mod class.

 

I create a Pair variable and set it equal to ForgeConfigSpec.Builder#configure

CrystalConfig is a class that has this as it's constructor.

It takes in a Builder and inside this constructor I create my config file using Builder#push(...) Builder#comment etc. I store the config values here as well.

 

Now I store the CrystalConfig value from the pair into my @Mod class.

Then I register the other value as a config.

I'm gonna be honest here. I'm completely confused as how to implement this into my code. do i add it to my main class or the oregeneration class. I'm sorry. but I'm more confused now.

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

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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