congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ComponentInventorySlots
Code IndexAdd Tabnine to your IDE (free)

How to use
ComponentInventorySlots
in
binnie.core.machines.inventory

Best Java code snippets using binnie.core.machines.inventory.ComponentInventorySlots (Showing top 20 results out of 315)

origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  inventory.addSlot(Nursery.SLOT_CATERPILLAR, getSlotRL("caterpillar"));
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ExtraBeeMachines.ComponentExtraBeeGUI(machine, ExtraBeesGUID.ALVEARY_HATCHERY);
  final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  for (final InventorySlot slot : inventory.addSlotArray(AlvearyHatchery.SLOT_LARVAE, "hatchery")) {
    slot.setValidator(new SlotValidatorLarvae());
  }
  new ComponentFrameModifier(machine);
}
origin: ForestryMC/Binnie

@Override
public ItemStack decrStackSize(final int index, final int amount) {
  InventorySlot slot = getInternalSlot(index);
  ItemStack stack = slot.decrStackSize(amount);
  if (!stack.isEmpty()) {
    this.markDirty();
  }
  return stack;
}
origin: ForestryMC/Binnie

@Override
public boolean isItemValidForSlot(final int index, final ItemStack itemStack) {
  InventorySlot slot = this.getSlot(index);
  return slot != null && (slot.isValid(itemStack) && !this.isReadOnly(index));
}
origin: ForestryMC/Binnie

@Override
public boolean canInsertItem(final int index, final ItemStack itemstack, final EnumFacing direction) {
  if (!isItemValidForSlot(index, itemstack)) {
    return false;
  }
  InventorySlot slot = this.getSlot(index);
  return slot != null && slot.canInsert(direction);
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ComponentGeneticGUI(machine, GeneticsGUI.INCUBATOR);
  ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  for (InventorySlot slot : inventory.addSlotArray(Incubator.SLOT_QUEUE, getSlotRL("input"))) {
    slot.forbidExtraction();
  }
  InventorySlot slotIncubator = inventory.addSlot(Incubator.SLOT_INCUBATOR, getSlotRL("incubator"));
  slotIncubator.forbidInteraction();
  for (InventorySlot slot : inventory.addSlotArray(Incubator.SLOT_OUTPUT, getSlotRL("output"))) {
    slot.setReadOnly();
  }
  new ComponentPowerReceptor(machine, 2000);
  ComponentTankContainer tanks = new ComponentTankContainer(machine);
  tanks.addTank(Incubator.TANK_INPUT, "input", 2000).forbidExtraction();
  tanks.addTank(Incubator.TANK_OUTPUT, "output", 2000).setReadOnly();
  new IncubatorLogic(machine);
}
origin: ForestryMC/Binnie

public final InventorySlot[] addSlotArray(final int[] indexes, final ResourceLocation unlocalizedName) {
  return Arrays.stream(indexes)
    .mapToObj(index -> addSlot(index, unlocalizedName))
    .toArray(InventorySlot[]::new);
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.INFUSER);
  final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  final ComponentTankContainer tanks = new ComponentTankContainer(machine);
  final TankSlot input = tanks.addTank(Infuser.TANK_INPUT, "input", 5000);
  input.setValidator(new TankValidatorInfuserInput());
  input.forbidExtraction();
  final TankSlot output = tanks.addTank(Infuser.TANK_OUTPUT, "output", 5000);
  output.setValidator(new TankValidatorInfuserOutput());
  output.setReadOnly();
  new ComponentPowerReceptor(machine);
  new InfuserLogic(machine);
}
origin: ForestryMC/Binnie

@Override
public boolean canExtractItem(final int index, final ItemStack itemstack, final EnumFacing direction) {
  InventorySlot slot = this.getSlot(index);
  return slot != null && slot.canExtract(direction);
}
origin: ForestryMC/Binnie

