Jump to content

Recommended Posts

Posted

I'm developing my first mod and it's made mostly by multiblocks. The problem I'm getting is about how they are rendered: the shadow  is casted on the wrong side or the faces are too dark. Also, when smooth lighting is turned off, some faces appear black.
I've had a problem with normals before, but the consequence was to have transparent faces, not black or dark.

It's strange because on Blender it's being rendered correctly, but it isn't on Minecraft.
What can be causing this?
 

Spoiler

One side is very dark. Both receive light!

Not receiving light

Spoiler

The shadow isn't because of external light (not even the sun)

2017-08-25_19_03_00.png.a684c5f4d429149f1822979399c0477c.png

Spoiler

When smooth lighting is Off, it looks like this

2017-08-25_19_03_35.png.f46178b92c374c995e6ae5ffdf3a11e1.png

The model is obviously being loaded (both obj and mtl)

Spoiler

metalMultiblock_biomassGenerator.json (blockstate file)


{
  "forge_marker": 1,
  "defaults":
  {
    "transform": "forge:default-block",
    "custom": { "flip-v": true },
    "textures": {
		/*"particle": "immersiveengineering:blocks/storage_steel"*/
    }
  },
  "variants":
  {
    "inventory,type=biomass_generator": [{
      "model": "immersivesawmills:metalMultiblock/biomassGenerator.obj",
      "transform": {
        "scale": 1,
        "rotation": [
          {
            "x": 20
          },
          {
            "y": -45
          }
        ]
      }
    }],
    "type":
    {
      "biomass_generator": {
      }
    },
    "facing":
    {
      "north": { "transform": {
        "rotation": {"y": 0 },
        "translation": [0, 0, 1]
      }},
      "south": { "transform": {
        "rotation": {"y": 180 },
        "translation": [0, 0, -1]
      }},
      "west": { "transform": {
        "rotation": {"y": 90 },
        "translation": [1, 0, 0]
      }},
      "east": { "transform": {
        "rotation": {"y": -90 },
        "translation": [-1, 0, 0]
      }}
    },
    "_0multiblockslave":
    {
      "false":{},
      "true":{
        "model": "builtin/generated"
      }
    },
    "_1dynamicrender":
  {
    "false":{
      
    },
    "true":{
      
    }
  },
    "boolean0":
    {
      "false":{"model": "immersivesawmills:metalMultiblock/biomassGenerator.obj"},
      "true":{}
    }
  }
}

 

Spoiler

biomassGenerator.mtl


newmtl BioGenMat
map_Ka immersivesawmills:blocks/metalMultiblock_biomassGenerator

 

Spoiler

