Jump to content

[1.16.4] overlaying textures make the textures below black


Recommended Posts

Posted (edited)

During the last few days I was working on a custom grass block in a forge 1.16.4 environment.

For now i'm aiming only to recreate a simple grass block indistinguishable in the world from the minecraft one.
I have practically copied the json file of the model from minecraft and created a simple block class with only the constructor with all the normal properties.

Here's the json:

{
  "parent": "block/cube",
  "textures": {
    "particle": "exoticanimalmod:blocks/dirt",
    "bottom": "exoticanimalmod:blocks/dirt",
    "top": "exoticanimalmod:blocks/grass_block_top",
    "side": "exoticanimalmod:blocks/grass_block_side",
    "overlay": "exoticanimalmod:blocks/grass_block_side_overlay"
  },
  "elements": [
    {
      "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" },
        "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#top",    "cullface": "up", "tintindex": 0 },
        "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "north" },
        "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "south" },
        "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "west" },
        "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "east" }
      }
    },
    {
      "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north"},
        "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south"},
        "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west"},
        "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east"}
      }
    }
  ]
}

 

 

 

In an event handler class i have created an IBlockColor and registered it on the custom block:

package com.EdLL.exoticanimalmod.events;

import com.EdLL.exoticanimalmod.ExoticAnimalMod;
import com.EdLL.exoticanimalmod.util.ModBlocksRegistry;
import com.EdLL.exoticanimalmod.util.ModEntityRegistry;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.world.GrassColors;
import net.minecraft.world.biome.BiomeColors;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(modid = ExoticAnimalMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ModEventsHandler {

    static final IBlockColor grassColourHandler = (state, blockAccess, pos, tintIndex) -> {
        if (blockAccess != null && pos != null) {
            return BiomeColors.getGrassColor(blockAccess, pos);
        }
        return GrassColors.get(0.5D, 1.0D);
    };

    @SubscribeEvent
    public static void registerBlockColors(final ColorHandlerEvent.Block event){
        event.getBlockColors().register(grassColourHandler, ModBlocksRegistry.EGGED_GRASS.get());
    }

    @SubscribeEvent
    public void onEntityFall(LivingFallEvent event){
        if(event.getEntityLiving().getType()== ModEntityRegistry.STAG_BEETLE_MALE.get()){
            event.setCanceled(true);
        }
    }
}

 

The IBlockColor renderer does work: the overlaid texture takes the correct color of the biome grass, but the first texture (the dirt.png on the json) is turned completely black.

 

2020-12-29_10_22_51.png.e4535f9910cd011c60daae6cfe3e37e0.png

 

2020-12-29_10_23_11.png.a50b3bacead6b4dea598ab3424251a09.png

 

As you can see the overlay texture works just fine, but somehow covers the dirt texture underneath. The bottom face, that is not overlaid is working fine.

The textures i use are the ones from minecraft and i double checked that the overlay texture was a .png.

The log gives me no hint on how to fix this.. Does someone know how to help me ?

 

 

Edited by EdLL

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

    • I have no idea what the flip is going on, I can load the modpack just fine at forge 42.2.0 but any forge version above it insta-crashes with exit code 1. Can somebody tell me what's going on, this is minecraft 1.20.1 Latest.log: https://pastebin.com/pBUL1ZFa
    • does anyone know how to incorporate custom noise settings into a custom dimension through the use of datagen, I have created a custon json file for the noise settings that I want but I just don't know how to get it to register with the generated json file of the custom dimension.   here is the code for the dimension class package net.hurst.lustria.worldgen.dimension; import com.mojang.datafixers.util.Pair; import net.hurst.lustria.Lustria; import net.hurst.lustria.worldgen.biome.ModBiomes; import net.hurst.lustria.worldgen.registries.LustriaNoiseSettings; import net.minecraft.core.HolderGetter; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.util.valueproviders.ConstantInt; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.*; import net.minecraft.world.level.dimension.BuiltinDimensionTypes; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; import java.util.List; import java.util.OptionalLong; public class ModDimensions { public static final ResourceKey<LevelStem> LUSTRIA_KEY = ResourceKey.create(Registries.LEVEL_STEM, ResourceLocation.fromNamespaceAndPath(Lustria.MOD_ID, "lustriadim")); public static final ResourceKey<Level> LUSTRIA_LEVEL_KEY = ResourceKey.create(Registries.DIMENSION, ResourceLocation.fromNamespaceAndPath(Lustria.MOD_ID, "lustriadim")); public static final ResourceKey<DimensionType> LUSTRIA_DIM_TYPE = ResourceKey.create(Registries.DIMENSION_TYPE, ResourceLocation.fromNamespaceAndPath(Lustria.MOD_ID, "lustriadim_type")); public static void bootstrapType(BootstapContext<DimensionType> context) { context.register(LUSTRIA_DIM_TYPE, new DimensionType( OptionalLong.of(12000), // fixedTime false, // hasSkylight true, // hasCeiling false, // ultraWarm false, // natural 1.0, // coordinateScale true, // bedWorks false, // respawnAnchorWorks -64, // minY 256, // height 256, // logicalHeight BlockTags.INFINIBURN_OVERWORLD, // infiniburn BuiltinDimensionTypes.OVERWORLD_EFFECTS, // effectsLocation 0.0f, // ambientLight new DimensionType.MonsterSettings(false, false, ConstantInt.of(0), 0))); } public static void bootstrapStem(BootstapContext<LevelStem> context) { HolderGetter<Biome> biomeRegistry = context.lookup(Registries.BIOME); HolderGetter<DimensionType> dimTypes = context.lookup(Registries.DIMENSION_TYPE); HolderGetter<NoiseGeneratorSettings> noiseGenSettings = context.lookup(Registries.NOISE_SETTINGS); NoiseBasedChunkGenerator wrappedChunkGenerator = new NoiseBasedChunkGenerator( new FixedBiomeSource(biomeRegistry.getOrThrow(Biomes.BEACH)), noiseGenSettings.getOrThrow(NoiseGeneratorSettings.CAVES)); NoiseBasedChunkGenerator noiseBasedChunkGenerator = new NoiseBasedChunkGenerator( MultiNoiseBiomeSource.createFromList( new Climate.ParameterList<>(List.of(Pair.of( Climate.parameters(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.BEACH)), Pair.of( Climate.parameters(0.1F, 0.2F, 0.0F, 0.2F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.BIRCH_FOREST)), Pair.of( Climate.parameters(0.3F, 0.6F, 0.1F, 0.1F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.OCEAN)), Pair.of( Climate.parameters(0.4F, 0.3F, 0.2F, 0.1F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.DARK_FOREST)) ))), noiseGenSettings.getOrThrow(NoiseGeneratorSettings.CAVES)); LevelStem stem = new LevelStem(dimTypes.getOrThrow(ModDimensions.LUSTRIA_DIM_TYPE), noiseBasedChunkGenerator); context.register(LUSTRIA_KEY, stem); } } minecraft version is 1.20.1
    • Please read the FAQ (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/) and post logs as described there using a site like https://mclo.gs and post the link to it here. It may have the information required to solve your problem.  
    • the error code comes up when i trry to run it and ive tried to fix it but i cant  
  • Topics

×
×
  • Create New...

Important Information

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