Skip to content

Instantly share code, notes, and snippets.

@thomas15v
Created September 19, 2014 16:29
Show Gist options
  • Save thomas15v/ee41669a256645b58995 to your computer and use it in GitHub Desktop.
Save thomas15v/ee41669a256645b58995 to your computer and use it in GitHub Desktop.
package com.thomas15v.turtlefix;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.FakePlayerFactory;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.world.BlockEvent;
/**
* Created by thomas on 9/19/2014.
*/
public class BreakUtil {
public static Boolean TurtleCanBreakBlock(World world, int x, int y, int z){
BlockEvent event =
new BlockEvent.BreakEvent(x,y,z,world, Block.blocksList[world.getBlockId(x,y,z)],world.getBlockMetadata(x,y,z), FakePlayerFactory.get(
world, "[ComputerCraft]"));
MinecraftForge.EVENT_BUS.post(event);
return event.getResult() != Event.Result.DENY;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment