forked from GTNewHorizons/GT5-Unofficial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix plasma mixer power consumption and overflow (GTNewHorizons#2778)
* fix * better fix
- Loading branch information
Showing
3 changed files
with
78 additions
and
6 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
59 changes: 59 additions & 0 deletions
59
src/main/java/gregtech/api/recipe/check/ResultInsufficientStartupPowerBigInt.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,59 @@ | ||
package gregtech.api.recipe.check; | ||
|
||
import static util.Util.toStandardForm; | ||
|
||
import java.math.BigInteger; | ||
import java.util.Objects; | ||
|
||
import net.minecraft.network.PacketBuffer; | ||
import net.minecraft.util.StatCollector; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ResultInsufficientStartupPowerBigInt implements CheckRecipeResult { | ||
|
||
private String required; | ||
|
||
public ResultInsufficientStartupPowerBigInt(BigInteger required) { | ||
this.required = toStandardForm(required); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getID() { | ||
return "insufficient_startup_power_bigint"; | ||
} | ||
|
||
@Override | ||
public boolean wasSuccessful() { | ||
return false; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getDisplayString() { | ||
return Objects.requireNonNull( | ||
StatCollector.translateToLocalFormatted("GT5U.gui.text.insufficient_startup_power", required)); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public CheckRecipeResult newInstance() { | ||
return new ResultInsufficientStartupPowerBigInt(BigInteger.ZERO); | ||
} | ||
|
||
@Override | ||
public void encode(@NotNull PacketBuffer buffer) { | ||
try { | ||
buffer.writeStringToBuffer(required); | ||
} catch (Exception ignored) {} | ||
|
||
} | ||
|
||
@Override | ||
public void decode(PacketBuffer buffer) { | ||
try { | ||
required = buffer.readStringFromBuffer(32768); | ||
} catch (Exception ignored) {} | ||
} | ||
} |
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