Jump to content

CobblestoneTree

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by CobblestoneTree

  1. Hi Modders,

     

    I'm interested in making a fluid in 1.16.x, but I'm running into an issue with textures not loading for the liquid; I'm wondering if it has something to do with the fluid tags as well, but I'm not sure.

     

    Here's my code for registering the fluid:

    @Mod.EventBusSubscriber
    public class FluidMod {
    
        public static final AmbrosiaFluid.Source AMBROSIA = (AmbrosiaFluid.Source) new AmbrosiaFluid.Source().setRegistryName(BaseMod.MODID, "ambrosia");
        public static final AmbrosiaFluid.Flowing AMBROSIA_FLOWING = (AmbrosiaFluid.Flowing) new AmbrosiaFluid.Flowing().setRegistryName(BaseMod.MODID, "ambrosia_flowing");
    
        public static final class Tags extends ForgeRegistryEntry<Tags> {
            public static final ITag.INamedTag<Fluid> AMBROSIA = FluidTags.makeWrapperTag("ambrosia");
        }
    
        @SubscribeEvent
        public static void registerFluids(RegistryEvent.Register<Fluid> event) {
            event.getRegistry().register(AMBROSIA);
            event.getRegistry().register(AMBROSIA_FLOWING);
        }
    
    }

    And here is the class for the fluid itself:

    public abstract class AmbrosiaFluid extends FlowingFluid {
        @Override
        public Fluid getFlowingFluid() {
            return FluidMod.AMBROSIA_FLOWING;
        }
    
        @Override
        public Fluid getStillFluid() {
            return FluidMod.AMBROSIA;
        }
    
        @Override
        protected boolean canSourcesMultiply() {
            return true;
        }
    
        @Override
        protected void beforeReplacingBlock(IWorld worldIn, BlockPos pos, BlockState state) {
            // If it runs over some grass, what does it do?
        }
    
        /*
        The shape that this thing forms when it flows out.
         */
        @Override
        protected int getSlopeFindDistance(IWorldReader worldIn) {
            return 4; // Same value as water and lava.
        }
    
        /*
        How far it goes out; water and lava are both 8.
         */
        @Override
        protected int getLevelDecreasePerBlock(IWorldReader worldIn) {
            return 3;
        }
    
        /*
    
         */
        @Override
        public Item getFilledBucket() {
            return ItemMod.BUCKET_AMBROSIA;
        }
    
        @Override
        protected boolean canDisplace(FluidState p_215665_1_, IBlockReader p_215665_2_, BlockPos p_215665_3_, Fluid p_215665_4_, Direction p_215665_5_) {
            return false;
        }
    
        @Override
        public int getTickRate(IWorldReader p_205569_1_) {
            return 60;
        }
    
        @Override
        protected float getExplosionResistance() {
            return 100.0f;
        }
    
        @Override
        protected BlockState getBlockState(FluidState state) {
            return BlockMod.AMBROSIA_BLOCK.getDefaultState().with(FlowingFluidBlock.LEVEL, Integer.valueOf(getLevelFromState(state)));
        }
    
        @Override
        public boolean isEquivalentTo(Fluid fluidIn) {
            return fluidIn == FluidMod.AMBROSIA || fluidIn == FluidMod.AMBROSIA_FLOWING;
        }
    
        @Override
        protected FluidAttributes createAttributes() {
            return FluidAttributes.builder(
                    new ResourceLocation(BaseMod.MODID, "textures/block/ambrosia.png"),
                    new ResourceLocation(BaseMod.MODID, "textures/block/ambrosia_flowing.png"))
                .translationKey("block.examplemod.ambrosia")
                .build(this);
        }
    
        public static class Flowing extends AmbrosiaFluid {
    
            @Override
            protected void fillStateContainer(StateContainer.Builder<Fluid, FluidState> builder) {
                super.fillStateContainer(builder);
                builder.add(LEVEL_1_8);
            }
    
            @Override
            public boolean isSource(FluidState state) {
                return false;
            }
    
            @Override
            public int getLevel(FluidState state) {
                return state.get(AmbrosiaFluid.LEVEL_1_8);
            }
        }
    
        public static class Source extends AmbrosiaFluid {
    
            @Override
            public boolean isSource(FluidState state) {
                return true;
            }
    
            @Override
            public int getLevel(FluidState state) {
                return 8;
            }
        }
    
    }

    Here is the JSON in the "resources/assets.examplemod/blockstates" folder:

    {
      "variants": {
        "": {
          "model": "examplemod:block/ambrosia"
        }
      }
    }

    And the JSON in the "resources/assets.examplemod/models/block" folder:

    {
      "textures": {
        "particle": "examplemod:block/ambrosia"
      }
    }

    In "resources/assets.examplemod/textures/block", I have the following mcmeta files accompanying the textures:

    ambrosia.png.mcmeta:

    {
      "animation": {
        "frametime": 2
      }
    }

    ambrosia_flowing.png.mcmeta:

    {
      "animation": {}
    }

    In "resources/data.examplemod/tags/fluids" I have the following file, "ambrosia.json":

    {
      "replace": false,
      "values": [
        "examplemod:ambrosia",
        "examplemod:ambrosia_flowing"
      ]
    }

    Currently, the fluid appears to be working except for the fact that the texture displays as a purple-black checker pattern.

     

    Is it maybe the ambrosia_flowing.png.mcmeta file? All the textures are in the textures folder for blocks.

     

    I would really appreciate assistance; I'm actually doing this for a tutoring job (I tutor Minecraft modding on a very basic level), and I would really appreciate insight into what I could do to get the texture to appear.

     

    Thank you and thanks in advance!

  2. Hi There,

     

    Forge is giving me an error when I run the gradlew genEclipseRuns command in the mod project root folder. 

    ForgeGradle1.thumb.PNG.593694199d053a52966a02c7b33fc7a9.PNG

    My current specs are:

    • JDK 16.0.1 (64-bit version)
    • Forge MDK 1.16.5
    • Eclipse
    • I do not have the JRE installed as my Eclipse didn't like the version of the JVM associated with it.

    When I installed the JRE, Eclipse gave me an error upon startup saying "Incompatible JVM. Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required" or something almost exactly along those lines.

    I realize that not having the JRE installed might cause a bit of a facepalm among the seasoned Java developers here (in case it wasn't already readily apparent, I'm not a seasoned Java developer). I wasn't sure how essential it was to have the JRE if I already have the JDK installed.

     

    Any ideas or recommendations would be greatly appreciated!

×
×
  • Create New...

Important Information

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