Jump to content

[1.12.2]Is there an easy way to make a fluid in 1.12.2?


Xeraster

Recommended Posts

I am wanting to make a custom fluid in forge 1.12.2. I did it in a 1.7.2 mod and I think I remember it being substantially difficult but I did figure it out. I think my biggest problem was with textures. That is not the case now.

 

After looking at the minecraft files for 1.12.2, they seem to have made it so much more complicated that I don't even know where or how to start making a custom one. I've made a few attempts extending base classes but in the end haven't been able to get anywhere because of the way they register their liquids in net.minecraft.init.Blocks and how that applies to or works with net.minecraftforge.fluids.

 

The biggest barrier that makes it not possible to extend existing classes and mess with it until it works is in net.minecraft.init.Blocks where they have:

public static final BlockDynamicLiquid FLOWING_WATER;
    public static final BlockStaticLiquid WATER;

 

followed by:

@Nullable
    private static Block getRegisteredBlock(String blockName)
    {
        Block block = Block.REGISTRY.getObject(new ResourceLocation(blockName));

        if (!CACHE.add(block))
        {
            throw new IllegalStateException("Invalid Block requested: " + blockName);
        }
        else
        {
            return block;
        }
    }

    static
    {
        if (!Bootstrap.isRegistered())
        {
            throw new RuntimeException("Accessed Blocks before Bootstrap!");
        }
        else
        {
            FLOWING_WATER = (BlockDynamicLiquid)getRegisteredBlock("flowing_water");
            WATER = (BlockStaticLiquid)getRegisteredBlock("water");
          }
    }

 

I expected there to be something along the lines of:

public static final BlockDynamicLiquid FLOWING_WATER = new BlockDynamicLiquid().getRegisteredBlock("flowing_water")

public static final BlockStaticLiquid WATER = new BlockStaticLiquid().getRegisteredBlock("water")

Now after doing what I believe is a good job of duplicating or extending base class files or making new ones, the above won't work, nor will:

public static final BlockDynamicLiquid FLOWING_WATER = new BlockDynamicLiquid("flowing_water");

public static final BlockStaticLiquid WATER = new BlockStaticLiquid("water");

or any other variation after much messing around with it.

The idea was to get that to work and then in my block registry, just register it like any regular block like:

@Mod.EventBusSubscriber(modid = SuperTNTMod.MODID)
	public static class RegistrationHandler {
		public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>();

	@SubscribeEvent
	public static void registerBlocks(final RegistryEvent.Register<Block> event) {
		final IForgeRegistry<Block> registry = event.getRegistry();
		System.out.println("register blocks event executed");

		final Block[] blocks = {FLOWING_WATER, WATER};
		registry.registerAll(blocks);
		System.out.println("register all function executed");
	}
  
  @SubscribeEvent
	public static void registerItemBlocks(final RegistryEvent.Register<Item> event) {
		final ItemBlock[] items = {new ItemBlock(WATER), new ItemBlock(FLOWING_WATER)
                                  };
    

 

I just can't even do a good enough job of this to even get it to compile.

 

I have also tried blatantly copy and pasting class files from TestMod3 to get a liquid working using that code. Seems like a reasonable idea if you're desperate enough but it just kept going down a never-ending rabbit hole and I had to keep creating more and more and more TestMod3 dependent classes. I gave up halfway through the multiplayer server crap which doesn't have anything to do with liquid but in TestMod3 I guess it does.

 

So is 1.12.2 liquid really this elusively difficult? What am I missing? I'm an experienced programmer but I'm dumbfounded from the unnecessary complexity of this liquid system.

I don't even have any code to post because I can't really get anything close to what might work or something I think should work that could compile.

Is there an "idiots guide" for 1.12.2 liquid?

Edited by Xeraster
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.

×
×
  • Create New...

Important Information

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