Stop using a custom bus subscriber annotation
I'm sorry, past self, but Forge has had one since like 1.10, it's time to move on. It's for the better.
This commit is contained in:
parent
e2538d9291
commit
9de2354e64
|
@ -1,6 +1,5 @@
|
||||||
package WayofTime.bloodmagic;
|
package WayofTime.bloodmagic;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||||
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
||||||
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
||||||
|
@ -17,7 +16,6 @@ import WayofTime.bloodmagic.registry.*;
|
||||||
import WayofTime.bloodmagic.structures.ModDungeons;
|
import WayofTime.bloodmagic.structures.ModDungeons;
|
||||||
import WayofTime.bloodmagic.util.BloodMagicIsntReadyYetStopTryingToUseItAndJustWaitForMeToFinishPleaseAndThankYou;
|
import WayofTime.bloodmagic.util.BloodMagicIsntReadyYetStopTryingToUseItAndJustWaitForMeToFinishPleaseAndThankYou;
|
||||||
import WayofTime.bloodmagic.util.PluginUtil;
|
import WayofTime.bloodmagic.util.PluginUtil;
|
||||||
import WayofTime.bloodmagic.util.Utils;
|
|
||||||
import WayofTime.bloodmagic.util.handler.IMCHandler;
|
import WayofTime.bloodmagic.util.handler.IMCHandler;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
@ -85,7 +83,6 @@ public class BloodMagic {
|
||||||
ModTranquilityHandlers.init();
|
ModTranquilityHandlers.init();
|
||||||
ModDungeons.init();
|
ModDungeons.init();
|
||||||
|
|
||||||
Utils.registerHandlers(event.getAsmData().getAll(Handler.class.getCanonicalName()));
|
|
||||||
proxy.preInit();
|
proxy.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package WayofTime.bloodmagic.annot;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classes annotated with this will automatically be registered to the
|
|
||||||
* {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface Handler {
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
package WayofTime.bloodmagic.util;
|
package WayofTime.bloodmagic.util;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
|
||||||
import WayofTime.bloodmagic.api.BlockStack;
|
import WayofTime.bloodmagic.api.BlockStack;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||||
|
@ -41,9 +40,7 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
import net.minecraftforge.common.ISpecialArmor;
|
import net.minecraftforge.common.ISpecialArmor;
|
||||||
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
|
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
@ -919,19 +916,6 @@ public class Utils {
|
||||||
return largerStack ? stack : ItemStack.EMPTY;
|
return largerStack ? stack : ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerHandlers(Set<ASMDataTable.ASMData> eventHandlers) {
|
|
||||||
for (ASMDataTable.ASMData data : eventHandlers) {
|
|
||||||
try {
|
|
||||||
Class<?> handlerClass = Class.forName(data.getClassName());
|
|
||||||
Object handlerImpl = handlerClass.newInstance();
|
|
||||||
MinecraftForge.EVENT_BUS.register(handlerImpl);
|
|
||||||
BloodMagic.LOGGER.debug("Registering event handler for class {}", data.getClassName());
|
|
||||||
} catch (Exception e) {
|
|
||||||
// No-op
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasUUID(ItemStack stack) {
|
public static boolean hasUUID(ItemStack stack) {
|
||||||
return stack.hasTagCompound() && stack.getTagCompound().hasKey(Constants.NBT.MOST_SIG) && stack.getTagCompound().hasKey(Constants.NBT.LEAST_SIG);
|
return stack.hasTagCompound() && stack.getTagCompound().hasKey(Constants.NBT.MOST_SIG) && stack.getTagCompound().hasKey(Constants.NBT.LEAST_SIG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.ConfigHandler;
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
||||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||||
|
@ -41,6 +40,7 @@ import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||||
|
@ -50,7 +50,7 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Handler
|
@Mod.EventBusSubscriber
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ClientHandler {
|
public class ClientHandler {
|
||||||
// Quick toggle for error suppression. Set to false if you wish to hide model errors.
|
// Quick toggle for error suppression. Set to false if you wish to hide model errors.
|
||||||
|
@ -76,7 +76,7 @@ public class ClientHandler {
|
||||||
private static boolean mrsHoloDisplay;
|
private static boolean mrsHoloDisplay;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTooltipEvent(ItemTooltipEvent event) {
|
public static void onTooltipEvent(ItemTooltipEvent event) {
|
||||||
ItemStack stack = event.getItemStack();
|
ItemStack stack = event.getItemStack();
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -93,7 +93,7 @@ public class ClientHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onSoundEvent(PlaySoundEvent event) {
|
public static void onSoundEvent(PlaySoundEvent event) {
|
||||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
if (player != null && player.isPotionActive(RegistrarBloodMagic.DEAFNESS)) {
|
if (player != null && player.isPotionActive(RegistrarBloodMagic.DEAFNESS)) {
|
||||||
event.setResultSound(null);
|
event.setResultSound(null);
|
||||||
|
@ -101,7 +101,7 @@ public class ClientHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTextureStitch(TextureStitchEvent.Pre event) {
|
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
||||||
final String BLOCKS = "blocks";
|
final String BLOCKS = "blocks";
|
||||||
|
|
||||||
ritualStoneBlank = forName(event.getMap(), "RitualStone", BLOCKS);
|
ritualStoneBlank = forName(event.getMap(), "RitualStone", BLOCKS);
|
||||||
|
@ -121,7 +121,7 @@ public class ClientHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void render(RenderWorldLastEvent event) {
|
public static void render(RenderWorldLastEvent event) {
|
||||||
EntityPlayerSP player = minecraft.player;
|
EntityPlayerSP player = minecraft.player;
|
||||||
World world = player.getEntityWorld();
|
World world = player.getEntityWorld();
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public class ClientHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMouseEvent(MouseEvent event) {
|
public static void onMouseEvent(MouseEvent event) {
|
||||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||||
|
|
||||||
if (event.getDwheel() != 0 && player != null && player.isSneaking()) {
|
if (event.getDwheel() != 0 && player != null && player.isSneaking()) {
|
||||||
|
@ -164,7 +164,7 @@ public class ClientHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onKey(InputEvent event) {
|
public static void onKey(InputEvent event) {
|
||||||
if (!minecraft.inGameHasFocus)
|
if (!minecraft.inGameHasFocus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ public class ClientHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onHudRender(RenderGameOverlayEvent.Pre event) {
|
public static void onHudRender(RenderGameOverlayEvent.Pre event) {
|
||||||
for (HUDElement element : hudElements)
|
for (HUDElement element : hudElements)
|
||||||
if (element.getElementType() == event.getType() && element.shouldRender(minecraft))
|
if (element.getElementType() == event.getType() && element.shouldRender(minecraft))
|
||||||
element.render(minecraft, event.getResolution(), event.getPartialTicks());
|
element.render(minecraft, event.getResolution(), event.getPartialTicks());
|
||||||
|
@ -182,7 +182,7 @@ public class ClientHandler {
|
||||||
|
|
||||||
// Stolen from Chisel
|
// Stolen from Chisel
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onModelBake(ModelBakeEvent event) {
|
public static void onModelBake(ModelBakeEvent event) {
|
||||||
if (BloodMagic.IS_DEV && SUPPRESS_ASSET_ERRORS)
|
if (BloodMagic.IS_DEV && SUPPRESS_ASSET_ERRORS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public class ClientHandler {
|
||||||
|
|
||||||
// For some reason, we need some bad textures to be listed in the Crystal and Node models. This will hide that from the end user.
|
// For some reason, we need some bad textures to be listed in the Crystal and Node models. This will hide that from the end user.
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTextureStitch(TextureStitchEvent.Post event) {
|
public static void onTextureStitch(TextureStitchEvent.Post event) {
|
||||||
if (BloodMagic.IS_DEV && SUPPRESS_ASSET_ERRORS)
|
if (BloodMagic.IS_DEV && SUPPRESS_ASSET_ERRORS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public class ClientHandler {
|
||||||
BloodMagic.LOGGER.debug("Suppressed required texture errors in {}", stopwatch.stop());
|
BloodMagic.LOGGER.debug("Suppressed required texture errors in {}", stopwatch.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderRitualStones(EntityPlayerSP player, float partialTicks) {
|
private static void renderRitualStones(EntityPlayerSP player, float partialTicks) {
|
||||||
World world = player.getEntityWorld();
|
World world = player.getEntityWorld();
|
||||||
ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem();
|
ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem();
|
||||||
EnumFacing direction = ritualDiviner.getDirection(player.inventory.getCurrentItem());
|
EnumFacing direction = ritualDiviner.getDirection(player.inventory.getCurrentItem());
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.event.AltarCraftedEvent;
|
import WayofTime.bloodmagic.api.event.AltarCraftedEvent;
|
||||||
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
||||||
|
@ -21,17 +20,18 @@ import net.minecraftforge.event.AnvilUpdateEvent;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Handler
|
@Mod.EventBusSubscriber
|
||||||
public class CraftingHandler {
|
public class CraftingHandler {
|
||||||
|
|
||||||
// Sets the uses of crafted Inscription Tools to 10
|
// Sets the uses of crafted Inscription Tools to 10
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onAltarCrafted(AltarCraftedEvent event) {
|
public static void onAltarCrafted(AltarCraftedEvent event) {
|
||||||
if (event.getOutput() == null) {
|
if (event.getOutput() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class CraftingHandler {
|
||||||
|
|
||||||
// Handles crafting of: Revealing Upgrade Tome, Elytra Upgrade Tome, Combining Upgrade Tomes, Setting Upgrade for Trainer
|
// Handles crafting of: Revealing Upgrade Tome, Elytra Upgrade Tome, Combining Upgrade Tomes, Setting Upgrade for Trainer
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onAnvil(AnvilUpdateEvent event) {
|
public static void onAnvil(AnvilUpdateEvent event) {
|
||||||
// TODO - Azanor come back :(
|
// TODO - Azanor come back :(
|
||||||
// if (ConfigHandler.thaumcraftGogglesUpgrade) {
|
// if (ConfigHandler.thaumcraftGogglesUpgrade) {
|
||||||
// if (event.getLeft().getItem() == RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET && event.getRight().getItem() == Constants.Compat.THAUMCRAFT_GOGGLES && !event.getRight().isItemDamaged()) {
|
// if (event.getLeft().getItem() == RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET && event.getRight().getItem() == Constants.Compat.THAUMCRAFT_GOGGLES && !event.getRight().isItemDamaged()) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.ConfigHandler;
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.event.ItemBindEvent;
|
import WayofTime.bloodmagic.api.event.ItemBindEvent;
|
||||||
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
||||||
|
@ -75,6 +74,7 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
|
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
|
||||||
import net.minecraftforge.event.world.ExplosionEvent;
|
import net.minecraftforge.event.world.ExplosionEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
@ -87,7 +87,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@Handler
|
@Mod.EventBusSubscriber
|
||||||
public class GenericHandler {
|
public class GenericHandler {
|
||||||
public static Map<EntityPlayer, Double> bounceMap = new HashMap<EntityPlayer, Double>();
|
public static Map<EntityPlayer, Double> bounceMap = new HashMap<EntityPlayer, Double>();
|
||||||
public static Map<EntityPlayer, Integer> filledHandMap = new HashMap<EntityPlayer, Integer>();
|
public static Map<EntityPlayer, Integer> filledHandMap = new HashMap<EntityPlayer, Integer>();
|
||||||
|
@ -95,7 +95,7 @@ public class GenericHandler {
|
||||||
private static Map<EntityAnimal, EntityAIBase> attackTaskMap = new HashMap<EntityAnimal, EntityAIBase>();
|
private static Map<EntityAnimal, EntityAIBase> attackTaskMap = new HashMap<EntityAnimal, EntityAIBase>();
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityFall(LivingFallEvent event) {
|
public static void onEntityFall(LivingFallEvent event) {
|
||||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||||
if (player.isPotionActive(RegistrarBloodMagic.BOUNCE) && !player.isSneaking() && event.getDistance() > 2) {
|
if (player.isPotionActive(RegistrarBloodMagic.BOUNCE) && !player.isSneaking() && event.getDistance() > 2) {
|
||||||
|
@ -114,7 +114,7 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void playerTickPost(TickEvent.PlayerTickEvent event) {
|
public static void playerTickPost(TickEvent.PlayerTickEvent event) {
|
||||||
if (event.phase == TickEvent.Phase.END && bounceMap.containsKey(event.player)) {
|
if (event.phase == TickEvent.Phase.END && bounceMap.containsKey(event.player)) {
|
||||||
event.player.motionY = bounceMap.remove(event.player);
|
event.player.motionY = bounceMap.remove(event.player);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerClick(PlayerInteractEvent event) {
|
public static void onPlayerClick(PlayerInteractEvent event) {
|
||||||
if (event.isCancelable() && event.getEntityPlayer().isPotionActive(RegistrarBloodMagic.CONSTRICT)) {
|
if (event.isCancelable() && event.getEntityPlayer().isPotionActive(RegistrarBloodMagic.CONSTRICT)) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
int level = player.getActivePotionEffect(RegistrarBloodMagic.CONSTRICT).getAmplifier();
|
int level = player.getActivePotionEffect(RegistrarBloodMagic.CONSTRICT).getAmplifier();
|
||||||
|
@ -143,7 +143,7 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerDropItem(ItemTossEvent event) {
|
public static void onPlayerDropItem(ItemTossEvent event) {
|
||||||
EntityItem itemEntity = event.getEntityItem();
|
EntityItem itemEntity = event.getEntityItem();
|
||||||
if (itemEntity != null) {
|
if (itemEntity != null) {
|
||||||
ItemStack stack = itemEntity.getItem();
|
ItemStack stack = itemEntity.getItem();
|
||||||
|
@ -157,7 +157,7 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onExplosion(ExplosionEvent.Start event) {
|
public static void onExplosion(ExplosionEvent.Start event) {
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
Explosion exp = event.getExplosion();
|
Explosion exp = event.getExplosion();
|
||||||
Vec3d position = exp.getPosition();
|
Vec3d position = exp.getPosition();
|
||||||
|
@ -176,7 +176,7 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityHurt(LivingHurtEvent event) {
|
public static void onEntityHurt(LivingHurtEvent event) {
|
||||||
if (event.getEntity().getEntityWorld().isRemote)
|
if (event.getEntity().getEntityWorld().isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class GenericHandler {
|
||||||
|
|
||||||
// Handles sending the client the Demon Will Aura updates
|
// Handles sending the client the Demon Will Aura updates
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
public static void onLivingUpdate(LivingUpdateEvent event) {
|
||||||
if (!event.getEntityLiving().getEntityWorld().isRemote) {
|
if (!event.getEntityLiving().getEntityWorld().isRemote) {
|
||||||
EntityLivingBase entity = event.getEntityLiving();
|
EntityLivingBase entity = event.getEntityLiving();
|
||||||
if (entity instanceof EntityPlayer && entity.ticksExisted % 50 == 0) //TODO: Change to an incremental counter
|
if (entity instanceof EntityPlayer && entity.ticksExisted % 50 == 0) //TODO: Change to an incremental counter
|
||||||
|
@ -286,7 +286,7 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @SideOnly(Side.SERVER)
|
// @SideOnly(Side.SERVER)
|
||||||
public void sendPlayerDemonWillAura(EntityPlayer player) {
|
public static void sendPlayerDemonWillAura(EntityPlayer player) {
|
||||||
if (player instanceof EntityPlayerMP) {
|
if (player instanceof EntityPlayerMP) {
|
||||||
BlockPos pos = player.getPosition();
|
BlockPos pos = player.getPosition();
|
||||||
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(player.getEntityWorld().provider.getDimension(), pos.getX() >> 4, pos.getZ() >> 4);
|
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(player.getEntityWorld().provider.getDimension(), pos.getX() >> 4, pos.getZ() >> 4);
|
||||||
|
@ -300,7 +300,7 @@ public class GenericHandler {
|
||||||
|
|
||||||
// Handles destroying altar
|
// Handles destroying altar
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void harvestEvent(PlayerEvent.HarvestCheck event) {
|
public static void harvestEvent(PlayerEvent.HarvestCheck event) {
|
||||||
IBlockState state = event.getTargetBlock();
|
IBlockState state = event.getTargetBlock();
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (block instanceof BlockAltar && event.getEntityPlayer() != null && event.getEntityPlayer() instanceof EntityPlayerMP && !event.getEntityPlayer().getHeldItemMainhand().isEmpty() && event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof ItemAltarMaker) {
|
if (block instanceof BlockAltar && event.getEntityPlayer() != null && event.getEntityPlayer() instanceof EntityPlayerMP && !event.getEntityPlayer().getHeldItemMainhand().isEmpty() && event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof ItemAltarMaker) {
|
||||||
|
@ -311,14 +311,14 @@ public class GenericHandler {
|
||||||
|
|
||||||
// Handle Teleposer block blacklist
|
// Handle Teleposer block blacklist
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTelepose(TeleposeEvent event) {
|
public static void onTelepose(TeleposeEvent event) {
|
||||||
if (BloodMagicAPI.INSTANCE.getBlacklist().getTeleposer().contains(event.initialState) || BloodMagicAPI.INSTANCE.getBlacklist().getTeleposer().contains(event.finalState))
|
if (BloodMagicAPI.INSTANCE.getBlacklist().getTeleposer().contains(event.initialState) || BloodMagicAPI.INSTANCE.getBlacklist().getTeleposer().contains(event.finalState))
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Teleposer entity blacklist
|
// Handle Teleposer entity blacklist
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTeleposeEntity(TeleposeEvent.Ent event) {
|
public static void onTeleposeEntity(TeleposeEvent.Ent event) {
|
||||||
EntityEntry entry = EntityRegistry.getEntry(event.entity.getClass());
|
EntityEntry entry = EntityRegistry.getEntry(event.entity.getClass());
|
||||||
if (BloodMagicAPI.INSTANCE.getBlacklist().getTeleposerEntities().contains(entry.getRegistryName()))
|
if (BloodMagicAPI.INSTANCE.getBlacklist().getTeleposerEntities().contains(entry.getRegistryName()))
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
@ -326,13 +326,13 @@ public class GenericHandler {
|
||||||
|
|
||||||
// Sets teleport cooldown for Teleposed entities to 5 ticks (1/4 second) instead of 150 (7.5 seconds)
|
// Sets teleport cooldown for Teleposed entities to 5 ticks (1/4 second) instead of 150 (7.5 seconds)
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTeleposeEntityPost(TeleposeEvent.Ent.Post event) {
|
public static void onTeleposeEntityPost(TeleposeEvent.Ent.Post event) {
|
||||||
event.entity.timeUntilPortal = 5;
|
event.entity.timeUntilPortal = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles binding of IBindable's as well as setting a player's highest orb tier
|
// Handles binding of IBindable's as well as setting a player's highest orb tier
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onInteract(PlayerInteractEvent.RightClickItem event) {
|
public static void onInteract(PlayerInteractEvent.RightClickItem event) {
|
||||||
if (event.getWorld().isRemote)
|
if (event.getWorld().isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -374,14 +374,14 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||||
public void onTooltip(ItemTooltipEvent event) {
|
public static void onTooltip(ItemTooltipEvent event) {
|
||||||
if (event.getItemStack().getItem() instanceof IBindable)
|
if (event.getItemStack().getItem() instanceof IBindable)
|
||||||
if (((IBindable) event.getItemStack().getItem()).getOwnerUUID(event.getItemStack()) != null)
|
if (((IBindable) event.getItemStack().getItem()).getOwnerUUID(event.getItemStack()) != null)
|
||||||
event.getToolTip().add(I18n.format("tooltip.bloodmagic.currentOwner", PlayerHelper.getUsernameFromStack(event.getItemStack())));
|
event.getToolTip().add(I18n.format("tooltip.bloodmagic.currentOwner", PlayerHelper.getUsernameFromStack(event.getItemStack())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void selfSacrificeEvent(SacrificeKnifeUsedEvent event) {
|
public static void selfSacrificeEvent(SacrificeKnifeUsedEvent event) {
|
||||||
EntityPlayer player = event.player;
|
EntityPlayer player = event.player;
|
||||||
|
|
||||||
if (LivingArmour.hasFullSet(player)) {
|
if (LivingArmour.hasFullSet(player)) {
|
||||||
|
@ -402,7 +402,7 @@ public class GenericHandler {
|
||||||
|
|
||||||
// Drop Blood Shards
|
// Drop Blood Shards
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLivingDrops(LivingDropsEvent event) {
|
public static void onLivingDrops(LivingDropsEvent event) {
|
||||||
EntityLivingBase attackedEntity = event.getEntityLiving();
|
EntityLivingBase attackedEntity = event.getEntityLiving();
|
||||||
DamageSource source = event.getSource();
|
DamageSource source = event.getSource();
|
||||||
Entity entity = source.getTrueSource();
|
Entity entity = source.getTrueSource();
|
||||||
|
@ -420,7 +420,7 @@ public class GenericHandler {
|
||||||
|
|
||||||
// Experience Tome
|
// Experience Tome
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onExperiencePickup(PlayerPickupXpEvent event) {
|
public static void onExperiencePickup(PlayerPickupXpEvent event) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, player);
|
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, player);
|
||||||
|
|
||||||
|
@ -441,11 +441,11 @@ public class GenericHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int xpToDurability(int xp) {
|
private static int xpToDurability(int xp) {
|
||||||
return xp * 2;
|
return xp * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int durabilityToXp(int durability) {
|
private static int durabilityToXp(int durability) {
|
||||||
return durability / 2;
|
return durability / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||||
|
@ -35,14 +34,16 @@ import net.minecraftforge.event.entity.living.LivingHealEvent;
|
||||||
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
@Handler
|
@Mod.EventBusSubscriber
|
||||||
public class LivingArmourHandler {
|
public class LivingArmourHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityHealed(LivingHealEvent event) {
|
public static void onEntityHealed(LivingHealEvent event) {
|
||||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getEntity();
|
EntityPlayer player = (EntityPlayer) event.getEntity();
|
||||||
if (LivingArmour.hasFullSet(player)) {
|
if (LivingArmour.hasFullSet(player)) {
|
||||||
|
@ -65,7 +66,7 @@ public class LivingArmourHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) {
|
public static void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
if (LivingArmour.hasFullSet(player)) {
|
if (LivingArmour.hasFullSet(player)) {
|
||||||
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
|
@ -85,7 +86,7 @@ public class LivingArmourHandler {
|
||||||
|
|
||||||
// Applies: Storm Trooper
|
// Applies: Storm Trooper
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityJoinedWorld(EntityJoinWorldEvent event) {
|
public static void onEntityJoinedWorld(EntityJoinWorldEvent event) {
|
||||||
Entity owner = null;
|
Entity owner = null;
|
||||||
if (event.getEntity() instanceof EntityArrow) {
|
if (event.getEntity() instanceof EntityArrow) {
|
||||||
owner = ((EntityArrow) event.getEntity()).shootingEntity;
|
owner = ((EntityArrow) event.getEntity()).shootingEntity;
|
||||||
|
@ -115,7 +116,7 @@ public class LivingArmourHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerClick(PlayerInteractEvent event) {
|
public static void onPlayerClick(PlayerInteractEvent event) {
|
||||||
if (event.isCancelable()) {
|
if (event.isCancelable()) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ public class LivingArmourHandler {
|
||||||
|
|
||||||
// Applies: Grim Reaper
|
// Applies: Grim Reaper
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityDeath(LivingDeathEvent event) {
|
public static void onEntityDeath(LivingDeathEvent event) {
|
||||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ public class LivingArmourHandler {
|
||||||
|
|
||||||
// Applies: Jump
|
// Applies: Jump
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onJumpEvent(LivingEvent.LivingJumpEvent event) {
|
public static void onJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||||
|
|
||||||
|
@ -198,7 +199,7 @@ public class LivingArmourHandler {
|
||||||
|
|
||||||
// Applies: Step Assist, Speed Boost
|
// Applies: Step Assist, Speed Boost
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
|
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
|
||||||
if (event.getEntityLiving() instanceof EntityPlayer) {
|
if (event.getEntityLiving() instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||||
boolean hasAssist = false;
|
boolean hasAssist = false;
|
||||||
|
@ -253,7 +254,7 @@ public class LivingArmourHandler {
|
||||||
// Applies: Arrow Shot
|
// Applies: Arrow Shot
|
||||||
// Tracks: Arrow Shot
|
// Tracks: Arrow Shot
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onArrowFire(ArrowLooseEvent event) {
|
public static void onArrowFire(ArrowLooseEvent event) {
|
||||||
World world = event.getEntityPlayer().getEntityWorld();
|
World world = event.getEntityPlayer().getEntityWorld();
|
||||||
ItemStack stack = event.getBow();
|
ItemStack stack = event.getBow();
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
||||||
|
@ -24,17 +23,18 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
|
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
@Handler
|
@Mod.EventBusSubscriber
|
||||||
public class StatTrackerHandler {
|
public class StatTrackerHandler {
|
||||||
|
|
||||||
private static float lastPlayerSwingStrength = 0;
|
private static float lastPlayerSwingStrength = 0;
|
||||||
|
|
||||||
// Tracks: Digging, DigSlowdown
|
// Tracks: Digging, DigSlowdown
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void blockBreakEvent(BlockEvent.BreakEvent event) {
|
public static void blockBreakEvent(BlockEvent.BreakEvent event) {
|
||||||
EntityPlayer player = event.getPlayer();
|
EntityPlayer player = event.getPlayer();
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (LivingArmour.hasFullSet(player)) {
|
if (LivingArmour.hasFullSet(player)) {
|
||||||
|
@ -53,7 +53,7 @@ public class StatTrackerHandler {
|
||||||
|
|
||||||
// Tracks: Health Boost
|
// Tracks: Health Boost
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityHealed(LivingHealEvent event) {
|
public static void onEntityHealed(LivingHealEvent event) {
|
||||||
EntityLivingBase healedEntity = event.getEntityLiving();
|
EntityLivingBase healedEntity = event.getEntityLiving();
|
||||||
if (!(healedEntity instanceof EntityPlayer)) {
|
if (!(healedEntity instanceof EntityPlayer)) {
|
||||||
return;
|
return;
|
||||||
|
@ -74,13 +74,13 @@ public class StatTrackerHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLivingAttack(AttackEntityEvent event) {
|
public static void onLivingAttack(AttackEntityEvent event) {
|
||||||
lastPlayerSwingStrength = event.getEntityPlayer().getCooledAttackStrength(0);
|
lastPlayerSwingStrength = event.getEntityPlayer().getCooledAttackStrength(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tracks: Fall Protect, Arrow Protect, Physical Protect, Grave Digger, Sprint Attack, Critical Strike, Nocturnal Prowess
|
// Tracks: Fall Protect, Arrow Protect, Physical Protect, Grave Digger, Sprint Attack, Critical Strike, Nocturnal Prowess
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void entityHurt(LivingHurtEvent event) {
|
public static void entityHurt(LivingHurtEvent event) {
|
||||||
DamageSource source = event.getSource();
|
DamageSource source = event.getSource();
|
||||||
Entity sourceEntity = event.getSource().getTrueSource();
|
Entity sourceEntity = event.getSource().getTrueSource();
|
||||||
EntityLivingBase attackedEntity = event.getEntityLiving();
|
EntityLivingBase attackedEntity = event.getEntityLiving();
|
||||||
|
@ -153,7 +153,7 @@ public class StatTrackerHandler {
|
||||||
|
|
||||||
// Tracks: Experienced
|
// Tracks: Experienced
|
||||||
@SubscribeEvent(priority = EventPriority.LOW)
|
@SubscribeEvent(priority = EventPriority.LOW)
|
||||||
public void onExperiencePickup(PlayerPickupXpEvent event) {
|
public static void onExperiencePickup(PlayerPickupXpEvent event) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
|
||||||
if (LivingArmour.hasFullSet(player)) {
|
if (LivingArmour.hasFullSet(player)) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.annot.Handler;
|
|
||||||
import WayofTime.bloodmagic.api.soul.*;
|
import WayofTime.bloodmagic.api.soul.*;
|
||||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||||
|
@ -25,6 +24,7 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||||
import net.minecraftforge.event.world.ChunkDataEvent;
|
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
@ -33,14 +33,14 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
@Handler
|
@Mod.EventBusSubscriber
|
||||||
public class WillHandler {
|
public class WillHandler {
|
||||||
|
|
||||||
private final HashMap<Integer, Integer> serverTicks = new HashMap<Integer, Integer>();
|
private static final HashMap<Integer, Integer> SERVER_TICKS = new HashMap<Integer, Integer>();
|
||||||
|
|
||||||
// Adds Will to player
|
// Adds Will to player
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onItemPickup(EntityItemPickupEvent event) {
|
public static void onItemPickup(EntityItemPickupEvent event) {
|
||||||
ItemStack stack = event.getItem().getItem();
|
ItemStack stack = event.getItem().getItem();
|
||||||
if (stack.getItem() instanceof IDemonWill) {
|
if (stack.getItem() instanceof IDemonWill) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
@ -55,7 +55,7 @@ public class WillHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityAttacked(LivingDeathEvent event) {
|
public static void onEntityAttacked(LivingDeathEvent event) {
|
||||||
if (event.getSource() instanceof EntityDamageSourceIndirect) {
|
if (event.getSource() instanceof EntityDamageSourceIndirect) {
|
||||||
Entity sourceEntity = event.getSource().getImmediateSource();
|
Entity sourceEntity = event.getSource().getImmediateSource();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class WillHandler {
|
||||||
|
|
||||||
// Add/Drop Demon Will for Player
|
// Add/Drop Demon Will for Player
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLivingDrops(LivingDropsEvent event) {
|
public static void onLivingDrops(LivingDropsEvent event) {
|
||||||
EntityLivingBase attackedEntity = event.getEntityLiving();
|
EntityLivingBase attackedEntity = event.getEntityLiving();
|
||||||
DamageSource source = event.getSource();
|
DamageSource source = event.getSource();
|
||||||
Entity entity = source.getTrueSource();
|
Entity entity = source.getTrueSource();
|
||||||
|
@ -106,16 +106,16 @@ public class WillHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onServerWorldTick(TickEvent.WorldTickEvent event) {
|
public static void onServerWorldTick(TickEvent.WorldTickEvent event) {
|
||||||
if (event.world.isRemote)
|
if (event.world.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int dim = event.world.provider.getDimension();
|
int dim = event.world.provider.getDimension();
|
||||||
if (event.phase == TickEvent.Phase.END) {
|
if (event.phase == TickEvent.Phase.END) {
|
||||||
if (!this.serverTicks.containsKey(dim))
|
if (!SERVER_TICKS.containsKey(dim))
|
||||||
this.serverTicks.put(dim, 0);
|
SERVER_TICKS.put(dim, 0);
|
||||||
|
|
||||||
int ticks = (this.serverTicks.get(dim));
|
int ticks = (SERVER_TICKS.get(dim));
|
||||||
|
|
||||||
if (ticks % 20 == 0) {
|
if (ticks % 20 == 0) {
|
||||||
CopyOnWriteArrayList<PosXY> dirtyChunks = WorldDemonWillHandler.dirtyChunks.get(dim);
|
CopyOnWriteArrayList<PosXY> dirtyChunks = WorldDemonWillHandler.dirtyChunks.get(dim);
|
||||||
|
@ -127,13 +127,13 @@ public class WillHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.serverTicks.put(dim, ticks + 1);
|
SERVER_TICKS.put(dim, ticks + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void chunkSave(ChunkDataEvent.Save event) {
|
public static void chunkSave(ChunkDataEvent.Save event) {
|
||||||
int dim = event.getWorld().provider.getDimension();
|
int dim = event.getWorld().provider.getDimension();
|
||||||
ChunkPos loc = event.getChunk().getPos();
|
ChunkPos loc = event.getChunk().getPos();
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class WillHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void chunkLoad(ChunkDataEvent.Load event) {
|
public static void chunkLoad(ChunkDataEvent.Load event) {
|
||||||
int dim = event.getWorld().provider.getDimension();
|
int dim = event.getWorld().provider.getDimension();
|
||||||
if (event.getData().getCompoundTag("BloodMagic").hasKey("base")) {
|
if (event.getData().getCompoundTag("BloodMagic").hasKey("base")) {
|
||||||
NBTTagCompound nbt = event.getData().getCompoundTag("BloodMagic");
|
NBTTagCompound nbt = event.getData().getCompoundTag("BloodMagic");
|
||||||
|
|
Loading…
Reference in a new issue