mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f622686f3 | ||
|
|
fce7efd59a | ||
|
|
6158afeb86 | ||
|
|
e94f967c38 | ||
|
|
3ee9facc9b |
No files matched your search
@@ -0,0 +1,8 @@
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface IAlleleBeeAcceleratableEffect {
|
||||
IEffectData doEffectAccelerated(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, float did);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
@@ -566,7 +565,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
|
||||
@Override
|
||||
protected void registerMutations() {
|
||||
registerMutation(Sequioa, Baobab, 1).requireNight().restrictBiomeType(BiomeDictionary.Type.FOREST);
|
||||
registerMutation(Sequioa, Baobab, 1);
|
||||
}
|
||||
},
|
||||
Jungle(
|
||||
|
||||
@@ -20,6 +20,7 @@ import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.network.packets.PacketGenomeTrackerSync;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -57,7 +58,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
|
||||
private GameProfile username;
|
||||
|
||||
@Nullable
|
||||
private World world;
|
||||
private WeakReference<World> world;
|
||||
|
||||
protected BreedingTracker(String s) {
|
||||
super(s);
|
||||
@@ -68,7 +69,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
|
||||
}
|
||||
|
||||
public void setWorld(@Nullable World world) {
|
||||
this.world = world;
|
||||
this.world = new WeakReference<>(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,6 +114,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
|
||||
Collection<String> discoveredSpecies,
|
||||
Collection<String> discoveredMutations,
|
||||
Collection<String> researchedMutations) {
|
||||
World world = this.world != null ? this.world.get() : null;
|
||||
if (world != null && username != null && username.getName() != null) {
|
||||
EntityPlayer player = world.getPlayerEntityByName(username.getName());
|
||||
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) {
|
||||
|
||||
@@ -172,6 +172,7 @@ for.gui.inactive=Inactive
|
||||
for.gui.life=Life
|
||||
for.gui.lifespan=Lifespan
|
||||
for.gui.normal=Normal
|
||||
for.gui.jubilance=Jubilance: %s
|
||||
|
||||
for.gui.escritoire.probe=Examine Specimens
|
||||
for.gui.escritoire.instructions=Place a genetic sample in the center to begin. Place more in the left slots and examine them for help.
|
||||
@@ -355,7 +356,7 @@ for.hints.beebreeding.desc=Crossbreeding drones and princesses of different spec
|
||||
for.hints.beebreeding.tag=Breed your bees!
|
||||
for.hints.beeflowers.desc=Any bee will need some type of flower in the vicinity. Some rather mundane flowers, others very exotic ones.
|
||||
for.hints.beeflowers.tag=Bees need flowers
|
||||
for.hints.beejubilance.desc=Only jubilant bees will produce their specialty. Make sure to have them in their preferred climate.
|
||||
for.hints.beejubilance.desc=Only jubilant bees will produce their specialty. Make sure to check jubilance requirements in the bee scan.
|
||||
for.hints.beejubilance.tag=Make your bee happy!
|
||||
for.hints.cooldownloss.desc=Engines going into forced cooldown will also lose a significant chunk of their stored energy.
|
||||
for.hints.cooldownloss.tag=Cooldown means energy loss!
|
||||
@@ -759,6 +760,14 @@ neiintegration.handler.forestry.shaped=Forestry Shaped
|
||||
neiintegration.handler.forestry.shapeless=Forestry Shapeless
|
||||
neiintegration.handler.forestry.fabricator.worth=Worth:
|
||||
|
||||
################
|
||||
# JUBILANCE
|
||||
################
|
||||
|
||||
for.jubilance.climate=Needs preferred climate
|
||||
for.jubilance.hermit=Will not produce if there are any other living creatures nearby
|
||||
for.jubilance.resource=Requires %s as foundation
|
||||
|
||||
################
|
||||
# ERRORS
|
||||
################
|
||||
|
||||
Reference in new issue
Block a user