Skip to content

Commit

Permalink
add API priority fluid storage bus
Browse files Browse the repository at this point in the history
  • Loading branch information
aagrishankov committed Mar 13, 2021
1 parent b5299a2 commit 8a2f939
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Binary file removed libs/gregtech-5.09.33.44-dev.jar1
Binary file not shown.
20 changes: 15 additions & 5 deletions src/main/scala/extracells/part/PartFluidStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.*;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
Expand All @@ -16,6 +17,8 @@
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.util.AEColor;
import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import extracells.container.ContainerBusFluidStorage;
Expand Down Expand Up @@ -45,10 +48,10 @@
import java.util.HashMap;
import java.util.List;

public class PartFluidStorage extends PartECBase implements ICellContainer, IInventoryUpdateReceiver, IFluidSlotPartOrBlock {
public class PartFluidStorage extends PartECBase implements ICellContainer, IInventoryUpdateReceiver, IFluidSlotPartOrBlock, IPriorityHost {

private HashMap<FluidStack, Integer> fluidList = new HashMap<FluidStack, Integer>();
private int priority = 0;
public int priority = 0; //todo priority
protected HandlerPartStorageFluid handler = new HandlerPartStorageFluid(this);
private Fluid[] filterFluids = new Fluid[54]; //total number 54
private AccessRestriction access = AccessRestriction.READ_WRITE;
Expand Down Expand Up @@ -118,10 +121,17 @@ public double getPowerUsage() {
}

@Override
public int getPriority() {
public int getPriority() {//todo priority
return this.priority;
}

@Override
public void setPriority(int priority) {//todo priority
this.priority = priority;
this.getHost().markForSave(); //save me with new priority
this.getHost().markForUpdate(); //upd me with new priority
}

@Override
public Object getServerGuiElement(EntityPlayer player) {
return new ContainerBusFluidStorage(this, player);
Expand Down Expand Up @@ -175,7 +185,7 @@ public void powerChange(MENetworkPowerStatusChange event) {
@Override
public void readFromNBT(NBTTagCompound data) {
super.readFromNBT(data);
this.priority = data.getInteger("priority");
this.priority = data.getInteger("priority"); //todo priority
for (int i = 0; i < 54; i++) { //total number 54
this.filterFluids[i] = FluidRegistry.getFluid(data.getString("FilterFluid#" + i));
}
Expand Down Expand Up @@ -284,7 +294,7 @@ public void updateChannels(MENetworkChannelsChanged channel) {
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
data.setInteger("priority", this.priority);
data.setInteger("priority", this.priority); //todo priority
for (int i = 0; i < this.filterFluids.length; i++) {//total number 54
Fluid fluid = this.filterFluids[i];
if (fluid != null)
Expand Down

0 comments on commit 8a2f939

Please sign in to comment.