@Override
public void onDestruction() {
  IMachine machine = getMachine();
  World world = machine.getWorld();
  Random rand = world.rand;
  BlockPos pos = machine.getTileEntity().getPos();
  for (InventorySlot slot : this.inventory.values()) {
    ItemStack stack = slot.getItemStack();
    if (slot.isRecipe() || stack.isEmpty()) {
      continue;
    }
    final float xOffset = rand.nextFloat() * 0.8f + 0.1f;
    final float yOffset = rand.nextFloat() * 0.8f + 0.1f;
    final float zOffset = rand.nextFloat() * 0.8f + 0.1f;
    final EntityItem entityItem = new EntityItem(world, pos.getX() + xOffset, pos.getY() + yOffset, pos.getZ() + zOffset, stack.copy());
    entityItem.motionX = (float) rand.nextGaussian() * ACCEL;
    entityItem.motionY = (float) rand.nextGaussian() * ACCEL + 0.2f;
    entityItem.motionZ = (float) rand.nextGaussian() * ACCEL;
    world.spawnEntity(entityItem);
  }
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ComponentGeneticGUI(machine, GeneticsGUI.SEQUENCER);
  ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  InventorySlot slotDye = inventory.addSlot(Sequencer.SLOT_DYE, getSlotRL("dye"));
  slotDye.setValidator(new SlotValidator.Item(GeneticsItems.FluorescentDye.get(1), ModuleMachine.getSpriteDye()));
  slotDye.forbidExtraction();
  for (InventorySlot slot : inventory.addSlotArray(Sequencer.SLOT_RESERVE, getSlotRL("input"))) {
    slot.setValidator(new SlotValidatorUnsequenced());
    slot.forbidExtraction();
  }
  InventorySlot slotTarget = inventory.addSlot(Sequencer.SLOT_TARGET, getSlotRL("process"));
  slotTarget.setValidator(new SlotValidatorUnsequenced());
  slotTarget.setReadOnly();
  slotTarget.forbidInteraction();
  InventorySlot slotDone = inventory.addSlot(Sequencer.SLOT_DONE, getSlotRL("output"));
  slotDone.setReadOnly();
  ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
  transfer.addRestock(Sequencer.SLOT_RESERVE, Sequencer.SLOT_TARGET, 1);
  new ComponentChargedSlots(machine).addCharge(0);
  new ComponentPowerReceptor(machine, 10000);
  new SequencerLogic(machine);
  new SequencerFX(machine);
}
origin: ForestryMC/Binnie

/**
 * @deprecated use {@link #addSlotArray(int[], ResourceLocation)}
 */
@Deprecated
public final InventorySlot[] addSlotArray(final int[] indexes, final String unlocalizedName) {
  return Arrays.stream(indexes)
    .mapToObj(index -> addSlot(index, unlocalizedName))
    .toArray(InventorySlot[]::new);
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.DISTILLERY);
  final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  final ComponentTankContainer tanks = new ComponentTankContainer(machine);
  final TankSlot input = tanks.addTank(TANK_INPUT, "input", 5000);
  input.setValidator(new TankValidatorDistilleryInput());
  input.forbidExtraction();
  final TankSlot output = tanks.addTank(TANK_OUTPUT, "output", 5000);
  output.setValidator(new TankValidatorDistilleryOutput());
  output.setReadOnly();
  new ComponentPowerReceptor(machine);
  new DistilleryLogic(machine);
}
origin: ForestryMC/Binnie

