-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Olloth
committed
Oct 3, 2011
1 parent
1f5c0ae
commit fb06417
Showing
4 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.getspout.testplugin; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.plugin.Plugin; | ||
import org.getspout.spoutapi.SpoutManager; | ||
import org.getspout.spoutapi.inventory.GenericCubeBlockDesign; | ||
import org.getspout.spoutapi.inventory.ItemManager; | ||
import org.getspout.spoutapi.material.block.GenericCubeCustomBlock; | ||
|
||
public class TestBlock extends GenericCubeCustomBlock { | ||
public static int[] faces = new int[]{0,0,0,0,0,0}; | ||
|
||
public TestBlock(Plugin plugin) { | ||
super(plugin, "CustomBlock", new GenericCubeBlockDesign(plugin.getDescription().getName(), "http://dl.dropbox.com/u/40267690/quartz.png", 16, faces), false, 0); | ||
ItemManager im = SpoutManager.getItemManager(); | ||
im.setCustomItemBlock(getCustomId(), getRawId(), (short) 0); | ||
im.setItemTexture(Material.FLINT, (short) getCustomId(), plugin, "http://dl.dropbox.com/u/40267690/quartz.png"); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/org/getspout/testplugin/TestBlockListener.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.getspout.testplugin; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.event.block.BlockBreakEvent; | ||
import org.bukkit.event.block.BlockListener; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.getspout.spoutapi.SpoutManager; | ||
import org.getspout.spoutapi.block.SpoutBlock; | ||
import org.getspout.spoutapi.inventory.ItemManager; | ||
|
||
public class TestBlockListener extends BlockListener { | ||
|
||
@Override | ||
public void onBlockBreak(BlockBreakEvent event) { | ||
super.onBlockBreak(event); | ||
ItemManager im = SpoutManager.getItemManager(); | ||
|
||
SpoutBlock block = im.getSpoutBlock(event.getBlock()); | ||
|
||
if(block.getType().equals(Material.DIRT)) { | ||
int id = block.getCustomBlockId(); | ||
ItemStack is = im.getCustomItemStack(TestPlugin.testBlock, 1); | ||
if(id == TestPlugin.testBlock.getCustomId()) { | ||
block.getWorld().dropItem(block.getLocation(), is); | ||
} | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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