Skip to content

Commit

Permalink
Update to latest builds of all mods including Pam's HarvestCraft, Add…
Browse files Browse the repository at this point in the history
… bonemeal changes to Pam's Crops, Fix Fruit tress dropping the fruit blocks.
  • Loading branch information
alexbegt committed Jan 10, 2018
1 parent 879a6ac commit 9ba1e03
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 120 deletions.
36 changes: 26 additions & 10 deletions build.gradle
Expand Up @@ -85,32 +85,48 @@ minecraft {
version = config.minecraft_version + "-" + config.forge_version
runDir = 'run'
replace '${version}', project.version
replace '${natura_version}', config.minecraft_version + "-" + config.natura_version
mappings = config.mappings_version
useDepAts = true

}

dependencies {
deobfCompile "slimeknights.mantle:Mantle:${config.minecraft_version_old}-${config.mantle_version}"
deobfCompile "com.progwml6.natura:natura:${config.minecraft_version_old}-${config.natura_version}"
deobfCompile "slimeknights:TConstruct:${config.minecraft_version_old}-${config.tconstruct_version}"
deobfCompile ("slimeknights.mantle:Mantle:${config.minecraft_version_short}-${config.mantle_version}") {
transitive = false
}

deobfCompile ("com.progwml6.natura:natura:${config.minecraft_version}-${config.natura_version}") {
transitive = false
}

deobfCompile ("slimeknights:TConstruct:${config.minecraft_version}-${config.tconstruct_version}") {
transitive = false
}

deobfCompile "com.github.glitchfiend.biomesoplenty:BiomesOPlenty:${config.minecraft_version}-${config.bop_version}:universal"

deobfCompile "applecore:AppleCore:${config.minecraft_version}-${config.applecore_version}"
deobfCompile ("com.github.glitchfiend.biomesoplenty:BiomesOPlenty:${config.minecraft_version}-${config.bop_version}:universal") {
transitive = false
}

deobfCompile "mezz.jei:jei_${config.minecraft_version}:${config.jei_version}"
deobfCompile ("applecore:AppleCore:${config.minecraft_version}-${config.applecore_version}") {
transitive = false
}

deobfCompile "mcp.mobius.waila:Hwyla:${config.hwyla_version}_${config.minecraft_version_old}"
deobfCompile ("mezz.jei:jei_${config.minecraft_version}:${config.jei_version}") {
transitive = false
}

deobfCompile ("mcp.mobius.waila:Hwyla:${config.hwyla_version}_${config.minecraft_version_short}") {
transitive = false
}
}

// the single quotes in these filenames seems to cause problems with
// the jenkins server, so skip this for jenkins builds
if (System.getenv().BUILD_NUMBER == null) {
// note: the 'repository' url changes with each version
repositories { ivy { artifactPattern "https://addons-origin.cursecdn.com/files/2488/307[module] [revision].[ext]" } }//
dependencies { compile "pam:Pam's HarvestCraft:1.12.2a@jar" }
repositories { ivy { artifactPattern "https://addons-origin.cursecdn.com/files/2518/832/[module] [revision].[ext]" } }//
dependencies { compile "pam:Pam's HarvestCraft:1.12.2f@jar" }
}

processResources
Expand Down
17 changes: 8 additions & 9 deletions build.properties
@@ -1,20 +1,19 @@
mod_version=1.3.0

minecraft_version=1.12.2
minecraft_version_short=1.12

minecraft_version_old=1.12
forge_version=14.23.1.2587
mappings_version=snapshot_20180101

forge_version=14.23.0.2515
mappings_version=snapshot_20171024

mantle_version=1.3.1.+
tconstruct_version=2.7.4.+
natura_version=4.3.0.+
mantle_version=1.3.+
tconstruct_version=2.9.+
natura_version=4.3.+

jei_version=4.8.+

hwyla_version=1.8.20-B35
hwyla_version=1.8.23-B38

bop_version=7.0.1.+

applecore_version=2.2.2+
applecore_version=3.1.0+
2 changes: 1 addition & 1 deletion src/main/java/iguanaman/hungeroverhaul/HungerOverhaul.java
Expand Up @@ -43,7 +43,7 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;

