Update energy cells to now 5 states

This commit is contained in:
yueh
2020-09-18 20:50:10 +02:00
parent 996698c022
commit 89173fd94f
2 changed files with 6 additions and 9 deletions
@@ -35,7 +35,9 @@ import appeng.tile.networking.EnergyCellTileEntity;
public class EnergyCellBlock extends AEBaseTileBlock<EnergyCellTileEntity> {
public static final IntegerProperty ENERGY_STORAGE = IntegerProperty.create("fullness", 0, 7);
public static final int MAX_FULLNESS = 4;
public static final IntegerProperty ENERGY_STORAGE = IntegerProperty.create("fullness", 0, MAX_FULLNESS);
public EnergyCellBlock() {
super(defaultProps(AEMaterials.GLASS));
@@ -21,6 +21,7 @@ package appeng.tile.networking;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.MathHelper;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -67,15 +68,9 @@ public class EnergyCellTileEntity extends AENetworkTileEntity implements IAEPowe
* block. This is also used for determining the item model.
*/
public static int getStorageLevelFromFillFactor(double fillFactor) {
byte boundMetadata = (byte) (8.0 * (fillFactor));
byte factor = (byte) (8.0 * (fillFactor));
if (boundMetadata > 7) {
boundMetadata = 7;
}
if (boundMetadata < 0) {
boundMetadata = 0;
}
return boundMetadata;
return MathHelper.clamp(factor, 0, EnergyCellBlock.MAX_FULLNESS);
}
private void changePowerLevel() {