Jump to content

Custom Hit box of Block 1.12


Ragnar

Recommended Posts

this is code but not working, what am I doing wrong?

it is for that block format

asdsad.png.d3da2bc19b13ecbcb68c706ce4525140.png

 

    public static final AxisAlignedBB under = new AxisAlignedBB(0.0625D, 0, 0.0625D, 0.9375D, 0.125D, 0.9375D);
    public static final AxisAlignedBB middle = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);
    public static final AxisAlignedBB top = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);

 

@Override
    public AxisAlignedBB getBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
        return under;
    }
    
    public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

Link to comment
Share on other sites

If your asking how to add collision boxes to the list, you need to override addCollisionBoxToList() (this one has the parameters: IBlockState, World, BlockPos, AxisAlignedBB, List<AxisAlignedBB>, Entity, boolean) and in this method call this.addCollisionBoxToList() (this one has the parameters: BlockPos, AxisAlignedBB, List<AxisAlignedBB>, AxisAlignedBB) for each box. An example of this can be found here: 

https://github.com/Cadiboo/WIPTechAlpha/blob/c179d852e43f08d6e9f34db62bd2a59c36475e6b/src/main/java/cadiboo/wiptech/block/BlockWire.java#L130-L157

 

If your asking about how to make your selected bounding box fit your model, in short, you can’t do this.

This is because you can only return one bounding box from getBoundingBox, getCollisionBoundingBox and getSelectedBoundingBox. However, as you’ve seen, you can add more than one box in addCollisionBoxesToList.

 

If you really want to do this you can though: If you want to render more than one selected bounding box you can subscribe to the DrawBlockHighlightEvent and draw your own selected bounding box, but I wouldn’t recommend this because

- it’s decently technical and requires knowing how to render boxes (or other shapes if that’s what your going for)

- it completely breaks the selected bounding box for anyone who wants to use a different model for your block in a resource pack

- it doesn’t fit in with the way vanilla does it (this may be what your going for though)

I suggest that you look at what vanilla did with the selected bounding box for the anvil - they made the anvil have a different (smaller) bounding box than a full cube, but didn’t go overboard.

If you still want to render your own selected bounding box, an example can be found here: https://github.com/Cadiboo/WIPTechAlpha/blob/c179d852e43f08d6e9f34db62bd2a59c36475e6b/src/main/java/cadiboo/wiptech/client/ClientEventSubscriber.java#L638-L727 

Edited by Cadiboo
Formatting & included links to examples

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

1 hour ago, Ragnar said:

@Override
    public AxisAlignedBB getBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
        return under;
    }

This method is not needed if you have more than one collision box.

1 hour ago, Ragnar said:

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

This will apply the correct collision boxes.

1 hour ago, Ragnar said:

this is code but not working, what am I doing wrong?

it is for that block format

What you are pointing out is the selected bounding box. You have changed the collision bounding blocks.

 

You can override getSelectedBoundingBox(IBlockState, World, BlockPos)

 

To return an AxisAlignedBB to change the drawn outline. However, if you need to have more than one box drawn...

16 minutes ago, Cadiboo said:

If you really want to do this you can though: If you want to render more than one selected bounding box you can subscribe to the DrawBlockHighlightEvent and draw your own

And

17 minutes ago, Cadiboo said:

 

Finally,

13 minutes ago, Ragnar said:

he is a forge modder you are only a member so I think he knows more

This isn't necessarily true. Anyone can get the "Forge Modder" tag if they want it. However I have probably spent more time within Forge/Minecraft code than he has. But I haven't done so longer than many more people on here, IE draco18s, diesieben07, etc. They definitely have also spent more time programming than myself.

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.

Link to comment
Share on other sites

1 minute ago, Animefan8888 said:

However I have probably spent more time within Forge/Minecraft code than he has.

@Animefan8888 is much more experienced than I am, I’ve only been modding for a little while, and I didn’t even know Java before I started.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

2 minutes ago, Cadiboo said:

@Animefan8888 is much more experienced than I am, I’ve only been modding for a little while, and I didn’t even know Java before I started.

