Jump to content

[1.12.2] Modifying vanilla blocks to render translucent texture


Eedelia01

Recommended Posts

A very long time ago, around 1.8, I created a base mod by recompiling minecraft and editing some class files so that ore blocks would handle rendering transparent textures like how glass does. I've recently set up an Eclipse workspace and am ready to get started but most guides for first time users are looking to create items that are new and don't already exist. 

 

I'll admit, I feel just a bit out of my element getting started on this. If someone would know what methods I could use to get a change like this to occur, or has a mod that modifies vanilla blocks that I could look to as an example, I would be extremely grateful. I was able to use this transparent feature on a number of different placable items with quite interesting effect. Here's some doors I made with transparent textures for example:

 

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/mod-packs/2587422-rezcraft-rerez-x64-1-8-craft-the-grid#

 

 

Edited by Eedelia01
Link to comment
Share on other sites

I started cooking up a class that would extend from BlockOre, and then use @Override to get the rendering rules I want loaded into BlockOre.java , but although my eventHandler was able to try to do it's thing, I received dozens of errors complaining that minecraft:blockore didn't have a json or a model. 

 

I understand that I need to get my event handler into a separate file, setup a github, etc. I'd like to know however, if I'm on the right track? I suspect that what I will in fact be doing is that since there are listings in Block like

 registerBlock(14, "gold_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSoundType(SoundType.STONE).setUnlocalizedName("oreGold"));

that what I may want to do is try to register my overrides to the vanilla ore types instead, as they have jsons and models? 

 

 

Quote

package grid.encom.rezcraft;
import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.BlockOre;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.common.Mod;

@Mod(modid = RezInOre.MODID, name = RezInOre.NAME, version = RezInOre.VERSION, acceptedMinecraftVersions = RezInOre.MC_VERSION)

public class RezInOre extends BlockOre
{
    
    public static final String MODID = "rezin";
    public static final String NAME = "RezCraft";
    public static final String VERSION = "0.0.1";
    public static final String MC_VERSION = "[1.12.2]";
    
      public RezInOre() {
        
        
        }

            @Override
            public boolean isOpaqueCube(IBlockState state)
            {
                return false;
            }

            @Override
            public boolean isTranslucent(IBlockState state)
            {
                return true;
            }

            @SideOnly(Side.CLIENT)
            @Override
            public BlockRenderLayer getBlockLayer() {
                return BlockRenderLayer.TRANSLUCENT;
            }
            
            @Override
            public EnumBlockRenderType getRenderType(IBlockState state) {
                return EnumBlockRenderType.MODEL;
            }
            

            
            @Mod.EventBusSubscriber(modid = RezInOre.MODID)
            public final class EventSubscriber {
            @SubscribeEvent 
            void onBlockRegister(final RegistryEvent.Register<Block> event) {
                event.getRegistry().setRegistryName(new ResourceLocation(new ResourceLocation("BlockOre")));
            }
            }
    }

 

Quote

3:33:20] [Client thread/ERROR] [FML]: Exception loading model for variant minecraft:blockore#normal for blockstate "minecraft:blockore"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:blockore#normal with loader VariantLoader.INSTANCE, skipping
    at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
    at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
    at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]
    at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
    at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
    at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
    at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
    at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
    at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?]
    at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?]
    at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
    ... 21 more
[03:33:20] [Client thread/ERROR] [FML]: Exception loading blockstate for the variant minecraft:blockore#normal: 
java.lang.Exception: Could not load model definition for variant minecraft:blockore
    at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:269) ~[ModelLoader.class:?]
    at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:121) ~[ModelBakery.class:?]
    at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
    at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
    at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
    at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
    at net.minecraft.client.Minecraft.init(Minecraft.java:560) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model minecraft:blockstates/blockore.json
    at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:228) ~[ModelBakery.class:?]
    at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
    at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:265) ~[ModelLoader.class:?]
    ... 20 more
Caused by: java.io.FileNotFoundException: minecraft:blockstates/blockore.json
    at net.minecraft.client.resources.FallbackResourceManager.getAllResources(FallbackResourceManager.java:104) ~[FallbackResourceManager.class:?]
    at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:79) ~[SimpleReloadableResourceManager.class:?]
    at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:221) ~[ModelBakery.class:?]
    at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
    at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:265) ~[ModelLoader.class:?]

 

image.png.9984abe5275451c540f82b4b02b2cc4f.png

 

 

 

Edited by Eedelia01
Link to comment
Share on other sites

On 11/15/2019 at 7:40 PM, Eedelia01 said:

Caused by: java.io.FileNotFoundException: minecraft:blockstates/blockore.json

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Announcements



×
×
  • Create New...

Important Information

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