Allow Scythe to harvest Natura crops

This commit is contained in:
YannickMG committed 2025-03-31 21:45:59 -04:00
1 parent 1a981fd00a
commit d650c59414
4 files changed
+56

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ dependencies {
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
compileOnly("com.github.GTNewHorizons:Mobs-Info:0.5.2-GTNH:dev")
compileOnlyApi("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
compileOnlyApi("com.github.GTNewHorizons:Natura:2.7.6:dev")
// devOnlyNonPublishable("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
+2
View File
@@ -61,6 +61,7 @@ import tconstruct.plugins.imc.TinkerBuildCraft;
import tconstruct.plugins.imc.TinkerMystcraft;
import tconstruct.plugins.imc.TinkerRfTools;
import tconstruct.plugins.mfr.TinkerMFR;
import tconstruct.plugins.natura.TinkerNatura;
import tconstruct.plugins.te4.TinkerTE4;
import tconstruct.plugins.te4.TinkersThermalFoundation;
import tconstruct.plugins.ubc.TinkerUBC;
@@ -174,6 +175,7 @@ public class TConstruct {
pulsar.registerPulse(new TinkerUBC());
pulsar.registerPulse(new TinkerGears());
pulsar.registerPulse(new TinkerRfTools());
pulsar.registerPulse(new TinkerNatura());
TConstructRegistry.materialTab = new TConstructCreativeTab("TConstructMaterials");
TConstructRegistry.toolTab = new TConstructCreativeTab("TConstructTools");
@@ -0,0 +1,31 @@
package tconstruct.plugins.natura;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import mods.natura.blocks.crops.CropBlock;
import tconstruct.api.harvesting.CropHarvestHandler;
public class NaturaCropHarvestHandler implements CropHarvestHandler {
@Override
public boolean couldHarvest(World world, int x, int y, int z) {
return world.getBlock(x, y, z) instanceof CropBlock;
}
@Override
public boolean tryHarvest(ItemStack stack, EntityPlayer player, World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block instanceof CropBlock crop) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == crop.getMaxGrowth(meta)) {
crop.dropBlockAsItem(world, x, y, z, meta, 0);
world.setBlockMetadataWithNotify(x, y, z, crop.getStartGrowth(meta), 2);
return true;
}
}
return false;
}
}
@@ -0,0 +1,22 @@
package tconstruct.plugins.natura;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import mantle.pulsar.pulse.Handler;
import mantle.pulsar.pulse.Pulse;
import tconstruct.TConstruct;
import tconstruct.api.harvesting.CropHarvestHandlers;
@GameRegistry.ObjectHolder(TConstruct.modID)
@Pulse(
id = "Tinkers Natura Compatibility",
description = "Tinkers Construct compatibility for Natura",
modsRequired = "Natura",
forced = true)
public class TinkerNatura {
@Handler
public void init(FMLInitializationEvent event) {
CropHarvestHandlers.registerCropHarvestHandler(new NaturaCropHarvestHandler());
}
}