Posted July 20, 20178 yr I have a block called "fermenter" which extends the BlockContainer class however the game doesn't seem to render the model when I place the block. However when I change BlockContainer to Block, the block renders perfectly normal. I'm using BlockContainer because I want my "fermenter" to act in a similar way as the furance or brewing stand in game. I read about TESR but the documentation make it quite unclear on how to execute. Block Class: Spoiler package me.pandaism.brewmaster.blocks; import me.pandaism.brewmaster.lib.Reference; import me.pandaism.brewmaster.tileentities.TileEntityFermenter; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import javax.annotation.Nullable; /** * Created by Panda on 7/20/2017. */ public class BlockFermenter extends BlockContainer { public BlockFermenter(String name) { super(Material.WOOD); this.setUnlocalizedName(name); this.setRegistryName(new ResourceLocation(Reference.MODID, name)); } @Nullable @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityFermenter(); } } Tile Entity Class: Spoiler package me.pandaism.brewmaster.tileentities; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ITickable; /** * Created by Panda on 7/20/2017. */ public class TileEntityFermenter extends TileEntity implements ITickable { private int fermentTime; public TileEntityFermenter() { this.fermentTime = 0; } @Override public void readFromNBT(NBTTagCompound compound) { this.fermentTime = compound.getInteger("FermentTime"); super.readFromNBT(compound); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setInteger("FermentTime", this.fermentTime); return super.writeToNBT(compound); } @Override public void update() { this.fermentTime++; this.fermentTime %= 100; System.out.println("Timer: " + this.fermentTime); } } TESR Class: Spoiler package me.pandaism.brewmaster.tileentities.tesr; import me.pandaism.brewmaster.lib.Reference; import me.pandaism.brewmaster.tileentities.TileEntityFermenter; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.util.ResourceLocation; /** * Created by Panda on 7/20/2017. */ public class TESRFermenter extends TileEntitySpecialRenderer<TileEntityFermenter> { @Override public void render(TileEntityFermenter te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { bindTexture(new ResourceLocation(Reference.MODID, "textures/fermenter.png")); super.render(te, x, y, z, partialTicks, destroyStage, alpha); } } Register Class: Spoiler package me.pandaism.brewmaster.networking.registers; import me.pandaism.brewmaster.blocks.BlockFermenter; import me.pandaism.brewmaster.lib.Reference; import me.pandaism.brewmaster.tileentities.TileEntityFermenter; import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; /** * Created by Panda on 7/20/2017. */ @Mod.EventBusSubscriber public class RegisterBlocks { private static Block block_Fermenter; public static void init() { block_Fermenter = new BlockFermenter("fermenter"); } @SubscribeEvent public static void registerBlock(RegistryEvent.Register<Block> event) { event.getRegistry().register(block_Fermenter); GameRegistry.registerTileEntity(TileEntityFermenter.class, Reference.MODID + ":fermenter"); } @SubscribeEvent public static void registerBlockItem(RegistryEvent.Register<Item> event) { event.getRegistry().register(new ItemBlock(block_Fermenter).setRegistryName(block_Fermenter.getRegistryName())); } @SubscribeEvent public static void render(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block_Fermenter), 0, new ModelResourceLocation(Reference.MODID + ":" + block_Fermenter.getUnlocalizedName().substring(5), "inventory")); } } Edited July 20, 20178 yr by YellowMilk2
July 20, 20178 yr 2 minutes ago, YellowMilk2 said: I have a block called "fermenter" which extends the BlockContainer class however the game doesn't seem to render the model when I place the block. Don't extend BlockContainer instead extend Block and override createTileEntity(World, IBlockState) and hasTileEntity(IBlockState) VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 20, 20178 yr 4 minutes ago, YellowMilk2 said: TESR Class: Also why are you using a TESR? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 20, 20178 yr Author 2 minutes ago, Animefan8888 said: Don't extend BlockContainer instead extend Block and override createTileEntity(World, IBlockState) and hasTileEntity(IBlockState) Okay then that should make my task alot more simple 1 minute ago, Animefan8888 said: Also why are you using a TESR? Tesr was under the docs for rendering so I implied it would be the right decision
July 20, 20178 yr Just now, YellowMilk2 said: Tesr was under the docs for rendering so I implied it would be the right decision Do you plan on having movement or the model being dynamic? If not use the JSON system. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 20, 20178 yr The reason block container doesn't work is because it overrides getBlockModelType() to make the block invisible. 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.
July 20, 20178 yr Author 8 minutes ago, Animefan8888 said: Do you plan on having movement or the model being dynamic? If not use the JSON system. not moving but probably have particles to show it's active
July 20, 20178 yr Author 10 minutes ago, Draco18s said: The reason block container doesn't work is because it overrides getBlockModelType() to make the block invisible. Might I ask how does the BlockFurance class manage to have a model? Just for education purposes
July 20, 20178 yr Just now, YellowMilk2 said: not moving but probably have particles to show it's active That can all be done in the Block class. Look at BlockFurnace for an example of the particles. And you can look at the vanillas json files for examples of those. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 20, 20178 yr Author Just now, Animefan8888 said: That can all be done in the Block class. Look at BlockFurnace for an example of the particles. And you can look at the vanillas json files for examples of those. Thank you that's the class I been following and around at other sources to gather more information
July 20, 20178 yr 1 minute ago, YellowMilk2 said: Might I ask how does the BlockFurance class manage to have a model? Just for education purposes It also overrides the method and returns a more proper value. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 21, 20178 yr Author 8 hours ago, Animefan8888 said: It also overrides the method and returns a more proper value. I managed to do it with a BlockContainer class messing around and trying to find new ways. Just in case someone stumble on this post Override getRenderType and return EnumBlockRenderType.MODEL
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.