tuturox

Untitled

Aug 16th, 2022
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. package net.sniklz.firstmod.block;
  2.  
  3. import net.minecraft.core.BlockPos;
  4. import net.minecraft.network.chat.TextComponent;
  5. import net.minecraft.world.entity.LivingEntity;
  6. import net.minecraft.world.item.ItemStack;
  7. import net.minecraft.world.level.Level;
  8. import net.minecraft.world.level.block.Block;
  9. import net.minecraft.world.level.block.state.BlockState;
  10. import org.jetbrains.annotations.Nullable;
  11.  
  12. public class PlacedBlock extends Block {
  13.  
  14.     public PlacedBlock(Properties properties) {
  15.         super(properties);
  16.     }
  17.  
  18.     @Override
  19.     public void setPlacedBy(Level pLevel, BlockPos pPos, BlockState pState, @Nullable LivingEntity pPlacer, ItemStack pStack) {
  20.         super.setPlacedBy(pLevel, pPos, pState, pPlacer, pStack);
  21.  
  22.         if(pLevel.isWaterAt(pPos.below())) {
  23.             pPlacer.sendMessage(new TextComponent("Under block is water" ), pPlacer.getUUID());
  24.         } else {
  25.             pPlacer.sendMessage(new TextComponent("Under block no water(" ), pPlacer.getUUID());
  26.         }
  27.  
  28.     }
  29. }
  30.  
Add Comment
Please, Sign In to add comment