Jump to content

Recommended Posts

Posted

Hi, after updating to 1.15.2 from 1.12.2 I'm re-adding everything I had from 1.12.2, but I'm having trouble with the glass block, same issue I had back then, the transparent parts of the texture are rendering white and with buggy shadows when I move away from the paced block.

Back in 1.12.2 I had the same issue and I fixed it with this code in the Custom Block's class:
 

Quote

    @Override
    public BlockRenderLayer getBlockLayer() 
    {
        return BlockRenderLayer.CUTOUT;
    }
    
    @Override
    public boolean isOpaqueCube(IBlockState state) {
        return false;
    }

 

But now in 1.15.2 I'm struggling to find the code that fixes it.

Any help, please? ...and sorry if the code isn't pretty XD

 

 

 

Quote

package com.xanderindalzone.customgunsmod.init;

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

import com.xanderindalzone.customgunsmod.CustomGunsMod;
import com.xanderindalzone.customgunsmod.creativetabs.AmmoItemGroup;
import com.xanderindalzone.customgunsmod.creativetabs.CustomBlocksItemGroup;
import com.xanderindalzone.customgunsmod.creativetabs.GunsItemGroup;
import com.xanderindalzone.customgunsmod.objects.ItemBase;
import com.xanderindalzone.customgunsmod.objects.blocks.ArmoredGlassBlock;
import com.xanderindalzone.customgunsmod.objects.blocks.BlockBase;
import com.xanderindalzone.customgunsmod.objects.blocks.BlockItemBase;
import com.xanderindalzone.customgunsmod.objects.items.guns.GunBase;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.Block.Properties;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.ObjectHolder;

@Mod.EventBusSubscriber(modid = CustomGunsMod.MOD_ID, bus = Bus.MOD)
@ObjectHolder(CustomGunsMod.MOD_ID)
public class Initialize 
{
    
    public static List<Item> ModItems = new ArrayList<Item>();
    public static List<Block> ModBlocks = new ArrayList<Block>();
    public static List<BlockItem> ModBlockItems = new ArrayList<BlockItem>();
    
    
    
    
    
    
    
    /*=====*/
    /*ITEMS*/
    /*=====*/
    public static final Item PISTOL_COLT_1911 = 
            new GunBase(new Item.Properties().group(CustomGunsMod.GUNS_TAB)).setRegistryName("pistol_colt_1911");
    
    public static final Item PISTOL_BULLET = 
            new ItemBase(new Item.Properties().group(CustomGunsMod.AMMO_TAB)).setRegistryName("pistol_bullet");
    
    
    
    
    
    /*=================*/
    /*BLOCKS PROPERTIES*/
    /*=================*/
    static Properties PROPERTIES_ARMORED_GLASS = Block.Properties.create(Material.IRON)
            .sound(SoundType.GLASS)
            .hardnessAndResistance(20.0F, 6000.0F)
            .harvestLevel(3)
            .harvestTool(ToolType.PICKAXE);
    
    
    
    
    /*======*/
    /*BLOCKS*/
    /*======*/
    public static final Block ARMORED_GLASS_BLOCK = 
            new ArmoredGlassBlock(PROPERTIES_ARMORED_GLASS).setRegistryName("armored_glass_block");
    public static final BlockItem ARMORED_GLASS_ITEM_BLOCK = 
            (BlockItem) new BlockItemBase(ARMORED_GLASS_BLOCK, new Item.Properties().group(CustomGunsMod.CUSTOM_BLOCKS_TAB)).setRegistryName(ARMORED_GLASS_BLOCK.getRegistryName());
    
    
    
    
    
    

    
    
    
    
    
    
    @SubscribeEvent
    public static void registerItems(final RegistryEvent.Register<Item> event)
    {
        
        for(Item item : ModItems)
        {
            event.getRegistry().register(item);
        }
        for(BlockItem blockitem : ModBlockItems)
        {
            event.getRegistry().register(blockitem);
        }
    }
    
    
    
    @SubscribeEvent
    public static void registerBlocks(final RegistryEvent.Register<Block> event)
    {
        for(Block block : ModBlocks)
        {
            event.getRegistry().register(block);
        }
    }
    
    
    
    
    

}
 

 

Quote

package com.xanderindalzone.customgunsmod.objects.blocks;

import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;

public class ArmoredGlassBlock extends BlockBase
{

    public ArmoredGlassBlock(Properties properties) 
    {
        super(properties);
    }
    
    @Override
    public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
        if(player.getHeldItemMainhand().getItem().equals(Items.DIAMOND_PICKAXE))
        {
            return true;
        }
        else 
        {
            return false;
        }
    }
    
    @Override
    public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
        // TODO Auto-generated method stub
        return 0;
    }
    


}
 

 

Also it's not dropping the block when I mine it with a diamond pickaxe, dont know why.

2020-06-18_11.16.01.png

Posted
Quote

    @Override
    public BlockRenderLayer getBlockLayer() 
    {
        return BlockRenderLayer.CUTOUT;
    }
    
    @Override
    public boolean isOpaqueCube(IBlockState state) {
        return false;
    }

These no longer exist

Posted (edited)

You want to use the FMLClientSetupEvent and use RenderTypeLookup.setRenderLayer on your block with the RenderType you want.

 

First mistakenly thought someone was saying those links weren't working, but I think it was more of a hint to use the forums search, as this question has been asked a million times already :D

Edited by Ugdhar
Posted
On 6/18/2020 at 12:37 PM, Ugdhar said:

You want to use the FMLClientSetupEvent and use RenderTypeLookup.setRenderLayer on your block with the RenderType you want.

 

First mistakenly thought someone was saying those links weren't working, but I think it was more of a hint to use the forums search, as this question has been asked a million times already :D

This helped me with the transparent texture issue, thx.


 

 

On 6/18/2020 at 3:34 PM, TheGreyGhost said:

Two possible reasons come to mind:

1) you need to use loot tables now.  eg https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/resources/data/minecraftbyexample/loot_tables/blocks

2) you're mining in creative mode

 

-TGG

And this helped me with the drops.... also thx

now I have the no floor issue XD...

how do I fix this in 1.15? XD

2020-06-19_23.11.52.png

Posted
8 minutes ago, xanderindalzone said:

how do I fix this in 1.15? XD

Dude, it was literally the first reply to this thread. Like FIVE links about how to fix it.

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.

Posted

I tried it before  but I was getting errors, maybe I didn't do it correctly, I

'll check the post again XD

21 minutes ago, Draco18s said:

Dude, it was literally the first reply to this thread. Like FIVE links about how to fix it.

Posted

ok fixed it by adding .notSolid() in the block's properties :)

 

Quote

    /*=================*/
    /*BLOCKS PROPERTIES*/
    /*=================*/
    static Properties PROPERTIES_ARMORED_GLASS = Block.Properties.create(Material.IRON)
            .sound(SoundType.GLASS)
            .hardnessAndResistance(20.0F, 6000.0F)
            .harvestLevel(3)
            .harvestTool(ToolType.PICKAXE)
            .notSolid();

 

  • Thanks 1

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.