use of net.minecraftforge.fml.relauncher.SideOnly in project Geolosys by oitsjustjose.
the class ItemFieldManual method translatePageText.
@SideOnly(Side.CLIENT)
public String translatePageText(int pageNumber) {
String langFile = Minecraft.getMinecraft().gameSettings.language;
langFile = langFile.substring(0, langFile.indexOf("_")) + langFile.substring(langFile.indexOf("_")).toUpperCase();
InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
if (in == null) {
langFile = "en_US";
in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
}
try {
for (String s : IOUtils.readLines(in, "utf-8")) {
if (s.indexOf("=") == -1) {
continue;
}
if (s.substring(0, s.indexOf("=")).equals("page_" + pageNumber + "_text")) {
return s.substring(s.indexOf("=") + 1);
}
}
} catch (IOException e) {
}
return "ERROR READING PAGE " + pageNumber;
}
use of net.minecraftforge.fml.relauncher.SideOnly in project Geolosys by oitsjustjose.
the class ItemFieldManual method getNumEntries.
@SideOnly(Side.CLIENT)
public int getNumEntries() {
String langFile = Minecraft.getMinecraft().gameSettings.language;
langFile = langFile.substring(0, langFile.indexOf("_")) + langFile.substring(langFile.indexOf("_")).toUpperCase();
InputStream in = Geolosys.class.getResourceAsStream("/assets/geolosys/book/" + langFile + ".lang");
int numLines = 0;
if (in == null) {
langFile = "en_US";
in = Geolosys.class.getResourceAsStream("/assets/geolosys/lang/" + langFile + ".lang");
}
try {
for (String s : IOUtils.readLines(in, "utf-8")) {
if (s.indexOf("=") == -1) {
continue;
}
if (s.contains("_title")) {
numLines++;
}
}
} catch (IOException e) {
}
return numLines;
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class FeatureAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null && tagCompound.hasKey("feature")) {
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxFeatureAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxFeatureAbsorbtion;
if (pct == 100) {
list.add(TextFormatting.GREEN + tagCompound.getString("feature"));
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
} else {
list.add(TextFormatting.GREEN + "Unknown Feature");
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block in an area and it will");
list.add(TextFormatting.WHITE + "gradually absorb the essence of a random feature of");
list.add(TextFormatting.WHITE + "this dimension.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class LiquidAbsorberBlock method getWailaBody.
@SideOnly(Side.CLIENT)
@Override
@Optional.Method(modid = "waila")
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
LiquidAbsorberTileEntity tileEntity = (LiquidAbsorberTileEntity) accessor.getTileEntity();
if (tileEntity != null && tileEntity.getBlock() != null) {
Block block = tileEntity.getBlock();
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
if (fluid != null) {
int absorbing = tileEntity.getAbsorbing();
int pct = ((DimletConstructionConfiguration.maxLiquidAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxLiquidAbsorbtion;
currenttip.add(TextFormatting.GREEN + "Liquid: " + new FluidStack(fluid, 1).getLocalizedName() + " (" + pct + "%)");
}
}
return currenttip;
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class LiquidAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null && tagCompound.hasKey("liquid")) {
Block block = Block.REGISTRY.getObject(new ResourceLocation(tagCompound.getString("liquid")));
if (block != null) {
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
if (fluid != null) {
list.add(TextFormatting.GREEN + "Liquid: " + new FluidStack(fluid, 1).getLocalizedName());
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxLiquidAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxLiquidAbsorbtion;
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
}
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block on top of a liquid and it will");
list.add(TextFormatting.WHITE + "gradually absorb all this liquid in the area.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
Aggregations