diff options
author | Dico200 <dico.karssiens@gmail.com> | 2015-05-01 21:46:24 +0200 |
---|---|---|
committer | Dico200 <dico.karssiens@gmail.com> | 2015-05-01 21:46:24 +0200 |
commit | 37dc80305fe870c564daa5603eb35ea627969ca8 (patch) | |
tree | 791632bbf55224337b96e3bc4bec542b52a3e804 /blockplacemods.py | |
parent | ad9de19d5da0030621573939c9dbb817e3e866d1 (diff) |
More blockplacemods
Trying to make it place an item (in this case 1 piece of redstone dust)
in a furnace. I know that it creates the ItemStack correctly, I know
that in this case .getInventory() returns an instance of
FurnaceInventory and I know that .update() is returning True meaning it
updated the blockstate successfully. However, the item is not appearing
in the furnace. Any idea why?
Diffstat (limited to 'blockplacemods.py')
-rw-r--r-- | blockplacemods.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/blockplacemods.py b/blockplacemods.py index a8f15d8..87bac71 100644 --- a/blockplacemods.py +++ b/blockplacemods.py @@ -1,6 +1,9 @@ from helpers import * from basecommands import simplecommand import org.bukkit.event.block.BlockBreakEvent as BlockBreakEvent +import org.bukkit.block.Furnace as Furnace +import org.bukkit.inventory.ItemStack as ItemStack +import org.bukkit.Material as Material denyslabcorrection = open_json_file("denyslabcorrection", []) #Players that don't want slabs corrected denyautofill = open_json_file("denyautocauldronfill", []) @@ -94,11 +97,15 @@ def on_block_place(event): return uuid = uid(player) block = event.getBlockPlaced() - if uuid not in denyslabcorrection and str(block.getType()) in ("WOOD_STEP", "STEP") and block.getData() < 8: + material = str(block.getType()) + if uuid not in denyslabcorrection and material in ("WOOD_STEP", "STEP") and block.getData() < 8: block.setData(block.getData() + 8) # Flip upside down - elif uuid not in denyautofill and str(block.getType()) == "CAULDRON": + elif uuid not in denyautofill and material == "CAULDRON": block.setData(3) #3 layers of water, 3 signal strength - + elif material == "FURNACE": + state = block.getState() + state.getInventory().setSmelting(ItemStack(Material.REDSTONE)) + state.update() @hook.event("player.PlayerInteractEvent", "monitor") def on_interact(event): @@ -114,7 +121,4 @@ def on_interact(event): server.getPluginManager().callEvent(event2) data = block.getData() if not event2.isCancelled() and str(block.getType()) == "CAULDRON": - if data > 0: - block.setData(data - 1) #Lower water level by one - else: - block.setData(3) #Set water level back to 3 + block.setData(data - 1 if data > 0 else 3) |