use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class LogisticsManager method canSink.
public static SinkReply canSink(@Nonnull ItemStack stack, @Nonnull IRouter destination, IRouter sourceRouter, boolean excludeSource, ItemIdentifier item, SinkReply result, boolean activeRequest, boolean allowDefault, boolean forcePassive) {
SinkReply reply;
LogisticsModule module = destination.getLogisticsModule();
CoreRoutedPipe crp = destination.getPipe();
if (module == null) {
return null;
}
if (!(module.recievePassive() || activeRequest)) {
return null;
}
if (crp == null || !crp.isEnabled()) {
return null;
}
if (excludeSource && sourceRouter != null) {
if (destination.getPipe().isOnSameContainer(sourceRouter.getPipe())) {
return null;
}
}
if (result == null) {
reply = module.sinksItem(stack, item, -1, 0, allowDefault, true, forcePassive);
} else {
reply = module.sinksItem(stack, item, result.fixedPriority.ordinal(), result.customPriority, allowDefault, true, forcePassive);
}
if (result != null && result.maxNumberOfItems < 0) {
return null;
}
return reply;
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class ItemModule method getLogisticsModule.
@Nullable
public static LogisticsModule getLogisticsModule(@Nonnull EntityPlayer player, int invSlot) {
ItemStack item = player.inventory.mainInventory.get(invSlot);
if (item.isEmpty() || !(item.getItem() instanceof ItemModule))
return null;
LogisticsModule module = ((ItemModule) item.getItem()).getModuleForItem(item, null, new DummyWorldProvider(player.getEntityWorld()), null);
if (module == null)
return null;
module.registerPosition(ModulePositionType.IN_HAND, invSlot);
ItemModuleInformationManager.readInformation(item, module);
return module;
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class ItemModule method getModule.
@Nullable
public LogisticsModule getModule(@Nullable LogisticsModule currentModule, @Nullable IWorldProvider world, @Nullable IPipeServiceProvider service) {
if (currentModule != null) {
if (moduleType.getILogisticsModuleClass().equals(currentModule.getClass())) {
return currentModule;
}
}
LogisticsModule newmodule = moduleType.getILogisticsModule();
if (newmodule == null) {
return null;
}
newmodule.registerHandler(world, service);
return newmodule;
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class ItemModule method openConfigGui.
private void openConfigGui(@Nonnull ItemStack stack, EntityPlayer player, World world) {
LogisticsModule module = getModuleForItem(stack, null, new DummyWorldProvider(world), null);
if (module instanceof Gui && !stack.isEmpty()) {
module.registerPosition(ModulePositionType.IN_HAND, player.inventory.currentItem);
ItemModuleInformationManager.readInformation(stack, module);
Gui.getInHandGuiProvider((Gui) module).open(player);
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class HudChassisPipe method renderHeadUpDisplay.
@Override
public void renderHeadUpDisplay(double distance, boolean day, boolean shifted, Minecraft mc, IHUDConfig config) {
if (day) {
GL11.glColor4b((byte) 64, (byte) 64, (byte) 64, (byte) 64);
} else {
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 64);
}
GuiGraphics.drawGuiBackGround(mc, -50, -50, 50, 50, 0, false);
if (day) {
GL11.glColor4b((byte) 64, (byte) 64, (byte) 64, (byte) 127);
} else {
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 127);
}
GL11.glTranslatef(0.0F, 0.0F, (float) (-0.00005F * distance));
super.renderHeadUpDisplay(distance, day, shifted, mc, config);
if (selected != -1) {
LogisticsModule selectedmodule = pipe.getSubModule(selected);
if (selectedmodule == null) {
return;
}
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 64);
GuiGraphics.drawGuiBackGround(mc, -23, -35, 45, 45, 0, false);
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 127);
if (selectedmodule instanceof IHUDModuleHandler && ((IHUDModuleHandler) selectedmodule).getHUDRenderer() != null) {
GL11.glTranslatef(11.0F, 5.0F, (float) (-0.00005F * distance));
((IHUDModuleHandler) selectedmodule).getHUDRenderer().renderContent(shifted);
if (((IHUDModuleHandler) selectedmodule).getHUDRenderer().getButtons() != null) {
for (IHUDButton button : ((IHUDModuleHandler) selectedmodule).getHUDRenderer().getButtons()) {
button.renderAlways(shifted);
if (button.shouldRenderButton()) {
button.renderButton(button.isFocused(), button.isblockFocused(), shifted);
}
if (!button.buttonEnabled() || !button.shouldRenderButton()) {
continue;
}
if ((button.getX() - 1 < (xCursor - 11) && (xCursor - 11) < (button.getX() + button.sizeX() + 1)) && (button.getY() - 1 < (yCursor - 5) && (yCursor - 5) < (button.getY() + button.sizeY() + 1))) {
if (!button.isFocused() && !button.isblockFocused()) {
button.setFocused();
} else if (button.focusedTime() > 400 && !button.isblockFocused()) {
button.clicked();
button.blockFocused();
}
} else if (button.isFocused() || button.isblockFocused()) {
button.clearFocused();
}
}
}
GL11.glTranslatef(-11.0F, -5.0F, (float) (0.00005F * distance));
} else {
GL11.glTranslatef(0.0F, 0.0F, (float) (-0.00005F * distance));
mc.fontRenderer.drawString("Nothing", -5, -15, 0);
mc.fontRenderer.drawString("to", 9, -5, 0);
mc.fontRenderer.drawString("display", -5, 5, 0);
GL11.glTranslatef(0.0F, 0.0F, (float) (0.00005F * distance));
}
} else {
GL11.glTranslatef(0.0F, 0.0F, (float) (-0.005F * distance));
GL11.glScalef(1.5F, 1.5F, 0.0001F);
GL11.glScalef(0.8F, 0.8F, -1F);
ItemStackRenderer.renderItemIdentifierStackListIntoGui(pipe.displayList, null, 0, -15, -35, 3, 12, 18, 18, 100.0F, DisplayAmount.ALWAYS, false, shifted);
}
GL11.glTranslatef(0.0F, 0.0F, (float) (0.00005F * distance));
}
Aggregations