private boolean isReadOnly(final int slot) {
  final InventorySlot iSlot = this.getSlot(slot);
  return iSlot == null || iSlot.isReadOnly();
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ComponentGeneticGUI(machine, GeneticsGUI.ANALYSER);
  ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  for (InventorySlot slot : inventory.addSlotArray(Analyser.SLOT_RESERVE, getSlotRL("input"))) {
    slot.setValidator(new SlotValidatorUnanalysed());
    slot.forbidExtraction();
  }
  InventorySlot slotTarget = inventory.addSlot(Analyser.SLOT_TARGET, getSlotRL("analyse"));
  slotTarget.setReadOnly();
  slotTarget.forbidInteraction();
  InventorySlot slotDye = inventory.addSlot(Analyser.SLOT_DYE, getSlotRL("dye"));
  slotDye.forbidExtraction();
  slotDye.setValidator(new DyeSlotValidator());
  for (InventorySlot slot : inventory.addSlotArray(Analyser.SLOT_FINISHED, getSlotRL("output"))) {
    slot.forbidInsertion();
    slot.setReadOnly();
  }
  ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
  transfer.addRestock(Analyser.SLOT_RESERVE, 6, 1);
  transfer.addStorage(6, Analyser.SLOT_FINISHED, ManagerGenetics::isAnalysed);
  new ComponentChargedSlots(machine).addCharge(13);
  new ComponentPowerReceptor(machine, 500);
  new AnalyserLogic(machine);
  new AnalyserFX(machine);
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ComponentGUIHolder(machine);
  new LabFX(machine);
  ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  inventory.addSlot(0, new ResourceLocation(GENETICS_MOD_ID, "lab_display"));
}
origin: ForestryMC/Binnie

/**
 * @deprecated use {@link #addSlot(int, ResourceLocation)}
 */
@Deprecated
public final InventorySlot addSlot(final int index, final String unlocName) {
  ResourceLocation unlocLocation = new ResourceLocation(Constants.CORE_MOD_ID, "gui.slot." + unlocName);
  return addSlot(index, unlocLocation);
}
origin: ForestryMC/Binnie

@Override
public ItemStack removeStackFromSlot(int index) {
  InventorySlot slot = getInternalSlot(index);
  if (slot.isFake()) {
    return ItemStack.EMPTY;
  }
  ItemStack content = slot.getItemStack();
  slot.setContent(ItemStack.EMPTY);
  this.markDirty();
  return content;
}
origin: ForestryMC/Binnie

  @Nullable
  @Override
  public InventorySlot getSlot(int index) {
    Machine machine = getMachine();
    if (machine == null) {
      return null;
    }
    if (!machine.hasComponent(ComponentInventorySlots.class)) {
      return null;
    }
    ComponentInventorySlots inventorySlots = machine.getComponent(ComponentInventorySlots.class);
    return inventorySlots.getSlot(index);
  }
}
origin: ForestryMC/Binnie

@Override
public void createMachine(final Machine machine) {
  new ComponentGeneticGUI(machine, GeneticsGUI.ACCLIMATISER);
  final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
  InventorySlot slotTarget = inventory.addSlot(Acclimatiser.SLOT_TARGET, getSlotRL("process"));
  slotTarget.setValidator(new SlotValidator.Individual());
  slotTarget.forbidInteraction();
  for (final InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_RESERVE, getSlotRL("input"))) {
    slot.forbidExtraction();
    slot.setValidator(new SlotValidator.Individual());
  }
  for (final InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_DRONE, getSlotRL("output"))) {
    slot.setReadOnly();
    slot.setValidator(new SlotValidator.Individual());
  }
  for (final InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_ACCLIMATISER, getSlotRL("acclimatiser"))) {
    slot.setValidator(new ValidatorAcclimatiserItem());
  }
  final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
  transfer.addRestock(Acclimatiser.SLOT_RESERVE, Acclimatiser.SLOT_TARGET, 1);
  transfer.addStorage(Acclimatiser.SLOT_TARGET, Acclimatiser.SLOT_DRONE, (stack) -> {
    NonNullList<ItemStack> stacks = machine.getMachineUtil().getNonEmptyStacks(Acclimatiser.SLOT_ACCLIMATISER);
    return !Acclimatiser.canAcclimatise(stack, stacks);
  });
  new ComponentPowerReceptor(machine, 5000);
  new AcclimatiserLogic(machine);
}
binnie.core.machines.inventoryComponentInventorySlots

Most used methods

  • addSlot
  • <init>
  • addSlotArray
  • getInternalSlot
  • getMachine
  • getSlot
  • isItemValidForSlot
  • isReadOnly
  • markDirty
  • readFromNBT
  • writeToNBT
  • writeToNBT

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JCheckBox (javax.swing)
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now