I'd like to say that you have definitely grown since you started. And that is how I started as well, and it is what made me decide my career path.

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.

Link to comment
Share on other sites

Just now, Ragnar said:

the drawing block I will use in DrawBlockHighlightEvent is that? 
 public static final AxisAlignedBB under = new AxisAlignedBB(0.0625D, 0, 0.0625D, 0.9375D, 0.125D, 0.9375D);

I don't understand your question.

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.

Link to comment
Share on other sites

Just now, Ragnar said:

the block (model) is also defined by AxisAlignedBB in event?

You don't have to, Minecraft does their rendering in the RenderGlobal class at line 1996. However you can do whatever you want for your rendering.

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.

Link to comment
Share on other sites

and this not work

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

 

but this 

@Override
    public AxisAlignedBB getBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
        return under;
    }

with this

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under);

 

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);

        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }

 

work, my hitbox stay in this format (under), but no middle and top, I think because getBoundingBox just returns under

Link to comment
Share on other sites

2 minutes ago, Ragnar said:

my hitbox stay in this format (under), but no middle and top, I think because getBoundingBox just returns under

Your right, I think that if your trying to render more than one (selected) bounding box you have two options:

1) Manually render it yourself with the DrawBlockHighlightEvent (example)

2) return a bounding box that is a union of bottom, middle and top (example)

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

9 minutes ago, Ragnar said:

"union" will not make the right format? is it just going to make a square according to all unions?

Yeah, it doesn’t work horribly though, it’s what fences & iron bars & glass use

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

Could you do the drawing for me this?

    public static final AxisAlignedBB under = new AxisAlignedBB(0.0625D, 0, 0.0625D, 0.9375D, 0.125D, 0.9375D);
    public static final AxisAlignedBB middle = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);
    public static final AxisAlignedBB top = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);

for using in DrawBlockHighlightEvent

Link to comment
Share on other sites

23 minutes ago, Ragnar said:

Could you do the drawing for me this?

    public static final AxisAlignedBB under = new AxisAlignedBB(0.0625D, 0, 0.0625D, 0.9375D, 0.125D, 0.9375D);
    public static final AxisAlignedBB middle = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);
    public static final AxisAlignedBB top = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);

for using in DrawBlockHighlightEvent

I’m not sure, I’m on holiday right now & don’t have a computer with me, the best I can recommend is to copy my code from here, delete stuff you don’t need, and replace the instance of check with a check on your block. I’ll try and modify my code and then post it, I can’t use spoilers/code tags on mobile so prepare for a wall of pseudo code

Edited by Cadiboo
Added link

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

2 minutes ago, Cadiboo said:

the best I can recommend is to copy my code from here, delete stuff you don’t need, and replace the instance of check with a check on your block

