mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 19:29:17 +00:00
Add Jubiliance description (#35)
* Add Jubilance description * Update GuiBeealyzer.java * Translatable strings
This commit is contained in:
1 parent
e94f967c38
commit
6158afeb86
9 files changed
+64
-39
No files matched your search
@@ -29,6 +29,13 @@ public interface IAlleleBeeSpeciesCustom extends IAlleleBeeSpecies, IAlleleSpeci
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider);
|
||||
|
||||
/**
|
||||
* Get the Jubilance Provider for this bee species.
|
||||
*/
|
||||
default IJubilanceProvider getJubilanceProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this species only active at night.
|
||||
*/
|
||||
|
||||
@@ -12,4 +12,8 @@ public interface IJubilanceProvider {
|
||||
* Jubilant bees can produce their Specialty products.
|
||||
*/
|
||||
boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing);
|
||||
|
||||
default String getDescription() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,7 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -426,12 +415,18 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
+ AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / "
|
||||
+ humidToleranceAllele.getName();
|
||||
String flowers = genome.getFlowerProvider().getDescription();
|
||||
String jubilance = null;
|
||||
if (primary instanceof IAlleleBeeSpeciesCustom) {
|
||||
IJubilanceProvider provider = ((IAlleleBeeSpeciesCustom) primary).getJubilanceProvider();
|
||||
if (provider != null) jubilance = provider.getDescription();
|
||||
}
|
||||
|
||||
list.add(lifespan);
|
||||
list.add(speed);
|
||||
list.add(tempTolerance);
|
||||
list.add(humidTolerance);
|
||||
list.add(flowers);
|
||||
if (jubilance != null) list.add(StringUtil.localizeAndFormat("gui.jubilance", jubilance));
|
||||
|
||||
if (genome.getNocturnal()) {
|
||||
list.add(EnumChatFormatting.RED + GenericRatings.rateActivityTime(genome.getNocturnal(), false));
|
||||
|
||||
@@ -16,6 +16,7 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class JubilanceDefault implements IJubilanceProvider {
|
||||
|
||||
@@ -30,4 +31,9 @@ public class JubilanceDefault implements IJubilanceProvider {
|
||||
|
||||
return temperature == species.getTemperature() && humidity == species.getHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StringUtil.localize("jubilance.climate");
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
@@ -26,4 +27,9 @@ public class JubilanceProviderHermit extends JubilanceDefault {
|
||||
List<EntityLiving> list = AlleleEffect.getEntitiesInRange(genome, housing, EntityLiving.class);
|
||||
return list.size() <= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StringUtil.localize("jubilance.hermit");
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,12 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
// import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
|
||||
@@ -35,20 +35,6 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
ChunkCoordinates housingCoords = housing.getCoordinates();
|
||||
/*
|
||||
Block block;
|
||||
TileEntity tile;
|
||||
int meta;
|
||||
int i = 1;
|
||||
do {
|
||||
block = world.getBlock(housingCoords.posX, housingCoords.posY - i, housingCoords.posZ);
|
||||
meta = world.getBlockMetadata(housingCoords.posX, housingCoords.posY - i, housingCoords.posZ);
|
||||
tile = world.getTileEntity(housingCoords.posX, housingCoords.posY - i, housingCoords.posZ);
|
||||
i++;
|
||||
} while (tile instanceof IBeeHousing);
|
||||
|
||||
return ItemStackUtil.equals(block, meta, blockRequired);
|
||||
*/
|
||||
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(
|
||||
world,
|
||||
housingCoords.posX,
|
||||
@@ -56,11 +42,11 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
housingCoords.posZ,
|
||||
(TileEntity tile) -> (tile instanceof IBeeHousing));
|
||||
|
||||
return InventoryUtil.isItemEqual(
|
||||
blockRequired,
|
||||
stk,
|
||||
true,
|
||||
true); // ffs dont compare itemsstacks with equal >_> and why tf didnt i got this until i debugged it?
|
||||
// im getting old..
|
||||
return InventoryUtil.isItemEqual(blockRequired, stk, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StringUtil.localizeAndFormat("jubilance.resource", blockRequired.getDisplayName());
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,11 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IJubilanceProvider getJubilanceProvider() {
|
||||
return this.jubilanceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setNocturnal() {
|
||||
nocturnal = true;
|
||||
|
||||
@@ -10,11 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
@@ -298,6 +294,17 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
}
|
||||
}
|
||||
|
||||
String jubilance = null;
|
||||
IAlleleBeeSpecies primary = bee.getGenome().getPrimary();
|
||||
if (primary instanceof IAlleleBeeSpeciesCustom) {
|
||||
IJubilanceProvider provider = ((IAlleleBeeSpeciesCustom) primary).getJubilanceProvider();
|
||||
if (provider != null) jubilance = provider.getDescription();
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
if (jubilance != null) textLayout.drawLine(StringUtil.localizeAndFormat("gui.jubilance", jubilance), COLUMN_0);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user