mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Pull from branch 'mc-1.12'
This commit is contained in:
commit
ce3dea42e3
97 files changed
+3349
-58
No files matched your search
@@ -37,10 +37,15 @@ public interface IBeekeepingMode {
|
||||
*/
|
||||
boolean isFatigued(IBee queen, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
|
||||
/**
|
||||
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
|
||||
* @deprecated bees max out at 16x productivity instead of being overworked.
|
||||
* TODO remove this method in 1.13
|
||||
*/
|
||||
boolean isOverworked(IBee queen, IBeeHousing housing);
|
||||
@Deprecated
|
||||
default boolean isOverworked(IBee queen, IBeeHousing housing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the genetic structure of the queen is breaking down during spawning of the offspring (with chance). will trigger a negative effect.
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface ITreeGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@@ -37,6 +38,8 @@ public interface ITreeGenome extends IGenome {
|
||||
|
||||
int getGirth();
|
||||
|
||||
boolean getFireproof();
|
||||
|
||||
IAlleleLeafEffect getEffect();
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,4 +23,9 @@ public class AlleleManager {
|
||||
* Creates Forestry alleles.
|
||||
*/
|
||||
public static IAlleleFactory alleleFactory;
|
||||
|
||||
/**
|
||||
* @since 5.8
|
||||
*/
|
||||
public static IFilterRegistry filterRegistry;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
public class GeneticCapabilities {
|
||||
/**
|
||||
* Capability for {@link IFilterLogic}.
|
||||
*/
|
||||
@CapabilityInject(IFilterLogic.class)
|
||||
public static Capability<IFilterLogic> FILTER_LOGIC;
|
||||
}
|
||||
@@ -5,10 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
|
||||
/**
|
||||
* Keeps track of who bred, discovered, and researched which species in a world.
|
||||
*
|
||||
@@ -67,6 +71,13 @@ public interface IBreedingTracker {
|
||||
*/
|
||||
boolean isDiscovered(IAlleleSpecies species);
|
||||
|
||||
/**
|
||||
* @return A collection that contains the {@link IAllele#getUID()}s of all discovered species.
|
||||
*/
|
||||
default Collection<String> getDiscoveredSpecies(){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a successfully researched mutation.
|
||||
* Mutations are normally researched in the Escritoire.
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
public interface IFilterData {
|
||||
|
||||
/**
|
||||
* If the root is present, returns the root,
|
||||
* otherwise throws {@code NoSuchElementException}.
|
||||
*/
|
||||
ISpeciesRoot getRoot();
|
||||
|
||||
/**
|
||||
* If the individual is present, returns the individual,
|
||||
* otherwise throws {@code NoSuchElementException}.
|
||||
*/
|
||||
IIndividual getIndividual();
|
||||
|
||||
/**
|
||||
* If the type is present, returns the type,
|
||||
* otherwise throws {@code NoSuchElementException}.
|
||||
*/
|
||||
ISpeciesType getType();
|
||||
|
||||
/**
|
||||
* @return True if this data contains a root, individual and type.
|
||||
*/
|
||||
boolean isPresent();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
public interface IFilterLogic extends INbtWritable, INbtReadable {
|
||||
void writeGuiData(PacketBuffer data);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void readGuiData(PacketBuffer data) throws IOException;
|
||||
|
||||
Collection<EnumFacing> getValidDirections(ItemStack itemStack, EnumFacing from);
|
||||
|
||||
boolean isValid(ItemStack itemStack, EnumFacing facing);
|
||||
|
||||
boolean isValid(EnumFacing facing, ItemStack itemStack, IFilterData filterData);
|
||||
|
||||
boolean isValidAllelePair(EnumFacing orientation, String activeUID, String inactiveUID);
|
||||
|
||||
IFilterRuleType getRule(EnumFacing facing);
|
||||
|
||||
boolean setRule(EnumFacing facing, IFilterRuleType rule);
|
||||
|
||||
@Nullable
|
||||
IAllele getGenomeFilter(EnumFacing facing, int index, boolean active);
|
||||
|
||||
boolean setGenomeFilter(EnumFacing facing, int index, boolean active, @Nullable IAllele allele);
|
||||
|
||||
void sendToServer(EnumFacing facing, int index, boolean active, @Nullable IAllele allele);
|
||||
|
||||
void sendToServer(EnumFacing facing, IFilterRuleType rule);
|
||||
|
||||
INetworkHandler getNetworkHandler();
|
||||
|
||||
interface INetworkHandler{
|
||||
/**
|
||||
* Sends the data of the logic to the client of all players that have the gui currently open.
|
||||
*
|
||||
* @param player The player that changed the filter.
|
||||
*/
|
||||
void sendToPlayers(IFilterLogic logic, WorldServer server, EntityPlayer player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
|
||||
/**
|
||||
* @since 5.8
|
||||
*/
|
||||
public interface IFilterRegistry {
|
||||
/**
|
||||
* Registers a filter rule.
|
||||
*/
|
||||
void registerFilter(IFilterRuleType rule);
|
||||
|
||||
Collection<IFilterRuleType> getRules();
|
||||
|
||||
IFilterRuleType getDefaultRule();
|
||||
|
||||
@Nullable
|
||||
IFilterRuleType getRule(String uid);
|
||||
|
||||
@Nullable
|
||||
IFilterRuleType getRule(int id);
|
||||
|
||||
int getId(IFilterRuleType rule);
|
||||
|
||||
IFilterLogic createLogic(ILocatable locatable, IFilterLogic.INetworkHandler networkHandler);
|
||||
|
||||
default IFilterRuleType getRuleOrDefault(String uid){
|
||||
IFilterRuleType rule = getRule(uid);
|
||||
return rule != null ? rule : getDefaultRule();
|
||||
}
|
||||
|
||||
default IFilterRuleType getRuleOrDefault(int id){
|
||||
IFilterRuleType rule = getRule(id);
|
||||
return rule != null ? rule : getDefaultRule();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFilterRule {
|
||||
boolean isValid(ItemStack itemStack, IFilterData data);
|
||||
|
||||
/**
|
||||
* If a root with this uid is registered, the filter will only get stack with individuals from this root.
|
||||
*/
|
||||
@Nullable
|
||||
default String getRootUID() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IFilterRuleType extends IFilterRule {
|
||||
void addLogic(IFilterRule logic);
|
||||
|
||||
/**
|
||||
* @return True if a other logic can be added to this type.
|
||||
*/
|
||||
boolean isContainer();
|
||||
|
||||
/**
|
||||
* @return A unique identifier for the rule.
|
||||
*/
|
||||
String getUID();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSprite();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ResourceLocation getTextureMap();
|
||||
}
|
||||
Reference in new issue
Block a user