Compare commits
2 commits
111f9cbdad
...
c28c6ccee0
Author | SHA1 | Date | |
---|---|---|---|
c28c6ccee0 | |||
b45e79029e |
4 changed files with 6 additions and 10 deletions
|
@ -7,7 +7,7 @@ minecraft_version=1.21.4
|
||||||
yarn_mappings=1.21.4+build.8
|
yarn_mappings=1.21.4+build.8
|
||||||
loader_version=0.16.10
|
loader_version=0.16.10
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.2.0
|
mod_version=1.2.1
|
||||||
maven_group=arzumify.polyenergy
|
maven_group=arzumify.polyenergy
|
||||||
archives_base_name=polyenergy
|
archives_base_name=polyenergy
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
|
@ -9,10 +9,11 @@ public interface EnergyProvider {
|
||||||
/**
|
/**
|
||||||
* When called by a receiver, attempts to remove energy from the provider.
|
* When called by a receiver, attempts to remove energy from the provider.
|
||||||
* Do not attempt to extract energy until {@link EnergyReceiver#ready(EnergyProvider)} is called by the receiver.
|
* Do not attempt to extract energy until {@link EnergyReceiver#ready(EnergyProvider)} is called by the receiver.
|
||||||
|
* The receiver may attempt to remove itself from the provider if it is no longer able to receive energy; this will be done via unready.
|
||||||
*
|
*
|
||||||
* @param amount The target amount of energy to extract
|
* @param amount The target amount of energy to extract
|
||||||
* @param receiver The receiver that is attempting to extract energy
|
* @param receiver The receiver that is attempting to extract energy
|
||||||
* @return The amount of energy actually extracted. If zero, the receiver will not attempt to extract energy until {@link EnergyReceiver#ready(EnergyProvider)} is called.
|
* @return The amount of energy actually extracted.
|
||||||
*/
|
*/
|
||||||
long extract(long amount, EnergyReceiver receiver);
|
long extract(long amount, EnergyReceiver receiver);
|
||||||
|
|
||||||
|
|
|
@ -43,18 +43,16 @@ public class SimpleCable extends BlockEntity implements EnergyProvider, EnergyRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long extract(long amount, EnergyReceiver receiver) {
|
public long extract(long amount, EnergyReceiver receiver) {
|
||||||
|
System.out.println("Extracting " + amount + " energy");
|
||||||
long extracted = Math.min(Math.min(outputRate, amount), energy);
|
long extracted = Math.min(Math.min(outputRate, amount), energy);
|
||||||
energy -= extracted;
|
energy -= extracted;
|
||||||
if (energy == 0) {
|
|
||||||
CoordinateMatchMaker.removeProvider(providerDetails);
|
|
||||||
}
|
|
||||||
return extracted;
|
return extracted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exists(EnergyReceiver receiver, ArrayList<Vec3i> pointsOfPresence) {
|
public void exists(EnergyReceiver receiver, ArrayList<Vec3i> pointsOfPresence) {
|
||||||
if (currentProvider != null) {
|
if (currentProvider != null) {
|
||||||
receiver.ready(currentProvider);
|
receiver.ready(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,6 @@ public class SimpleCodeOnlyCable implements EnergyProvider, EnergyReceiver, Serv
|
||||||
long extracted = Math.min(Math.min(outputRate, amount), energy);
|
long extracted = Math.min(Math.min(outputRate, amount), energy);
|
||||||
energy -= extracted;
|
energy -= extracted;
|
||||||
System.out.println(name + " extracted " + extracted + " energy");
|
System.out.println(name + " extracted " + extracted + " energy");
|
||||||
if (energy == 0) {
|
|
||||||
CoordinateMatchMaker.removeProvider(providerDetails);
|
|
||||||
}
|
|
||||||
return extracted;
|
return extracted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +51,7 @@ public class SimpleCodeOnlyCable implements EnergyProvider, EnergyReceiver, Serv
|
||||||
public void exists(EnergyReceiver receiver, ArrayList<Vec3i> pointsOfPresence) {
|
public void exists(EnergyReceiver receiver, ArrayList<Vec3i> pointsOfPresence) {
|
||||||
System.out.println(name + " found other receiver");
|
System.out.println(name + " found other receiver");
|
||||||
if (currentProvider != null) {
|
if (currentProvider != null) {
|
||||||
receiver.ready(currentProvider);
|
receiver.ready(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue