Jump to content

Recommended Posts

Posted

I'm right now updating my mod from 1.7.10 to 1.8.9 and I need semitransparent rendering for one of my blocks and a lot of items. The block and the items are rendered as an .obj File and are modeled in blender. Problem: I have no idea on how to do this and I need to know if minecraft and/or forge as implemented some sort of Distance based rendering for 1.8.9 yet.

 

I hope someone can help me.

Posted

Ok, after a lot of testing i found a method that lets me render semitransparent Block in the correct order, but from time to time the block gets rendered wrong and I don't know why (the method, that does it is "public EnumWorldBlockLayer getBlockLayer()" from the slime block). I think this could be a forge bug. I still need a way to render .obj items semitransparent.

How the block should look like:

 

 

How the block from time to time looks like:

 

 

Code:

 

 

TileEntity:

package tileEntitys;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.client.model.obj.OBJModel;

public class TileEntity_TestBlock extends TileEntity implements ITickable{
    
    public TileEntity_TestBlock(){
    }
    
    @Override
    public void writeToNBT(NBTTagCompound compound) {
    	super.writeToNBT(compound);
    }
    @Override
    public void readFromNBT(NBTTagCompound compound) {
    	super.readFromNBT(compound);
    }

@Override
public void update() {
}

}

 

BlockClass:

package blocks.TestCreations;

import com.google.common.collect.Lists;

import reference.Constants;
import reference.Methref;
import tileEntitys.TileEntity_TestBlock;
import base.MainClass;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.obj.OBJModel;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


/**
* A block, created only for testing purposes.
* @since 14.02.2016
* @author Pythonschlange
*
*/
public class Block_TestBlock extends Block implements ITileEntityProvider{
/**
 * The constructor for the TestBlock.
 * @param material -The material of the block.
 * 
 * @since 14.02.2016
 * @author Pythonschlange
 */
public Block_TestBlock(Material material) {
	super(material);
	this.setCreativeTab(Constants.tabStuffForMC);
	this.setLightLevel(1.0F);
	this.setHardness(5.0F);
	this.setStepSound(Block.soundTypeStone);
	this.setUnlocalizedName(Constants.UnlocalizedNameBlock_TestBlock);
	//this.setBlockTextureName(Constants.ModID + ":" + "testblock");
}
    @Override
    public boolean isOpaqueCube() { return false; }

    @Override
    public boolean isFullCube() { return false; }

    @Override
    public boolean isVisuallyOpaque() { return false; }
    
    @SideOnly(Side.CLIENT)
    public EnumWorldBlockLayer getBlockLayer(){
        return EnumWorldBlockLayer.TRANSLUCENT;
    }
    
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
	return new TileEntity_TestBlock();
}
}

 

ClientProxy:

package base.Proxies;


import blocks.AllBlocks;
import items.AllItems;
import reference.Constants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

/**
* Here go things that only the Client has to do.
* @since 14.02.2016
* @author Pythonschlange
*
*/
public class ClientProxy extends CommonProxy {


@Override
public void preInit(FMLPreInitializationEvent e){
	super.preInit(e);

	OBJLoader.instance.addDomain(Constants.ModID.toLowerCase());
        Item item2 = Item.getItemFromBlock(AllBlocks.blockTestblock);
        ModelLoader.setCustomModelResourceLocation(item2, 0, new ModelResourceLocation(Constants.ModID.toLowerCase() + ":" + AllBlocks.blockTestblock.getUnlocalizedName().substring(5)));
}

@Override
public void load(FMLInitializationEvent event){
	super.load(event);
	blocks.BlockRenderRegister.registerBlockRenderer();
	items.ItemRenderRegister.registerItemRenderer();
}
@Override
public void postInit(FMLPostInitializationEvent event){
	super.postInit(event);
}
}

blockstate.json:

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "#Material.001": "stuffformc:blocks/TestBlock_TsTexture",
            "#Material.002": "stuffformc:blocks/TestBlock_SphereTexture",
            "#Material.003": "stuffformc:blocks/TestBlock_CasingTexture"},
        "model": "stuffformc:TestBlock_Casing.obj"
     },
    "variants": {
        "normal": [{}],
        "inventory": [{
            "transform": "forge:default-block"
        }]
    }
}

block.json(I don't know for sure, but i think this doesn't get called):

{
    "parent": "stuffformc:blockstates/testblock",
    "textures": {
        "all": "stuffformc:blocks/TestBlock_CasingTexture"
    }
}

Item.json(doesn't work right now, if you know how to do the ItemRenderer for .obj models please tell me):

{
    "parent":"stuffformc:blockstates/testblock",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}

 

 

EDIT: I also would like to know, how to animate an .obj model (item and/or block). I'm happy for any response :D

Posted

Okay, this is new stuff... is there anywere a place where the Json file (and it's arguments, functions...) is explained? Because I searched for way to long and found nothing. And if there isn't, would someone be kind enough to quickly explain how Jsons work (background would be nice, but I just need to know what all the arguments in the file are doing and how they work)

I'm thankfull for every respond. :)

Posted
This Gist appears to explain the grammar of the animation state machine JSON. I haven't seen any other documentation of it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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