I really did not understand how DrawBlockHighlightEvent works, so I did not do this :( But anyway, thank you

Edited by Ragnar
Link to comment
Share on other sites

@SubscribeEvent

public static void drawBlockHighlightEvent(final DrawBlockHighlightEvent event) {

try {

final EntityPlayer player = event.getPlayer();

if (player == null) {

return;

}

final RayTraceResult rayTraceResult = event.getTarget();

if ((rayTraceResult == null) || (rayTraceResult.typeOfHit != RayTraceResult.Type.BLOCK)) {

return;

}

final World world = player.world;

if (world == null) {

return;

}

final float partialTicks = event.getPartialTicks();

final BlockPos pos = rayTraceResult.getBlockPos();

final IBlockState blockState = world.getBlockState(pos);

if ((blockState.getMaterial() == Material.AIR) || !world.getWorldBorder().contains(pos)) {

return;

}

final Block block = blockState.getBlock();

if (!(block instanceof YOURBLOCK)) {

return;

}

event.setCanceled(true);

final List<AxisAlignedBB> boxes = new ArrayList<>();

blockState.addCollisionBoxToList(world, pos, new AxisAlignedBB(pos), boxes, player, false);

final double renderX = player.lastTickPosX + ((player.posX - player.lastTickPosX) * partialTicks);

final double renderY = player.lastTickPosY + ((player.posY - player.lastTickPosY) * partialTicks);

final double renderZ = player.lastTickPosZ + ((player.posZ - player.lastTickPosZ) * partialTicks);

GlStateManager.enableBlend();

GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

GlStateManager.glLineWidth(2.0F);

GlStateManager.disableTexture2D();

GlStateManager.depthMask(false);

for (AxisAlignedBB box : boxes) {

if (box==Block.NULL_AABB) {

continue;

}

final AxisAlignedBB renderBox = box.grow(0.0020000000949949026D).offset(-renderX, -renderY, -renderZ);

event.getContext().drawSelectionBoundingBox(renderBox, 0.0F, 0.0F, 0.0F, 0.4F);

}

GlStateManager.depthMask(true);

GlStateManager.enableTexture2D();

GlStateManager.disableBlend();

} catch (final Exception e) {

event.setCanceled(false);

}

}

 

So much for pseudo code, just put this in a CLIENT @Mod.EventSubscriber class, replace YOURBLOCK and you should be good to go. You should read the documentation on sides and the documentation on events before implementing this, as I said before it’s pretty technical.

 

This code is taken directly from here

 

What this code does:

1) checks if it can & should render a box

2) gets all the boxes from addCollisionBoxToList

3) sets up all the GLStateManager flags needed to render the box

4) renders the box using the RenderGlobal from event.getContext

5) resets all the GLStateManager flags

6) catches any exceptions reverts to normal selection box rendering (you might want to disable this catch part until you get everything working)

 

If any moderators could move the code into a spoiler it would be much appreciated (and then delete this part of the comment).

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

12 minutes ago, Ragnar said:

