mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 07:35:47 +00:00
Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into dev
This commit is contained in:
commit
e90ab8caf6
41 files changed
+205
-241
No files matched your search
@@ -11,5 +11,5 @@ public enum EnumDatabaseTab {
|
||||
//Used to display information about the products of the active species of the individual.
|
||||
PRODUCTS,
|
||||
//Used to display information about the mutations of the active species of the individual.
|
||||
MUTATIONS;
|
||||
MUTATIONS
|
||||
}
|
||||
@@ -425,7 +425,7 @@ public class ModuleApiculture extends BlankForestryModule {
|
||||
flowerType.getName().contains("sapling") ||
|
||||
flowerType == BlockFlowerPot.EnumFlowerType.DEAD_BUSH ||
|
||||
flowerType == BlockFlowerPot.EnumFlowerType.FERN) {
|
||||
continue;
|
||||
//Don't register these as flowers
|
||||
} else if (flowerType == BlockFlowerPot.EnumFlowerType.MUSHROOM_RED ||
|
||||
flowerType == BlockFlowerPot.EnumFlowerType.MUSHROOM_BROWN) {
|
||||
flowerRegistry.registerAcceptableFlower(flowerPot.withProperty(CONTENTS, flowerType), FlowerManager.FlowerTypeMushrooms);
|
||||
|
||||
@@ -40,7 +40,6 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.apiculture.hives.IHiveRegistry.HiveType;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -199,22 +198,19 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
public String getNameFromMeta(int meta) {
|
||||
return HiveType.VALUES[meta].getName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,14 @@ package forestry.apiculture.compat;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.apiculture.ModuleApiculture;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.utils.JeiUtil;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleHelper;
|
||||
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
@@ -23,7 +20,7 @@ import mezz.jei.api.JEIPlugin;
|
||||
public class ApicultureJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +39,7 @@ public class ApicultureJeiPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,17 @@ package forestry.apiculture.entities;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
@@ -37,13 +45,6 @@ import forestry.core.tiles.IClimatised;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IOwnedTile, IGuiBeeHousingDelegate, IClimatised, IStreamableGui {
|
||||
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecartBeeHousingBase.class, GameProfileDataSerializer.INSTANCE);
|
||||
|
||||
@@ -61,7 +61,6 @@ import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.apiculture.ModuleApiculture;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
@@ -461,9 +460,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
public NonNullList<ItemStack> getSpecialtyList() {
|
||||
Set<ItemStack> specialties = genome.getPrimary().getSpecialtyChances().keySet();
|
||||
NonNullList<ItemStack> specialtyList = NonNullList.create();
|
||||
for (ItemStack specialty : specialties) {
|
||||
specialtyList.add(specialty);
|
||||
}
|
||||
specialtyList.addAll(specialties);
|
||||
return specialtyList;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,12 @@ package forestry.apiculture.network.packets;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.apiculture.BeekeepingLogic;
|
||||
@@ -20,10 +26,6 @@ import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.IForestryPacketHandlerClient;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.PacketIdClient;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PacketBeeLogicActiveEntity extends ForestryPacket implements IForestryPacketClient {
|
||||
private final Entity entity;
|
||||
@@ -54,7 +56,7 @@ public class PacketBeeLogicActiveEntity extends ForestryPacket implements IFores
|
||||
IBeeHousing beeHousing = (IBeeHousing) entity;
|
||||
IBeekeepingLogic beekeepingLogic = beeHousing.getBeekeepingLogic();
|
||||
if (beekeepingLogic instanceof BeekeepingLogic) {
|
||||
((BeekeepingLogic) beekeepingLogic).readData(data);
|
||||
beekeepingLogic.readData(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@ public abstract class BlockAbstractLeaves extends BlockLeaves implements IItemMo
|
||||
// Hack: When harvesting leaves we need to get the drops in onBlockHarvested,
|
||||
// because there is no Player parameter in getDrops()
|
||||
// and Mojang destroys the block and tile before calling getDrops.
|
||||
// TODO in 1.13 - use new getDrops() (https://github.com/MinecraftForge/MinecraftForge/pull/4727)
|
||||
private final ThreadLocal<NonNullList<ItemStack>> drops = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
@@ -197,7 +198,7 @@ public abstract class BlockAbstractLeaves extends BlockLeaves implements IItemMo
|
||||
if (ret != null) {
|
||||
drops.addAll(ret);
|
||||
} else {
|
||||
if(!(world instanceof World)){
|
||||
if (!(world instanceof World)) {
|
||||
return;
|
||||
}
|
||||
// leaves not harvested, get drops normally
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BlockDecorativeWoodPile extends BlockRotatedPillar implements IItem
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for(int i = 0;i < 3;i++) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
manager.registerItemModel(item, i, "wood_pile");
|
||||
}
|
||||
}
|
||||
@@ -82,12 +82,13 @@ public class BlockDecorativeWoodPile extends BlockRotatedPillar implements IItem
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
switch (rot) {
|
||||
case COUNTERCLOCKWISE_90:
|
||||
case CLOCKWISE_90:
|
||||
|
||||
switch ((EnumFacing.Axis)state.getValue(AXIS)) {
|
||||
switch (state.getValue(AXIS)) {
|
||||
case X:
|
||||
return state.withProperty(AXIS, EnumFacing.Axis.Z);
|
||||
case Z:
|
||||
@@ -109,13 +110,11 @@ public class BlockDecorativeWoodPile extends BlockRotatedPillar implements IItem
|
||||
return state.getValue(AXIS).ordinal();
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {AXIS});
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[]{AXIS});
|
||||
}
|
||||
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state) {
|
||||
return new ItemStack(Item.getItemFromBlock(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import forestry.arboriculture.items.ItemRegistryArboriculture;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.JeiUtil;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleHelper;
|
||||
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
@@ -19,7 +20,7 @@ import mezz.jei.api.JEIPlugin;
|
||||
public class ArboricultureJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.ARBORICULTURE))) {
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.ARBORICULTURE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpeciesBuilder;
|
||||
import forestry.api.arboriculture.IGermlingModelProvider;
|
||||
import forestry.api.arboriculture.ILeafProvider;
|
||||
import forestry.api.arboriculture.ILeafSpriteProvider;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenerator;
|
||||
@@ -857,7 +858,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleTreeSpeciesBuilder treeSpecies) {
|
||||
treeSpecies.addFruitFamily(EnumFruitFamily.JUNGLE).setRarity(0.0025F).setTemperature(EnumTemperature.WARM)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -883,7 +884,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleTreeSpeciesBuilder treeSpecies) {
|
||||
treeSpecies.addFruitFamily(EnumFruitFamily.JUNGLE)
|
||||
.addFruitFamily(EnumFruitFamily.NUX).setRarity(0.005F).setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);;
|
||||
.addFruitFamily(EnumFruitFamily.NUX).setRarity(0.005F).setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -973,10 +974,11 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
IGermlingModelProvider germlingIconProvider = ModelProviderFactory.create(woodType, uid, leafIconProvider);
|
||||
IWoodProvider woodProvider = WoodProviderFactory.create(woodType);
|
||||
|
||||
IAlleleTreeSpeciesBuilder speciesBuilder = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, Constants.MOD_ID, leafIconProvider, germlingIconProvider, woodProvider, this);
|
||||
ILeafProvider leafProvider = new LeafProvider();
|
||||
|
||||
IAlleleTreeSpeciesBuilder speciesBuilder = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, Constants.MOD_ID, leafIconProvider, germlingIconProvider, woodProvider, this, leafProvider);
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
this.species = speciesBuilder.build();
|
||||
|
||||
this.woodType = woodType;
|
||||
}
|
||||
|
||||
@@ -1056,7 +1058,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
public final String getUID() {
|
||||
return species.getUID();
|
||||
}
|
||||
|
||||
|
||||
public final String getUnlocalizedName() {
|
||||
return species.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import net.minecraft.item.ItemSlab;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.BlockArbSlab;
|
||||
import forestry.arboriculture.blocks.BlockForestrySlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockWoodSlab extends ItemSlab {
|
||||
public ItemBlockWoodSlab(BlockForestrySlab block, BlockForestrySlab slab, BlockForestrySlab doubleSlab) {
|
||||
@@ -19,7 +19,7 @@ public class ItemBlockWoodSlab extends ItemSlab {
|
||||
IWoodType woodType = wood.getWoodType(meta);
|
||||
return WoodHelper.getDisplayName(wood, woodType);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
BlockForestrySlab forestrySlab = (BlockForestrySlab) this.block;
|
||||
|
||||
@@ -14,12 +14,10 @@ import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -38,6 +36,7 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.MultiModelState;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -53,7 +52,7 @@ public class SimpleModel implements IModel {
|
||||
private final IModelState defaultState;
|
||||
|
||||
public SimpleModel(List<ResourceLocation> locations, List<IModel> models, List<Variant> variants,
|
||||
IModelState defaultState) {
|
||||
IModelState defaultState) {
|
||||
this.variants = variants;
|
||||
this.locations = ImmutableList.copyOf(locations);
|
||||
this.models = ImmutableList.copyOf(models);
|
||||
@@ -116,7 +115,7 @@ public class SimpleModel implements IModel {
|
||||
public Collection<ResourceLocation> getTextures() {
|
||||
return ImmutableSet.copyOf(textures);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
if (variants.size() == 1) {
|
||||
@@ -154,7 +153,8 @@ public class SimpleModel implements IModel {
|
||||
try {
|
||||
model = ModelLoaderRegistry.getModel(loc);
|
||||
} catch (Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
Throwables.throwIfUnchecked(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,16 +46,16 @@ import forestry.core.utils.BlockUtil;
|
||||
public class TreeDecorator {
|
||||
private static final List<IAlleleTreeSpecies> SPECIES = new ArrayList<>();
|
||||
private static final Map<ResourceLocation, Set<ITree>> biomeCache = new HashMap<>();
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void decorateTrees(Decorate event) {
|
||||
if(event.getType() == Decorate.EventType.TREE){
|
||||
if (event.getType() == Decorate.EventType.TREE) {
|
||||
decorateTrees(event.getWorld(), event.getRand(), event.getPos().getX() + 8, event.getPos().getZ() + 8);
|
||||
}
|
||||
}
|
||||
|
||||
public static void decorateTrees(World world, Random rand, int worldX, int worldZ) {
|
||||
if(!Config.isValidTreeDim(world.provider.getDimension())) {
|
||||
if (!Config.isValidTreeDim(world.provider.getDimension()) || Config.generateTreesAmount == 0) {
|
||||
return;
|
||||
}
|
||||
if (biomeCache.isEmpty()) {
|
||||
@@ -67,17 +67,17 @@ public class TreeDecorator {
|
||||
|
||||
BlockPos pos = new BlockPos(x, 0, z);
|
||||
Biome biome = world.getBiome(pos);
|
||||
|
||||
|
||||
Set<ITree> trees = biomeCache.computeIfAbsent(biome.getRegistryName(), k -> new HashSet<>());
|
||||
for (ITree tree : trees) {
|
||||
IAlleleTreeSpecies species = tree.getGenome().getPrimary();
|
||||
if (species.getRarity() >= rand.nextFloat()) {
|
||||
if (species.getRarity() * Config.generateTreesAmount >= rand.nextFloat()) {
|
||||
pos = getValidPos(world, x, z, tree);
|
||||
|
||||
if(pos == null){
|
||||
|
||||
if (pos == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (species.getGrowthProvider().canSpawn(tree, world, pos)) {
|
||||
if (TreeGenHelper.generateTree(tree, world, pos)) {
|
||||
return;
|
||||
@@ -87,49 +87,47 @@ public class TreeDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private static BlockPos getValidPos(World world, int x, int z, ITree tree){
|
||||
private static BlockPos getValidPos(World world, int x, int z, ITree tree) {
|
||||
// get to the ground
|
||||
final BlockPos topPos = world.getHeight(new BlockPos(x, 0, z));
|
||||
if (topPos.getY() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(topPos);
|
||||
|
||||
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
IBlockState downState = world.getBlockState(pos.down());
|
||||
while (BlockUtil.canReplace(blockState, world, pos)) {
|
||||
pos.move(EnumFacing.DOWN);
|
||||
if (pos.getY() <= 0) {
|
||||
return null;
|
||||
}
|
||||
blockState = world.getBlockState(pos);
|
||||
downState = world.getBlockState(pos.down());
|
||||
}
|
||||
if(tree instanceof IPlantable && blockState.getBlock().canSustainPlant(blockState, world, pos, EnumFacing.UP, (IPlantable) tree)){
|
||||
if (tree instanceof IPlantable && blockState.getBlock().canSustainPlant(blockState, world, pos, EnumFacing.UP, (IPlantable) tree)) {
|
||||
return pos.up();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<IAlleleTreeSpecies> getSpecies(){
|
||||
if(!SPECIES.isEmpty()){
|
||||
|
||||
private static List<IAlleleTreeSpecies> getSpecies() {
|
||||
if (!SPECIES.isEmpty()) {
|
||||
return SPECIES;
|
||||
}
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles(EnumTreeChromosome.SPECIES)) {
|
||||
if (allele instanceof IAlleleTreeSpecies) {
|
||||
IAlleleTreeSpecies alleleTreeSpecies = (IAlleleTreeSpecies) allele;
|
||||
if(alleleTreeSpecies.getRarity() > 0){
|
||||
if (alleleTreeSpecies.getRarity() > 0) {
|
||||
SPECIES.add(alleleTreeSpecies);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SPECIES;
|
||||
}
|
||||
|
||||
private static void generateBiomeCache(World world, Random rand){
|
||||
|
||||
private static void generateBiomeCache(World world, Random rand) {
|
||||
for (IAlleleTreeSpecies species : getSpecies()) {
|
||||
IAllele[] template = TreeManager.treeRoot.getTemplate(species);
|
||||
ITreeGenome genome = TreeManager.treeRoot.templateAsGenome(template);
|
||||
@@ -143,11 +141,11 @@ public class TreeDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final class BiomeCache {
|
||||
protected final Biome biome;
|
||||
protected final List<ITree> validTrees;
|
||||
|
||||
|
||||
public BiomeCache(Biome biome, List<ITree> validTrees) {
|
||||
this.biome = biome;
|
||||
this.validTrees = validTrees;
|
||||
|
||||
@@ -1,34 +1,18 @@
|
||||
package forestry.core.advancements;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.advancements.ICriterionInstance;
|
||||
import net.minecraft.advancements.ICriterionTrigger;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import forestry.core.utils.Log;
|
||||
|
||||
public class AdvancementManager {
|
||||
|
||||
private static Method criterionRegister;
|
||||
|
||||
public static void registerTriggers() {
|
||||
registerAdvancementTrigger(SpeciesDiscoveredTrigger.INSTANCE);
|
||||
}
|
||||
|
||||
private static <T extends ICriterionInstance> ICriterionTrigger<T> registerAdvancementTrigger(ICriterionTrigger<T> trigger) {
|
||||
if(criterionRegister == null) {
|
||||
criterionRegister = ReflectionHelper.findMethod(CriteriaTriggers.class, "register", "func_192118_a", ICriterionTrigger.class);
|
||||
criterionRegister.setAccessible(true);
|
||||
}
|
||||
try {
|
||||
trigger = (ICriterionTrigger<T>) criterionRegister.invoke(null, trigger);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException error) {
|
||||
Log.error("Failed to register a trigger " + trigger.getId() + " .", error);
|
||||
}
|
||||
CriteriaTriggers.register(trigger);
|
||||
return trigger;
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,7 @@ public class Config {
|
||||
public static boolean logHivePlacement = false;
|
||||
public static boolean enableVillagers = true;
|
||||
public static boolean generateTrees = true;
|
||||
public static float generateTreesAmount = 1.0F;
|
||||
public static Set<Integer> blacklistedTreeDims = new HashSet<Integer>();
|
||||
public static Set<Integer> whitelistedTreeDims = new HashSet<Integer>();
|
||||
|
||||
@@ -275,6 +276,9 @@ public class Config {
|
||||
enableVillagers = configCommon.getBooleanLocalized("world.generate", "villagers", enableVillagers);
|
||||
|
||||
generateTrees = configCommon.getBooleanLocalized("world.generate", "trees", generateTrees);
|
||||
|
||||
generateTreesAmount = configCommon.getFloatLocalized("world.generate.trees", "treeFrequency", generateTreesAmount, 0.0F, 10.0F);
|
||||
|
||||
for (int dimId : configCommon.get("world.generate.trees", "dimBlacklist", new int[0]).getIntList()) {
|
||||
blacklistedTreeDims.add(dimId);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import invtweaks.api.container.ContainerSectionCallback;
|
||||
public abstract class ContainerForestry extends Container {
|
||||
public static final int PLAYER_HOTBAR_OFFSET = 27;
|
||||
public static final int PLAYER_INV_SLOTS = PLAYER_HOTBAR_OFFSET + 9;
|
||||
private int transferCount = 0; // number of items that have been shift-click-transfered during this click
|
||||
|
||||
protected final void addPlayerInventory(InventoryPlayer playerInventory, int xInv, int yInv) {
|
||||
// Player inventory
|
||||
@@ -87,6 +88,7 @@ public abstract class ContainerForestry extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
transferCount = 0;
|
||||
return super.slotClick(slotId, dragType_or_button, clickTypeIn, player);
|
||||
}
|
||||
|
||||
@@ -101,7 +103,12 @@ public abstract class ContainerForestry extends Container {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return SlotUtil.transferStackInSlot(inventorySlots, player, slotIndex);
|
||||
if (transferCount < 64)
|
||||
{
|
||||
transferCount++;
|
||||
return SlotUtil.transferStackInSlot(inventorySlots, player, slotIndex);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
protected abstract boolean canAccess(EntityPlayer player);
|
||||
|
||||
@@ -59,9 +59,7 @@ public class InventoryEscritoire extends InventoryAdapterTile<TileEscritoire> {
|
||||
}
|
||||
|
||||
if (SlotUtil.isSlotInRange(slotIndex, SLOT_INPUT_1, SLOTS_INPUT_COUNT)) {
|
||||
if (slotIndex >= SLOT_INPUT_1 + tile.getGame().getSampleSize(SLOTS_INPUT_COUNT)) {
|
||||
return true;
|
||||
}
|
||||
return slotIndex >= SLOT_INPUT_1 + tile.getGame().getSampleSize(SLOTS_INPUT_COUNT);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -17,10 +17,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -29,7 +25,6 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -39,9 +34,8 @@ import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.core.CreativeTabForestry;
|
||||
import forestry.core.circuits.SolderManager;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
import forestry.core.utils.ItemTooltipUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class ItemElectronTube extends ItemOverlay {
|
||||
|
||||
|
||||
@@ -10,11 +10,32 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.tiles;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.core.ILocatable;
|
||||
@@ -28,24 +49,6 @@ import forestry.core.network.packets.PacketTileStream;
|
||||
import forestry.core.utils.NBTUtilForestry;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public abstract class TileForestry extends TileEntity implements IStreamable, IErrorLogicSource, ISidedInventory, IFilterSlotDelegate, ITitled, ILocatable, IGuiHandlerTile, ITickable {
|
||||
@@ -168,17 +171,17 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
|
||||
/* ITriggerProvider */
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// return null;
|
||||
// }
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// / REDSTONE INFO
|
||||
protected boolean isRedstoneActivated() {
|
||||
|
||||
@@ -87,10 +87,7 @@ public class DayMonth {
|
||||
if (this.day != other.day) {
|
||||
return false;
|
||||
}
|
||||
if (this.month != other.month) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return this.month == other.month;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -328,8 +328,7 @@ public abstract class ItemStackUtil {
|
||||
ItemStack req = condensedRequiredStacks.get(y);
|
||||
String offerDict = condensedRequiredDicts.get(y);
|
||||
int reqCount = 0;
|
||||
for (int i = 0;i < condensedOfferedStacks.size();i++) {
|
||||
ItemStack offer = condensedOfferedStacks.get(i);
|
||||
for (ItemStack offer : condensedOfferedStacks) {
|
||||
if (isCraftingEquivalent(req, offer, offerDict, craftingTools)) {
|
||||
int stackCount = (int) Math.floor(offer.getCount() / req.getCount());
|
||||
reqCount = Math.max(reqCount, stackCount);
|
||||
|
||||
@@ -37,9 +37,7 @@ public abstract class ModUtil {
|
||||
VersionRange versionRange = VersionParser.parseRange(versionRangeString);
|
||||
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(modname, versionRange);
|
||||
|
||||
if (!requiredVersion.containsVersion(modVersion)) {
|
||||
return false;
|
||||
}
|
||||
return requiredVersion.containsVersion(modVersion);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -82,9 +80,7 @@ public abstract class ModUtil {
|
||||
DefaultArtifactVersion givenVersion = new DefaultArtifactVersion(apiName, apiVersionString);
|
||||
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(apiName, versionRange);
|
||||
|
||||
if (!requiredVersion.containsVersion(givenVersion)) {
|
||||
return false;
|
||||
}
|
||||
return requiredVersion.containsVersion(givenVersion);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -18,10 +18,7 @@ public class InventoryDatabase extends InventoryAdapterTile<TileDatabase> {
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
itemStack = GeneticsUtil.convertToGeneticEquivalent(itemStack);
|
||||
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(itemStack);
|
||||
if (speciesRoot == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return speciesRoot != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,12 +46,13 @@ import forestry.factory.recipes.jei.still.StillRecipeCategory;
|
||||
import forestry.factory.recipes.jei.still.StillRecipeMaker;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleHelper;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.gui.BlankAdvancedGuiHandler;
|
||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry;
|
||||
|
||||
@@ -60,13 +61,13 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry;
|
||||
public class FactoryJeiPlugin implements IModPlugin {
|
||||
@Nullable
|
||||
public static IJeiHelpers jeiHelpers;
|
||||
|
||||
|
||||
@Override
|
||||
public void registerCategories(IRecipeCategoryRegistration registry) {
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.FACTORY)){
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.FACTORY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
jeiHelpers = registry.getJeiHelpers();
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
|
||||
@@ -86,8 +87,8 @@ public class FactoryJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
registry.addAdvancedGuiHandlers(new ForestryAdvancedGuiHandler());
|
||||
|
||||
if(!ModuleHelper.isEnabled(ForestryModuleUids.FACTORY)){
|
||||
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.FACTORY)) {
|
||||
return;
|
||||
}
|
||||
jeiHelpers = registry.getJeiHelpers();
|
||||
@@ -136,7 +137,7 @@ public class FactoryJeiPlugin implements IModPlugin {
|
||||
);
|
||||
}
|
||||
|
||||
private static class ForestryAdvancedGuiHandler extends BlankAdvancedGuiHandler<GuiForestry> {
|
||||
private static class ForestryAdvancedGuiHandler implements IAdvancedGuiHandler<GuiForestry> {
|
||||
|
||||
@Override
|
||||
public Class<GuiForestry> getGuiContainerClass() {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class BottlerRecipeMaker {
|
||||
|
||||
public static List<BottlerRecipeWrapper> getBottlerRecipes(IIngredientRegistry ingredientRegistry) {
|
||||
List<BottlerRecipeWrapper> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : ingredientRegistry.getIngredients(ItemStack.class)) {
|
||||
for (ItemStack stack : ingredientRegistry.getAllIngredients(ItemStack.class)) {
|
||||
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||
IFluidHandlerItem fluidHandler = stack.copy().getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
|
||||
if (fluidHandler != null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class SqueezerRecipeMaker {
|
||||
|
||||
public static List<SqueezerContainerRecipeWrapper> getSqueezerContainerRecipes(IIngredientRegistry ingredientRegistry) {
|
||||
List<SqueezerContainerRecipeWrapper> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : ingredientRegistry.getIngredients(ItemStack.class)) {
|
||||
for (ItemStack stack : ingredientRegistry.getAllIngredients(ItemStack.class)) {
|
||||
ISqueezerContainerRecipe containerRecipe = SqueezerRecipeManager.findMatchingContainerRecipe(stack);
|
||||
if (containerRecipe != null) {
|
||||
recipes.add(new SqueezerContainerRecipeWrapper(containerRecipe, stack));
|
||||
|
||||
@@ -13,12 +13,9 @@ package forestry.farming.items;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
@@ -46,15 +43,15 @@ public class ItemBlockFarm extends ItemBlock {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if(GuiScreen.isShiftKeyDown()){
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
tooltip.add(Translator.translateToLocal("tile.for.ffarm.tooltip"));
|
||||
if (stack.getTagCompound() == null) {
|
||||
return;
|
||||
}
|
||||
EnumFarmBlockTexture texture = EnumFarmBlockTexture.getFromCompound(stack.getTagCompound());
|
||||
|
||||
tooltip.add(Translator.translateToLocal("tile.for.ffarm.material.tooltip") + texture.getFormatting() + TextFormatting.ITALIC + " "+ texture.getName());
|
||||
}else{
|
||||
tooltip.add(Translator.translateToLocal("tile.for.ffarm.material.tooltip") + texture.getFormatting() + TextFormatting.ITALIC + " " + texture.getName());
|
||||
} else {
|
||||
ItemTooltipUtil.addShiftInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CropBasicAgriCraft extends Crop {
|
||||
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
NonNullList<ItemStack> harvest = NonNullList.create();
|
||||
harvest.addAll(block.getDrops(world, pos, blockState, 0));
|
||||
block.getDrops(harvest, world, pos, blockState, 0);
|
||||
if (harvest.size() > 1) {
|
||||
harvest.remove(1); //AgriCraft returns cropsticks in 0, seeds in 1 in getDrops, removing since harvesting doesn't return them.
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CropBasicGrowthCraft extends Crop {
|
||||
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
NonNullList<ItemStack> harvest = NonNullList.create();
|
||||
harvest.addAll(block.getDrops(world, pos, blockState, 0));
|
||||
block.getDrops(harvest, world, pos, blockState, 0);
|
||||
if (harvest.size() > 1) {
|
||||
harvest.remove(0); //Hops have rope as first drop.
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.plugins.PluginIC2;
|
||||
|
||||
import ic2.api.crops.ICropTile;
|
||||
|
||||
public class CropBasicIC2Crop extends Crop {
|
||||
@@ -56,9 +57,7 @@ public class CropBasicIC2Crop extends Crop {
|
||||
if (crop.getCrop() == null) {
|
||||
return false;
|
||||
}
|
||||
if (crop.getCurrentSize() == crop.getCrop().getOptimalHarvestSize(crop)) {
|
||||
return true;
|
||||
}
|
||||
return crop.getCurrentSize() == crop.getCrop().getOptimalHarvestSize(crop);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CropDestroy extends Crop {
|
||||
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
NonNullList<ItemStack> harvested = NonNullList.create();
|
||||
harvested.addAll(block.getDrops(world, pos, blockState, 0));
|
||||
block.getDrops(harvested, world, pos, blockState, 0);
|
||||
float chance = ForgeEventFactory.fireBlockHarvesting(harvested, world, pos, blockState, 0, 1.0F, false, null);
|
||||
|
||||
boolean removedSeed = germling.isEmpty();
|
||||
|
||||
@@ -43,7 +43,7 @@ public class FarmableBasicIC2Crop implements IFarmable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, BlockPos pos) {
|
||||
public boolean isSaplingAt(World world, BlockPos pos, IBlockState blockState) {
|
||||
TileEntity crop = world.getTileEntity(pos);
|
||||
if (CropBasicIC2Crop.isIC2Crop(crop)) {
|
||||
babysitCrop(crop);
|
||||
|
||||
@@ -45,31 +45,31 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
this.humidityMode = ClimateSourceMode.NONE;
|
||||
this.state = ClimateStates.extendedZero();
|
||||
}
|
||||
|
||||
|
||||
public void setHumidityMode(ClimateSourceMode humidityMode) {
|
||||
this.humidityMode = humidityMode;
|
||||
}
|
||||
|
||||
|
||||
public void setTemperatureMode(ClimateSourceMode temperatureMode) {
|
||||
this.temperatureMode = temperatureMode;
|
||||
}
|
||||
|
||||
|
||||
public void setOwner(O owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getBoundaryModifier(ClimateType type, boolean boundaryUp) {
|
||||
if(type == ClimateType.HUMIDITY){
|
||||
if(humidityMode == ClimateSourceMode.POSITIVE && boundaryUp){
|
||||
if (type == ClimateType.HUMIDITY) {
|
||||
if (humidityMode == ClimateSourceMode.POSITIVE && boundaryUp) {
|
||||
return getBoundModifier(ClimateType.HUMIDITY);
|
||||
}else if(humidityMode == ClimateSourceMode.NEGATIVE && !boundaryUp){
|
||||
} else if (humidityMode == ClimateSourceMode.NEGATIVE && !boundaryUp) {
|
||||
return getBoundModifier(ClimateType.HUMIDITY);
|
||||
}
|
||||
}else {
|
||||
if(temperatureMode == ClimateSourceMode.POSITIVE && boundaryUp){
|
||||
} else {
|
||||
if (temperatureMode == ClimateSourceMode.POSITIVE && boundaryUp) {
|
||||
return getBoundModifier(ClimateType.TEMPERATURE);
|
||||
}else if(temperatureMode == ClimateSourceMode.NEGATIVE && !boundaryUp){
|
||||
} else if (temperatureMode == ClimateSourceMode.NEGATIVE && !boundaryUp) {
|
||||
return getBoundModifier(ClimateType.TEMPERATURE);
|
||||
}
|
||||
}
|
||||
@@ -79,16 +79,16 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
protected float getBoundModifier(ClimateType type) {
|
||||
return boundModifier;
|
||||
}
|
||||
|
||||
|
||||
protected float getChange(ClimateType type) {
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean affectClimateType(ClimateType type) {
|
||||
return sourceType.affectClimateType(type);
|
||||
@@ -98,39 +98,39 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
public IClimateSourceOwner getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAdded(IClimateContainer container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRemoved(IClimateContainer container) {
|
||||
this.container = null;
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
if(!addedToManager){
|
||||
if (!addedToManager) {
|
||||
onLoad();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onLoad() {
|
||||
World world = owner.getWorldObj();
|
||||
if(!addedToManager && !world.isRemote) {
|
||||
if (!addedToManager && !world.isRemote) {
|
||||
GreenhouseManager.climateManager.addSource(owner);
|
||||
addedToManager = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void invalidate() {
|
||||
this.onChunkUnload();
|
||||
}
|
||||
|
||||
|
||||
public void onChunkUnload() {
|
||||
World world = owner.getWorldObj();
|
||||
if(addedToManager &&!world.isRemote) {
|
||||
if (addedToManager && !world.isRemote) {
|
||||
GreenhouseManager.climateManager.removeSource(owner);
|
||||
addedToManager = false;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
} else if (ClimateStates.isNearTarget(currentState, targetState)) {
|
||||
return change;
|
||||
}
|
||||
if(oppositeType != null) {
|
||||
if (oppositeType != null) {
|
||||
//If the state is not already zero, remove one change state from the state.
|
||||
change = getChange(oppositeType, defaultState, currentState);
|
||||
change = ClimateStates.INSTANCE.create(-change.getTemperature(), -change.getHumidity(), ClimateStateType.EXTENDED);
|
||||
@@ -165,7 +165,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
} else if (validType == null && oppositeType != null) {
|
||||
//Remove the resources if the owner has enough resources and the state is not the default state.
|
||||
removeResources(state, oppositeType);
|
||||
} else if(validType != null){
|
||||
} else if (validType != null) {
|
||||
change = getChange(validType, targetState, previousState);
|
||||
IClimateState changedState = state.add(change.scale(1 / sizeModifier));
|
||||
boolean couldWork = canWork(changedState, oppositeType);
|
||||
@@ -179,20 +179,17 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
if (ClimateStates.isZero(state) || ClimateStates.isNearZero(state)) {
|
||||
state = ClimateStates.extendedZero();
|
||||
}
|
||||
if (false) {
|
||||
state = ClimateStates.extendedZero();
|
||||
}
|
||||
setState(state);
|
||||
return change;
|
||||
}
|
||||
|
||||
protected void isNotValid(){
|
||||
|
||||
protected void isNotValid() {
|
||||
|
||||
}
|
||||
|
||||
protected void beforeWork(){
|
||||
|
||||
protected void beforeWork() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return true if the source can work, false if it can not.
|
||||
*/
|
||||
@@ -215,11 +212,11 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
boolean canChangeTemperature = sourceType.canChangeTemperature() && canChange(state.getTemperature(), target.getTemperature(), temperatureMode);
|
||||
return canChangeHumidity ? canChangeTemperature ? ClimateSourceType.BOTH : ClimateSourceType.HUMIDITY : canChangeTemperature ? ClimateSourceType.TEMPERATURE : null;
|
||||
}
|
||||
|
||||
private boolean canChange(float value, float target, ClimateSourceMode mode){
|
||||
if(mode == ClimateSourceMode.POSITIVE && value < target){
|
||||
|
||||
private boolean canChange(float value, float target, ClimateSourceMode mode) {
|
||||
if (mode == ClimateSourceMode.POSITIVE && value < target) {
|
||||
return true;
|
||||
}else if(mode == ClimateSourceMode.NEGATIVE && value > target){
|
||||
} else if (mode == ClimateSourceMode.NEGATIVE && value > target) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -35,7 +35,7 @@ class NextTickEntry implements Comparable<NextTickEntry> {
|
||||
return false;
|
||||
} else {
|
||||
NextTickEntry nextticklistentry = (NextTickEntry) o;
|
||||
return this.position.equals(nextticklistentry.position) && provider.equals(provider);
|
||||
return this.position.equals(nextticklistentry.position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@ package forestry.lepidopterology.genetics;
|
||||
import java.awt.Color;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
@@ -30,9 +32,6 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public enum ButterflyDefinition implements IButterflyDefinition {
|
||||
CabbageWhite(ButterflyBranchDefinition.Pieris, "cabbageWhite", "rapae", new Color(0xccffee), true, 1.0f) {
|
||||
@@ -323,7 +322,7 @@ public enum ButterflyDefinition implements IButterflyDefinition {
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
this.species = speciesBuilder.build();
|
||||
}
|
||||
|
||||
|
||||
public static void preInit() {
|
||||
// just used to initialize the enums
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package forestry.mail.compat;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.JeiUtil;
|
||||
import forestry.mail.ModuleMail;
|
||||
import forestry.mail.blocks.BlockRegistryMail;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleHelper;
|
||||
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
@@ -17,7 +14,7 @@ import mezz.jei.api.JEIPlugin;
|
||||
public class MailJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.MAIL))) {
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.MAIL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ public class PluginHarvestCraft extends CompatPlugin {
|
||||
genericCropsBuilder.addAll(spices);
|
||||
|
||||
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
|
||||
|
||||
|
||||
ImmutableList<String> genericCrops = genericCropsBuilder.build();
|
||||
|
||||
ImmutableList.Builder<String> plants = ImmutableList.builder();
|
||||
@@ -190,7 +190,7 @@ public class PluginHarvestCraft extends CompatPlugin {
|
||||
juiceAmount = Math.max(juiceAmount, 1); // Produce at least 1 mb of juice.
|
||||
for (String berryName : berries) {
|
||||
ItemStack berry = getItemStack(berryName + "item");
|
||||
ItemStack berrySeed = getItemStack( berryName + "seeditem");
|
||||
ItemStack berrySeed = getItemStack(berryName + "seeditem");
|
||||
Block berryBlock = getBlock("pam" + berryName + "crop");
|
||||
if (berry != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, berry, Fluids.JUICE.getFluid(juiceAmount));
|
||||
@@ -348,13 +348,13 @@ public class PluginHarvestCraft extends CompatPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(20, nut, Fluids.SEED_OIL.getFluid(15 * seedamount));
|
||||
}
|
||||
}
|
||||
|
||||
if(ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) {
|
||||
|
||||
if (ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) {
|
||||
ItemStack hcHoneyItem = getItemStack("honeyitem");
|
||||
if (hcHoneyItem != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
|
||||
}
|
||||
|
||||
|
||||
ItemStack hcBeeswaxItem = getItemStack("beeswaxitem");
|
||||
if (hcBeeswaxItem != null) {
|
||||
RecipeUtil.addRecipe("pam_wax_capsule", ModuleFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package forestry.storage.compat;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.JeiUtil;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleHelper;
|
||||
import forestry.storage.ModuleBackpacks;
|
||||
import forestry.storage.items.ItemRegistryBackpacks;
|
||||
|
||||
@@ -17,7 +14,7 @@ import mezz.jei.api.JEIPlugin;
|
||||
public class StorageJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.BACKPACKS))) {
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.BACKPACKS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,9 +44,11 @@ public class StorageJeiPlugin implements IModPlugin {
|
||||
items.builderBackpack,
|
||||
items.builderBackpackT2
|
||||
);
|
||||
JeiUtil.addDescription(registry,
|
||||
items.apiaristBackpack,
|
||||
items.lepidopteristBackpack
|
||||
);
|
||||
if (ModuleHelper.isEnabled(ForestryModuleUids.APICULTURE)) {
|
||||
JeiUtil.addDescription(registry, items.apiaristBackpack);
|
||||
}
|
||||
if (ModuleHelper.isEnabled(ForestryModuleUids.LEPIDOPTEROLOGY)) {
|
||||
JeiUtil.addDescription(registry, items.lepidopteristBackpack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class WorktableJeiPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
if(!ModuleHelper.isEnabled(ForestryModuleUids.WORKTABLE)){
|
||||
if (!ModuleHelper.isEnabled(ForestryModuleUids.WORKTABLE)) {
|
||||
return;
|
||||
}
|
||||
BlockRegistryWorktable blocks = ModuleWorktable.getBlocks();
|
||||
|
||||
Reference in new issue
Block a user