mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-26 23:03:21 +00:00
1.7.2 commit
This commit is contained in:
1 parent
92e097eaa2
commit
9aaa65feb4
548 files changed
+46982
-2
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class LifeBucketHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent event)
|
||||
{
|
||||
ItemStack result = fillCustomBucket(event.world, event.target);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.result = result;
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
|
||||
public ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
|
||||
{
|
||||
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
if (block!=null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0)
|
||||
{
|
||||
world.setBlock(pos.blockX, pos.blockY, pos.blockZ, block);
|
||||
return new ItemStack(ModItems.bucketLife);
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user