From ea38096ef6ec1f3d1fc18cf9cfc98b29864c0151 Mon Sep 17 00:00:00 2001 From: Guillaume Mercier Date: Mon, 21 Oct 2024 11:42:26 -0400 Subject: [PATCH] Fix Essence Berry (#79) --- dependencies.gradle | 1 + .../crops/TConstruct/BasicTConstructOreBerryCrop.java | 6 +++++- .../cropspp/crops/TConstruct/EssenceOreBerryCrop.java | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 955a964..cdb2c3e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -25,6 +25,7 @@ dependencies { //runtimeOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") //runtimeOnly("com.github.GTNewHorizons:twilightforest:2.6.34:dev") //runtimeOnly("com.github.GTNewHorizons:TinkersConstruct:1.12.10-GTNH:dev") + //runtimeOnly("com.github.GTNewHorizons:EnderIO:2.8.18:dev") //runtimeOnly("com.github.GTNewHorizons:Natura:2.7.3:dev") //runtimeOnly("com.github.GTNewHorizons:NewHorizonsCoreMod:2.6.56:dev") //runtimeOnly("com.github.GTNewHorizons:Galacticraft:3.2.5-GTNH:dev") diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java index a1dc601..349ef65 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java @@ -21,9 +21,13 @@ public int growthDuration(ICropTile crop) { return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; } + public boolean isBlockBelow(ICropTile crop) { + return crop.isBlockBelow(hasBlock()); + } + @Override public ItemStack getGain(ICropTile crop) { - return getDropItem(crop.getSize() >= this.maxSize() && crop.isBlockBelow(hasBlock()) ? 6 : 2); + return getDropItem(crop.getSize() >= this.maxSize() && this.isBlockBelow(crop) ? 6 : 2); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java index 1ae924d..67a9744 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java @@ -1,5 +1,6 @@ package com.github.bartimaeusnek.cropspp.crops.TConstruct; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import ic2.api.crops.ICropTile; @@ -26,6 +27,14 @@ protected String hasBlock() { return "itemSkull"; } + @Override + public boolean isBlockBelow(ICropTile crop) { + // IC2 doesn't understand wildcards in its item comparison logic for block below checks. + // So I'm using a workaround for vanilla skulls. EIO also adds a it's endermand head to the list and since that + // doesn't use a wild card we can assume it that should keep working. + return crop.isBlockBelow(Blocks.skull) || super.isBlockBelow(crop); + } + @Override public boolean canGrow(ICropTile crop) { return super.canGrowBase(crop);