The TileEntity (not using special renderers or any code at all to change the way it's rendered)


package axelmontini.immersivesawmills.common.blocks.metal;

import axelmontini.immersivesawmills.api.energy.BiomassHandler;
import axelmontini.immersivesawmills.common.Config;
import axelmontini.immersivesawmills.common.blocks.multiblock.MultiblockBiomassGenerator;
import blusunrize.immersiveengineering.api.crafting.IMultiblockRecipe;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces;
import blusunrize.immersiveengineering.common.blocks.metal.TileEntityMultiblockMetal;
import blusunrize.immersiveengineering.common.util.EnergyHelper;
import blusunrize.immersiveengineering.common.util.Utils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFireball;
import net.minecraft.item.ItemFlintAndSteel;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static net.minecraft.util.EnumFacing.UP;

/**Note: pos 48 is the hopper*/
public class TileEntityBiomassGenerator extends TileEntityMultiblockMetal<TileEntityBiomassGenerator, IMultiblockRecipe> implements IEBlockInterfaces.IPlayerInteraction/*, IEBlockInterfaces.IAdvancedSelectionBounds, IEBlockInterfaces.IAdvancedCollisionBounds*/ {
    public TileEntityBiomassGenerator() {
        super(MultiblockBiomassGenerator.instance, new int[] {3,4,5}, 0, true);
    }
//... Cut off

    @Override
    public void readCustomNBT(NBTTagCompound nbt, boolean descPacket) {
        super.readCustomNBT(nbt, descPacket);
        active = nbt.getBoolean("active");
        tanks[0].readFromNBT(nbt.getCompoundTag("tank_water"));
        if(isDummy())
            return;
        //Collect fuel into the queue
        {
            NBTTagList fuels = nbt.getTagList("fuel", Constants.NBT.TAG_LIST);
            this.fuel.addAll(IntStream.range(0, fuels.tagCount()).mapToObj(i -> IntStream.of(fuels.getIntArrayAt(i)).boxed().toArray(Integer[]::new)).collect(Collectors.toList()));
        }
        //Collect burning
        {
            NBTTagList burning = nbt.getTagList("burning", Constants.NBT.TAG_LIST);
            for(int i=0; i<Math.min(maxParallelFuel, burning.tagCount()); i++)
                this.burning[i] = burning.getIntArrayAt(i);
        }
    }

    @Override
    public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) {
        super.writeCustomNBT(nbt, descPacket);
        nbt.setTag("tank_water", tanks[0].writeToNBT(new NBTTagCompound()));
        nbt.setBoolean("active", active);
        if(isDummy())
            return;
        //Write out fuel
        {
            NBTTagList fuel = new NBTTagList();
            this.fuel.stream().forEach( f -> fuel.appendTag( new NBTTagIntArray( new int[]{f[0], f[1]} ) ) );
            nbt.setTag("fuel", fuel);
        }
        //Write out burning
        {
            NBTTagList burning = new NBTTagList();
            //Append arrays. Must filter, since the array burning[][] is of fixed size, prevent null entries
            Stream.of(this.burning).filter(b-> b!=null).forEach(b -> burning.appendTag(new NBTTagIntArray(b)));
            nbt.setTag("burning", burning);
        }
    }

    //... Cut off some methods (not render related)

    @Override
    public float[] getBlockBounds() {
        return new float[] {0,0,0,1,1,1};
    }

    @Override
    public ItemStack[] getInventory() {
        //... Cut off
    }

    @Override
    public boolean isStackValid(int slot, ItemStack stack) {
        //... Cut off
    }

    @Override
    public int getSlotLimit(int slot) {
        //... Cut off
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void doGraphicalUpdates(int slot) {
      //Empty method
    }


    @Override
    public void disassemble() {
        //... Cut off
    }
}

 

(Note) The block has no special renderer yet; Only the master block is being rendered with this model; the texture is complete;
The other multiblock I've made doesn't have this problem and it have the same superclass.

  • 2 weeks later...
Posted

Found a partial fix.
After looking into IE's code I noticed that I've forgot to override both Block#isFullCube(IBlockState).
This mostly fixed the issue. The remaining problem consists in a poor lighting strength on a side of the block.

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 also just tried with iron's spellbooks removed, since that seemed related, but i am still having the same problem, even in newly created worlds. https://mclo.gs/AtrAfaj 
    • My Gradle Project for my Minecraft mod isn't building. Terminal: * Where: Settings file 'C:\Users\csonn\OneDrive\Desktop\fusionlucky\settings.gradle' line: 2 * What went wrong: Could not compile settings file 'C:\Users\csonn\OneDrive\Desktop\fusionlucky\settings.gradle'. > startup failed:   settings file 'C:\Users\csonn\OneDrive\Desktop\fusionlucky\settings.gradle': 2: The pluginManagement {} block must appear before any other statements in the script.   For more information on the pluginManagement {} block, please refer to https://docs.gradle.org/9.0.0/userguide/plugins.html#sec:plugin_management in the Gradle documentation.    @ line 2, column 1.      pluginManagement {      ^   1 error * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to generate a Build Scan (Powered by Develocity). > Get more help at https://help.gradle.org.   Setting.Gradle File:   rootProject.name = 'fusion-lucky-block' pluginManagement {     repositories {         gradlePluginPortal()         maven { url "https://maven.minecraftforge.net/" }         mavenCentral()     } }
    • no change still. here's a new log  https://mclo.gs/RXwiZmn 
    • Whenever I go to build my it says "Build failed in " how many seconds   Here is what is said in my terminal * Where: Build file 'C:\Users\csonn\OneDrive\Desktop\fusionlucky\build.gradle' line: 3 * What went wrong: Plugin [id: 'net.minecraftforge.gradle', version: '6.1.51'] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Included Builds (No included builds contain this plugin) - Plugin Repositories (could not resolve plugin artifact 'net.minecraftforge.gradle:net.minecraftforge.gradle.gradle.plugin:6.1.51')   Searched in the following repositories:     Gradle Central Plugin Repository     MinecraftForge(https://maven.minecraftforge.net/) * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Get more help at https://help.gradle.org.   Here is what is in my build.gradle file plugins {     id 'java'     id 'net.minecraftforge.gradle' version '6.1+' }   group = 'io.github.csonnic03.fusionlucky' version = '1.0.0' archivesBaseName = 'fusionlucky'   java {     toolchain {         languageVersion = JavaLanguageVersion.of(17)     } }   repositories {     mavenCentral()     maven {         name "forgeMaven"         url "https://maven.minecraftforge.net/<repository>" } }   dependencies {     minecraft 'net.minecraftforge:forge:1.20.1-47.1.0' }   minecraft {     mappings channel: 'official', version: '1.20.1'     runs {         client {             workingDirectory project.file('run')         }         server {             workingDirectory project.file('run')         }     } }   tasks.withType(JavaCompile) {     options.encoding = 'UTF-8' }   jar {     manifest {         attributes(             "Specification-Title": "Fusion Lucky Block",             "Specification-Vendor": "example",             "Implementation-Title": project.name,             "Implementation-Version": project.version,             "Implementation-Vendor": "example",             "ModLauncher-TargetFMLVersion": "[47,)"         )     } }  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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