Skip to content

Commit

Permalink
Add reliquarry support (#96)
Browse files Browse the repository at this point in the history
* Add reliquarry support

* fixed startup crash

* Update src/main/java/com/kuba6000/mobsinfo/loader/extras/Reliquarry.java

Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com>

* yup it works w/o special class

* Final, looting, spotless

* bs

---------

Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com>
Co-authored-by: kuba6000 <kuba.123123.6000@gmail.com>
  • Loading branch information
3 people authored Sep 13, 2024
1 parent 55ad3ff commit 21a5d80
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 2 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ dependencies {
compileOnly("curse.maven:CoFHCore-69162:2388751") // DEV JAR
compileOnly("curse.maven:ExtraUtilities-225561:2264384") // DEOBF JAR
compileOnly(rfg.deobf("curse.maven:JustAnotherSpawner-228952:2380961"))
compileOnly(rfg.deobf("curse.maven:reliquary-reincarnations-241319:2323453"))
compileOnly(deobf("https://github.com/Roadhog360/Et-Futurum-Requiem/releases/download/2.5.1/Et_Futurum_Requiem-2.5.1+nomixin.jar", "Et Futurum Requiem"))

compileOnly(rfg.deobf(project.files("libs/dqr.jar")))
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/kuba6000/mobsinfo/api/LoaderReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public enum LoaderReference {
ExtraUtilities("ExtraUtilities"),
EtFuturumRequiem("etfuturum"),
LycanitesMobs("lycanitesmobs"),
JustAnotherSpawner("JustAnotherSpawner"),;
JustAnotherSpawner("JustAnotherSpawner"),
Reliquarry("xreliquary"),;

public final String modID;
public final boolean isLoaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ private static void init() {
&& !alreadyProvided.contains(LoaderReference.EtFuturumRequiem.modID)) loaders.add(new EtFuturum());
if (LoaderReference.LycanitesMobs.isLoaded && !alreadyProvided.contains(LoaderReference.LycanitesMobs.modID))
loaders.add(new LycanitesMobs());
if (LoaderReference.Reliquarry.isLoaded && !alreadyProvided.contains(LoaderReference.Reliquarry.modID))
loaders.add(new Reliquarry());

// LAST
if (LoaderReference.EditMobDrops.isLoaded && !alreadyProvided.contains(LoaderReference.EditMobDrops.modID))
Expand Down
93 changes: 93 additions & 0 deletions src/main/java/com/kuba6000/mobsinfo/loader/extras/Reliquarry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.kuba6000.mobsinfo.loader.extras;

import java.util.ArrayList;

import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import com.kuba6000.mobsinfo.api.MobDrop;
import com.kuba6000.mobsinfo.api.MobRecipe;

import xreliquary.event.CommonEventHandler;
import xreliquary.init.XRRecipes;
import xreliquary.lib.Names;
import xreliquary.lib.Reference;

public class Reliquarry implements IExtraLoader {

private final CommonEventHandler eventHandler;

public Reliquarry() {
this.eventHandler = new CommonEventHandler();
}

@Override
public void process(String k, ArrayList<MobDrop> drops, MobRecipe recipe) {
if (recipe.entity instanceof EntitySquid) {
addDrop(drops, XRRecipes.ingredient(Reference.SQUID_INGREDIENT_META), Names.squid_beak);
} else if (recipe.entity instanceof EntityWitch) {
Item witchHatItem = XRRecipes.getItem(Names.witch_hat);
ItemStack witchHatStack = new ItemStack(witchHatItem, 1);
addDrop(drops, witchHatStack, Names.witch_hat);
} else if (recipe.entity instanceof EntitySpider) {
addDrop(drops, XRRecipes.ingredient(Reference.SPIDER_INGREDIENT_META), Names.spider_fangs);
} else if (recipe.entity instanceof EntityCaveSpider) {
addDrop(drops, XRRecipes.ingredient(Reference.SPIDER_INGREDIENT_META), Names.cave_spider_fangs);
} else if (recipe.entity instanceof EntitySkeleton) {
addDrop(drops, XRRecipes.ingredient(Reference.SKELETON_INGREDIENT_META), Names.rib_bone);
if (((EntitySkeleton) recipe.entity).getSkeletonType() == 1) {
addDrop(drops, XRRecipes.ingredient(Reference.WITHER_INGREDIENT_META), Names.withered_rib);
}
} else if (recipe.entity instanceof EntityZombie) {
addDrop(drops, XRRecipes.ingredient(Reference.ZOMBIE_INGREDIENT_META), Names.zombie_heart);
} else if (recipe.entity instanceof EntityPigZombie) {
addDrop(drops, XRRecipes.ingredient(Reference.ZOMBIE_INGREDIENT_META), Names.pigman_heart);
} else if (recipe.entity instanceof EntitySlime) {
addDrop(drops, XRRecipes.ingredient(Reference.SLIME_INGREDIENT_META), Names.slime_pearl);
} else if (recipe.entity instanceof EntityBlaze) {
addDrop(drops, XRRecipes.ingredient(Reference.MOLTEN_INGREDIENT_META), Names.blaze_molten_core);
} else if (recipe.entity instanceof EntityMagmaCube) {
addDrop(drops, XRRecipes.ingredient(Reference.MOLTEN_INGREDIENT_META), Names.magma_cube_molten_core);
} else if (recipe.entity instanceof EntityGhast) {
addDrop(drops, XRRecipes.ingredient(Reference.CREEPER_INGREDIENT_META), Names.ghast_gland);
} else if (recipe.entity instanceof EntityCreeper) {
addDrop(drops, XRRecipes.ingredient(Reference.CREEPER_INGREDIENT_META), Names.creeper_gland);
if (((EntityCreeper) recipe.entity).getPowered()) {
addDrop(drops, XRRecipes.ingredient(Reference.STORM_INGREDIENT_META), Names.eye_of_the_storm);
}
} else if (recipe.entity instanceof EntityEnderman) {
addDrop(drops, XRRecipes.ingredient(Reference.ENDER_INGREDIENT_META), Names.ender_heart);
} else if (recipe.entity instanceof EntityBat) {
addDrop(drops, XRRecipes.ingredient(Reference.BAT_INGREDIENT_META), Names.bat_wing);
} else if (recipe.entity instanceof EntitySnowman) {
addDrop(drops, XRRecipes.ingredient(Reference.FROZEN_INGREDIENT_META), Names.frozen_core);
}
}

private void addDrop(ArrayList<MobDrop> drops, ItemStack item, String name) {
MobDrop drop = new MobDrop(
item,
MobDrop.DropType.Normal,
(int) (eventHandler.getBaseDrop(name) * 10000d),
null,
null,
eventHandler.getLootingDrop(name) > 0.01f,
false);
drops.add(drop);
}
}

0 comments on commit 21a5d80

Please sign in to comment.