Posted August 19, 201510 yr Why did this: Suddenly start happening to my block when I added a TileEntity? Before that it was working better than fine. It makes no sense to me that once I add a TileEntity to a block suddenly the render starts crapping itself. Here's the main class which registers the TileEntites: package robotsculptures; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import robotsculptures.block.RSBlocks; import robotsculptures.constants.ModConstants; import robotsculptures.proxy.CommonProxy; import robotsculptures.tileentity.RSTileEntities; @Mod(modid = ModConstants.MOD_ID, name = ModConstants.MOD_NAME, version = ModConstants.MOD_VERSION, acceptedMinecraftVersions = ModConstants.ACCEPTED_MINECRAFT_VERSIONS) public class RobotSculptures { @SidedProxy(clientSide = ModConstants.CLIENT_PROXY_PATH, serverSide = ModConstants.COMMON_PROXY_PATH) public static CommonProxy proxy; @Instance(ModConstants.MOD_ID) public static RobotSculptures instance; @EventHandler public void preInit(FMLPreInitializationEvent event) { RSBlocks.init(); RSBlocks.register(); } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRenders(); RSTileEntities.register(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Here's the class with the actual register code: package robotsculptures.tileentity; import net.minecraftforge.fml.common.registry.GameRegistry; public class RSTileEntities { public static void register() { GameRegistry.registerTileEntity(KenSculptureTileEntity.class, "KenSculptureTileEntity"); } } Here's the block class: package robotsculptures.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import robotsculptures.tileentity.KenSculptureTileEntity; public class KenSculptureBlock extends BlockContainer { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public KenSculptureBlock(Material mat) { super(mat); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { KenSculptureTileEntity kste = (KenSculptureTileEntity) world.getTileEntity(pos); kste.ignite(); return true; } @Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if (!worldIn.isRemote) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "You DARE to destroy the sculpture of Ken the Mighty?!")); player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "Be forwarned. Bad things may befall you yet.")); } } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { Block block = worldIn.getBlockState(pos.north()).getBlock(); Block block1 = worldIn.getBlockState(pos.south()).getBlock(); Block block2 = worldIn.getBlockState(pos.west()).getBlock(); Block block3 = worldIn.getBlockState(pos.east()).getBlock(); EnumFacing enumFacing = (EnumFacing) state.getValue(FACING); if (enumFacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumFacing = EnumFacing.SOUTH; } else if (enumFacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumFacing = EnumFacing.NORTH; } else if (enumFacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumFacing = EnumFacing.EAST; } else if (enumFacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumFacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumFacing), 2); } } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } @SideOnly(Side.CLIENT) public IBlockState getStateForEntityRender(IBlockState state) { return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); } public IBlockState getStateFromMeta(int meta) { EnumFacing enumFacing = EnumFacing.getFront(meta); if (enumFacing.getAxis() == EnumFacing.Axis.Y) { enumFacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumFacing); } public int getMetaFromState(IBlockState state) { return ((EnumFacing) state.getValue(FACING)).getIndex(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } @SideOnly(Side.CLIENT) static final class SwitchEnumFacing { static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; static { try { FACING_LOOKUP[EnumFacing.WEST.ordinal()] = 1; } catch (NoSuchFieldError var4) { ; } try { FACING_LOOKUP[EnumFacing.EAST.ordinal()] = 2; } catch (NoSuchFieldError var3) { ; } try { FACING_LOOKUP[EnumFacing.NORTH.ordinal()] = 3; } catch (NoSuchFieldError var2) { ; } try { FACING_LOOKUP[EnumFacing.SOUTH.ordinal()] = 4; } catch (NoSuchFieldError var1) { ; } } } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new KenSculptureTileEntity(); } } And finally, here's the TileEntity class: package robotsculptures.tileentity; import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.tileentity.TileEntity; public class KenSculptureTileEntity extends TileEntity implements IUpdatePlayerListBox { private int fuse = 60; private boolean ignited = false; @Override public void update() { if (checkExplosion()) { getWorld().createExplosion(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3.0F, true); ignited = false; fuse = 60; } } public void ignite() { ignited = true; } private boolean checkExplosion() { if (ignited) { if (fuse > 0) { System.out.println(fuse); fuse--; } else { System.out.println("Exploding"); return true; } } return false; } } Sorry if that was a crazy amount of code, but I'm not quite sure why this could be happening at all. Side note: that's not a blue plane in the middle of the block. It's a hole in the world. Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*. Also this. Check it out. http://i.imgur.com/J4rrGt6.png[/img]
August 19, 201510 yr BlockContainer overrides Block#getRenderType to return -1 (no renderer) so you can use a TESR to render the Block . If you want to use a JSON model, override it to return 3. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 19, 201510 yr Author That seems to work when I place it above ground, but when I place it in a hole, it gives me world holes in the sides and completely screws up the lighting too... Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*. Also this. Check it out. http://i.imgur.com/J4rrGt6.png[/img]
August 19, 201510 yr That typically has to do with the other methods you overrode in your block. Is what you showed for your block the whole block? Long time Bukkit & Forge Programmer Happy to try and help
August 19, 201510 yr Author Yes, that's the whole block class. Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*. Also this. Check it out. http://i.imgur.com/J4rrGt6.png[/img]
August 20, 201510 yr Author UPDATE After adding @Override public int getRenderType() { return 3; } It seems as though it's rendering correctly, but when place in a hole, you can see through the world to the side of the model, as seen in this screenshot: The lighting is also completely screwed up for some reason. Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*. Also this. Check it out. http://i.imgur.com/J4rrGt6.png[/img]
August 20, 201510 yr You need to override Block#isOpaqueCube to return false if your Block isn't a full cube. This way the adjacent Block s will still be rendered. The Grey Ghost has a post on transparent blocks here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 20, 201510 yr Author I solved the world holes, but the lighting for the model is still glitched. For some reason everything that is facing the side of a block is completely black. When I break a block next to the model, the lighting glitch on that side disappears, and when I place it again the glitch comes back. As that is the case, I'm thinking it might not be a glitch, but I'd like to know if there's any way to disable the lighting entirely for the model without using a TESR. Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*. Also this. Check it out. http://i.imgur.com/J4rrGt6.png[/img]
August 20, 201510 yr Author I suppose it doesn't matter that much. I'm guessing absolutely no-one's going to put the model in a hole, and if they do they probably won't care about lighting glitches. Nobody puts something in a hole to get a better view of it. Who are you? Why have you brought me here? And why are there so many PewDiePie fanboys surrounding meeeeeeeee....... *falls into pit and dies*. Also this. Check it out. http://i.imgur.com/J4rrGt6.png[/img]
August 20, 201510 yr You should override Block#getBlockLayer to return the appropriate layer (explained in TGG's post) and Block#isFullCube to return false . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.