Compare commits

...
3 Commits
Author SHA1 Message Date
__felix__andgithub-actions[bot] fc58f5346c fix loader check (#144)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-29 11:52:12 -04:00
koolkrafter5 aec32b9149 Make blood orb stacks in NEI size 0 (#142) 2026-07-26 22:59:16 +00:00
koolkrafter5 6f45c3efae Fix bound blade not dropping blood shards if you kill in one hit (#141) 2026-07-14 20:06:43 +02:00
9 changed files with 40 additions and 55 deletions

No files matched your search

@@ -64,7 +64,6 @@ import WayofTime.alchemicalWizardry.common.ClientToServerPacketHandler;
import WayofTime.alchemicalWizardry.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.LifeBucketHandler;
import WayofTime.alchemicalWizardry.common.LifeEssence;
import WayofTime.alchemicalWizardry.common.ModLivingDropsEvent;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.achievements.ModAchievements;
import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry;
@@ -480,7 +479,7 @@ public class AlchemicalWizardry {
public static int ritualWeakCostThunderstorm;
public static int ritualWeakCostZombie;
public static boolean isGregTechLoaded;
public static boolean isGregTech5UnofficialNewHorizonsLoaded;
public static boolean isThaumcraftLoaded;
public static boolean isForestryLoaded;
public static boolean isBotaniaLoaded;
@@ -1554,7 +1553,6 @@ public class AlchemicalWizardry {
blacklistAccelerators();
MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
proxy.InitRendering();
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
@@ -3248,7 +3246,7 @@ public class AlchemicalWizardry {
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.registerPostSideObjects();
isGregTechLoaded = Loader.isModLoaded("gregtech");
isGregTech5UnofficialNewHorizonsLoaded = Loader.isModLoaded("gregtech_nh");
isEndlessIdsLoaded = Loader.isModLoaded("endlessids");
// TODO Thaumcraft Integration
if (Loader.isModLoaded("Thaumcraft")) {
@@ -43,7 +43,7 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
ArrayList<ItemStack> orbs = new ArrayList<>();
for (Item item : getBloodOrbs()) {
if (((IBloodOrb) item).getOrbLevel() >= i) {
orbs.add(new ItemStack(item));
orbs.add(new ItemStack(item, 0));
}
}
PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
@@ -42,7 +42,7 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
ArrayList<ItemStack> orbs = new ArrayList<>();
for (Item item : NEIConfig.getBloodOrbs()) {
if (((IBloodOrb) item).getOrbLevel() >= i) {
orbs.add(new ItemStack(item));
orbs.add(new ItemStack(item, 0));
}
}
@@ -11,6 +11,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
@@ -27,6 +28,7 @@ import net.minecraftforge.event.AnvilUpdateEvent;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
@@ -35,14 +37,17 @@ import net.minecraftforge.event.entity.player.EntityInteractEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.BlockStack;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.common.achievements.ModAchievements;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.EnergySword;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
@@ -153,6 +158,31 @@ public class AlchemicalWizardryEventHooks {
}
}
@SubscribeEvent
public void onHurt(LivingHurtEvent event) {
if (!(event.source.getEntity() instanceof EntityPlayer player)) {
return;
}
ItemStack item = player.getCurrentEquippedItem();
if (item != null && item.getItem() instanceof EnergySword sword
&& IBindable.checkAndSetItemOwner(item, player)
&& EnergyItems.syphonBatteries(item, player, sword.drainCost())) {
event.entityLiving.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
}
}
@SubscribeEvent
public void onEntityDrop(LivingDropsEvent event) {
if (!event.source.getDamageType().equals("player") || event.entityLiving instanceof EntityAnimal) {
return;
}
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
if (effect != null && effect.getAmplifier() >= 2 && Math.random() < 0.50d) {
event.entityLiving.dropItem(ModItems.weakBloodShard, 1);
}
}
@SubscribeEvent
public void omegaUpdateReagentAndHpEvent(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer player && !event.entityLiving.worldObj.isRemote) {
@@ -1,31 +0,0 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ModLivingDropsEvent {
public static double rand;
@SubscribeEvent
public void onEntityDrop(LivingDropsEvent event) {
if (event.source.getDamageType().equals("player")) {
rand = Math.random();
if (!(event.entityLiving instanceof EntityAnimal)) {
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
if (effect != null) {
if (effect.getAmplifier() >= 2) if (rand < 0.50d) {
event.entityLiving.dropItem(ModItems.weakBloodShard, 1);
}
}
}
}
}
}
@@ -125,7 +125,8 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
dropMultiset.add(new ItemType(block, meta));
} else {
ArrayList<ItemStack> itemDropList;
if (AlchemicalWizardry.isGregTechLoaded && block instanceof GTBlockOre ore) {
if (AlchemicalWizardry.isGregTech5UnofficialNewHorizonsLoaded
&& block instanceof GTBlockOre ore) {
itemDropList = ore.getDropsForPlayer(world, x, y, z, meta, fortuneLvl, player);
} else {
itemDropList = block.getDrops(world, x, y, z, meta, fortuneLvl);
@@ -4,12 +4,9 @@ import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
@@ -88,17 +85,6 @@ public class EnergySword extends ItemSword implements IBindable {
return !isActive;
}
@Override
public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase attacker) {
if (attacker instanceof EntityPlayer player && (!IBindable.checkAndSetItemOwner(item, player)
|| !EnergyItems.syphonBatteries(item, player, this.drainCost()))) {
return false;
}
target.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
return true;
}
@Override
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
super.onItemRightClick(item, world, player);
@@ -36,7 +36,7 @@ public class RitualEffectMagnetic extends RitualEffect {
public static boolean isBlockOre(Block block, int meta) {
// Special case for lit redstone ore
if (block instanceof BlockOre || block instanceof BlockRedstoneOre
|| (AlchemicalWizardry.isGregTechLoaded && block instanceof GTBlockOre)) {
|| (AlchemicalWizardry.isGregTech5UnofficialNewHorizonsLoaded && block instanceof GTBlockOre)) {
return true;
}
@@ -160,7 +160,8 @@ public class Meteor {
if (blockStack != null && blockStack.getItem() instanceof ItemBlock) {
((ItemBlock) blockStack.getItem())
.placeBlockAt(blockStack, null, world, x, y, z, 0, 0, 0, 0, blockStack.getItemDamage());
if (AlchemicalWizardry.isGregTechLoaded) setGTOresNaturalIfNeeded(world, x, y, z);
if (AlchemicalWizardry.isGregTech5UnofficialNewHorizonsLoaded)
setGTOresNaturalIfNeeded(world, x, y, z);
world.markBlockForUpdate(x, y, z);
break;
}
@@ -230,7 +231,7 @@ public class Meteor {
this.fillerChance = Math.max(0f, Math.min(100f * (1 - ((float) getTotalListWeight(ores) / maxWeight)), 100.0f));
}
@Optional.Method(modid = "gregtech")
@Optional.Method(modid = "gregtech_nh")
private static void setGTOresNaturalIfNeeded(World world, int x, int y, int z) {
try (OreInfo<?> info = OreManager.getOreInfo(world, x, y, z)) {
if (info == null) return;