Posted November 3, 20186 yr Hello everyone. Here is my issue: I don't know how to make a bloc only collidable for players. Arrows can cross it which is very annoying because I want to make a shield which stop projectiles and not players. Any help would be great.
November 3, 20186 yr Author Do you mean like this? @Override public void addCollisionBoxTo List(IBlockState state, World world, BlockPos pos, entity.projectiles)
November 3, 20186 yr Author In fact, I'm not used to this method. I found an example: 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); } So what do I have to do with these information?
November 3, 20186 yr Author public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) if(entity.projectiles) Edited November 3, 20186 yr by MosquitoFRA
November 3, 20186 yr Author Sorry, I was editing. I don't know why there is @Nullable Entity entityIn?
November 3, 20186 yr Author public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) if(entity.projectiles) { super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under); super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle); super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top); } Is it like this?
November 4, 20186 yr Author For the entity, it's entityLiving (I think it's for projectiles). And I don't know to do this null check { if(EntityLiving) super.addCollisionBoxToList(pos, entityBox, collidingBoxes, under); super.addCollisionBoxToList(pos, entityBox, collidingBoxes, middle); super.addCollisionBoxToList(pos, entityBox, collidingBoxes, top); } Edited November 4, 20186 yr by MosquitoFRA
November 4, 20186 yr Author Could you correct it, please ... I didn't find an answer anywhere on google and i tried javadoc but didn't know where to go to find the good method.
November 4, 20186 yr What diesieben was trying to say is that you should learn how to check if an entity is of a given instance or has some particular properties defined in the entity class. I'm pretty sure that the entity class itself has no "projectiles" property, and even if it does i don't think it's a boolean by the name. That being said, you should do something like this (assuming you are using Forge 1.12.2) @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if(entityIn instanceof EntityPlayer) { // Do stuff } } In this case you check if the entity that collides with the block is a player. If so then you can do whatever you want (like adding the collision box). Don't blame me if i always ask for your help. I just want to learn to be better
November 4, 20186 yr @MosquitoFRA there are hundreds of resources to help you learn basic Java online. I started with Codecademy. Please run through some basic Java tutorials or courses before you keep trying to make mods. You are setting yourself up for constant frustration and failure until you learn more Java.
November 5, 20186 yr Author Huge thanks @JimiIT92. I will try. And finally decided to look at some videos.
November 5, 20186 yr On 11/4/2018 at 5:29 PM, JimiIT92 said: ... @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if(entityIn instanceof EntityPlayer) { // Do stuff } } ... And now you've just give him the code which he can copy-paste without learning anything from it. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
November 5, 20186 yr Author @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if(entityIn instanceof EntityPlayer) { public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); } } } I have this but it doesn't work Edited November 5, 20186 yr by MosquitoFRA
November 5, 20186 yr Learn java. Just the basics, 5 minutes of learning java and you will understand how horribly wrong that is on every level 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)
November 5, 20186 yr Author @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if(entityIn instanceof EntityPlayer) { getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); } } } I tried this but it didn't work
November 5, 20186 yr Learn Java. Learn Java. Learn Java. Learn Java. Edited November 5, 20186 yr by larsgerrits Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
November 6, 20186 yr Ok, do you know what a method is? right now your trying to define a method inside another method. This will never* work. I see you tried to fix your issue by removing “public AxisAlignedBB”, but your still trying to define a method inside a method, you’ve just now mangled the inner method. What you need to do where your trying to define the second (where your sure the entity is a player) method is run some code adding custom bounding boxes (look at fences), and otherwise (if the entity is not a player) call super (or run other logic). *unless your instantiating an anonymous class (which you won’t learn about for a long time and may never need) 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)
November 6, 20186 yr This has been said before “these formums are not a java tutorial”. Feel free to pm me on Discord (Cadiboo#8887) if you want help with this though 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)
November 7, 20186 yr Author Sorry, but I don't have Discord. @Override class collisionBox { public AxisAlignedBB addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if(entityIn instanceof EntityPlayer) { class boundingBox { void getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return super.AxisAlignedBB[](0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); } } } } } I tried to correct the code as best as I could and search again on Google, but I can't figure it out.
November 7, 20186 yr 56 minutes ago, MosquitoFRA said: Sorry, but I don't have Discord. @Override class collisionBox { public AxisAlignedBB addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if(entityIn instanceof EntityPlayer) { class boundingBox { void getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return super.AxisAlignedBB[](0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); } } } } } I tried to correct the code as best as I could and search again on Google, but I can't figure it out. Please, just go learn Java first. You have absolutely no idea what you are doing. That code won't even compile your IDE should be yelling its head off at you. 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.
November 8, 20186 yr 1 hour ago, Animefan8888 said: go learn Java On 11/6/2018 at 12:54 PM, Cadiboo said: these formums are not a java tutorial As I said though you can pm me for some help 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)
November 8, 20186 yr Author Sorry @Cadiboo, but I told that I haven't Discord presviously. But I found how to pm you on this forum.
November 9, 20186 yr I recommended discord because it - doesn’t have a 1 minute delay between messages - is something pretty much every gamer/programmer has 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)
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.