Я делаю аддон к моду Scape and run parasites 1 12 2 forge.Я сделал блок который по идее должен использовать предметы из этого мода для кастомных крафтов в этом блоке.И не понимаю как сделать так чтобы мой мод использовал предметы того мода для различных целей.В данный момент интересуюсь как сделать так чтобы мой блок использовал предметы из другого мода.
Процедура моего блока:
import net.minecraft.util.math.BlockPos;
import net.minecraft.tileentity.TileEntityLockableLoot;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.init.Items;
import net.minecraft.init.Blocks;
import net.minecraft.block.state.IBlockState;
import net.mcreator.omegaswords.ElementsKataklizmaddon;
@ElementsKataklizmaddon.ModElement.Tag
public class ProcedureIndustrialConverterProcedure1 extends ElementsKataklizmaddon.ModElement {
public ProcedureIndustrialConverterProcedure1(ElementsKataklizmaddon instance) {
super(instance, 3);
}
public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
if (dependencies.get("x") == null) {
System.err.println("Failed to load dependency x for procedure IndustrialConverterProcedure1!");
return;
}
if (dependencies.get("y") == null) {
System.err.println("Failed to load dependency y for procedure IndustrialConverterProcedure1!");
return;
}
if (dependencies.get("z") == null) {
System.err.println("Failed to load dependency z for procedure IndustrialConverterProcedure1!");
return;
}
if (dependencies.get("world") == null) {
System.err.println("Failed to load dependency world for procedure IndustrialConverterProcedure1!");
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");
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) (0))).getItem() == new ItemStack(Items.DIAMOND_SWORD, (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) (2))).getItem() == new ItemStack(Items.DIAMOND, (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(Blocks.DIAMOND_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(Blocks.AIR, (int) (1))
.getItem())))
&& ((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))) < 64))) {
if (((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), "progress")) < 100)) {
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("progress", ((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), "progress")) + 1));
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
}
} else if (((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), "progress")) == 100)) {
{
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
if (inv instanceof TileEntityLockableLoot)
((TileEntityLockableLoot) inv).decrStackSize((int) (0), (int) (1));
}
{
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
if (inv instanceof TileEntityLockableLoot)
((TileEntityLockableLoot) inv).decrStackSize((int) (2), (int) (1));
}
{
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
if (inv != null && (inv instanceof TileEntityLockableLoot)) {
ItemStack _setstack = new ItemStack(Blocks.DIAMOND_BLOCK, (int) (1));
_setstack.setCount(((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));
((TileEntityLockableLoot) inv).setInventorySlotContents((int) (1), _setstack);
}
}
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("progress", 0);
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
}
}
} else {
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("progress", 0);
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
}
}
}
}
Процедура моего блока:
import net.minecraft.util.math.BlockPos;
import net.minecraft.tileentity.TileEntityLockableLoot;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.init.Items;
import net.minecraft.init.Blocks;
import net.minecraft.block.state.IBlockState;
import net.mcreator.omegaswords.ElementsKataklizmaddon;
@ElementsKataklizmaddon.ModElement.Tag
public class ProcedureIndustrialConverterProcedure1 extends ElementsKataklizmaddon.ModElement {
public ProcedureIndustrialConverterProcedure1(ElementsKataklizmaddon instance) {
super(instance, 3);
}
public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
if (dependencies.get("x") == null) {
System.err.println("Failed to load dependency x for procedure IndustrialConverterProcedure1!");
return;
}
if (dependencies.get("y") == null) {
System.err.println("Failed to load dependency y for procedure IndustrialConverterProcedure1!");
return;
}
if (dependencies.get("z") == null) {
System.err.println("Failed to load dependency z for procedure IndustrialConverterProcedure1!");
return;
}
if (dependencies.get("world") == null) {
System.err.println("Failed to load dependency world for procedure IndustrialConverterProcedure1!");
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");
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) (0))).getItem() == new ItemStack(Items.DIAMOND_SWORD, (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) (2))).getItem() == new ItemStack(Items.DIAMOND, (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(Blocks.DIAMOND_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(Blocks.AIR, (int) (1))
.getItem())))
&& ((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))) < 64))) {
if (((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), "progress")) < 100)) {
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("progress", ((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), "progress")) + 1));
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
}
} else if (((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), "progress")) == 100)) {
{
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
if (inv instanceof TileEntityLockableLoot)
((TileEntityLockableLoot) inv).decrStackSize((int) (0), (int) (1));
}
{
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
if (inv instanceof TileEntityLockableLoot)
((TileEntityLockableLoot) inv).decrStackSize((int) (2), (int) (1));
}
{
TileEntity inv = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
if (inv != null && (inv instanceof TileEntityLockableLoot)) {
ItemStack _setstack = new ItemStack(Blocks.DIAMOND_BLOCK, (int) (1));
_setstack.setCount(((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));
((TileEntityLockableLoot) inv).setInventorySlotContents((int) (1), _setstack);
}
}
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("progress", 0);
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
}
}
} else {
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("progress", 0);
world.notifyBlockUpdate(_bp, _bs, _bs, 3);
}
}
}
}