Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/fluid-crafting' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Sep 1, 2024
2 parents 84d576c + c39f232 commit e41a7d4
Show file tree
Hide file tree
Showing 37 changed files with 359 additions and 256 deletions.
4 changes: 4 additions & 0 deletions src/main/java/logisticspipes/api/ILPPipe.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package logisticspipes.api;

import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;

/**
* Public interface implemented by LP's internal Pipe logic
*/
Expand All @@ -9,4 +11,6 @@ public interface ILPPipe {
* @return true if the pipe can route items inside the network
*/
boolean isRoutedPipe();

IBlockPos getPos();
}
4 changes: 4 additions & 0 deletions src/main/java/logisticspipes/api/ILPPipeTile.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package logisticspipes.api;

import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;

/**
* Public interface implemented by LP's Pipe tile
*/
Expand All @@ -11,4 +13,6 @@ public interface ILPPipeTile {
* @return the pipe
*/
ILPPipe getLPPipe();

IBlockPos getPos();
}
4 changes: 4 additions & 0 deletions src/main/java/logisticspipes/api/IRoutedPowerProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.List;

import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;

/**
* things implementing this interface are capable of providing power, but they draw from another sources Implement
* ILogisticsPowerProvider if you wish to provide power to the LP network. Losses of energy based on distance may be
Expand Down Expand Up @@ -30,4 +32,6 @@ public interface IRoutedPowerProvider {
int getY();

int getZ();

IBlockPos getPos();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;

import cofh.api.energy.IEnergyHandler;
import cpw.mods.fml.common.Optional;
import ic2.api.energy.tile.IEnergySink;
Expand Down Expand Up @@ -36,6 +39,7 @@
import logisticspipes.proxy.computers.interfaces.CCType;
import logisticspipes.renderer.LogisticsHUDRenderer;
import logisticspipes.utils.PlayerCollectionList;
import lombok.Getter;

@Optional.InterfaceList({ @Optional.Interface(modid = "IC2", iface = "ic2.api.energy.tile.IEnergySink"),
@Optional.Interface(modid = "CoFHAPI|energy", iface = "cofh.api.energy.IEnergyHandler"),
Expand Down Expand Up @@ -68,6 +72,9 @@ public class LogisticsPowerJunctionTileEntity extends LogisticsSolidTileEntity
private final PlayerCollectionList watcherList = new PlayerCollectionList();
private final IHeadUpDisplayRenderer HUD;

@Getter
private IBlockPos pos;

public LogisticsPowerJunctionTileEntity() {
HUD = new HUDPowerLevel(this);
}
Expand Down Expand Up @@ -185,6 +192,8 @@ public void invalidate() {
@Override
public void validate() {
super.validate();
pos = new BlockPos(xCoord, yCoord, zCoord);

if (MainProxy.isClient(getWorld())) {
init = false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/logisticspipes/gui/hud/HUDCrafting.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public void renderHeadUpDisplay(double d, boolean day, boolean shifted, Minecraf
}
GL11.glScalef(0.8F, 0.8F, -1F);
List<ItemIdentifierStack> list = new ArrayList<>();
List<ItemIdentifierStack> craftables = pipe.getCraftedItems();
if (craftables != null && craftables.size() > 0) {
List<ItemIdentifierStack> craftables = pipe.getConfiguredCraftResults();
if (craftables != null && !craftables.isEmpty()) {
// TODO: handle multiple crafables.
list.add(craftables.get(0));
}
if (pipe.displayList.size() > 0) {
if (!pipe.displayList.isEmpty()) {
ItemStackRenderer.renderItemIdentifierStackListIntoGui(
list,
null,
Expand Down Expand Up @@ -111,8 +111,8 @@ public void renderHeadUpDisplay(double d, boolean day, boolean shifted, Minecraf

@Override
public boolean display(IHUDConfig config) {
return config.isHUDCrafting()
&& ((!pipe.hasCraftingSign() && pipe.getCraftedItems() != null) || pipe.displayList.size() > 0);
return config.isHUDCrafting() && ((!pipe.hasCraftingSign() && pipe.getConfiguredCraftResults() != null)
|| pipe.displayList.size() > 0);
}

@Override
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/logisticspipes/gui/hud/HUDCraftingMK3.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public void renderHeadUpDisplay(double d, boolean day, boolean shifted, Minecraf
}
GL11.glScalef(0.8F, 0.8F, -1F);
List<ItemIdentifierStack> list = new ArrayList<>();
List<ItemIdentifierStack> craftables = pipe.getCraftedItems();
if (craftables != null && craftables.size() > 0) {
List<ItemIdentifierStack> craftables = pipe.getConfiguredCraftResults();
if (craftables != null && !craftables.isEmpty()) {
// TODO: handle multiple crafables.
list.add(craftables.get(0));
}
if (pipe.displayList.size() > 0 && pipe.getMk3Module().bufferList.size() == 0) {
if (!pipe.displayList.isEmpty() && pipe.getMk3Module().bufferList.size() == 0) {
ItemStackRenderer.renderItemIdentifierStackListIntoGui(
list,
null,
Expand Down Expand Up @@ -169,9 +169,9 @@ public void renderHeadUpDisplay(double d, boolean day, boolean shifted, Minecraf

@Override
public boolean display(IHUDConfig config) {
return config.isHUDCrafting() && ((!pipe.hasCraftingSign() && pipe.getCraftedItems() != null)
|| pipe.getMk3Module().bufferList.size() > 0
|| pipe.displayList.size() > 0);
return config.isHUDCrafting() && ((!pipe.hasCraftingSign() && pipe.getConfiguredCraftResults() != null)
|| !pipe.getMk3Module().bufferList.isEmpty()
|| !pipe.displayList.isEmpty());
}

@Override
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/logisticspipes/interfaces/IStack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package logisticspipes.interfaces;

import org.jetbrains.annotations.NotNull;

import logisticspipes.utils.item.ItemIdentifier;

public interface IStack extends Comparable<IStack> {

ItemIdentifier getItemIdentifier();

int getStackSize();

@Override
default int compareTo(@NotNull IStack o) {
int c = getItemIdentifier().compareTo(o.getItemIdentifier());
if (c != 0) return c;

return Integer.compare(getStackSize(), o.getStackSize());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logisticspipes.request.IPromise;
import logisticspipes.request.resources.IResource;

public interface ICraft extends IProvide {
public interface ICraft extends IProvide, IRequest {

void registerExtras(IPromise promise);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package logisticspipes.interfaces.routing;

public interface ICraftFluids extends ICraft, IProvideFluids {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public interface ICraftItems extends ICraft, IProvideItems, IItemSpaceControl, I
* @deprecated getCraftedItems can be slow, instead ask if the item you are after can be crafted
*/
@Deprecated
List<ItemIdentifierStack> getCraftedItems(); // list of all items that can be crafted.
List<ItemIdentifierStack> getConfiguredCraftResults(); // list of all items that can be crafted.
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logisticspipes.routing.IRouter;

