ProspectPyxis Posted October 10, 2018 Posted October 10, 2018 (edited) I have a block with a custom model that also emits some light, but when I place it on the world this happens: Spoiler Here's the code for this block: Spoiler package prospectpyxis.glowinglights.blocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import java.util.Random; public class BlockGlowGravelPath extends BlockBase { protected static final AxisAlignedBB GLOWING_GRAVEL_PATH_AABB = new AxisAlignedBB(0.0625d, 0.0d, 0.0625d, 0.9375d, 0.0625d, 0.9375d); @GameRegistry.ObjectHolder("glowinglights:glowing_gravel_path_item") public static final Item glowGravelPathOH = null; public BlockGlowGravelPath() { super(Material.GROUND, "glowing_gravel_path", 0.1f, 0, MapColor.SAND); this.lightValue = 5; this.lightOpacity = 255; this.fullBlock = false; this.blockSoundType = SoundType.STONE; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return glowGravelPathOH; } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(glowGravelPathOH); } @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { BlockPos blockPos = pos.offset(EnumFacing.DOWN); IBlockState state = worldIn.getBlockState(blockPos); if (state.isSideSolid(worldIn, blockPos, EnumFacing.UP) || state.getBlockFaceShape(worldIn, blockPos, EnumFacing.UP) == BlockFaceShape.SOLID) { return state.getBlock() != Blocks.END_GATEWAY && state.getBlock() != Blocks.LIT_PUMPKIN; } else { return false; } } @Override @SuppressWarnings("deprecation") public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { BlockPos blockPos = pos.offset(EnumFacing.DOWN); if (worldIn.getBlockState(blockPos).getBlockFaceShape(worldIn, blockPos, EnumFacing.UP) != BlockFaceShape.SOLID) { this.dropBlockAsItem(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } @Override @SuppressWarnings("deprecation") public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return GLOWING_GRAVEL_PATH_AABB; } @Override @SuppressWarnings("deprecation") public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return NULL_AABB; } @Override @SuppressWarnings("deprecation") public boolean isOpaqueCube(IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") public boolean isFullCube(IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") public boolean isFullBlock(IBlockState state) { return false; } @Override @SuppressWarnings("deprecation") public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.CENTER_SMALL; } } I have another light-emitting block with a custom model with very similar code to this but that works fine, so I really don't know what's wrong here... Edited October 10, 2018 by ProspectPyxis 1 Quote
Animefan8888 Posted October 10, 2018 Posted October 10, 2018 16 minutes ago, ProspectPyxis said: I have a block with a custom model that also emits some light, but when I place it on the world this happens: What exactly is your problem? Quote 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.
ProspectPyxis Posted October 10, 2018 Author Posted October 10, 2018 The image in the first spoiler should say it all, I think, but the problem is that the block below the one this block is placed on is inexplicably dark. Quote
Animefan8888 Posted October 10, 2018 Posted October 10, 2018 3 minutes ago, ProspectPyxis said: The image in the first spoiler should say it all, I think, but the problem is that the block below the one this block is placed on is inexplicably dark. I'll be honest with you. Until you pointed it out I didn't notice it, could be a me just waking up, it not being that noticable, or I'm just really bad at that sort of thing. However I believe the solution is returning CUTOUT in getBlockLayer. Quote 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.
ProspectPyxis Posted October 10, 2018 Author Posted October 10, 2018 (edited) I added this line to my code: @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } But it looks like that line didn't do anything? It's still darkening the block below. Edited October 10, 2018 by ProspectPyxis Quote
Cadiboo Posted October 10, 2018 Posted October 10, 2018 Override getLightOpacity? (Between 0-15) Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
ProspectPyxis Posted October 10, 2018 Author Posted October 10, 2018 4 minutes ago, Cadiboo said: Override getLightOpacity? (Between 0-15) That didn't do it either. Now I'm wondering if the problem is with the model itself... Quote
ProspectPyxis Posted October 11, 2018 Author Posted October 11, 2018 Any help with this? I even tried copying the code over from another block that works fine and only changing the light value and collision box, but not even that worked. Quote
Cadiboo Posted October 11, 2018 Posted October 11, 2018 Can you post your code as a GitHub repository? I've got some spare time & could clone & test your project myself Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
ProspectPyxis Posted October 11, 2018 Author Posted October 11, 2018 https://github.com/ProspectPyxis/GlowingLights Here's the github, feel free to take a look at it. Quote
Recommended Posts
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.