Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mrcyberdragon.lightthenight.tileentities;
- import com.mrcyberdragon.lightthenight.init.ModBlocks;
- import net.minecraft.init.Blocks;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.ITickable;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- import java.util.Random;
- public class TileEntityMudBlock extends TileEntity implements ITickable {
- @Override
- public void update() {
- World worldIn = getWorld();
- Random random = new Random();
- BlockPos pos = this.getPos();
- if (worldIn.getWorldTime() > 13000) {
- if (worldIn.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())).getBlock() == Blocks.WATER && (worldIn.getBlockState(new BlockPos(pos.getX(), pos.getY() + 2, pos.getZ())).getBlock() == Blocks.AIR||worldIn.getBlockState(new BlockPos(pos.getX(), pos.getY() + 2, pos.getZ())).getBlock() == Blocks.WATER)) {
- if (worldIn.getBlockState(new BlockPos(pos.getX(), pos.getY() + 3, pos.getZ())).getBlock() == Blocks.AIR) {
- if(random.nextInt(100)==1)worldIn.setBlockState(new BlockPos(pos.getX(), pos.getY() + 3, pos.getZ()), ModBlocks.WISP_FLAME.getDefaultState());
- }
- } else {
- if (worldIn.getBlockState(new BlockPos(pos.getX(), pos.getY() + 3, pos.getZ())).getBlock() == ModBlocks.WISP_FLAME) {
- worldIn.setBlockToAir(new BlockPos(pos.getX(), pos.getY() + 3, pos.getZ()));
- }
- }
- } else {
- if (worldIn.getBlockState(new BlockPos(pos.getX(), pos.getY() + 3, pos.getZ())).getBlock() == ModBlocks.WISP_FLAME) {
- worldIn.setBlockToAir(new BlockPos(pos.getX(), pos.getY() + 3, pos.getZ()));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement