Jump to content

[1.18.2] Error trying to register a custom feature based on KelpFeature [SOLVED]


KristenStuffs

Recommended Posts

Specifics:
I created an underwater plant called, "Living Sponge" based on Kelp which I have confirmed working in game and works as fully intended, now I am trying to get register generation for the plant. The LivingSpongeGeneration class has no errors attached to it, though I expect there to be depending on how much I need to change in my ModWorldEventAlts class which I'm currently using to register LivingSpongeGeneration. I have tried fixing it multiple times, but when I do another error will popup.

Error message in console: "Exception message: java.lang.IllegalStateException: Can not register to a locked registry. Modder should use Forge Register methods." This only displays in the console as the game will say, "null".

Project Github:
https://github.com/KristenStuffs/ALMTS

Edited by KristenStuffs
Link to comment
Share on other sites

4 hours ago, KristenStuffs said:

Error message in console: "Exception message: java.lang.IllegalStateException: Can not register to a locked registry. Modder should use Forge Register methods."

You should use the Forge registry when registering features. You can read more about how to do it here.

Link to comment
Share on other sites

Use DeferredRegister with Registry.CONFIGURED_FEATURE_REGISTRY and Registry.PLACED_FEATURE_REGISTRY

 

Here's an example from a different thread that makes diamond blocks "ores":

public class ModFeatures {
    private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ExampleMod.MODID);
    private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ExampleMod.MODID);

    public static final RegistryObject<ConfiguredFeature<?, ?>> DIAMOND_BLOCKS_CONFIGURED = CONFIGURED_FEATURES.register("diamond_blocks",
            () -> {
                var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:diamond_block"));
                var target = List.of(OreConfiguration.target(OreFeatures.NATURAL_STONE, block.defaultBlockState()));
                return new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(target, 64));
            });

    public static final RegistryObject<PlacedFeature> DIAMOND_BLOCKS_PLACED = PLACED_FEATURES.register("diamond_blocks",
            () -> new PlacedFeature(DIAMOND_BLOCKS_CONFIGURED.getHolder().get(), 
                        commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56)))));

    public static void register(IEventBus bus) {
        CONFIGURED_FEATURES.register(bus);
        PLACED_FEATURES.register(bus);
    }
}

Obviously the ModFeatures.register() needs to be called from your main mod class.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

14 hours ago, warjort said:

Use DeferredRegister with Registry.CONFIGURED_FEATURE_REGISTRY and Registry.PLACED_FEATURE_REGISTRY

 

Here's an example from a different thread that makes diamond blocks "ores":

public class ModFeatures {
    private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ExampleMod.MODID);
    private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ExampleMod.MODID);

    public static final RegistryObject<ConfiguredFeature<?, ?>> DIAMOND_BLOCKS_CONFIGURED = CONFIGURED_FEATURES.register("diamond_blocks",
            () -> {
                var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:diamond_block"));
                var target = List.of(OreConfiguration.target(OreFeatures.NATURAL_STONE, block.defaultBlockState()));
                return new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(target, 64));
            });

    public static final RegistryObject<PlacedFeature> DIAMOND_BLOCKS_PLACED = PLACED_FEATURES.register("diamond_blocks",
            () -> new PlacedFeature(DIAMOND_BLOCKS_CONFIGURED.getHolder().get(), 
                        commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56)))));

    public static void register(IEventBus bus) {
        CONFIGURED_FEATURES.register(bus);
        PLACED_FEATURES.register(bus);
    }
}

Obviously the ModFeatures.register() needs to be called from your main mod class.

How does this work with NoneFeatureConfiguration which is used in the default KelpFeature Registry?

Link to comment
Share on other sites

Isn't that trivial? Maybe I don't understand your question.

Why you would need your own configured feature for this (it is the same as the vanilla one) unless you intend to use your own/different Feature.


    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(Feature.KELP, NoneFeatureConfiguration.INSTANCE));

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

16 minutes ago, warjort said:

Isn't that trivial? Maybe I don't understand your question.

Why you would need your own configured feature for this (it is the same as the vanilla one) unless you intend to use your own/different Feature.


    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(Feature.KELP, NoneFeatureConfiguration.INSTANCE));

 

Sorry, I've never worked with this in particular before so this is a first time experience for me as I took a few years break from modding.

