Skip to content

Commit

Permalink
added partial amps machine flag, made machines with batteries in them…
Browse files Browse the repository at this point in the history
… accept partial amps
  • Loading branch information
Trinsdar committed Nov 30, 2023
1 parent 53a9665 commit 53c81dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package muramasa.antimatter.blockentity.pipe;

import lombok.Getter;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Data;
import muramasa.antimatter.Ref;
Expand Down Expand Up @@ -59,6 +60,7 @@ public abstract class BlockEntityPipe<T extends PipeType<T>> extends BlockEntity
**/
private byte connection, virtualConnection;

@Getter
protected Holder pipeCapHolder;

public BlockEntityPipe(T type, BlockPos pos, BlockState state) {
Expand Down Expand Up @@ -86,10 +88,6 @@ public void onLoad() {
}
}

public Holder getPipeCapHolder() {
return pipeCapHolder;
}

public boolean isConnector() {
return !this.getBlockState().getValue(BlockPipe.TICKING) || this.coverHandler.map(p -> {
for (ICover cover : p.getAll()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import muramasa.antimatter.capability.EnergyHandler;
import muramasa.antimatter.capability.IMachineHandler;
import muramasa.antimatter.gui.SlotType;
import muramasa.antimatter.machine.MachineFlag;
import muramasa.antimatter.machine.event.IMachineEvent;
import muramasa.antimatter.machine.event.MachineEvent;
import muramasa.antimatter.util.Utils;
Expand Down Expand Up @@ -91,7 +92,7 @@ public long insertEu(long voltage, boolean simulate) {
if (getState().getAmpsReceived() >= getInputAmperage()) return 0;
int loss = canInput() && canOutput() ? 1 : 0;
voltage -= loss;
if (this.getEnergy() + voltage > this.getCapacity()) return 0;
if (!this.tile.getMachineType().has(MachineFlag.PARTIAL_AMPS) && cachedItems.isEmpty() && this.getEnergy() + voltage > this.getCapacity()) return 0;
if (!simulate && !checkVoltage(voltage + loss)) return voltage + loss;
if (cachedItems.isEmpty()){
long superInsert = super.insertEu(voltage, simulate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public enum MachineFlag {
RECIPE, //Has a recipe map
GUI,
GENERATOR, //Has a recipe map and converts applicable recipes to power.
COVERABLE;
COVERABLE,
PARTIAL_AMPS;

public static final MachineFlag[] VALUES;

Expand Down

0 comments on commit 53c81dd

Please sign in to comment.