Here are the examples of the java api com.github.vini2003.blade.common.widget.base.SlotWidget taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
10 Examples
16
Source : TrituratorScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
SlotWidget output = new SlotWidget(0, blockEnreplacedy, ExtractionSlot::new);
output.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
output.setSize(Size.of(18, 18));
SlotWidget input = new SlotWidget(1, blockEnreplacedy);
input.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
input.setSize(Size.of(18, 18));
output.setPosition(Position.of(width / 2F - output.getWidth() / 2F, output.getY()));
output.setPosition(Position.of(output.getX() + 29, output.getY() + 15));
HorizontalArrowWidget arrow = new HorizontalArrowWidget();
arrow.setPosition(Position.of(output.getX() - 31, output.getY()));
arrow.setSize(Size.of(22, 16));
arrow.setLimitSupplier(() -> triturator.limit);
arrow.setProgressSupplier(() -> (int) triturator.progress);
input.setPosition(Position.of(arrow.getX() - 27, arrow.getY()));
mainTab.addWidget(input);
mainTab.addWidget(output);
mainTab.addWidget(arrow);
}
15
Source : PresserScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
SlotWidget output = new SlotWidget(0, blockEnreplacedy, ExtractionSlot::new);
output.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
output.setSize(Size.of(18, 18));
SlotWidget input = new SlotWidget(1, blockEnreplacedy);
input.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
input.setSize(Size.of(18, 18));
output.setPosition(Position.of(width / 2F - output.getWidth() / 2F, output.getY()));
output.setPosition(Position.of(output.getX() + 27, output.getY() + 15));
HorizontalArrowWidget arrow = new HorizontalArrowWidget();
arrow.setPosition(Position.of(output.getX() - 31, output.getY()));
arrow.setSize(Size.of(22, 16));
arrow.setLimitSupplier(() -> sorter.limit);
arrow.setProgressSupplier(() -> (int) sorter.progress);
input.setPosition(Position.of(arrow.getX() - 27, arrow.getY()));
mainTab.addWidget(input);
mainTab.addWidget(output);
mainTab.addWidget(arrow);
}
15
Source : AlloySmelterScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
SlotWidget firstInput = new SlotWidget(0, smelter);
firstInput.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
firstInput.setSize(Size.of(18, 18));
SlotWidget secondInput = new SlotWidget(1, smelter);
secondInput.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
secondInput.setSize(Size.of(18, 18));
SlotWidget output = new SlotWidget(2, smelter, ExtractionSlot::new);
output.setPosition(Position.of(energyBar.getX(), energyBar.getY()));
output.setSize(Size.of(18, 18));
firstInput.setPosition(Position.of(width / 2F - firstInput.getWidth() / 2, firstInput.getY()));
firstInput.setPosition(Position.of(firstInput.getX() - 22, firstInput.getY() + 15 - 9));
secondInput.setPosition(Position.of(width / 2F - secondInput.getWidth() / 2, secondInput.getY()));
secondInput.setPosition(Position.of(secondInput.getX() - 22, secondInput.getY() + 15 + 18 - 9));
output.setPosition(Position.of(width / 2F - output.getWidth() / 2, output.getY()));
output.setPosition(Position.of(secondInput.getX() + 57, secondInput.getY() - 9));
HorizontalArrowWidget arrow = new HorizontalArrowWidget();
arrow.setPosition(Position.of(output.getX() - 31, output.getY()));
arrow.setSize(Size.of(22, 16));
arrow.setLimitSupplier(() -> smelter.limit);
arrow.setProgressSupplier(() -> (int) smelter.progress);
mainTab.addWidget(firstInput);
mainTab.addWidget(secondInput);
mainTab.addWidget(output);
mainTab.addWidget(arrow);
}
15
Source : RocketScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
ButtonWidget launchButtonWidget = new ButtonWidget(() -> {
((RocketEnreplacedy) enreplacedy).tryLaunch(this.getPlayer());
return null;
});
launchButtonWidget.setPosition(Position.of(mainTab, 3 + 4, 11));
launchButtonWidget.setSize(Size.of(48, 18));
launchButtonWidget.setLabel(new TranslatableText("text.astromine.rocket.launch"));
launchButtonWidget.setDisabled(() -> enreplacedy.getDataTracker().get(RocketEnreplacedy.IS_RUNNING) || enreplacedy.getFluidComponent().getVolume(0).smallerOrEqualThan(Fraction.empty()));
ButtonWidget abortButtonWidget = new ButtonWidget(() -> {
((RocketEnreplacedy) enreplacedy).tryDisreplacedemble(true);
return null;
});
abortButtonWidget.setPosition(Position.of(mainTab, 3 + 4, 11 + fluidBar.getHeight() - 18));
abortButtonWidget.setSize(Size.of(48, 18));
abortButtonWidget.setLabel(new TranslatableText("text.astromine.rocket.destroy").formatted(Formatting.RED));
fluidBar.setPosition(Position.of(width / 2F - fluidBar.getWidth() / 2F + 2, fluidBar.getY()));
SlotWidget input = new SlotWidget(0, enreplacedy);
input.setPosition(Position.of(fluidBar, -18 - 3, 0));
input.setSize(Size.of(18, 18));
SlotWidget output = new SlotWidget(1, enreplacedy);
output.setPosition(Position.of(fluidBar, -18 - 3, fluidBar.getHeight() - 18));
output.setSize(Size.of(18, 18));
fuelTextWidget = new TextWidget();
mainTab.addWidget(launchButtonWidget);
mainTab.addWidget(abortButtonWidget);
mainTab.addWidget(input);
mainTab.addWidget(output);
}
14
Source : CreativeBufferScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
SlotWidget slot = new SlotWidget(0, ItemInventoryFromInventoryComponent.of(blockEnreplacedy.getComponent(AstromineComponentTypes.ITEM_INVENTORY_COMPONENT)));
slot.setPosition(Position.of(mainTab, 70, 20));
slot.setSize(Size.of(36, 36));
mainTab.addWidget(slot);
}
14
Source : CapacitorScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
energyBar.setPosition(Position.of(width / 2F - energyBar.getWidth() / 2F, energyBar.getY()));
SlotWidget input = new SlotWidget(0, blockEnreplacedy);
input.setPosition(Position.of(mainTab, 12, 26));
input.setSize(Size.of(18, 18));
SlotWidget output = new SlotWidget(1, blockEnreplacedy);
output.setPosition(Position.of(mainTab, 146, 26));
output.setSize(Size.of(18, 18));
HorizontalArrowWidget leftArrow = new HorizontalArrowWidget();
leftArrow.setPosition(Position.of(input, 28, 0));
leftArrow.setSize(Size.of(22, 16));
leftArrow.setLimitSupplier(() -> 1);
leftArrow.setProgressSupplier(() -> {
ItemStack stack = blockEnreplacedy.getComponent(AstromineComponentTypes.ITEM_INVENTORY_COMPONENT).getStack(0);
if (!Energy.valid(stack))
return 0;
EnergyHandler handler = Energy.of(stack);
return handler.getEnergy() > 0 && handler.getMaxOutput() > 0 ? 1 : 0;
});
HorizontalArrowWidget rightArrow = new HorizontalArrowWidget();
rightArrow.setPosition(Position.of(output, -34, 0));
rightArrow.setSize(Size.of(22, 16));
rightArrow.setLimitSupplier(() -> 1);
rightArrow.setProgressSupplier(() -> {
ItemStack stack = blockEnreplacedy.getComponent(AstromineComponentTypes.ITEM_INVENTORY_COMPONENT).getStack(1);
if (!Energy.valid(stack))
return 0;
EnergyHandler handler = Energy.of(stack);
return handler.getEnergy() < handler.getMaxStored() && blockEnreplacedy.getEnergyComponent().getAmount() > 0 && handler.getMaxInput() > 0 ? 1 : 0;
});
mainTab.addWidget(input);
mainTab.addWidget(output);
mainTab.addWidget(leftArrow);
mainTab.addWidget(rightArrow);
}
14
Source : BlockPlacerScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
SlotWidget slot = new SlotWidget(0, blockEnreplacedy);
slot.setPosition(Position.of(mainTab, mainTab.getWidth() / 2F - 9F, 26));
slot.setSize(Size.of(18, 18));
mainTab.addWidget(slot);
}
12
Source : TankScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
fluidBar.setPosition(Position.of(width / 2F - fluidBar.getWidth() / 2F, fluidBar.getY()));
SlotWidget input = new SlotWidget(0, blockEnreplacedy);
input.setPosition(Position.of(mainTab, 12, 26));
input.setSize(Size.of(18, 18));
SlotWidget output = new SlotWidget(1, blockEnreplacedy);
output.setPosition(Position.of(mainTab, 146, 26));
output.setSize(Size.of(18, 18));
HorizontalArrowWidget leftArrow = new HorizontalArrowWidget();
leftArrow.setPosition(Position.of(input, 28, 0));
leftArrow.setSize(Size.of(22, 16));
leftArrow.setLimitSupplier(() -> 1);
leftArrow.setProgressSupplier(() -> {
ItemStack stack = blockEnreplacedy.getComponent(AstromineComponentTypes.ITEM_INVENTORY_COMPONENT).getStack(0);
if (stack.gereplacedem() instanceof FluidVolumeItem) {
FluidInventoryComponent fluidComponent = ComponentProvider.fromItemStack(stack).getComponent(AstromineComponentTypes.FLUID_INVENTORY_COMPONENT);
return !fluidComponent.isEmpty() ? 1 : 0;
} else {
return 0;
}
});
HorizontalArrowWidget rightArrow = new HorizontalArrowWidget();
rightArrow.setPosition(Position.of(output, -34, 0));
rightArrow.setSize(Size.of(22, 16));
rightArrow.setLimitSupplier(() -> 1);
rightArrow.setProgressSupplier(() -> {
ItemStack stack = blockEnreplacedy.getComponent(AstromineComponentTypes.ITEM_INVENTORY_COMPONENT).getStack(0);
FluidVolume blockEnreplacedyVolume = blockEnreplacedy.getComponent(AstromineComponentTypes.FLUID_INVENTORY_COMPONENT).getVolume(0);
if (stack.gereplacedem() instanceof FluidVolumeItem) {
FluidInventoryComponent fluidComponent = ComponentProvider.fromItemStack(stack).getComponent(AstromineComponentTypes.FLUID_INVENTORY_COMPONENT);
return !fluidComponent.isEmpty() && !blockEnreplacedyVolume.isEmpty() ? 1 : 0;
} else {
return 0;
}
});
FluidFilterWidget filter = new FluidFilterWidget();
filter.setPosition(Position.of(input, 5, -9 - 5));
filter.setSize(Size.of(8, 8));
filter.setFluidConsumer(fluid -> {
tank.setFilter(fluid);
});
filter.setFluidSupplier(() -> tank.getFilter());
mainTab.addWidget(input);
mainTab.addWidget(output);
mainTab.addWidget(leftArrow);
mainTab.addWidget(rightArrow);
mainTab.addWidget(filter);
}
9
Source : ElectricSmelterScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
SlotWidget output = new SlotWidget(0, smelter, ExtractionSlot::new);
output.setSize(Size.of(18, 18));
SlotWidget input = new SlotWidget(1, smelter);
input.setSize(Size.of(18, 18));
output.setPosition(Position.of(energyBar, 102, 15));
HorizontalArrowWidget arrow = new HorizontalArrowWidget();
arrow.setPosition(Position.of(output, -31, 0));
arrow.setSize(Size.of(22, 16));
arrow.setLimitSupplier(() -> smelter.limit);
arrow.setProgressSupplier(() -> (int) smelter.progress);
input.setPosition(Position.of(arrow, -27, 0));
mainTab.addWidget(input);
mainTab.addWidget(output);
mainTab.addWidget(arrow);
}
8
Source : SolidGeneratorScreenHandler.java
with MIT License
from Mixinors
with MIT License
from Mixinors
@Override
public void initialize(int width, int height) {
super.initialize(width, height);
HorizontalArrowWidget arrow = new HorizontalArrowWidget();
arrow.setPosition(Position.of(Position.of(energyBar), energyBar.getWidth() + 3, energyBar.getHeight() / 2F - 8));
arrow.setSize(Size.of(22, 16));
arrow.setLimitSupplier(() -> generator.limit);
arrow.setProgressSupplier(() -> (int) generator.progress);
SlotWidget input = new SlotWidget(0, blockEnreplacedy);
input.setPosition(Position.of(arrow, -26, 0));
input.setSize(Size.of(18, 18));
energyBar.setPosition(Position.of(mainTab, 68, 11));
mainTab.addWidget(input);
mainTab.addWidget(arrow);
}