Posted June 8, 20214 yr hi im trying to get it so that when i use bonemeal on soul soil it turns into ferilized soul soil i can get it so when i use bone meal on any block it changes to fertilized soul soil but as as soon as i try to restrict it to only soul soil it stops working @SubscribeEvent public void onSoulSoilClick(PlayerInteractEvent.RightClickBlock e) { World world = e.getWorld(); PlayerEntity player = e.getPlayer(); ItemStack hand = e.getItemStack(); BlockPos targetpos = e.getPos(); BlockState state = world.getBlockState(targetpos); Block block = state.getBlock(); if (world.isRemote) { return; } if (!hand.getItem().equals(Items.BONE_MEAL)) { return; } if (block.equals(Blocks.SOUL_SOIL)) { world.setBlockState(targetpos, ModBlocks.FERTILE_SOUL_SOIL.get().getDefaultState()); } } @SubscribeEvent public void onSoulSoilClick(PlayerInteractEvent.RightClickBlock e) { World world = e.getWorld(); PlayerEntity player = e.getPlayer(); ItemStack hand = e.getItemStack(); BlockPos targetpos = e.getPos(); BlockState state = world.getBlockState(targetpos); Block block = state.getBlock(); if (world.isRemote) { return; } if (!hand.getItem().equals(Items.BONE_MEAL)) { return; } if (block.equals(Blocks.SOUL_SOIL)) { world.setBlockState(targetpos, ModBlocks.FERTILE_SOUL_SOIL.get().getDefaultState()); } if (!player.isCreative()) { hand.shrink(1); } } Edited June 8, 20214 yr by TamsynnImogen
June 8, 20214 yr Author the fertilized soul soil allows crops to grow on it. original plan was to get soul soil to be tillable and then get it so it acts like farmland but needing lava instead of water but couldnt figure out how to get it to be tillable so changed the plan and got it so you craft it with bone meal to make it fertilized and that'll take over wich worked but thought would be more fun to have it instead of a crafting recipe to get it done in world sortta thing
June 8, 20214 yr Author so you can add things like IGrowable to vanilla blocks? i'll look into it after i finish work tonight
June 8, 20214 yr Author oh ok well ive fixed it anyway all it was instead of if (block.equals(Blocks.SOUL_SOIL)) i used if (block == (Blocks.SOUL_SOIL)) and it works (probably could remove the brackes around Blocks.SOUL_SOIL but was just a v quick test i'll look into what you susgested later though as its probably better but for now im just glad it worked
June 8, 20214 yr Author well for some reason with the 1st option it didnt work but when used the second option it worked. im not questioning it as long as it works for now is good enough for me
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.