Posted July 20, 20187 yr As it says in the title, when I try and render using TESR and bind texture, Minecraft seems to ignore the bind texture and throw an error that I don't have a blockstate. The default minecraft chest doesn't have one so why would mine throw an error? TESR Class package harry.mods.tutorialmod.blocks.animation; import org.lwjgl.opengl.GL11; import harry.mods.tutorialmod.Reference; import harry.mods.tutorialmod.blocks.tileentity.TileEntityCopperChest; import harry.mods.tutorialmod.init.BlockInit; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderCopperChest extends TileEntitySpecialRenderer<TileEntityCopperChest> { private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.MODID + ":textures/blocks/copper_chest.png"); private final ModelCopperChest MODEL = new ModelCopperChest(); @Override public void render(TileEntityCopperChest te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GlStateManager.enableDepth(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); ModelCopperChest model = MODEL; if (destroyStage >= 0) { this.bindTexture(DESTROY_STAGES[destroyStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else this.bindTexture(TEXTURE); GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); GlStateManager.scale(1.0F, -1.0F, -1.0F); GlStateManager.translate(0.5F, 0.5F, 0.5F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks; f = 1.0F - f; f = 1.0F - f * f * f; model.chestLid.rotateAngleX = -(f * ((float)Math.PI / 2F)); model.renderAll(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (destroyStage >= 0) { GlStateManager.matrixMode(5890); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); } } } Block Class package harry.mods.tutorialmod.blocks; import harry.mods.tutorialmod.Main; import harry.mods.tutorialmod.Reference; import harry.mods.tutorialmod.blocks.animation.RenderCopperChest; import harry.mods.tutorialmod.blocks.tileentity.TileEntityCopperChest; import harry.mods.tutorialmod.init.BlockInit; import harry.mods.tutorialmod.init.ItemInit; import harry.mods.tutorialmod.interfaces.IHasModel; import net.minecraft.block.BlockContainer; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.client.registry.ClientRegistry; public class BlockCopperChest extends BlockContainer implements IHasModel { public BlockCopperChest(String name, Material material, CreativeTabs tab, float hardness, float resistance, String harvestTool, int harvestLevel, SoundType sound) { super(material); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(tab); setHardness(hardness); setResistance(resistance); setHarvestLevel(harvestTool, harvestLevel); setSoundType(sound); BlockInit.BLOCKS.add(this); ItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(name)); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!worldIn.isRemote) { playerIn.openGui(Main.instance, Reference.GUI_COPPER_CHEST, worldIn, pos.getX(), pos.getY(), pos.getZ()); } return true; } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityCopperChest(); } @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntityCopperChest tileentity = (TileEntityCopperChest)worldIn.getTileEntity(pos); InventoryHelper.dropInventoryItems(worldIn, pos, tileentity); super.breakBlock(worldIn, pos, state); } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override public void registerModels() { Main.proxy.registerModel(Item.getItemFromBlock(this), 0); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCopperChest.class, new RenderCopperChest()); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityCopperChest) { ((TileEntityCopperChest)tileentity).setCustomName(stack.getDisplayName()); } } } private boolean isBelowSolidBlock(World worldIn, BlockPos pos) { return worldIn.getBlockState(pos.up()).doesSideBlockChestOpening(worldIn, pos.up(), EnumFacing.DOWN); } @Override public boolean isFullBlock(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } } Tile Entity Class package harry.mods.tutorialmod.blocks.tileentity; import harry.mods.tutorialmod.blocks.container.ContainerCopperChest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryLargeChest; import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityLockableLoot; import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; public class TileEntityCopperChest extends TileEntityLockableLoot implements ITickable { private NonNullList<ItemStack> chestContents = NonNullList.<ItemStack>withSize(72, ItemStack.EMPTY); public int numPlayersUsing, ticksSinceSync; public float lidAngle, prevLidAngle; @Override public int getSizeInventory() { return 72; } @Override public boolean isEmpty() { for(ItemStack stack : this.chestContents) { if(!stack.isEmpty()) return false; } return true; } @Override public String getName() { return this.hasCustomName() ? this.customName : "container.copper_chest"; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.chestContents = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY); if(!this.checkLootAndRead(compound)) ItemStackHelper.loadAllItems(compound, chestContents); if(compound.hasKey("CustomName", 8)) this.customName = compound.getString("CustomName"); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); if(!this.checkLootAndWrite(compound)) ItemStackHelper.saveAllItems(compound, chestContents); if(compound.hasKey("CustomName", 8)) compound.setString("CustomName", this.customName); return compound; } @Override public int getInventoryStackLimit() { return 64; } @Override public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { return new ContainerCopperChest(playerInventory, this, playerIn); } @Override public String getGuiID() { return "tutorial:copper_chest"; } @Override protected NonNullList<ItemStack> getItems() { return this.chestContents; } @Override public void update() { if (!this.world.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + pos.getX() + pos.getY() + pos.getZ()) % 200 == 0) { this.numPlayersUsing = 0; float f = 5.0F; for (EntityPlayer entityplayer : this.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB((double)((float)pos.getX() - 5.0F), (double)((float)pos.getY() - 5.0F), (double)((float)pos.getZ() - 5.0F), (double)((float)(pos.getX() + 1) + 5.0F), (double)((float)(pos.getY() + 1) + 5.0F), (double)((float)(pos.getZ() + 1) + 5.0F)))) { if (entityplayer.openContainer instanceof ContainerCopperChest) { if (((ContainerCopperChest)entityplayer.openContainer).getChestInventory() == this) { ++this.numPlayersUsing; } } } } this.prevLidAngle = this.lidAngle; float f1 = 0.1F; if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F) { double d1 = (double)pos.getX() + 0.5D; double d2 = (double)pos.getZ() + 0.5D; this.world.playSound((EntityPlayer)null, d1, (double)pos.getY() + 0.5D, d2, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F); } if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { float f2 = this.lidAngle; if (this.numPlayersUsing > 0) { this.lidAngle += 0.1F; } else { this.lidAngle -= 0.1F; } if (this.lidAngle > 1.0F) { this.lidAngle = 1.0F; } float f3 = 0.5F; if (this.lidAngle < 0.5F && f2 >= 0.5F) { double d3 = (double)pos.getX() + 0.5D; double d0 = (double)pos.getZ() + 0.5D; this.world.playSound((EntityPlayer)null, d3, (double)pos.getY() + 0.5D, d0, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F); } if (this.lidAngle < 0.0F) { this.lidAngle = 0.0F; } } } @Override public void openInventory(EntityPlayer player) { ++this.numPlayersUsing; this.world.addBlockEvent(pos, this.getBlockType(), 1, this.numPlayersUsing); this.world.notifyNeighborsOfStateChange(pos, this.getBlockType(), false); } @Override public void closeInventory(EntityPlayer player) { --this.numPlayersUsing; this.world.addBlockEvent(pos, this.getBlockType(), 1, this.numPlayersUsing); this.world.notifyNeighborsOfStateChange(pos, this.getBlockType(), false); } } Edited July 20, 20187 yr by HarryTechReviews
July 20, 20187 yr Author 6 minutes ago, diesieben07 said: You register a block for the model, so minecraft tries to load one. So I shouldn't register a block? The default chest gets registered like all others
July 20, 20187 yr Can't you also override getBlockLayer with? public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.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, 20187 yr Author 9 minutes ago, Draco18s said: Can't you also override getBlockLayer with? public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.INVISIBLE; } INVISIBLE doesn't exist. I got it working so I have the texture but still throws no blockstate error which is weird. 2 hours ago, diesieben07 said: I misspoke, I wanted to say you register a model for the block. If you do not want a model, you need a custom state mapper that does not request one. I'm not calling the model anymore. Thanks for the help but as I said, blockstate error still present
July 20, 20187 yr 1 minute ago, HarryTechReviews said: INVISIBLE doesn't exist. I got it working so I have the texture but still throws no blockstate error which is weird. I might have the value wrong, but I was sure there was a BlockRenderLayer that was NONE or INVISIBLE or similar. 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, 20187 yr Author Just now, Draco18s said: I might have the value wrong, but I was sure there was a BlockRenderLayer that was NONE or INVISIBLE or similar. SOLID("Solid"), CUTOUT_MIPPED("Mipped Cutout"), CUTOUT("Cutout"), TRANSLUCENT("Translucent");
July 20, 20187 yr Author I've figured out a complicated workaround. Basically, I created an item that summons the block so then I don't have to call the register model function for the item. If anyone has any better ideas, would love to hear them. Didn't work Edited July 20, 20187 yr by HarryTechReviews
July 20, 20187 yr 59 minutes ago, HarryTechReviews said: If anyone has any better ideas, would love to hear them. 3 hours ago, diesieben07 said: If you do not want a model, you need a custom state mapper that does not request one. Edited July 20, 20187 yr by Animefan8888 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, 20187 yr 1 hour ago, HarryTechReviews said: SOLID("Solid"), CUTOUT_MIPPED("Mipped Cutout"), CUTOUT("Cutout"), TRANSLUCENT("Translucent"); (I swear I've seen it somewhere though... Hmm...) Found it: /** * The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only, * LIQUID for vanilla liquids, INVISIBLE to skip all rendering */ public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.INVISIBLE; } Edited July 20, 20187 yr by Draco18s 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 21, 20187 yr 1 hour ago, diesieben07 said: This will not stop Minecraft from trying to load a block state file for it though, right? I haven't actually used it. So it's possible that you're right. Buut...there is no blockstate or model file for Air. 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.
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.