Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.79 KB | None | 0 0
  1. package com.formas1.ruispantry.blocks.uncorruptor;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.formas1.ruispantry.blocks.BlockBase;
  6. import com.formas1.ruispantry.init.ModBlocks;
  7.  
  8. import net.minecraft.block.SoundType;
  9. import net.minecraft.block.material.Material;
  10. import net.minecraft.block.state.IBlockState;
  11. import net.minecraft.init.Blocks;
  12. import net.minecraft.util.math.BlockPos;
  13. import net.minecraft.world.World;
  14.  
  15. public class Uncorruptor extends BlockBase
  16. {
  17.  
  18.     public Uncorruptor(String name, Material material)
  19.     {
  20.         super(name, material);
  21.         this.setTickRandomly(true);
  22.        
  23.         setSoundType(SoundType.METAL);
  24.         setHardness(5.0F);
  25.         setResistance(15.0F);
  26.         setHarvestLevel("pickaxe", 4);
  27.         setLightLevel(0.5F);
  28.     }
  29.    
  30.     @Override
  31.     public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
  32.     {
  33.        
  34.         //IBlockState west = worldIn.getBlockState(pos.west());
  35.        
  36.         //if(west == Blocks.IRON_BLOCK.getDefaultState())
  37.         //{
  38.         for(int x = -8; x < 16; x++) {
  39.             for(int y = 0; y < 256; y++) {
  40.                 for(int z = -8; z < 16; z++) {
  41.                     BlockPos newPos = new BlockPos(pos.getX()+x, y, pos.getZ()+z);
  42.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_GRASS) {
  43.                         worldIn.setBlockState(newPos, Blocks.GRASS.getDefaultState());
  44.                     }
  45.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_DIRT) {
  46.                         worldIn.setBlockState(newPos, Blocks.GRASS.getDefaultState());
  47.                     }
  48.                    
  49.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_DIRT) {
  50.                         worldIn.setBlockState(newPos, Blocks.DIRT.getDefaultState());
  51.                     }
  52.                    
  53.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_OAK_LOG) {
  54.                         worldIn.setBlockState(newPos, Blocks.LOG.getDefaultState());
  55.                     }
  56.                    
  57.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_OAK_LEAVES) {
  58.                         worldIn.setBlockState(newPos, Blocks.LEAVES.getDefaultState());
  59.                     }
  60.                    
  61.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_OAK_SAPLING) {
  62.                         worldIn.setBlockState(newPos, Blocks.SAPLING.getDefaultState());
  63.                     }
  64.                    
  65.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_COBBLESTONE) {
  66.                         worldIn.setBlockState(newPos, Blocks.COBBLESTONE.getDefaultState());
  67.                     }
  68.                    
  69.                     if(worldIn.getBlockState(newPos).getBlock() == ModBlocks.CORRUPTED_MOSSY_COBBLESTONE) {
  70.                         worldIn.setBlockState(newPos, Blocks.MAGMA.getDefaultState());
  71.                     }
  72.                 }
  73.             //}
  74.         }
  75.     }
  76.     }
  77.    
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement