67 lines
2.3 KiB
Java
67 lines
2.3 KiB
Java
package net.paladrill.paladrillmod.procedure;
|
|
|
|
import net.paladrill.paladrillmod.ElementsPaladrillmodMod;
|
|
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import java.util.Random;
|
|
import java.util.Map;
|
|
|
|
@ElementsPaladrillmodMod.ModElement.Tag
|
|
public class ProcedureExtrapolatedBucketRightClickedOnBlock extends ElementsPaladrillmodMod.ModElement {
|
|
public ProcedureExtrapolatedBucketRightClickedOnBlock(ElementsPaladrillmodMod instance) {
|
|
super(instance, 168);
|
|
}
|
|
|
|
public static void executeProcedure(Map<String, Object> dependencies) {
|
|
if (dependencies.get("itemstack") == null) {
|
|
System.err.println("Failed to load dependency itemstack for procedure ExtrapolatedBucketRightClickedOnBlock!");
|
|
return;
|
|
}
|
|
if (dependencies.get("x") == null) {
|
|
System.err.println("Failed to load dependency x for procedure ExtrapolatedBucketRightClickedOnBlock!");
|
|
return;
|
|
}
|
|
if (dependencies.get("y") == null) {
|
|
System.err.println("Failed to load dependency y for procedure ExtrapolatedBucketRightClickedOnBlock!");
|
|
return;
|
|
}
|
|
if (dependencies.get("z") == null) {
|
|
System.err.println("Failed to load dependency z for procedure ExtrapolatedBucketRightClickedOnBlock!");
|
|
return;
|
|
}
|
|
if (dependencies.get("world") == null) {
|
|
System.err.println("Failed to load dependency world for procedure ExtrapolatedBucketRightClickedOnBlock!");
|
|
return;
|
|
}
|
|
ItemStack itemstack = (ItemStack) dependencies.get("itemstack");
|
|
int x = (int) dependencies.get("x");
|
|
int y = (int) dependencies.get("y");
|
|
int z = (int) dependencies.get("z");
|
|
World world = (World) dependencies.get("world");
|
|
if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getMaterial() == Material.LAVA)) {
|
|
{
|
|
ItemStack _ist = (itemstack);
|
|
if (_ist.attemptDamageItem((int) 1, new Random(), null)) {
|
|
_ist.shrink(1);
|
|
_ist.setItemDamage(0);
|
|
}
|
|
}
|
|
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
|
|
}
|
|
if (((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getMaterial() == Material.WATER)) {
|
|
{
|
|
ItemStack _ist = (itemstack);
|
|
if (_ist.attemptDamageItem((int) 1, new Random(), null)) {
|
|
_ist.shrink(1);
|
|
_ist.setItemDamage(0);
|
|
}
|
|
}
|
|
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
|
|
}
|
|
}
|
|
}
|