Posted November 11, 20204 yr I want to creat the Tinted Glass Block for the new Minecraft Snapshot but i can look through the block into the "world"/void This is the code: package net.luis.cave.blocks; import net.minecraft.block.AbstractBlock; import net.minecraft.block.AbstractGlassBlock; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.PushReaction; import net.minecraftforge.common.ToolType; public class TintedGlass extends AbstractGlassBlock { public TintedGlass() { super(AbstractBlock.Properties.create(Material.GLASS) .zeroHardnessAndResistance() .sound(SoundType.GLASS) .harvestLevel(0) .harvestTool(ToolType.PICKAXE)); } @Override public boolean isTransparent(BlockState state) { return true; } @Override public PushReaction getPushReaction(BlockState state) { return PushReaction.DESTROY; } }
November 11, 20204 yr Author i get this code for the glass class but it dosent work package net.luis.cave.blocks; import net.minecraft.block.AbstractBlock; import net.minecraft.block.AbstractGlassBlock; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.PushReaction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; public class TintedGlass extends AbstractGlassBlock { public TintedGlass() { super(AbstractBlock.Properties.create(Material.GLASS) .zeroHardnessAndResistance() .sound(SoundType.GLASS) .harvestLevel(0)); } @Override public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) { return true; } @Override public boolean isTransparent(BlockState state) { return true; } @Override public PushReaction getPushReaction(BlockState state) { return PushReaction.DESTROY; } @Override public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) { return 1.0f; } @Override public VoxelShape func_230322_a_(BlockState p_230322_1_, IBlockReader p_230322_2_, BlockPos p_230322_3_, ISelectionContext p_230322_4_) { return VoxelShapes.empty(); } } Edited November 11, 20204 yr by Luis_ST
November 11, 20204 yr You need to set the render layer of the block within your FMLClientsetupEvent via RenderTypeLookup::setRenderLayer.
November 12, 20204 yr Author I alredy do this : private void doClientStuff(FMLClientSetupEvent event) { RenderTypeLookup.setRenderLayer(CaveBlocks.TINTED_GLASS.get(), RenderType.getTranslucent()); }
November 13, 20204 yr Author I dont cant find this .notOpaque() is this the corect name this are the properties which i can add
November 13, 20204 yr Author which of the func_XXXXXX_X_ is .notOpaque() Edited November 13, 20204 yr by Luis_ST
November 13, 20204 yr I believe that method was renamed to setOpaque in recent mappings. Anyway in your case it should be the func_235828_a_. You can take a look here to see what unmapped methods looks like in the most recent mappings: https://docs.google.com/spreadsheets/d/14knNUYjYkKkGpW9VTyjtlhaCTUsPWRJ91GLOFX2d23Q/edit#gid=721555859 Alternatively if you do not know what method does what you want you can try to search where those methods could have been used in vanilla code..for example, you are trying to create a block that is similar to glass in behaviour. Then go inside the Blocks class and see how the various glass blocks and their properties are defined, and you may found the informations that could help you deducing which of those non-sense name method is the one you need to use Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
November 13, 20204 yr Author Yes, this is the function but what comes in the brackets i can't set a true or a false inside
November 13, 20204 yr Well, it already tells you what is required, and its not an unmapped name. Follow my above suggestion and see how vanilla glass blocks are defined in their properties Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
November 14, 20204 yr Author i just looked into the vanilla glass block class: package net.minecraft.block; public class GlassBlock extends AbstractGlassBlock { public GlassBlock(AbstractBlock.Properties properties) { super(properties); } } and the Abstract Glass Block class: package net.minecraft.block; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public abstract class AbstractGlassBlock extends BreakableBlock { protected AbstractGlassBlock(AbstractBlock.Properties p_i49999_1_) { super(p_i49999_1_); } public VoxelShape func_230322_a_(BlockState p_230322_1_, IBlockReader p_230322_2_, BlockPos p_230322_3_, ISelectionContext p_230322_4_) { return VoxelShapes.empty(); } @OnlyIn(Dist.CLIENT) public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) { return 1.0F; } public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) { return true; } } there are no properties
November 14, 20204 yr Thats because in the above posts i suggested you to look into the Blocks class, where the properties for each block are actually defined Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
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.