Elemental Posted June 23, 2022 Share Posted June 23, 2022 package com.el_elemental.overlord_mod.materials.Items; import com.el_elemental.overlord_mod.utils.ModItemGroups; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class SaltyIngot extends Item { public SaltyIngot() { super(new Properties().group(ModItemGroups.MOD_MATERIALS_TAB)); } @SubscribeEvent public ActionResult<ItemStack> onItemRightClick( World world, PlayerEntity player, Hand hand) { if (!world.isRemote) { world.setBlockState(new BlockPos(1, 1, 1), Blocks.DIAMOND_BLOCK.getDefaultState()); } return this.onItemRightClick(world, player, hand); } } Quote Link to comment Share on other sites More sharing options...
Elemental Posted June 23, 2022 Author Share Posted June 23, 2022 (edited) problem exit the game when you try to install the block with the help of an item Edited June 23, 2022 by Elemental Quote Link to comment Share on other sites More sharing options...
Elemental Posted June 23, 2022 Author Share Posted June 23, 2022 (edited) [12:30:23] [Render thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID c028e287-13b2-432b-b43b-f1fa91002cd0 [12:30:23] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception java.lang.StackOverflowError: null at net.minecraft.util.palette.PalettedContainer.lockedSwap(PalettedContainer.java:110) ~[forge:?] {re:classloading} at net.minecraft.world.chunk.ChunkSection.setBlockState(ChunkSection.java:60) ~[forge:?] {re:classloading} at net.minecraft.world.chunk.ChunkSection.setBlockState(ChunkSection.java:54) ~[forge:?] {re:classloading} at net.minecraft.world.chunk.Chunk.setBlockState(Chunk.java:253) ~[forge:?] {re:classloading} at net.minecraft.world.World.setBlockState(World.java:228) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.setBlockState(World.java:205) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.World.setBlockState(World.java:315) ~[forge:?] {re:classloading,pl:accesstransformer:B} at com.el_elemental.overlord_mod.materials.Items.SaltyIngot.onItemRightClick(SaltyIngot.java:25) ~[?:?] {re:classloading} at com.el_elemental.overlord_mod.materials.Items.SaltyIngot.onItemRightClick(SaltyIngot.java:27) ~[?:?] {re:classloading} [12:30:23] [Server thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID 98a088e3-f32c-4397-8a89-d32c0a456ac4 Edited June 23, 2022 by Elemental Quote Link to comment Share on other sites More sharing options...
Elemental Posted June 23, 2022 Author Share Posted June 23, 2022 How to fix infinite recursion ? Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted June 23, 2022 Share Posted June 23, 2022 4 hours ago, Elemental said: return this.onItemRightClick(world, player, hand); i think you mixed up the usage of this and super Quote Link to comment Share on other sites More sharing options...
Elemental Posted October 11, 2022 Author Share Posted October 11, 2022 unfortunately I didn 't mix it up Quote Link to comment Share on other sites More sharing options...
Elemental Posted October 11, 2022 Author Share Posted October 11, 2022 unfortunately I didn 't mix it up I know the basics of java but I don't understand how to apply them Quote Link to comment Share on other sites More sharing options...
Elemental Posted October 11, 2022 Author Share Posted October 11, 2022 (edited) ? Edited October 11, 2022 by Elemental Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.