mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Merge remote-tracking branch 'origin/mc-1.12' into 1.12
This commit is contained in:
commit
13f49fc930
7 files changed
+11
-13
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package forestry.apiculture.compat;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.apiculture.ModuleApiculture;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
@@ -20,7 +19,7 @@ public class ApicultureJeiPlugin implements IModPlugin {
|
||||
Preconditions.checkNotNull(items);
|
||||
|
||||
ISubtypeRegistry.ISubtypeInterpreter beeSubtypeInterpreter = itemStack -> {
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(itemStack);
|
||||
return species == null ? ISubtypeRegistry.ISubtypeInterpreter.NONE : species.getUID();
|
||||
};
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
public static IAlleleBeeSpecies getSpecies(ItemStack itemStack) {
|
||||
Preconditions.checkArgument(BeeManager.beeRoot.isMember(itemStack), "itemStack must be a bee");
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
if (species instanceof IAlleleBeeSpecies) {
|
||||
return (IAlleleBeeSpecies) species;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
public static IAlleleTreeSpecies getSpecies(ItemStack itemStack) {
|
||||
Preconditions.checkArgument(TreeManager.treeRoot.isMember(itemStack), "ItemStack must be a tree");
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(TreeManager.treeRoot, itemStack);
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
if (species instanceof IAlleleTreeSpecies) {
|
||||
return (IAlleleTreeSpecies) species;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
int i = stateIn.getValue(LEVEL);
|
||||
|
||||
if (i > 0 && i < 8) {
|
||||
if (rand.nextInt(64) == 0) {
|
||||
if (getFluid().getViscosity(worldIn, pos) < 5000 && rand.nextInt(64) == 0) {
|
||||
worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, SoundEvents.BLOCK_WATER_AMBIENT, SoundCategory.BLOCKS, rand.nextFloat() * 0.25F + 0.75F, rand.nextFloat() + 0.5F, false);
|
||||
}
|
||||
} else if (rand.nextInt(10) == 0) {
|
||||
|
||||
@@ -22,8 +22,8 @@ import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public class Chromosome implements IChromosome {
|
||||
private static final String UID0_TAG = "UID0";
|
||||
private static final String UID1_TAG = "UID1";
|
||||
public static final String UID0_TAG = "UID0";
|
||||
public static final String UID1_TAG = "UID1";
|
||||
|
||||
private final IAllele primary;
|
||||
private final IAllele secondary;
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.google.common.base.MoreObjects;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -109,7 +110,7 @@ public abstract class Genome implements IGenome {
|
||||
* We need this because the client uses the species for rendering.
|
||||
*/
|
||||
@Nullable
|
||||
public static IAlleleSpecies getSpeciesDirectly(ISpeciesRoot speciesRoot, ItemStack itemStack) {
|
||||
public static IAlleleSpecies getSpeciesDirectly(ItemStack itemStack) {
|
||||
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
||||
if (nbtTagCompound == null) {
|
||||
return null;
|
||||
@@ -126,13 +127,11 @@ public abstract class Genome implements IGenome {
|
||||
}
|
||||
|
||||
NBTTagCompound chromosomeNBT = chromosomesNBT.getCompoundTagAt(0);
|
||||
Chromosome chromosome = Chromosome.create(null, null, speciesRoot.getSpeciesChromosomeType(), chromosomeNBT);
|
||||
|
||||
IAllele activeAllele = chromosome.getActiveAllele();
|
||||
String speciesUid = chromosomeNBT.getString(Chromosome.UID0_TAG);
|
||||
IAllele activeAllele = AlleleManager.alleleRegistry.getAllele(speciesUid);
|
||||
if (!(activeAllele instanceof IAlleleSpecies)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (IAlleleSpecies) activeAllele;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ButterflyGenome extends Genome implements IButterflyGenome {
|
||||
public static IAlleleButterflySpecies getSpecies(ItemStack itemStack) {
|
||||
Preconditions.checkArgument(ButterflyManager.butterflyRoot.isMember(itemStack), "Must be a butterfly");
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(ButterflyManager.butterflyRoot, itemStack);
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
if (species instanceof IAlleleButterflySpecies) {
|
||||
return (IAlleleButterflySpecies) species;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user