Last active
December 17, 2015 16:39
-
-
Save azenla/5640262 to your computer and use it in GitHub Desktop.
Example Script for GroovyForge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mods.groovyforge.* | |
| static def load() { | |
| GroovyForge.logger.info("====It Worked! Yay for GroovyForge!====") | |
| ForgeHelper.addItem(new BlockPlacer(10353), "Block Placer Example", "groovyforge.example.itemBlockPlacer") | |
| } | |
| import net.minecraft.client.renderer.texture.IconRegister; | |
| import net.minecraft.entity.player.EntityPlayer; | |
| import net.minecraft.item.Item; | |
| import net.minecraft.item.ItemStack; | |
| import net.minecraft.world.World; | |
| class BlockPlacer extends Item { | |
| public BlockPlacer(int par1) { | |
| super(par1) | |
| this.setMaxStackSize(1) | |
| this.setUnlocalizedName("groovyforge.example.BlockPlacer") | |
| } | |
| @Override | |
| public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) { | |
| player.capabilities.allowEdit = false | |
| for(int i = 0; i<15; i++) { | |
| world.setBlockToAir(x, y + i, z) | |
| world.setBlockToAir(x, y, z + i) | |
| world.setBlockToAir(x + 1, y, z) | |
| } | |
| player.capabilities.allowEdit = true; | |
| try { | |
| Thread.sleep(700) | |
| } catch (InterruptedException e) { | |
| e.printStackTrace() | |
| } | |
| return true | |
| } | |
| @Override | |
| public void registerIcons(IconRegister register) { | |
| register.registerIcon(blazeRod.getIcon(new ItemStack(blazeRod, 1), 1).getIconName()) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment