166 lines
7.1 KiB
Java
166 lines
7.1 KiB
Java
package net.paladrill.paladrillmod.procedure;
|
|
|
|
import net.paladrill.paladrillmod.item.ItemPalaMixedCoal;
|
|
import net.paladrill.paladrillmod.item.ItemOrangeBlueFruit;
|
|
import net.paladrill.paladrillmod.item.ItemOkamiFruit;
|
|
import net.paladrill.paladrillmod.item.ItemKiwano;
|
|
import net.paladrill.paladrillmod.item.ItemEggPlantFruit;
|
|
import net.paladrill.paladrillmod.item.ItemCreativeMixedCoal;
|
|
import net.paladrill.paladrillmod.ElementsPaladrillmodMod;
|
|
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.tileentity.TileEntityLockableLoot;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import java.util.Map;
|
|
|
|
@ElementsPaladrillmodMod.ModElement.Tag
|
|
public class ProcedurePaladiumCrusherUpdateTick extends ElementsPaladrillmodMod.ModElement {
|
|
public ProcedurePaladiumCrusherUpdateTick(ElementsPaladrillmodMod instance) {
|
|
super(instance, 203);
|
|
}
|
|
|
|
public static void executeProcedure(Map<String, Object> dependencies) {
|
|
if (dependencies.get("x") == null) {
|
|
System.err.println("Failed to load dependency x for procedure PaladiumCrusherUpdateTick!");
|
|
return;
|
|
}
|
|
if (dependencies.get("y") == null) {
|
|
System.err.println("Failed to load dependency y for procedure PaladiumCrusherUpdateTick!");
|
|
return;
|
|
}
|
|
if (dependencies.get("z") == null) {
|
|
System.err.println("Failed to load dependency z for procedure PaladiumCrusherUpdateTick!");
|
|
return;
|
|
}
|
|
if (dependencies.get("world") == null) {
|
|
System.err.println("Failed to load dependency world for procedure PaladiumCrusherUpdateTick!");
|
|
return;
|
|
}
|
|
int x = (int) dependencies.get("x");
|
|
int y = (int) dependencies.get("y");
|
|
int z = (int) dependencies.get("z");
|
|
World world = (World) dependencies.get("world");
|
|
double fuelAmount = 0;
|
|
double orangeBlueAmount = 0;
|
|
double chance = 0;
|
|
if (((((new Object() {
|
|
public int getAmount(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot) {
|
|
ItemStack stack = ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
if (stack != null)
|
|
return stack.getCount();
|
|
}
|
|
return 0;
|
|
}
|
|
}.getAmount(new BlockPos((int) x, (int) y, (int) z), (int) (0))) >= 1) && ((new Object() {
|
|
public int getAmount(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot) {
|
|
ItemStack stack = ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
if (stack != null)
|
|
return stack.getCount();
|
|
}
|
|
return 0;
|
|
}
|
|
}.getAmount(new BlockPos((int) x, (int) y, (int) z), (int) (1))) >= 1)) && ((((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (0))).getItem() == new ItemStack(ItemOrangeBlueFruit.block, (int) (1))
|
|
.getItem()) || (((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (0))).getItem() == new ItemStack(ItemKiwano.block, (int) (1)).getItem())
|
|
|| (((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (0)))
|
|
.getItem() == new ItemStack(ItemOkamiFruit.block, (int) (1)).getItem()) || ((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (0)))
|
|
.getItem() == new ItemStack(ItemEggPlantFruit.block, (int) (1)).getItem()))))
|
|
&& ((((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (1))).getItem() == new ItemStack(ItemPalaMixedCoal.block, (int) (1))
|
|
.getItem()) || ((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (1)))
|
|
.getItem() == new ItemStack(ItemCreativeMixedCoal.block, (int) (1)).getItem()))
|
|
&& ((new Object() {
|
|
public double getValue(BlockPos pos, String tag) {
|
|
TileEntity tileEntity = world.getTileEntity(pos);
|
|
if (tileEntity != null)
|
|
return tileEntity.getTileData().getDouble(tag);
|
|
return -1;
|
|
}
|
|
}.getValue(new BlockPos((int) x, (int) y, (int) z), "luck")) < 1))))) {
|
|
{
|
|
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
((TileEntityLockableLoot) inv).decrStackSize((int) (0), (int) (1));
|
|
}
|
|
if (((!((new Object() {
|
|
public ItemStack getItemStack(BlockPos pos, int sltid) {
|
|
TileEntity inv = world.getTileEntity(pos);
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
return ((TileEntityLockableLoot) inv).getStackInSlot(sltid);
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}.getItemStack(new BlockPos((int) x, (int) y, (int) z), (int) (1))).getItem() == new ItemStack(ItemCreativeMixedCoal.block, (int) (1))
|
|
.getItem())) && (Math.random() < 0.2))) {
|
|
{
|
|
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
|
|
if (inv instanceof TileEntityLockableLoot)
|
|
((TileEntityLockableLoot) inv).decrStackSize((int) (1), (int) (1));
|
|
}
|
|
}
|
|
if (!world.isRemote) {
|
|
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
|
|
TileEntity _tileEntity = world.getTileEntity(_bp);
|
|
IBlockState _bs = world.getBlockState(_bp);
|
|
if (_tileEntity != null)
|
|
_tileEntity.getTileData().setDouble("luck", ((new Object() {
|
|
public double getValue(BlockPos pos, String tag) {
|
|
TileEntity tileEntity = world.getTileEntity(pos);
|
|
if (tileEntity != null)
|
|
return tileEntity.getTileData().getDouble(tag);
|
|
return -1;
|
|
}
|
|
}.getValue(new BlockPos((int) x, (int) y, (int) z), "luck")) + 0.0078125));
|
|
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
|
|
}
|
|
}
|
|
}
|
|
}
|