-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
224 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/com/teammoeg/frostedheart/content/steamenergy/HeatCapacityEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.teammoeg.frostedheart.content.steamenergy; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import net.minecraft.nbt.CompoundTag; | ||
|
||
/** | ||
* Defines a HeatEndpoint with a capacity to store, provide, and receive heat. | ||
*/ | ||
@Getter | ||
@ToString(callSuper = true) | ||
public abstract class HeatCapacityEndpoint extends HeatEndpoint { | ||
/** The max capacity to store heat. */ | ||
protected final float capacity; | ||
/** | ||
* Detach priority. | ||
* Consumer priority, if power is low, endpoint with lower priority would detach first | ||
*/ | ||
protected final int priority; | ||
/** Current heat stored. */ | ||
@Setter | ||
protected float heat; | ||
|
||
public HeatCapacityEndpoint(int priority, float capacity) { | ||
this.capacity = capacity; | ||
this.priority = priority; | ||
} | ||
|
||
public void load(CompoundTag nbt,boolean isPacket) { | ||
heat = nbt.getFloat("net_power"); | ||
} | ||
|
||
public void save(CompoundTag nbt,boolean isPacket) { | ||
nbt.putFloat("net_power", heat); | ||
} | ||
|
||
@Override | ||
public boolean canReceiveHeat() { | ||
return heat < capacity; | ||
} | ||
|
||
@Override | ||
public boolean canProvideHeat() { | ||
return heat > 0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.