public interface IRequest {
public interface IRequest extends Comparable<IRequest> {

IRouter getRouter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@
*/
package logisticspipes.interfaces.routing;

import org.jetbrains.annotations.NotNull;

import logisticspipes.utils.item.ItemIdentifierStack;

public interface IRequestItems extends Comparable<IRequestItems>, IRequest {
public interface IRequestItems extends IRequest {

void itemCouldNotBeSend(ItemIdentifierStack item, IAdditionalTargetInformation info);

@Override
int compareTo(@NotNull IRequestItems value2);
}
6 changes: 3 additions & 3 deletions src/main/java/logisticspipes/logistics/LogisticsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ public String getBetterRouterName(IRouter r) {

if (r.getPipe() instanceof PipeItemsCraftingLogistics) {
PipeItemsCraftingLogistics pipe = (PipeItemsCraftingLogistics) r.getPipe();
if (pipe.getCraftedItems() != null) {
List<ItemIdentifierStack> items = pipe.getCraftedItems();
if (pipe.getConfiguredCraftResults() != null) {
List<ItemIdentifierStack> items = pipe.getConfiguredCraftResults();
if (items.size() == 1) {
return ("Crafter<" + items.get(0).getFriendlyName() + ">");
}
Expand Down Expand Up @@ -398,7 +398,7 @@ public LinkedList<ItemIdentifier> getCraftableItems(List<ExitRoute> validDestina
}
}
ICraftItems crafter = (ICraftItems) r.destination.getPipe();
List<ItemIdentifierStack> craftedItems = crafter.getCraftedItems();
List<ItemIdentifierStack> craftedItems = crafter.getConfiguredCraftResults();
if (craftedItems != null) {
outer2: for (ItemIdentifierStack craftedItem : craftedItems) {
if (craftedItem != null && !craftableItems.contains(craftedItem.getItem())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;

import org.jetbrains.annotations.NotNull;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import logisticspipes.interfaces.IClientInformationProvider;
Expand All @@ -25,6 +27,7 @@
import logisticspipes.interfaces.IModuleInventoryReceive;
import logisticspipes.interfaces.IModuleWatchReciver;
import logisticspipes.interfaces.routing.IAdditionalTargetInformation;
import logisticspipes.interfaces.routing.IRequest;
import logisticspipes.interfaces.routing.IRequestItems;
import logisticspipes.interfaces.routing.IRequireReliableTransport;
import logisticspipes.interfaces.routing.ITargetSlotInformation;
Expand Down Expand Up @@ -593,7 +596,7 @@ public int getID() {
}

@Override
public int compareTo(IRequestItems value2) {
public int compareTo(@NotNull IRequest o) {
return 0;
}

Expand Down
Loading

0 comments on commit e41a7d4

Please sign in to comment.