Posted March 12, 20196 yr New in making minecraft mods here. For 2 days I have been trying to make block clickable by adding onBlockActiavted function (/event ?)(@Override included) to it, so I made new class extended it with block , of course it didn't work, so after some reasearch I have found that block don't have onBlockActivated in it so I tried with block.BlockContainer, but eclipse show me that there is no onBlockActivated in it. At this point I started to look on some examples of 1.12 mods and most of them use onBlockActivated with BlockContainer extended. I am asking for help because I can't continue with project without it. Thanks for any help.
March 12, 20196 yr The onBlockActivated method exists in the Block class. So extending your class with Block should work. Maybe post how you tried overriding the method in your class.
March 12, 20196 yr Post your code. Block#onBlockActivated should work. Edited March 12, 20196 yr by DavidM Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
March 12, 20196 yr Author package com.mkk.testmod.blocks.special.infuser; import com.mkk.testmod.init.ModBlocks; import com.mkk.testmod.init.ModItems; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class Infuser extends Block implements ITileEntityProvider { //tried with this as well public Infuser(String name) { super(Material.IRON); setSoundType(SoundType.ANVIL); setHardness(3f); setResistance(7f); setLightLevel(10/16f); setLightOpacity(3); setHarvestLevel("pickaxe", 1); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.REDSTONE); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } //some of my code return true; } public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } @Override public TileEntity createNewTileEntity(World arg0, int arg1) { return new InfuserContainerTE(); } As you can see it's pretty basic because I want to first get rightclick work
March 12, 20196 yr 3 minutes ago, mkkl said: ItemStack heldItem This parameter does not exist in the onBlockActivated method.
March 12, 20196 yr Author Feel like an idiot now, but it confuses me becouse I have tried to even find onBlockActivated in block class and wasn't able to find it for some reason, and in docs there was itemstack as well. Anyway thanks for help, really appreciate it.
March 12, 20196 yr Any time @Override yells at you, you made a mistake. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
March 13, 20196 yr 10 hours ago, mkkl said: implements ITileEntityProvider Also don’t use this, just override hasTileEntity and createTileEntity 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.