Skip to content

Commit

Permalink
Fix FireFiend NEI drops (#19)
Browse files Browse the repository at this point in the history
* Fix FireFiend NEI drops

* Update EntityMiniBossFireFiend.java

* Add custom event provider

* Update dependencies.gradle

* Update dependencies.gradle

* update

---------

Co-authored-by: Martin Robertz <dream-master@gmx.net>
  • Loading branch information
kuba6000 and Dream-Master authored Aug 19, 2024
1 parent 417ff99 commit e6a0d6b
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 9 deletions.
5 changes: 3 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Add your dependencies here

dependencies {
implementation('com.github.GTNewHorizons:GTNHLib:0.3.3:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.4.3:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.26-GTNH:dev')

compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:Mobs-Info:0.4.2-GTNH:dev')
}
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false

# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
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
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.24'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
}


21 changes: 18 additions & 3 deletions src/main/java/chylex/hee/entity/boss/EntityMiniBossFireFiend.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.Iterator;
import java.util.List;

import javax.annotation.Nonnull;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.EntityLivingBase;
Expand All @@ -19,6 +21,9 @@
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;

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

import chylex.hee.HardcoreEnderExpansion;
import chylex.hee.entity.GlobalMobData.IIgnoreEnderGoo;
import chylex.hee.entity.RandomNameGenerator;
Expand All @@ -35,8 +40,11 @@
import chylex.hee.system.util.BlockPosM;
import chylex.hee.system.util.DragonUtil;
import chylex.hee.system.util.MathUtil;
import cpw.mods.fml.common.Optional;

public class EntityMiniBossFireFiend extends EntityFlying implements IBossDisplayData, IIgnoreEnderGoo {
@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobInfoProvider", modid = "mobsinfo")
public class EntityMiniBossFireFiend extends EntityFlying
implements IBossDisplayData, IIgnoreEnderGoo, IMobInfoProvider {

private static final byte ATTACK_NONE = 0, ATTACK_FIREBALLS = 1, ATTACK_FLAMES = 2;

Expand Down Expand Up @@ -64,8 +72,8 @@ public EntityMiniBossFireFiend(World world) {
@Override
protected void entityInit() {
super.entityInit();
dataWatcher.addObject(16, Byte.valueOf((byte) 0));
dataWatcher.addObject(17, Byte.valueOf((byte) 0));
dataWatcher.addObject(16, (byte) 0);
dataWatcher.addObject(17, (byte) 0);
}

@Override
Expand Down Expand Up @@ -295,11 +303,18 @@ public void setHealth(float newHealth) {

@Override
protected void dropFewItems(boolean recentlyHit, int looting) {
// ANY CHANGE MADE IN HERE MUST ALSO BE MADE IN provideDropsInformation!
for (int a = 0; a < 80; a++) entityDropItem(
new ItemStack(ItemList.essence, 3, EssenceType.FIERY.getItemDamage()),
rand.nextFloat() * height);
}

@Optional.Method(modid = "mobsinfo")
@Override
public void provideDropsInformation(@Nonnull ArrayList<MobDrop> drops) {
drops.add(MobDrop.create(new ItemStack(ItemList.essence, 3 * 80, EssenceType.FIERY.getItemDamage())));
}

@Override
public void knockBack(Entity entity, float damage, double xPower, double zPower) {
super.knockBack(entity, damage, xPower, zPower);
Expand Down
37 changes: 36 additions & 1 deletion src/main/java/chylex/hee/mechanics/MiscEvents.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package chylex.hee.mechanics;

import java.util.ArrayList;
import java.util.Arrays;

import javax.annotation.Nonnull;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.monster.EntitySilverfish;
Expand All @@ -12,16 +17,23 @@
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.EntityInteractEvent;

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

import chylex.hee.entity.item.EntityItemDragonEgg;
import chylex.hee.init.ItemList;
import chylex.hee.item.ItemTransferenceGem;
import chylex.hee.mechanics.enhancements.EnhancementHandler;
import chylex.hee.mechanics.enhancements.types.TransferenceGemEnhancements;
import chylex.hee.system.util.ItemUtil;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class MiscEvents {
@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobExtraInfoProvider", modid = "mobsinfo")
public class MiscEvents implements IMobExtraInfoProvider {

/*
* Dragon Egg entity join world
Expand Down Expand Up @@ -53,6 +65,7 @@ public void onEntityJoinWorld(EntityJoinWorldEvent e) {
*/
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent e) {
// ANY CHANGE MADE IN HERE MUST ALSO BE MADE IN provideDropsInformation!
if (e.entity.worldObj.isRemote /* || SpectralEssenceHandler.handleMobDeath(e) */ || !e.recentlyHit) return;

if (e.entity.getClass() == EntitySilverfish.class
Expand All @@ -78,6 +91,28 @@ public void onLivingDrops(LivingDropsEvent e) {
}
}

@Optional.Method(modid = "mobsinfo")
@Override
public void provideExtraDropsInformation(@Nonnull String entityString, @Nonnull ArrayList<MobDrop> drops,
@Nonnull MobRecipe recipe) {
if (recipe.entity.getClass() == EntitySilverfish.class) {
MobDrop drop = new MobDrop(
new ItemStack(ItemList.silverfish_blood),
MobDrop.DropType.Normal,
179,
null,
null,
false,
false);
drop.variableChance = true;
drop.chanceModifiers.addAll(
Arrays.asList(
new IChanceModifier.NormalChance(1.79d),
new IChanceModifier.OrUsing(Items.golden_sword, 7.14d)));
drops.add(drop);
}
}

/*
* Right-clicking on item frame, mob and item with Transference Gem
*/
Expand Down

0 comments on commit e6a0d6b

Please sign in to comment.