I don't see where I would reference my own custom class (LivingSpongeGeneration), where would I register that within the code?

Link to comment
Share on other sites

That's a feature correct? Continuing the theme of reinventing vanilla 🙂

Something like (untested code):

    private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ExampleMod.MODID);

    public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp",
            () -> new KelpFeature(NoneFeatureConfiguration.CODEC));

    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE));

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

52 minutes ago, warjort said:

That's a feature correct? Continuing the theme of reinventing vanilla 🙂

Something like (untested code):

    private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ExampleMod.MODID);

    public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp",
            () -> new KelpFeature(NoneFeatureConfiguration.CODEC));

    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE));

 

I have something quite similar to this class and there's no errors at all in it, but nothing spawns in game. My code looks like this, is there anything wrong with it?
 

package com.kristen.almts.world;

import com.kristen.almts.ALMTS;
import com.kristen.almts.world.gen.plants.LivingSpongeGeneration;

import net.minecraft.core.Registry;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

public class ModWorldEventsAlt {
    private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ALMTS.MOD_ID);
    private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ALMTS.MOD_ID);

    
    // Placement
    public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp",
            () -> new LivingSpongeGeneration(NoneFeatureConfiguration.CODEC));

    // Configuration
    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE));

    

    	    public static void register(IEventBus bus) {
    	        CONFIGURED_FEATURES.register(bus);
    	        FEATURES.register(bus);
    	        
    	    }
    	}

 

Link to comment
Share on other sites

You need a placed feature as well.

Feature = the thing that places blocks

ConfiguredFeature = Configuration(s) of that feature, e.g. how big an ore vein or which ore

PlacedFeature = PlacementModifier(s) that decides where to put it, e.g. cactus goes on sand, diamonds generate at the bottom of the world

 

But more importantly you need a Biome that uses it.

To modify vanilla biomes see: https://forge.gemwire.uk/wiki/Biome_Modifiers or before 1.19 you use the BiomeLoadingEvent

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

20 minutes ago, warjort said:

You need a placed feature as well.

Feature = the thing that places blocks

ConfiguredFeature = Configuration(s) of that feature, e.g. how big an ore vein or which ore

PlacedFeature = PlacementModifier(s) that decides where to put it, e.g. cactus goes on sand, diamonds generate at the bottom of the world

 

But more importantly you need a Biome that uses it.

To modify vanilla biomes see: https://forge.gemwire.uk/wiki/Biome_Modifiers or before 1.19 you use the BiomeLoadingEvent

So a couple of things (sorry, you have been helping me a lot already)

I added in a Placed Features Section
 

    private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ALMTS.MOD_ID);
    public static final RegistryObject<PlacedFeature> MY_KELP_PLACED = PLACED_FEATURES.register("my_kelp",
            () -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get()))));    


However it is telling me:
 

The constructor PlacedFeature(Holder<ConfiguredFeature<?,?>>) is undefined
1 quick fix avaiable:
+ Add Arguement to match 'PlacedFeature(Holder<ConfiguredFeature<?, ?>>, List<PlacementModifier>)'


I've also tried implementing the biomeLoadingEvent as you've told me to do since I am using 1.18.2, but I've been getting an error with that as well and admittedly I have a lack of understanding with the biomeLoadingEvent in general. This is what I currently have:
 

	@SubscribeEvent
	public static void biomeLoadingEvent(final BiomeLoadingEvent event) {
		if (event.getCategory() == Biome.BiomeCategory.OCEAN) {
			event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED);
		}
}


The error is:

The method addFeature(GenerationStep.Decoration, Holder<PlacedFeature>) in the type BiomeGenerationSettings.Builder is not applicable for the arguments (GenerationStep.Decoration, RegistryObject<PlacedFeature>)

1 quick fix avaiable:
Change type of 'My_KELP_PLACED' to 'Holder<PlacedFeature>'


Here is my whole class if you need to need to see anything else:

package com.kristen.almts.world;

import com.kristen.almts.ALMTS;
import com.kristen.almts.world.gen.plants.LivingSpongeGeneration;

import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

