Skip to content

Commit

Permalink
Add compatibility with AppleCore (squeek502/AppleCore#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChloeDawn committed Apr 28, 2020
1 parent da1df56 commit e57255d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ minecraft {
replace '%VERSION%', modVersion
}

repositories {
maven { url 'http://www.ryanliptak.com/maven' }
}

dependencies {
deobfCompile "applecore:AppleCore:$applecoreVersion:api"
}

processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info', 'pack.mcmeta'
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
modVersion=2.0.0
mcfVersion=1.12.2-14.23.1.2582
mcpMappings=snapshot_20171229
applecoreVersion=1.12.2-3.1.0+296.50100
2 changes: 1 addition & 1 deletion src/main/java/net/insomniakitten/cake/PersistentCake.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class PersistentCake {
public static final String ID = "persistentcake";
public static final String NAME = "Persistent Cake";
public static final String VERSION = "%VERSION%";
public static final String DEPENDENCIES = "after:harvestcraft";
public static final String DEPENDENCIES = "after:applecore;after:harvestcraft";

protected static final Logger LOGGER = LogManager.getLogger(ID);

Expand Down
19 changes: 18 additions & 1 deletion src/main/java/net/insomniakitten/cake/PersistentCakeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
import org.apache.logging.log4j.Logger;
import squeek.applecore.api.food.FoodValues;
import squeek.applecore.api.food.IEdibleBlock;

import javax.annotation.Nonnull;
import java.util.Random;

public class PersistentCakeBlock extends BlockCake {
@Optional.Interface(iface = "squeek.applecore.api.food.IEdibleBlock", modid = "applecore")
public class PersistentCakeBlock extends BlockCake implements IEdibleBlock {

private final Block delegate;

Expand Down Expand Up @@ -110,4 +115,16 @@ private boolean canBlockStay(World world, BlockPos pos) {
return world.getBlockState(pos.down()).getMaterial().isSolid();
}

@Override
@Optional.Method(modid = "applecore")
public void setEdibleAtMaxHunger(boolean value) {
((IEdibleBlock) delegate).setEdibleAtMaxHunger(value);
}

@Override
@Optional.Method(modid = "applecore")
public FoodValues getFoodValues(@Nonnull ItemStack stack) {
return ((IEdibleBlock) delegate).getFoodValues(stack);
}

}

0 comments on commit e57255d

Please sign in to comment.