@Mod(modid = HungerOverhaul.modID, name = HungerOverhaul.modName, version = HungerOverhaul.modVersion, dependencies = "required-after:forge@[14.21.1.2387,);required-after:applecore;after:tconstruct;after:harvestcraft;after:natura@[1.12-4.3.0.17,);after:ic2;after:*", acceptedMinecraftVersions = "[1.12, 1.13)")
@Mod(modid = HungerOverhaul.modID, name = HungerOverhaul.modName, version = HungerOverhaul.modVersion, dependencies = "required-after:forge@[14.21.1.2387,);required-after:applecore;after:tconstruct;after:harvestcraft@[1.12.2f,);after:natura@[1.12-4.3.0.17,);after:ic2;after:*", acceptedMinecraftVersions = "[1.12, 1.13)")
public class HungerOverhaul
{
public static final String modID = Util.MODID;
Expand Down
32 changes: 31 additions & 1 deletion src/main/java/iguanaman/hungeroverhaul/common/BlockHelper.java
Expand Up @@ -4,11 +4,15 @@
import java.util.List;

import com.pam.harvestcraft.blocks.growables.BlockPamCrop;
import com.pam.harvestcraft.blocks.growables.BlockPamFruit;
import com.pam.harvestcraft.blocks.growables.BlockPamFruitLog;
import com.progwml6.natura.overworld.NaturaOverworld;

import iguanaman.hungeroverhaul.module.harvestcraft.helper.PamsModsHelper;
import iguanaman.hungeroverhaul.module.natura.helper.NaturaHelper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -26,6 +30,8 @@ public static List<ItemStack> modifyCropDrops(List<ItemStack> drops, IBlockState
ItemStack produceItem = BlockHelper.getProduceOfBlock(state, produce);
boolean produceIsNotSeed = (seedItem.getItem() != produceItem.getItem() || seedItem.getItemDamage() != produceItem.getItemDamage());

boolean shouldProduceNotDrop = BlockHelper.shouldProduceNotDrop(state);

for (ItemStack item : drops)
{
// don't include seed/produce already in the list; we'll add them back afterwards
Expand All @@ -43,7 +49,7 @@ public static List<ItemStack> modifyCropDrops(List<ItemStack> drops, IBlockState
modifiedDrops.add(seedItem);
}

if (produceItem.getCount() > 0)
if (produceItem.getCount() > 0 && !shouldProduceNotDrop)
{
modifiedDrops.add(produceItem);
}
Expand Down Expand Up @@ -122,4 +128,28 @@ else if (Loader.isModLoaded("natura") && state.getBlock() == NaturaOverworld.cot
return state.getBlock().damageDropped(state);
}
}

public static boolean shouldProduceNotDrop(IBlockState state)
{
if (Loader.isModLoaded("harvestcraft") && state.getBlock() instanceof BlockPamFruit)
{
Block seed = PamsModsHelper.fruitBlockToBlockMap.get(state.getBlock());

if (seed == state.getBlock() || seed == Blocks.AIR)
{
return true;
}
}
else if (Loader.isModLoaded("harvestcraft") && state.getBlock() instanceof BlockPamFruitLog)
{
Block seed = PamsModsHelper.fruitBlockToBlockMap.get(state.getBlock());

if (seed == state.getBlock() || seed == Blocks.AIR)
{
return true;
}
}

return false;
}
}
Expand Up @@ -529,16 +529,16 @@ else if (Loader.isModLoaded("harvestcraft") && clicked_block.getClass() == Block
}
else if (Loader.isModLoaded("harvestcraft") && clicked_block.getClass() == BlockPamFruit.class)
{
if (ReflectionModule.pamFruitAgeFound && real_state.getValue(ReflectionModule.pamFruitAge) >= 2)
if (real_state.getValue(BlockPamFruit.AGE) >= 2)
{
resultingState = real_state.withProperty(ReflectionModule.pamFruitAge, 0);
resultingState = real_state.withProperty(BlockPamFruit.AGE, 0);
}
}
else if (Loader.isModLoaded("harvestcraft") && clicked_block.getClass() == BlockPamFruitLog.class)
{
if (ReflectionModule.pamFruitLogAgeFound && real_state.getValue(ReflectionModule.pamFruitLogAge) >= 2)
if (real_state.getValue(BlockPamFruitLog.AGE) >= 2)
{
resultingState = real_state.withProperty(ReflectionModule.pamFruitLogAge, 0);
resultingState = real_state.withProperty(BlockPamFruitLog.AGE, 0);
}
}

Expand Down Expand Up @@ -614,8 +614,8 @@ public void onBlockHarvested(HarvestDropsEvent event)
|| (isCottonCrop && state.getValue(BlockNaturaCotton.AGE) == 4)
|| (isBarleyCrop && state.getValue(BlockNaturaBarley.AGE) == 3)
|| (ReflectionModule.pamCropAgeFound && (isPamCrop && state.getValue(ReflectionModule.pamCropAge) == 3))
|| (ReflectionModule.pamFruitAgeFound && (isPamFruit && state.getValue(ReflectionModule.pamFruitAge) == 2))
|| (ReflectionModule.pamFruitLogAgeFound && (isPamFruitLog && state.getValue(ReflectionModule.pamFruitLogAge) == 2));
|| (isPamFruit && state.getValue(BlockPamFruit.AGE) == 2)
|| (isPamFruitLog && state.getValue(BlockPamFruitLog.AGE) == 2);

if (!fullyGrown)
{
Expand Down
Expand Up @@ -2,11 +2,14 @@

import java.util.Arrays;
import java.util.List;
import java.util.Random;

import com.pam.harvestcraft.HarvestCraft;
import com.pam.harvestcraft.blocks.CropRegistry;
import com.pam.harvestcraft.blocks.FruitRegistry;
import com.pam.harvestcraft.blocks.growables.BlockPamCrop;
import com.pam.harvestcraft.blocks.growables.BlockPamFruit;
import com.pam.harvestcraft.blocks.growables.BlockPamFruitLog;
import com.pam.harvestcraft.blocks.growables.BlockPamSapling;
import com.pam.harvestcraft.item.ItemRegistry;

Expand All @@ -17,18 +20,24 @@
import iguanaman.hungeroverhaul.module.growth.PlantGrowthModule;
import iguanaman.hungeroverhaul.module.growth.modification.PlantGrowthModification;
import iguanaman.hungeroverhaul.module.harvestcraft.helper.PamsModsHelper;
import iguanaman.hungeroverhaul.module.reflection.ReflectionModule;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraftforge.common.BiomeDictionary.Type;
import squeek.applecore.api.food.FoodValues;

public class HarvestCraftModule
{
public static Random random = new Random();

public static void init()
{
random.setSeed(2 ^ 16 + 2 ^ 8 + (4 * 3 * 271));

// SETUP VALUES
if (Config.modifyFoodValues && Config.useHOFoodValues)
{
Expand Down Expand Up @@ -820,14 +829,87 @@ else if (lowerSaturationCrops.contains(crop))
/*
* Bonemeal
*/
BonemealModification cropBonemealModification = new BonemealModification()
{
@Override
public IBlockState getNewState(World world, BlockPos pos, IBlockState currentState)
{
//TODO REMOVE REFLECTION
if (ReflectionModule.pamCropAgeFound)
{
int currentMeta = currentState.getValue(ReflectionModule.pamCropAge);
int metaFullyGrown = 3;
int metaIncrease = 0;

if (currentMeta != metaFullyGrown)
{
metaIncrease = 1;

if (Config.difficultyScalingBoneMeal && world.getDifficulty().ordinal() < EnumDifficulty.NORMAL.ordinal())
{
int metaRandomIncreaseRange = currentMeta < 3 ? 2 : 3;
metaIncrease += random.nextInt(metaRandomIncreaseRange);
}
}

return currentState.withProperty(ReflectionModule.pamCropAge, Math.min(currentMeta + metaIncrease, metaFullyGrown));
}
else
{
return currentState;
}
}
};
BonemealModule.registerBonemealModifier(BlockPamCrop.class, cropBonemealModification);

BonemealModification fruitBonemealModification = new BonemealModification()
{
@Override
public IBlockState getNewState(World world, BlockPos pos, IBlockState currentState)
{
return currentState.withProperty(BlockPamFruit.AGE, Math.min(currentState.getValue(BlockPamFruit.AGE) + 1, 2));
int currentMeta = currentState.getValue(BlockPamFruit.AGE);
int metaFullyGrown = 2;
int metaIncrease = 0;

if (currentMeta != metaFullyGrown)
{
metaIncrease = 1;

if (Config.difficultyScalingBoneMeal && world.getDifficulty().ordinal() < EnumDifficulty.NORMAL.ordinal())
{
int metaRandomIncreaseRange = currentMeta < 2 ? 1 : 2;
metaIncrease += random.nextInt(metaRandomIncreaseRange);
}
}

return currentState.withProperty(BlockPamFruit.AGE, Math.min(currentMeta + metaIncrease, metaFullyGrown));
}
};
BonemealModule.registerBonemealModifier(BlockPamFruit.class, fruitBonemealModification);

BonemealModification fruitLogBonemealModification = new BonemealModification()
{
@Override
public IBlockState getNewState(World world, BlockPos pos, IBlockState currentState)
{
int currentMeta = currentState.getValue(BlockPamFruitLog.AGE);
int metaFullyGrown = 2;
int metaIncrease = 0;

if (currentMeta != metaFullyGrown)
{
metaIncrease = 1;

if (Config.difficultyScalingBoneMeal && world.getDifficulty().ordinal() < EnumDifficulty.NORMAL.ordinal())
{
int metaRandomIncreaseRange = currentMeta < 2 ? 1 : 2;
metaIncrease += random.nextInt(metaRandomIncreaseRange);
}
}

return currentState.withProperty(BlockPamFruitLog.AGE, Math.min(currentMeta + metaIncrease, metaFullyGrown));
}
};
BonemealModule.registerBonemealModifier(BlockPamFruitLog.class, fruitLogBonemealModification);
}
}

0 comments on commit 9ba1e03

Please sign in to comment.