Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Ragnar

Members
  • Joined

  • Last visited

Everything posted by Ragnar

  1. I'm going to do it, and I did not sleep, I'm still too sleepy to sue hahaha, and I'm sorry I judged you before, I sincerely apologize
  2. I'm sorry, I'm Brazilian, my code is all in English but as my google is activated the translator, when I put the code he translated and did not see and sent translated, sorry
  3. https://github.com/Ragnarrrr/Hit-box/tree/master/.gitignore
  4. but my code still does not work, what's wrong?
  5. the event is working, you said it yourself have to create account ... this it came from the code that you sent me, I have removed it, but it continues in the same way as the previous print
  6. 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); } }
  7. he is not in the format
  8. It did not work, I gave up, I can not do it.
  9. I really did not understand how DrawBlockHighlightEvent works, so I did not do this But anyway, thank you
  10. 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
  11. "union" will not make the right format? is it just going to make a square according to all unions?
  12. 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
  13. can you make me some example of the event to do what I want?
  14. the block (model) is also defined by AxisAlignedBB in event?
  15. 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);
  16. that's not what @Animefan8888 said, he is a forge modder you are only a member so I think he knows more and I created another topic because it was about format, this that about hitbox But anyway, thank you (topic is not resolved)
  17. this is code but not working, what am I doing wrong? it is for that block format 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); }
  18. @Animefan8888 help me kkk
  19. I already have the form, I just need to know how to use it in the method '-'
  20. So how can I do this?
  21. this is the format of my block and I want the hit box of its format, it is not possible to use only one AxisAlignedBB to do exactly that format ...
  22. How do I do this?
  23. the hitbox is just like the under, the middle and top not would I have to make a list to return in getBoundingBox? but he does not accept list
  24. did not work this is full code 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 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; } @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); }
  25. @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); } like this?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.