mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 17:44:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cac9a14df | ||
|
|
43f98e9cca | ||
|
|
ff4c09324b | ||
|
|
d1c17a13b1 | ||
|
|
8a8ac56266 | ||
|
|
208de8ad3a |
No files matched your search
+1
-1
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.4.1614-1.7.10
|
||||
version_major=4
|
||||
version_minor=2
|
||||
version_patch=22
|
||||
version_patch=25
|
||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Wed Jul 02 15:54:47 CDT 2014
|
||||
#Sat Jan 04 01:52:14 CET 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
|
||||
@@ -10,17 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
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.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
//import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
|
||||
@@ -34,6 +34,7 @@ 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;
|
||||
@@ -46,6 +47,12 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
} while (tile instanceof IBeeHousing);
|
||||
|
||||
return ItemStackUtil.equals(block, meta, blockRequired);
|
||||
*/
|
||||
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, housingCoords.posX, housingCoords.posY, housingCoords.posZ,
|
||||
(TileEntity tile) -> (tile instanceof IBeeHousing)
|
||||
);
|
||||
|
||||
return blockRequired.equals(stk); //this way to prevent NPEs
|
||||
}
|
||||
|
||||
}
|
||||
+14
-6
@@ -10,17 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
//import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
|
||||
@@ -32,6 +33,7 @@ public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
/*
|
||||
Block block;
|
||||
TileEntity tile;
|
||||
int meta;
|
||||
@@ -44,6 +46,12 @@ public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
} while (tile instanceof IBeeHousing);
|
||||
|
||||
return ItemStackUtil.equals(block, meta, blockRequired) ? 1 : 0;
|
||||
*/
|
||||
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, x, y, z,
|
||||
(TileEntity tile) -> (tile instanceof IBeeHousing)
|
||||
);
|
||||
|
||||
return blockRequired.equals(stk) ? 1f : 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+18
-17
@@ -10,20 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MutationConditionRequiresResourceOreDict implements IMutationCondition {
|
||||
|
||||
@@ -43,6 +41,7 @@ public class MutationConditionRequiresResourceOreDict implements IMutationCondit
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
/*
|
||||
Block block;
|
||||
int meta;
|
||||
TileEntity tile;
|
||||
@@ -53,18 +52,20 @@ public class MutationConditionRequiresResourceOreDict implements IMutationCondit
|
||||
tile = world.getTileEntity(x, y-i, z);
|
||||
i++;
|
||||
} while (tile instanceof IBeeHousing);
|
||||
|
||||
int[] oreIds = OreDictionary.getOreIDs(new ItemStack(block, 1, meta));
|
||||
for (int oreId : oreIds) {
|
||||
if (oreId == this.oreDictId) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
*/
|
||||
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, x, y, z,
|
||||
(TileEntity tile) -> (tile instanceof IBeeHousing)
|
||||
);
|
||||
int[] oreIds = OreDictionary.getOreIDs(stk);
|
||||
for (int oreId : oreIds)
|
||||
if (oreId == this.oreDictId)
|
||||
return 1f;
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StringUtil.localizeAndFormat("mutation.condition.resource", displayName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCocoa;
|
||||
import net.minecraft.block.BlockLog;
|
||||
@@ -22,16 +26,13 @@ import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public abstract class BlockUtil {
|
||||
|
||||
@@ -228,4 +229,42 @@ public abstract class BlockUtil {
|
||||
private static boolean isVecInsideXYBounds(Vec3 vec, float minX, float minY, float maxX, float maxY) {
|
||||
return vec != null && (vec.xCoord >= minX && vec.xCoord <= maxX && vec.yCoord >= minY && vec.yCoord <= maxY);
|
||||
}
|
||||
}
|
||||
|
||||
private static Class<? extends Block> BW_MetaGenerated_WerkstoffBlocksClass;
|
||||
private static Method getDamage;
|
||||
private static Block BWBlocks;
|
||||
private static boolean bw = Loader.isModLoaded("bartworks");
|
||||
static {
|
||||
if (bw)
|
||||
try {
|
||||
BW_MetaGenerated_WerkstoffBlocksClass = (Class<? extends Block>) Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_WerkstoffBlocks");
|
||||
getDamage = Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Blocks").getMethod("getDamageValue", World.class, int.class, int.class, int.class);
|
||||
BWBlocks = (Block) Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader").getField("BWBlocks").get(null);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackFromBlockBelow(World world, int x, int y, int z, Predicate<TileEntity> stillInside) {
|
||||
TileEntity tile;
|
||||
Block block;
|
||||
int depth = 0;
|
||||
|
||||
do {
|
||||
++depth;
|
||||
tile = world.getTileEntity(x, y - depth, z);
|
||||
} while (stillInside.test(tile));
|
||||
block = world.getBlock(x, y - depth, z);
|
||||
|
||||
if (bw && BW_MetaGenerated_WerkstoffBlocksClass.isInstance(block)) {
|
||||
try {
|
||||
return new ItemStack(BWBlocks, 1, (Integer) getDamage.invoke(block, world, x, y - depth, z));
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return new ItemStack(block, 1, world.getBlockMetadata(x, y - depth, z));
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,9 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
super.writeEntityToNBT(nbttagcompound);
|
||||
|
||||
NBTTagCompound bio = new NBTTagCompound();
|
||||
contained.writeToNBT(bio);
|
||||
if (contained != null)
|
||||
contained.writeToNBT(bio);
|
||||
|
||||
nbttagcompound.setTag("BTFLY", bio);
|
||||
|
||||
if (pollen != null) {
|
||||
|
||||
Reference in new issue
Block a user