Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on June 14, 2015 at 01:24 PM

Section 1 (Java)

package me.mackan.random_mod.blocks;

import me.mackan.random_mod.Main;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;

public class BlackLight extends Block{
	private String name = "blacklight";
	
	public BlackLight(){
		super(Material.rock);
		this.setCreativeTab(CreativeTabs.tabBlock);
		this.setBlockName(Main.MODID+"_"+name);
		this.setBlockTextureName(Main.MODID+":"+name);
		this.setStepSound(soundTypeStone);
		this.lightValue = 15;
		this.blockHardness = (float)1.5;
		
		GameRegistry.registerBlock(this, name);
	}
	
	@Override
	public boolean onBlockActivated(World wor, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
		int v = this.getLightValue(wor, x, y, z);
		
		if(player.isSneaking()){
			ChatComponentText txt = new ChatComponentText("Light level is "+v);
			player.addChatComponentMessage(txt);
		}else{
			if(v > 1){
				v = v-1;
				wor.setBlockMetadataWithNotify(x, y, z, v, 0);
			}else{
				v = 15;
				wor.setBlockMetadataWithNotify(x, y, z, v, 0);
			}
		}
		return true;
	}
	
	@Override
	public int getLightValue(IBlockAccess w, int x, int y, int z) {
		w.getBlock(x, y, z).setLightLevel((float)w.getBlockMetadata(x, y, z));
		return super.getLightValue(w, x, y, z);
	}
	
}