mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Merge branch '1.11' into issue-4484
This commit is contained in:
commit
4a7b457bfc
45 files changed
+171
-85
No files matched your search
@@ -84,10 +84,12 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
@@ -1106,6 +1108,19 @@ public final class MekanismUtils
|
||||
|
||||
return "error";
|
||||
}
|
||||
|
||||
public static String getEnergyDisplay(double energy, double max)
|
||||
{
|
||||
if(energy == Double.MAX_VALUE)
|
||||
{
|
||||
return LangUtils.localize("gui.infinite");
|
||||
}
|
||||
|
||||
String energyString = getEnergyDisplay(energy);
|
||||
String maxString = getEnergyDisplay(max);
|
||||
|
||||
return energyString + "/" + maxString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from the unit defined in the configuration to joules.
|
||||
@@ -1551,4 +1566,9 @@ public final class MekanismUtils
|
||||
return prefix + "/";
|
||||
}
|
||||
}
|
||||
|
||||
public static TileEntity getTileEntitySafe(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn instanceof ChunkCache ? ((ChunkCache)worldIn).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : worldIn.getTileEntity(pos);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user