Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.12.2] Override Air


Cadiboo
 Share

Recommended Posts

How would I override Air in the block registry?

I've tried

Spoiler

@SubscribeEvent
public static void onRegisterBlocksEvent(final RegistryEvent.Register<Block> event) {

	event.getRegistry().register(

		(new BlockAir() {

			@Override
			public BlockRenderLayer getRenderLayer() {

				return airRenderLayerHook();

			}

			@Override
			public EnumBlockRenderType getRenderType(IBlockState state) {

				return airRenderTypeHook(state);

			}
		})

			.setRegistryName("minecraft:air")

			.setTranslationKey(Blocks.AIR.getTranslationKey())

	);

}

 

But I get this error

Spoiler

[14:07:50] [main/WARN] [FML]: Potentially Dangerous alternative prefix `minecraft` for name `air`, expected `nocubes`. This could be a intended override, but in most cases indicates a broken mod.
[14:07:50] [main/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@2bd20f96:
java.lang.IllegalStateException: Attemped to override already set default value. This is not allowed: The object Block{null} (name minecraft:air)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:335) ~[ForgeRegistry.class:?]
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:289) ~[ForgeRegistry.class:?]
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:122) ~[ForgeRegistry.class:?]
    at cadiboo.nocubes.EventSubscriber.onRegisterBlocksEvent(EventSubscriber.java:44) ~[EventSubscriber.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventSubscriber_onRegisterBlocksEvent_Register.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) ~[EventBus$1.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?]
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:752) [GameData.class:?]
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628) [Loader.class:?]
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:246) [FMLClientHandler.class:?]
    at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
[14:07:50] [main/ERROR] [FML]: Index: 2 Listeners:
[14:07:50] [main/ERROR] [FML]: 0: NORMAL
[14:07:50] [main/ERROR] [FML]: 1: net.minecraftforge.fml.common.eventhandler.EventBus$1@6f99ed9f
[14:07:50] [main/ERROR] [FML]: 2: net.minecraftforge.fml.common.eventhandler.EventBus$1@2f2c41d3
[14:07:51] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ----
// Don't be sad. I'll do better next time, I promise!

Time: 11/25/18 2:07 PM
Description: Initializing game

java.lang.IllegalStateException: Attemped to override already set default value. This is not allowed: The object Block{null} (name minecraft:air)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:335)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:289)
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:122)
    at cadiboo.nocubes.EventSubscriber.onRegisterBlocksEvent(EventSubscriber.java:44)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventSubscriber_onRegisterBlocksEvent_Register.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:752)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:246)
    at net.minecraft.client.Minecraft.init(Minecraft.java:513)
    at net.minecraft.client.Minecraft.run(Minecraft.java:421)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:335)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:289)
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:122)
    at cadiboo.nocubes.EventSubscriber.onRegisterBlocksEvent(EventSubscriber.java:44)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventSubscriber_onRegisterBlocksEvent_Register.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:752)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:246)
    at net.minecraft.client.Minecraft.init(Minecraft.java:513)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:421)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)
 

I only really need to override 1 method in BlockAir. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I don't think you are allowed to do this.

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

Would I be able to set the value with reflection? It's a client-side only mod and the only functionality added is allowing it to use a model

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

It might be possible with reflection, but I spent an hour and a half trying to make it work and couldn’t.

You need to modify 2 locked registries and set their default values AND register your new air block without Forge realising what your doing and marking it as an override. You have to somehow pretend that the mod registering the block is FML/null. I managed to get it almost to work (got it all the way to the resync of the registries) but gave up.

I achieved it in the way we don’t talk about, and air renders perfectly now ?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

Guest
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I understand that 1.12.2 is no longer supported, but can't you at least host the library files? At this stage the Server Installer for Forge 1.12.2 (latest build and older builks) is broken - it doesn't download all the files even though it says it does (Client still works, server files don't) I've tested on Linux installer and Windows installer, both are incomplete. Forge 1.12.2 is still widely used by the community - if you no longer wish to host the files for it, can we, the community, host it for our community to download and use?   When running the installer: 23/10/2021 Found java version 1.8.0_292 23/10/2021 Target Directory: . 23/10/2021 Data kindly mirrored by CreeperHost at https://www.creeperhost.net/ 23/10/2021 Extracting main jar: 23/10/2021   Extracted successfully 23/10/2021 Considering minecraft server jar 23/10/2021   Downloading library from https://launcher.mojang.com/v1/objects/886945bfb2b978778c3a0288fd7fab09d315b25f/server.jar 23/10/2021     Download completed: Checksum validated. 23/10/2021 Downloading libraries 23/10/2021 Considering library de.oceanlabs.mcp:mcp_config:1.12.2-20200226.224830@zip 23/10/2021   Downloading library from https://maven.creeperhost.net/de/oceanlabs/mcp/mcp_config/1.12.2-20200226.224830/mcp_config-1.12.2-20200226.224830.zip 23/10/2021     Download completed: Checksum validated. 23/10/2021 Considering library net.minecraftforge:forge:1.12.2-14.23.5.2855 23/10/2021   Extracting library from /maven/net/minecraftforge/forge/1.12.2-14.23.5.2855/forge-1.12.2-14.23.5.2855.jar 23/10/2021     Extraction completed: Checksum validated. 23/10/2021 Building Processors 23/10/2021 The server installed successfully, you should now be able to run the file forge You can delete this installer file now if you wish Now I run Forge Server Jar: 23/10/2021 We appear to be missing one or more essential library files. You will need to add them to your server before FML and Forge will run successfully. 23/10/2021 java.lang.ClassNotFoundException: net.minecraft.launchwrapper.Launch     at java.net.URLClassLoader.findClass(URLClassLoader.java:382)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Class.java:348)     at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:52)     at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34) I looked in the Library folder, it only has 2 folders and 2 files. Normally it has around 20 files.                
    • ok, it works, but how can i say the server that i pressed the button?
    • You named your own class "SimpleChannel", which means the "SimpleChannel" on the field declaration refers to your class, not the Forge class.
    • Hmm, I might just do some sort of jimmy rig to get around this. Do something like make a block model in blockbench that is slightly large than a normal block (something like 0.01 on each side to prevent z-fighting), draw the textures and just have the blocks act as a multipart. (I really hope this can end up transparent and not just blackout the texture underneath) Might be messy, but I really just want to get this done to move onto something else (been working on this one feature for maybe a month because IRL stuff). Thanks for the suggestions anyways mate (I can probably use them for some other crazy idea later).
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.