Posted February 21, 20223 yr Hello everyone, I am trying to check wether a player is at an ocean/beach, and then gives the player a Salty Water Bucket instead of a normal Water Bucket. I got it kinda working, up until the point it's not giving me the Salty Water Bucket. This is what I have now: public class BucketFillHandler { @SubscribeEvent public static void onBucketFill(@NotNull FillBucketEvent event) { Player player = event.getPlayer(); BlockPos pos = new BlockPos(player.getX(), player.getY(), player.getZ()); if (event.getWorld().isClientSide()) { if (event.getWorld().getBiomeManager().getBiome(pos).getRegistryName().toString().equals("minecraft:beach")) { if (event.getPlayer() != null) { HitResult target = event.getTarget(); if (target != null && target.getType() == HitResult.Type.BLOCK) { BlockState state = event.getWorld().getBlockState(new BlockPos(target.getLocation())); Material material = state.getMaterial(); if (material == Material.WATER && (Integer) state.getValue(LiquidBlock.LEVEL) == 0) { event.setResult(Event.Result.ALLOW); System.out.println("YES"); // This is just for testing purposes. event.setFilledBucket(new ItemStack(ModItems.SALTY_WATER_BUCKET.get(), 1)); // This is what doesn't work } } } } } } } Edited February 21, 20223 yr by airpodjoch_
February 21, 20223 yr Author Wow. It was that simple. I actually scrapped that off my list if possible fixes, when my game crashed last time I used the if statement with that condition. However, before I made this forum post I changed the script around a little, not checking if this would actually work. I got to say that, it's kinda weird isClientSide() basically means "are you a server". Anyway, I got it fixed by making it: if (!event.getWorld().isClientSide()) {}
February 22, 20223 yr Author Ah ok. So the goal is to give the player the bucket from the server side, and not the client side? I thought it was the other way around.
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.