use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.
the class AdvancedExtractorModuleInHand method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
DummyModuleContainer dummy = new DummyModuleContainer(player, getInvSlot());
if (!(dummy.getModule() instanceof ModuleAdvancedExtractor)) {
return null;
}
dummy.setInventory(((ModuleAdvancedExtractor) dummy.getModule()).getFilterInventory());
dummy.addNormalSlotsForPlayerInventory(8, 60);
//Pipe slots
for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
dummy.addDummySlot(pipeSlot, 8 + pipeSlot * 18, 18);
}
return dummy;
}
use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.
the class ApiaristSinkModuleInHand method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
SimpleServiceLocator.forestryProxy.syncTracker(player.getEntityWorld(), player);
DummyModuleContainer dummy = new DummyModuleContainer(player, getInvSlot());
if (!(dummy.getModule() instanceof ModuleApiaristSink)) {
return null;
}
return dummy;
}
use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.
the class CraftingModuleInHand method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
DummyModuleContainer dummy = new DummyModuleContainer(player, getInvSlot());
if (!(dummy.getModule() instanceof ModuleCrafter)) {
return null;
}
MainProxy.sendPacketToPlayer(((ModuleCrafter) dummy.getModule()).getCPipePacket(), player);
dummy.setInventory(((ModuleCrafter) dummy.getModule()).getDummyInventory());
dummy.addNormalSlotsForPlayerInventory(18, 97);
//Input slots
for (int l = 0; l < 9; l++) {
dummy.addFuzzyDummySlot(l, 18 + l * 18, 18, ((ModuleCrafter) dummy.getModule()).fuzzyCraftingFlagArray[l]);
}
//Output slot
dummy.addFuzzyDummySlot(9, 90, 64, ((ModuleCrafter) dummy.getModule()).outputFuzzyFlags);
return dummy;
}
use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.
the class AdvancedExtractorSneakyGuiPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
if (getType() == ModulePositionType.IN_HAND) {
if (player.openContainer instanceof DummyModuleContainer) {
DummyModuleContainer dummy = (DummyModuleContainer) player.openContainer;
if (dummy.getModule() instanceof ModuleAdvancedExtractor) {
player.closeScreen();
NewGuiHandler.getGui(ExtractorModuleInHand.class).setInvSlot(getPositionInt()).open(player);
}
}
return;
}
final LogisticsTileGenericPipe pipe = this.getPipe(player.worldObj);
if (pipe == null) {
return;
}
if (!(pipe.pipe instanceof CoreRoutedPipe)) {
return;
}
final CoreRoutedPipe piperouted = (CoreRoutedPipe) pipe.pipe;
if (piperouted.getLogisticsModule() == null) {
return;
}
if (piperouted.getLogisticsModule().getSubModule(getPositionInt()) instanceof ModuleAdvancedExtractor) {
final ModuleAdvancedExtractor module = (ModuleAdvancedExtractor) piperouted.getLogisticsModule().getSubModule(getPositionInt());
NewGuiHandler.getGui(ExtractorModuleSlot.class).setSneakyOrientation(module.getSneakyDirection()).setSlot(getType()).setPositionInt(getPositionInt()).setPosX(getPosX()).setPosY(getPosY()).setPosZ(getPosZ()).open(player);
return;
}
}
use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.
the class ModuleCoordinatesPacket method getLogisticsModule.
@SuppressWarnings("unchecked")
public <T> T getLogisticsModule(EntityPlayer player, Class<T> clazz) {
LogisticsModule module = null;
if (type == ModulePositionType.IN_PIPE) {
moduleBased = true;
LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
moduleBased = false;
if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
targetNotFound("Couldn't find " + clazz.getName() + ", pipe didn't exsist");
return null;
}
module = ((CoreRoutedPipe) pipe.pipe).getLogisticsModule();
} else if (type == ModulePositionType.IN_HAND) {
if (MainProxy.isServer(player.getEntityWorld())) {
if (player.openContainer instanceof DummyModuleContainer) {
DummyModuleContainer dummy = (DummyModuleContainer) player.openContainer;
module = dummy.getModule();
} else {
targetNotFound("Couldn't find " + clazz.getName() + ", container wasn't a DummyModule Container");
return null;
}
} else {
module = MainProxy.proxy.getModuleFromGui();
if (module == null) {
targetNotFound("Couldn't find " + clazz.getName() + ", GUI didn't provide the module");
return null;
}
}
} else {
moduleBased = true;
LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
moduleBased = false;
if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
targetNotFound("Couldn't find " + clazz.getName() + ", pipe didn't exsist");
return null;
} else if (!pipe.isInitialized()) {
return null;
}
if (!(pipe.pipe instanceof PipeLogisticsChassi)) {
targetNotFound("Couldn't find " + clazz.getName() + ", pipe wasn't a chassi pipe");
return null;
}
module = ((PipeLogisticsChassi) pipe.pipe).getLogisticsModule().getSubModule(positionInt);
}
if (module != null) {
if (!(clazz.isAssignableFrom(module.getClass()))) {
targetNotFound("Couldn't find " + clazz.getName() + ", found " + module.getClass());
return null;
}
} else {
targetNotFound("Couldn't find " + clazz.getName());
}
return (T) module;
}
Aggregations