It did not work, I gave up, I can not do it. :(

What’s not working?

28 minutes ago, Cadiboo said:

You should read the documentation on sides and the documentation on events before implementing this

 

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

Can you please post your code as a GitHub repository so that we can help you? It’s very hard to help when we only have (parts of!) your code from a while hours ago which I assume you have modified plenty since you posted it. From what I see (the selected box seems blacker than usual) the selection box seems to be rendering twice which is a good start to build on - It seems to me that this means you subscribed to the drawBox event properly but may not be getting the box(es) you want to draw properly (or I messed something up in the code I gave you)

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

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

import javax.annotation.Nullable;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class Pedestal extends BlockBase{

    public static final AxisAlignedBB under = new AxisAlignedBB(0.0625D, 0, 0.0625D, 0.9375D, 0.125D, 0.9375D);
    public static final AxisAlignedBB middle = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);
    public static final AxisAlignedBB top = new AxisAlignedBB(0.1875D, 0.125D, 0.1875D, 0.8125D, 0.75D, 0.8125D);
    public static final ArrayList<AxisAlignedBB> all = new ArrayList<AxisAlignedBB>();
    
    public Pedestal(String name, Material material, CreativeTabs creativetab) {
        super(name, material, creativetab);
        setSoundType(SoundType.STONE);
        setHardness(3.0F);
        setHarvestLevel("pickaxe", 1);
        setResistance(35.0F);
    }    
    
    public BlockRenderLayer getBlockLayer() {
        return BlockRenderLayer.CUTOUT;
    }

    public boolean isFullCube(IBlockState state) {
        return false;
    }
    
    public boolean isOpaqueCube(IBlockState state) {
        return false;
    }
    
    @SideOnly(Side.CLIENT)
    public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
    {
        double x = (double)pos.getX();
        double y = (double)pos.getY() + 1.14D;
        double z = (double)pos.getZ();
        
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x + 0.5D, y + 0.2D, z + 0.5D , 0.0D, 0.0D, 0.0D);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, x + 0.5D, y, z + 0.5D, 0.0D, 0.0D, 0.0D); 
       
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x + 0.25D, y + 0.2D, z + 0.25D , 0.0D, 0.0D, 0.0D);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, x + 0.25D, y, z + 0.25D, 0.0D, 0.0D, 0.0D);
        
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x + 0.25D, y + 0.2D, z + 0.75D , 0.0D, 0.0D, 0.0D);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, x + 0.25D, y, z + 0.75D, 0.0D, 0.0D, 0.0D);
        
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x + 0.75D, y + 0.2D, z + 0.25D , 0.0D, 0.0D, 0.0D);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, x + 0.75D, y, z + 0.25D, 0.0D, 0.0D, 0.0D);

        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x + 0.75D, y + 0.2D, z + 0.75D , 0.0D, 0.0D, 0.0D);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, x + 0.75D, y, z + 0.75D, 0.0D, 0.0D, 0.0D);
    }
    
    @SubscribeEvent
    public static void drawBlockHighlightEvent(final DrawBlockHighlightEvent event) {
        try {
            final EntityPlayer player = event.getPlayer();
            if (player == null) {
                return;
            }
            final RayTraceResult rayTraceResult = event.getTarget();
            if ((rayTraceResult == null) || (rayTraceResult.typeOfHit != RayTraceResult.Type.BLOCK)) {
                return;
            }
            final World world = player.world;
            if (world == null) {
                return;
            }
            final float partialTicks = event.getPartialTicks();
            final BlockPos pos = rayTraceResult.getBlockPos();
            final IBlockState blockState = world.getBlockState(pos);
            if ((blockState.getMaterial() == Material.AIR) || !world.getWorldBorder().contains(pos)) {
                return;
            }
            final Block block = blockState.getBlock();
            if (!(block instanceof Pedestal)) {
                return;
            }
            event.setCanceled(true);
            all.add(under);
            all.add(middle);
            all.add(top);
            all.add(candle1);
            all.add(candle2);
            all.add(candle3);
            all.add(candle4);
            all.add(candle5);
            blockState.addCollisionBoxToList(world, pos, new AxisAlignedBB(pos), all, player, false);
            final double renderX = player.lastTickPosX + ((player.posX - player.lastTickPosX) * partialTicks);
            final double renderY = player.lastTickPosY + ((player.posY - player.lastTickPosY) * partialTicks);
            final double renderZ = player.lastTickPosZ + ((player.posZ - player.lastTickPosZ) * partialTicks);
            GlStateManager.enableBlend();
            GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
            GlStateManager.glLineWidth(2.0F);
            GlStateManager.disableTexture2D();
            GlStateManager.depthMask(false);
            for (AxisAlignedBB box : all) {
                if (box==Block.NULL_AABB) {
                    continue;
                }
                final AxisAlignedBB renderBox = box.grow(0.0020000000949949026D).offset(-renderX, -renderY, -renderZ);
                event.getContext().drawSelectionBoundingBox(renderBox, 0.0F, 0.0F, 0.0F, 0.4F);
            }
            GlStateManager.depthMask(true);
            GlStateManager.enableTexture2D();
            GlStateManager.disableBlend();
        } catch (final Exception e) {
            event.setCanceled(false);
        }
    }
    
    public static void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
        addCollisionBoxToList(pos, entityBox, collidingBoxes, under);
        addCollisionBoxToList(pos, entityBox, collidingBoxes, middle);
        addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
    }
}

Link to comment
Share on other sites

27 minutes ago, Cadiboo said:

post your code as a GitHub repository

 

13 minutes ago, Ragnar said:

@SubscribeEvent
    public static void drawBlockHighlightEvent(final DrawBlockHighlightEvent event) {

This should be in a seperate EventSubscribing class or, if you want to ignore convention (as you already are in many other parts of your code), annotate your pedestal class (it should be called BlockPedestal) with “@Mod.EventBusSubscriber”.

 

16 minutes ago, Ragnar said:

        } catch (final Exception e) {
            event.setCanceled(false);

Delete this. Your going to want to see any exceptions that pop up

 

Do you know Java? If not you’ve done remarkably well so far, but you still need to learn it before you continue with modding.

 

32 minutes ago, Cadiboo said:

please post your code as a GitHub repository

The important part of this is “as a GitHub Repository”

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.