mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 20:22:35 +00:00
Adding database and soil localisation
This commit is contained in:
1 parent
7e9a87f08b
commit
a300bc0a11
13 files changed
+71
-33
No files matched your search
@@ -129,10 +129,13 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return "Unknown";
|
||||
return Binnie.Language.localise("item.botany.flower.corrupted.name");
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + tag) : "Corrupted Flower";
|
||||
IIndividual individual = this.getIndividual(itemstack);
|
||||
if (individual != null && individual.getGenome() != null) {
|
||||
return individual.getDisplayName() + (!tag.isEmpty() ? " " + Binnie.Language.localise("item.botany." + tag + ".name") : "");
|
||||
}
|
||||
return Binnie.Language.localise("item.botany.flower.corrupted.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,6 +44,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||
super(Material.GROUND);
|
||||
this.weedKilled = weedKilled;
|
||||
setUnlocalizedName("botany.soil." + type.getName());
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setRegistryName(blockName);
|
||||
this.setTickRandomly(true);
|
||||
@@ -52,6 +53,12 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
this.setSoundType(SoundType.GROUND);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return super.getUnlocalizedName().replaceFirst("tile.", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -38,10 +39,9 @@ public class ItemSoil extends ItemBlock {
|
||||
tooltip.add(TextFormatting.GREEN + Binnie.Language.localise("botany.soil.weedkiller"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
|
||||
|
||||
public String getItemStackDisplayName(ItemStack stack){
|
||||
return this.getUnlocalizedNameInefficiently(stack).trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,8 +35,8 @@ public class ModuleGenetics implements IInitializable {
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
|
||||
Botany.flowerItem = new ItemBotany("itemFlower", EnumFlowerStage.FLOWER, "");
|
||||
Botany.pollen = new ItemBotany("pollen", EnumFlowerStage.POLLEN, "Pollen");
|
||||
Botany.seed = new ItemBotany("seed", EnumFlowerStage.SEED, " Germling");
|
||||
Botany.pollen = new ItemBotany("pollen", EnumFlowerStage.POLLEN, "pollen");
|
||||
Botany.seed = new ItemBotany("seed", EnumFlowerStage.SEED, "germling");
|
||||
Botany.database = new ItemDictionary();
|
||||
Botany.encyclopedia = new ItemEncyclopedia(false);
|
||||
Botany.encyclopediaIron = new ItemEncyclopedia(true);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -26,22 +28,22 @@ public class PageBranchOverview extends PageBranch {
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IClassification branch) {
|
||||
this.pageBranchOverview_branchName.setValue("§n" + branch.getName() + " Branch§r");
|
||||
this.pageBranchOverview_branchScientific.setValue("§oApidae " + branch.getScientific() + "§r");
|
||||
this.pageBranchOverview_branchAuthority.setValue("Discovered by §l" + branch.getMemberSpecies()[0].getAuthority() + "§r");
|
||||
this.pageBranchOverview_branchName.setValue(TextFormatting.UNDERLINE + branch.getName() + Binnie.Language.localise("binniecore.gui.database.branch.branch"));
|
||||
this.pageBranchOverview_branchScientific.setValue(TextFormatting.ITALIC + Binnie.Language.localise("binniecore.gui.database.branch.apidae") + " " + branch.getScientific());
|
||||
this.pageBranchOverview_branchAuthority.setValue(Binnie.Language.localise("binniecore.gui.database.discovered") + " " + TextFormatting.BOLD + branch.getMemberSpecies()[0].getAuthority());
|
||||
for (final IWidget widget : this.pageBranchOverview_branchDescription) {
|
||||
this.deleteChild(widget);
|
||||
}
|
||||
this.pageBranchOverview_branchDescription.clear();
|
||||
String desc = branch.getDescription();
|
||||
if (desc == null || Objects.equals(desc, "")) {
|
||||
desc = "No Description Provided.";
|
||||
desc = Binnie.Language.localise("binniecore.gui.database.no.description");
|
||||
}
|
||||
String line = "";
|
||||
final List<String> descLines = new ArrayList<>();
|
||||
for (final String str : desc.split(" ")) {
|
||||
if (CraftGUI.Render.textWidth(line + " " + str) > 134) {
|
||||
descLines.add("§o" + line + "§r");
|
||||
descLines.add(TextFormatting.ITALIC + line + TextFormatting.RESET);
|
||||
line = "";
|
||||
}
|
||||
line = line + " " + str;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
@@ -18,7 +19,7 @@ public class PageBranchSpecies extends PageBranch {
|
||||
|
||||
public PageBranchSpecies(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageBranchSpecies_title = new ControlTextCentered(this, 8.0f, "Species");
|
||||
this.pageBranchSpecies_title = new ControlTextCentered(this, 8.0f, Binnie.Language.localise("binniecore.gui.database.species"));
|
||||
this.addEventHandler(new EventValueChanged.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventValueChanged event) {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.controls.page.ControlPage;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class PageBreeder extends ControlPage<DatabaseTab> {
|
||||
@@ -22,15 +25,15 @@ public class PageBreeder extends ControlPage<DatabaseTab> {
|
||||
}
|
||||
final BreedingSystem system = ((WindowAbstractDatabase) Window.get(this)).getBreedingSystem();
|
||||
final String descriptor = system.getDescriptor();
|
||||
new ControlTextCentered(this, 8.0f, "§n" + system.getDescriptor() + " Profile§r");
|
||||
new ControlTextCentered(this, 75.0f, "" + system.discoveredSpeciesCount + "/" + system.totalSpeciesCount + " Species");
|
||||
new ControlTextCentered(this, 8.0f, TextFormatting.UNDERLINE + system.getDescriptor() + " " + Binnie.Language.localise("binniecore.gui.database.breeder.profile"));
|
||||
new ControlTextCentered(this, 75.0f, "" + system.discoveredSpeciesCount + "/" + system.totalSpeciesCount + " " + Binnie.Language.localise("binniecore.gui.database.species"));
|
||||
new ControlBreedingProgress(this, 20, 87, 102, 14, system, system.discoveredSpeciesPercentage);
|
||||
new ControlTextCentered(this, 115.0f, "" + system.discoveredBranchCount + "/" + system.totalBranchCount + " Branches");
|
||||
new ControlTextCentered(this, 115.0f, "" + system.discoveredBranchCount + "/" + system.totalBranchCount + " " + Binnie.Language.localise("binniecore.gui.database.breeder.branches"));
|
||||
new ControlBreedingProgress(this, 20, 127, 102, 14, system, system.discoveredBranchPercentage);
|
||||
if (system.discoveredSecretCount > 0) {
|
||||
new ControlTextCentered(this, 155.0f, "" + system.discoveredSecretCount + "/" + system.totalSecretCount + " Secret Species");
|
||||
new ControlTextCentered(this, 155.0f, "" + system.discoveredSecretCount + "/" + system.totalSecretCount + " " + Binnie.Language.localise("binniecore.gui.database.breeder.species.secret"));
|
||||
}
|
||||
new ControlTextCentered(this, 32.0f, this.player.getName());
|
||||
new ControlTextCentered(this, 44.0f, "§o" + system.getEpitome() + "§r");
|
||||
new ControlTextCentered(this, 44.0f, TextFormatting.ITALIC + system.getEpitome());
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
public class PageBreederStats extends Control {
|
||||
String player;
|
||||
|
||||
|
||||
public PageBreederStats(final IWidget parent, final int w, final int h, final String player) {
|
||||
super(parent, 0.0f, 0.0f, w, h);
|
||||
this.player = player;
|
||||
final ControlText pageBranchOverview_branchName = new ControlTextCentered(this, 8.0f, "§nStats§r");
|
||||
final ControlText pageBranchOverview_branchName = new ControlTextCentered(this, 8.0f, TextFormatting.UNDERLINE + Binnie.Language.localise("binniecore.gui.database.breeder.stats"));
|
||||
final BreedingSystem system = ((WindowAbstractDatabase) this.getSuperParent()).getBreedingSystem();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
@@ -11,7 +12,7 @@ public class PageSpeciesMutations extends PageSpecies {
|
||||
|
||||
public PageSpeciesMutations(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Further Mutations");
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, Binnie.Language.localise("binniecore.gui.database.mutations.further"));
|
||||
this.pageSpeciesFurther_List = new ControlMutationBox(this, 4, 20, 136, 152, ControlMutationBox.Type.Further);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
@@ -8,6 +9,7 @@ import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -28,7 +30,7 @@ public class PageSpeciesOverview extends PageSpecies {
|
||||
this.controlName = new ControlTextCentered(this, 8.0f, "");
|
||||
this.controlScientific = new ControlTextCentered(this, 32.0f, "");
|
||||
this.controlAuthority = new ControlTextCentered(this, 44.0f, "");
|
||||
this.controlComplexity = new ControlTextCentered(this, 56.0f, "");
|
||||
this.controlComplexity = new ControlTextCentered(this, 68.0f, "");
|
||||
this.controlDescription = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.MiddleCenter);
|
||||
this.controlSignature = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.BottomRight);
|
||||
}
|
||||
@@ -39,15 +41,15 @@ public class PageSpeciesOverview extends PageSpecies {
|
||||
this.controlInd2.setSpecies(species, EnumDiscoveryState.Show);
|
||||
final String branchBinomial = (species.getBranch() != null) ? species.getBranch().getScientific() : "<Unknown>";
|
||||
final String branchName = (species.getBranch() != null) ? species.getBranch().getName() : "Unknown";
|
||||
this.controlName.setValue("§n" + species.getName() + "§r");
|
||||
this.controlScientific.setValue("§o" + branchBinomial + " " + species.getBinomial() + "§r");
|
||||
this.controlAuthority.setValue("Discovered by §l" + species.getAuthority() + "§r");
|
||||
this.controlComplexity.setValue("Complexity: " + species.getComplexity());
|
||||
this.controlName.setValue(TextFormatting.UNDERLINE + species.getName());
|
||||
this.controlScientific.setValue(TextFormatting.ITALIC + branchBinomial + " " + species.getBinomial());
|
||||
this.controlAuthority.setValue(Binnie.Language.localise("binniecore.gui.database.discovered") + ": " + TextFormatting.BOLD + species.getAuthority());
|
||||
this.controlComplexity.setValue(Binnie.Language.localise("binniecore.gui.database.overview.complexity") + ": " + species.getComplexity());
|
||||
final String desc = species.getDescription();
|
||||
String descBody = "§o";
|
||||
String descBody = TextFormatting.ITALIC.toString();
|
||||
String descSig = "";
|
||||
if (desc == null || Objects.equals(desc, "")) {
|
||||
descBody += "No Description Provided.";
|
||||
descBody += Binnie.Language.localise("binniecore.gui.database.no.description");
|
||||
} else {
|
||||
final String[] descStrings = desc.split("\\|");
|
||||
descBody += descStrings[0];
|
||||
@@ -58,8 +60,8 @@ public class PageSpeciesOverview extends PageSpecies {
|
||||
descSig += descStrings[descStrings.length - 1];
|
||||
}
|
||||
}
|
||||
this.controlDescription.setValue(descBody + "§r");
|
||||
this.controlSignature.setValue(descSig + "§r");
|
||||
this.controlDescription.setValue(descBody + TextFormatting.RESET);
|
||||
this.controlSignature.setValue(descSig);
|
||||
final float descHeight = CraftGUI.Render.textHeight(this.controlDescription.getValue(), this.controlDescription.getSize().x());
|
||||
this.controlSignature.setPosition(new IPoint(this.controlSignature.pos().x(), this.controlDescription.getPosition().y() + descHeight + 10.0f));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.craftgui.mod.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
@@ -11,7 +12,7 @@ public class PageSpeciesResultant extends PageSpecies {
|
||||
|
||||
public PageSpeciesResultant(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesResultant_Title = new ControlTextCentered(this, 8.0f, "Resultant Mutations");
|
||||
this.pageSpeciesResultant_Title = new ControlTextCentered(this, 8.0f, Binnie.Language.localise("binniecore.gui.database.mutations.resultant"));
|
||||
this.pageSpeciesResultant_List = new ControlMutationBox(this, 4, 20, 136, 152, ControlMutationBox.Type.Resultant);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user