public class ModWorldEventsAlt {
    private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ALMTS.MOD_ID);
    private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ALMTS.MOD_ID);
    private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ALMTS.MOD_ID);

    
    // Feature
    public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp",
            () -> new LivingSpongeGeneration(NoneFeatureConfiguration.CODEC));

    // Configuration
    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE));

    // Placement
    public static final RegistryObject<PlacedFeature> MY_KELP_PLACED = PLACED_FEATURES.register("my_kelp",
            () -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get()))));    

    	    public static void register(IEventBus bus) {
    	        CONFIGURED_FEATURES.register(bus);
    	        PLACED_FEATURES.register(bus);
    	        FEATURES.register(bus);
    	        
    	    }
    	    

	@SubscribeEvent
	public static void biomeLoadingEvent(final BiomeLoadingEvent event) {
		if (event.getCategory() == Biome.BiomeCategory.OCEAN) {
			event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED);
		}
}
    	}


 

Link to comment
Share on other sites

These aren't forge/minecraft questions, these are java questions.

We don't really answer those here. Knowing java is a prerequisite for minecraft modding.

But since one of them is partly minecraft related I will answer them.

 

Your main problem is you are not passing the correct parameter types or not passing parameters at all. (basic java).

() -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get()))));    

This constructor takes 2 parameters, you are missing the List of PlacementModifers which is the whole point of this class.

You can see what is done for kelp in AquaticPlacements.

event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED);

This methods wants a PlacedFeature not a RegistryObject<PlacedFeature>, use MY_KELP_PLACED.get() - which gives you the real object.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

16 hours ago, warjort said:

These aren't forge/minecraft questions, these are java questions.

We don't really answer those here. Knowing java is a prerequisite for minecraft modding.

But since one of them is partly minecraft related I will answer them.

 

Your main problem is you are not passing the correct parameter types or not passing parameters at all. (basic java).

() -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get()))));    

This constructor takes 2 parameters, you are missing the List of PlacementModifers which is the whole point of this class.

You can see what is done for kelp in AquaticPlacements.

event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED);

This methods wants a PlacedFeature not a RegistryObject<PlacedFeature>, use MY_KELP_PLACED.get() - which gives you the real object.

Sorry if my first question came across as basic Java, I was basically just trying to ask where there would be example placements, albeit in a pretty round about way.

I've gotten to another point, where there is no errors anywhere within the code from what I can tell. I also used the AquaticFeatures class as an example. Minecraft launches, though I don't see any of the Sponges which should be generating. I ran the debug tool and can confirm, it is being called.

Currently this is how the code looks.

package com.kristen.almts.world;

import java.util.List;

import com.kristen.almts.ALMTS;
import com.kristen.almts.world.gen.plants.LivingSpongeGeneration;

import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
import net.minecraft.world.level.levelgen.placement.NoiseBasedCountPlacement;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

public class ModWorldEventsAlt {
    private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ALMTS.MOD_ID);
    private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ALMTS.MOD_ID);
    private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ALMTS.MOD_ID);
    
    // Feature
    public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp",
            () -> new LivingSpongeGeneration(NoneFeatureConfiguration.CODEC));

    public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp",
            () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE));

    // Placement
    public static final RegistryObject<PlacedFeature> MY_KELP_PLACED = PLACED_FEATURES.register("my_kelp",
            () -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get(), List.of(NoiseBasedCountPlacement.of(73, 730D, 0.0D), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome())))));

    	    public static void register(IEventBus bus) {
    	        CONFIGURED_FEATURES.register(bus);
    	        PLACED_FEATURES.register(bus);
    	        FEATURES.register(bus);
    	        
    	    }
    	    

	@SubscribeEvent
	public static void biomeLoadingEvent(final BiomeLoadingEvent event) {
		if (event.getCategory() == Biome.BiomeCategory.OCEAN) {
			event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED.getHolder().get());
		}
}
    	}

 

Link to comment
Share on other sites

@Mod.EventBusSubscriber(modid = ALMTS.MOD_ID) // ** ADD THIS **
public class ModWorldEventsAlt {

-- snip --

	@SubscribeEvent
	public static void biomeLoadingEvent(final BiomeLoadingEvent event) {

You don't have a subscriber annotation. See the comment above.

I assume you don't have other (not shown) code registering that event handler?

 

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

40 minutes ago, warjort said:
@Mod.EventBusSubscriber(modid = ALMTS.MOD_ID) // ** ADD THIS **
public class ModWorldEventsAlt {

-- snip --

	@SubscribeEvent
	public static void biomeLoadingEvent(final BiomeLoadingEvent event) {

You don't have a subscriber annotation. See the comment above.

I assume you don't have other (not shown) code registering that event handler?

 

 

Well I got it working, thank you a lot for your time helping me.

Link to comment
Share on other sites

  • KristenStuffs changed the title to [1.18.2] Error trying to register a custom feature based on KelpFeature [SOLVED]

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

    • https://drive.google.com/file/d/1M0EG-c5yfRd08DSnE5HVQNCu2v0YtA7A/view?usp=sharing  
    • so im not sure if your still watching this TileEntity but once we loaded a FTB modpack we wanted to run on the server it no longer seems to run. The console opens like normal but we've been sitting here for like a little over an hour and the server screen has not yet opened. Should we just keep waiting at this point?
    • I have now easily fixed the duplication error present, I was just not looking.   I have been working for the past half hour to try and fix another error present, this time with the Creative Mode Tab.   I have changed some things around to get where I am currently. (ModFoods to ModDrinks*) and it cannot find the symbol ".get" at the end of the code. *The custom class you recommended pOutput.accept(ModDrinks.ORANGE_JUICE.get()); I think the point I am at currently is the closest I have to how it should be but because I am not as experienced with java I would not know.  I have also removed ORANGE_JUICE and LEMON_JUICE from the ModFoods class, to avoid confliction. I do hope all this can be fully resolved soon.  
    • [SOLVED]  public class RenderGUIHandler { @SubscribeEvent public void renderGUI(RenderGameOverlayEvent.Text event){ Client.hud.draw(); } } As I was playing around a little with the code, i found out about an option to change The RenderGameOverlayEvent.Post to RenderGameOverlayEvent.Text
    • public class HUD { public Minecraft mc = Minecraft.getMinecraft(); public static class ModuleComparator implements Comparator<Module>{ @Override public int compare(Module o1, Module o2) { if (Minecraft.getMinecraft().fontRendererObj.getStringWidth(o1.name) > Minecraft.getMinecraft().fontRendererObj.getStringWidth(o2.name)){ return -1; } if (Minecraft.getMinecraft().fontRendererObj.getStringWidth(o1.name) < Minecraft.getMinecraft().fontRendererObj.getStringWidth(o2.name)){ return 1; } return 0; } } public void draw(){ ScaledResolution sr = new ScaledResolution(mc); FontRenderer fr = mc.fontRendererObj; Collections.sort(Client.modules, new ModuleComparator()); GlStateManager.pushMatrix(); GlStateManager.translate(4,4,0); GlStateManager.scale(1.5,1.5,1); GlStateManager.translate(-4, -4, 0); fr.drawString("Skyline", 10, 10, -1); GlStateManager.popMatrix(); int count = 0; for (Module m : Client.modules){ if (!m.toggled || m.name.equals("TabGUI")) continue; int offset = count* (fr.FONT_HEIGHT + 6); GL11.glTranslated(0.0f, 0.0f, -1.0f); Gui.drawRect(sr.getScaledWidth() - fr.getStringWidth(m.name) - 10, offset, sr.getScaledWidth() - fr.getStringWidth(m.name) - 8, 6 + fr.FONT_HEIGHT + offset, -1); Gui.drawRect(sr.getScaledWidth() - fr.getStringWidth(m.name) - 8, offset, sr.getScaledWidth(), 6 + fr.FONT_HEIGHT + offset, 0x90000000); fr.drawString(m.name, sr.getScaledWidth() - fr.getStringWidth(m.name) - 4, offset + 4, -1); count++; } Client.onEvent(new EventRenderGUI()); } } I have just recently stumbled upon this Problem, where the HudRenderer renders the wrong section of the textures and therefore completely destroys the Minecraft Armour and Hunger Bar. I am currently thinking if it is an issue with the DrawRect changing something it shouldn't. But I couldn't find anything about it. (To keep things Clean, the function is Called from another file) public class RenderGUIHandler { @SubscribeEvent public void renderGUI(RenderGameOverlayEvent.Post event){ Client.hud.draw(); } } Any help would be greatly appreciated  
  • Topics

×
×
  • Create New...

Important Information

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