From e11c3910f1fe61bc600331890d8877c420566943 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:51:54 +0200 Subject: [PATCH 01/12] quick fixes --- .../client/InfernalMobsClient.java | 18 ++--- .../infernalmobs/client/RendererBossGlow.java | 6 +- .../common/EntityEventHandler.java | 9 +-- .../infernalmobs/common/ISidedProxy.java | 16 ++-- .../InfernalCommandFindEntityClass.java | 14 ++-- .../common/InfernalCommandSpawnInfernal.java | 14 ++-- .../infernalmobs/common/InfernalMobsCore.java | 75 +++++++++++++------ .../common/InfernalMobsServer.java | 4 +- .../infernalmobs/common/MobModifier.java | 15 ++-- .../infernalmobs/common/SaveEventHandler.java | 15 +--- .../infernalmobs/common/mods/MM_1UP.java | 6 +- .../common/mods/MM_Alchemist.java | 4 +- .../infernalmobs/common/mods/MM_Berserk.java | 6 +- .../infernalmobs/common/mods/MM_Blastoff.java | 9 +-- .../infernalmobs/common/mods/MM_Bulwark.java | 4 +- .../infernalmobs/common/mods/MM_Choke.java | 6 +- .../infernalmobs/common/mods/MM_Cloaking.java | 6 +- .../infernalmobs/common/mods/MM_Darkness.java | 4 +- .../infernalmobs/common/mods/MM_Ender.java | 7 +- .../infernalmobs/common/mods/MM_Exhaust.java | 6 +- .../infernalmobs/common/mods/MM_Fiery.java | 6 +- .../infernalmobs/common/mods/MM_Ghastly.java | 8 +- .../infernalmobs/common/mods/MM_Gravity.java | 11 ++- .../common/mods/MM_Lifesteal.java | 6 +- .../infernalmobs/common/mods/MM_Ninja.java | 4 +- .../common/mods/MM_Poisonous.java | 4 +- .../common/mods/MM_Quicksand.java | 4 +- .../infernalmobs/common/mods/MM_Regen.java | 4 +- .../infernalmobs/common/mods/MM_Rust.java | 6 +- .../infernalmobs/common/mods/MM_Sapper.java | 4 +- .../infernalmobs/common/mods/MM_Sprint.java | 4 +- .../infernalmobs/common/mods/MM_Sticky.java | 9 +-- .../infernalmobs/common/mods/MM_Storm.java | 4 +- .../common/mods/MM_Vengeance.java | 4 +- .../infernalmobs/common/mods/MM_Weakness.java | 4 +- .../infernalmobs/common/mods/MM_Webber.java | 6 +- .../infernalmobs/common/mods/MM_Wither.java | 4 +- .../common/network/HealthPacket.java | 2 +- .../common/network/MobModsPacket.java | 2 +- .../common/network/NetworkHelper.java | 35 ++++----- 40 files changed, 188 insertions(+), 187 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java index 44fd7e37..0d6a7b93 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java +++ b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java @@ -35,7 +35,7 @@ public class InfernalMobsClient implements ISidedProxy { - private final double NAME_VISION_DISTANCE = 32D; + private static final double NAME_VISION_DISTANCE = 32D; private Minecraft mc; private long nextPacketTime; private ConcurrentHashMap rareMobsClient; @@ -54,7 +54,7 @@ public void preInit() { @Override public void load() { nextPacketTime = 0; - rareMobsClient = new ConcurrentHashMap(); + rareMobsClient = new ConcurrentHashMap<>(); MinecraftForge.EVENT_BUS.register(new RendererBossGlow()); MinecraftForge.EVENT_BUS.register(this); @@ -77,7 +77,7 @@ private void askServerHealth(Entity ent) { if (System.currentTimeMillis() > nextPacketTime) { InfernalMobsCore.instance().networkHelper.sendPacketToServer( new HealthPacket(mc.thePlayer.getGameProfile().getName(), ent.getEntityId(), 0f, 0f)); - nextPacketTime = System.currentTimeMillis() + 100l; + nextPacketTime = System.currentTimeMillis() + 100L; } } @@ -97,7 +97,7 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { retained = true; } - if (ent != null && ent instanceof EntityLivingBase) { + if (ent instanceof EntityLivingBase) { MobModifier mod = InfernalMobsCore.getMobModifiers((EntityLivingBase) ent); if (mod != null) { askServerHealth(ent); @@ -117,7 +117,7 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { short lifeBarLength = 182; int x = screenwidth / 2 - lifeBarLength / 2; - int lifeBarLeft = (int) ((float) mod.getActualHealth(target) / (float) mod.getActualMaxHealth(target) + int lifeBarLeft = (int) (mod.getActualHealth(target) / mod.getActualMaxHealth(target) * (float) (lifeBarLength + 1)); byte y = 12; gui.drawTexturedModalRect(x, y, 0, 74, lifeBarLength, 5); @@ -151,7 +151,7 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { if (!retained) { retainedTarget = target; - healthBarRetainTime = System.currentTimeMillis() + 3000l; + healthBarRetainTime = System.currentTimeMillis() + 3000L; } } @@ -188,12 +188,12 @@ private Entity getEntityCrosshairOver(float renderTick, Minecraft mc) { viewEntityLookVec.xCoord * reachDistance, viewEntityLookVec.yCoord * reachDistance, viewEntityLookVec.zCoord * reachDistance) - .expand((double) expandBBvalue, (double) expandBBvalue, (double) expandBBvalue))) { + .expand(expandBBvalue, expandBBvalue, expandBBvalue))) { iterEnt = (Entity) obj; if (iterEnt.canBeCollidedWith()) { float entBorderSize = iterEnt.getCollisionBorderSize(); AxisAlignedBB entHitBox = iterEnt.boundingBox - .expand((double) entBorderSize, (double) entBorderSize, (double) entBorderSize); + .expand(entBorderSize, entBorderSize, entBorderSize); MovingObjectPosition interceptObjectPosition = entHitBox .calculateIntercept(viewEntPositionVec, actualReachVector); @@ -230,7 +230,7 @@ public ConcurrentHashMap getRareMobs() { @Override public void onHealthPacketForClient(String stringData, int entID, float health, float maxhealth) { Entity ent = FMLClientHandler.instance().getClient().theWorld.getEntityByID(entID); - if (ent != null && ent instanceof EntityLivingBase) { + if (ent instanceof EntityLivingBase) { MobModifier mod = InfernalMobsCore.getMobModifiers((EntityLivingBase) ent); if (mod != null) { // System.out.printf("health packet [%f of %f] for %s\n", health, maxhealth, ent); diff --git a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java index c47137fb..8ddae79c 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java +++ b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java @@ -18,9 +18,9 @@ public class RendererBossGlow { @SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { - if (System.currentTimeMillis() > lastRender + 10L) { - lastRender = System.currentTimeMillis(); - + final long time = System.currentTimeMillis(); + if (time > lastRender + 10L) { + lastRender = time; renderBossGlow(event.partialTicks); } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java index c5bcf286..a86d4b4e 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java @@ -35,8 +35,7 @@ public class EntityEventHandler { /** * Links the Forge Event Handler to the registered Entity MobModifier Events (if present) Also keeps track of the * anti mobfarm mechanic if enabled - * - * @param antiMobfarming enables or disables + * */ public EntityEventHandler() { Configuration config = InfernalMobsCore.instance().config; @@ -52,7 +51,7 @@ public EntityEventHandler() { "AntiMobFarmCheckInterval", 30, "time in seconds between mob check intervals. Higher values cost more performance, but might be more accurate.") - .getInt() * 1000l; + .getInt() * 1000L; mobFarmDamageTrigger = (float) config.get( Configuration.CATEGORY_GENERAL, "mobFarmDamageThreshold", @@ -60,7 +59,7 @@ public EntityEventHandler() { "Damage in chunk per interval that triggers anti farm effects").getDouble(150D); config.save(); - damageMap = new HashMap(); + damageMap = new HashMap<>(); nextMapEvaluation = System.currentTimeMillis(); } @@ -68,7 +67,7 @@ public EntityEventHandler() { public void onEntityJoinedWorld(EntityJoinWorldEvent event) { if (event.entity instanceof EntityLivingBase) { String savedMods = event.entity.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); - if (!savedMods.equals("")) { + if (!savedMods.isEmpty()) { InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) event.entity, savedMods); } else { InfernalMobsCore.instance().processEntitySpawn((EntityLivingBase) event.entity); diff --git a/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java b/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java index df7e55f4..6ac2bd32 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java +++ b/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java @@ -6,19 +6,19 @@ public interface ISidedProxy { - public void preInit(); + void preInit(); - public void load(); + void load(); - public ConcurrentHashMap getRareMobs(); + ConcurrentHashMap getRareMobs(); - public void onHealthPacketForClient(String stringData, int entID, float health, float maxhealth); + void onHealthPacketForClient(String stringData, int entID, float health, float maxhealth); - public void onKnockBackPacket(float xv, float zv); + void onKnockBackPacket(float xv, float zv); - public void onMobModsPacketToClient(String stringData, int entID); + void onMobModsPacketToClient(String stringData, int entID); - public void onVelocityPacket(float xv, float yv, float zv); + void onVelocityPacket(float xv, float yv, float zv); - public void onAirPacket(int air); + void onAirPacket(int air); } diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java index 58776987..1d20d2c9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java @@ -30,27 +30,27 @@ public void processCommand(ICommandSender sender, String[] args) { if (args.length == 0) { throw new WrongUsageException("Invalid Usage of FindEntityClass command", (Object) args); } else { - String classname = args[0]; + StringBuilder classname = new StringBuilder(args[0]); for (int i = 1; i < args.length; i++) { - classname = classname + " " + args[i]; + classname.append(" ").append(args[i]); } - String result = "Found Entity classes: "; + StringBuilder result = new StringBuilder("Found Entity classes: "); final Collection classes = EntityList.classToStringMapping.values(); boolean found = false; for (String entclass : classes) { - if (entclass.toLowerCase().contains(classname.toLowerCase())) { + if (entclass.toLowerCase().contains(classname.toString().toLowerCase())) { if (!found) { - result += entclass; + result.append(entclass); found = true; } else { - result += (", " + entclass); + result.append(", ").append(entclass); } } } if (!found) { - result += "Nothing found."; + result.append("Nothing found."); } FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, sender.getCommandSenderName() + ": " + result); diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java index e218b2e4..7ad277c1 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java @@ -31,12 +31,12 @@ public void processCommand(ICommandSender sender, String[] args) { throw new WrongUsageException("Invalid Usage of SpawnInfernal command, too few arguments", (Object) args); } else { try { - final int x = (args[0].equals("~")) ? sender.getPlayerCoordinates().posX : Integer.valueOf(args[0]); - final int y = (args[1].equals("~")) ? sender.getPlayerCoordinates().posY : Integer.valueOf(args[1]); - final int z = (args[2].equals("~")) ? sender.getPlayerCoordinates().posZ : Integer.valueOf(args[2]); - String modifier = args[4]; + final int x = (args[0].equals("~")) ? sender.getPlayerCoordinates().posX : Integer.parseInt(args[0]); + final int y = (args[1].equals("~")) ? sender.getPlayerCoordinates().posY : Integer.parseInt(args[1]); + final int z = (args[2].equals("~")) ? sender.getPlayerCoordinates().posZ : Integer.parseInt(args[2]); + StringBuilder modifier = new StringBuilder(args[4]); for (int i = 5; i < args.length; i++) { - modifier = modifier + " " + args[i]; + modifier.append(" ").append(args[i]); } final Class entClass = (Class) EntityList.stringToClassMapping @@ -47,11 +47,11 @@ public void processCommand(ICommandSender sender, String[] args) { sender.getEntityWorld().spawnEntityInWorld(mob); InfernalMobsCore.proxy.getRareMobs().remove(mob); - if (modifier.equals("~")) { + if (modifier.toString().equals("~")) { MobModifier mod = InfernalMobsCore.instance().createMobModifiers(mob); InfernalMobsCore.instance().addEntityModifiers(mob, mod, true); } else { - InfernalMobsCore.instance().addEntityModifiersByString(mob, modifier); + InfernalMobsCore.instance().addEntityModifiersByString(mob, modifier.toString()); } MobModifier mod = InfernalMobsCore.getMobModifiers(mob); if (mod != null) { diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index e6fd2cb8..3ba15d61 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -1,7 +1,13 @@ package atomicstryker.infernalmobs.common; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Random; +import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentData; @@ -28,9 +34,40 @@ import com.google.common.collect.Lists; -import atomicstryker.infernalmobs.common.mods.*; +import atomicstryker.infernalmobs.common.mods.MM_1UP; +import atomicstryker.infernalmobs.common.mods.MM_Alchemist; +import atomicstryker.infernalmobs.common.mods.MM_Berserk; +import atomicstryker.infernalmobs.common.mods.MM_Blastoff; +import atomicstryker.infernalmobs.common.mods.MM_Bulwark; +import atomicstryker.infernalmobs.common.mods.MM_Choke; +import atomicstryker.infernalmobs.common.mods.MM_Cloaking; +import atomicstryker.infernalmobs.common.mods.MM_Darkness; +import atomicstryker.infernalmobs.common.mods.MM_Ender; +import atomicstryker.infernalmobs.common.mods.MM_Exhaust; +import atomicstryker.infernalmobs.common.mods.MM_Fiery; +import atomicstryker.infernalmobs.common.mods.MM_Ghastly; +import atomicstryker.infernalmobs.common.mods.MM_Gravity; +import atomicstryker.infernalmobs.common.mods.MM_Lifesteal; +import atomicstryker.infernalmobs.common.mods.MM_Ninja; +import atomicstryker.infernalmobs.common.mods.MM_Poisonous; +import atomicstryker.infernalmobs.common.mods.MM_Quicksand; +import atomicstryker.infernalmobs.common.mods.MM_Regen; +import atomicstryker.infernalmobs.common.mods.MM_Rust; +import atomicstryker.infernalmobs.common.mods.MM_Sapper; +import atomicstryker.infernalmobs.common.mods.MM_Sprint; +import atomicstryker.infernalmobs.common.mods.MM_Sticky; +import atomicstryker.infernalmobs.common.mods.MM_Storm; +import atomicstryker.infernalmobs.common.mods.MM_Vengeance; +import atomicstryker.infernalmobs.common.mods.MM_Weakness; +import atomicstryker.infernalmobs.common.mods.MM_Webber; +import atomicstryker.infernalmobs.common.mods.MM_Wither; import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; -import atomicstryker.infernalmobs.common.network.*; +import atomicstryker.infernalmobs.common.network.AirPacket; +import atomicstryker.infernalmobs.common.network.HealthPacket; +import atomicstryker.infernalmobs.common.network.KnockBackPacket; +import atomicstryker.infernalmobs.common.network.MobModsPacket; +import atomicstryker.infernalmobs.common.network.NetworkHelper; +import atomicstryker.infernalmobs.common.network.VelocityPacket; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; @@ -112,15 +149,15 @@ public String getNBTTag() { @EventHandler public void preInit(FMLPreInitializationEvent evt) { - dimensionBlackList = new ArrayList(); - dropIdListElite = new ArrayList(); - dropIdListUltra = new ArrayList(); - dropIdListInfernal = new ArrayList(); + dimensionBlackList = new ArrayList<>(); + dropIdListElite = new ArrayList<>(); + dropIdListUltra = new ArrayList<>(); + dropIdListInfernal = new ArrayList<>(); nextExistCheckTime = System.currentTimeMillis(); - classesAllowedMap = new HashMap(); - classesForcedMap = new HashMap(); - classesHealthMap = new HashMap(); - modifiedPlayerTimes = new HashMap(); + classesAllowedMap = new HashMap<>(); + classesForcedMap = new HashMap<>(); + classesHealthMap = new HashMap<>(); + modifiedPlayerTimes = new HashMap<>(); config = new Configuration(evt.getSuggestedConfigurationFile()); loadMods(); @@ -326,7 +363,7 @@ private void parseIDsForList(String dimensionIDs, ArrayList list) { dimensionIDs = dimensionIDs.trim(); for (String s : dimensionIDs.split(",")) { String trimmedDimIDString = s.trim(); - if (s.length() == 0) continue; // Skipping empty entries if list is empty at all + if (s.isEmpty()) continue; // Skipping empty entries if list is empty at all try { Integer tDimID = Integer.parseInt(trimmedDimIDString); @@ -342,7 +379,6 @@ private void parseIDsForList(String dimensionIDs, ArrayList list) { String.format( "Configured DimensionID %s is not an integer! All values must be numeric. Ignoring entry", trimmedDimIDString)); - continue; } } } @@ -401,7 +437,6 @@ public void processEntitySpawn(EntityLivingBase entity) { if (dimensionBlackList.contains(tEntityDim)) { // System.out.println("InfernalMobsCore skipped spawning InfernalMob due blacklisted // Dimension"); - return; } else { MobModifier mod = instance.createMobModifiers(entity); if (mod != null) { @@ -412,7 +447,7 @@ public void processEntitySpawn(EntityLivingBase entity) { } } catch (Exception e) { FMLLog.log("InfernalMobs", Level.ERROR, "processEntitySpawn() threw an exception"); - FMLLog.severe(e.getMessage(), new Object[0]); + FMLLog.severe(e.getMessage()); } } } @@ -424,9 +459,7 @@ public boolean isClassAllowed(EntityLivingBase entity) { if (entity instanceof IEntityOwnable) { return false; } - if (instance.checkEntityClassAllowed(entity)) { - return true; - } + return instance.checkEntityClassAllowed(entity); } return false; } @@ -670,7 +703,7 @@ private void dropRandomEnchantedItems(EntityLivingBase mob, MobModifier mods) { ItemStack itemStack = getRandomItem(mob, prefix); if (itemStack != null) { Item item = itemStack.getItem(); - if (item != null && item instanceof Item) { + if (item != null) { if (item instanceof ItemEnchantedBook) { itemStack = ((ItemEnchantedBook) item).func_92114_b(mob.getRNG()).theItemId; } else { @@ -719,7 +752,7 @@ private void enchantRandomly(Random rand, ItemStack itemStack, int itemEnchantab private ItemStack getRandomItem(EntityLivingBase mob, int prefix) { ArrayList list = (prefix == 0) ? instance.dropIdListElite : (prefix == 1) ? instance.dropIdListUltra : instance.dropIdListInfernal; - return list.size() > 0 ? list.get(mob.worldObj.rand.nextInt(list.size())).copy() : null; + return !list.isEmpty() ? list.get(mob.worldObj.rand.nextInt(list.size())).copy() : null; } public void sendVelocityPacket(EntityPlayerMP target, float xVel, float yVel, float zVel) { @@ -764,7 +797,7 @@ public void onTick(TickEvent.WorldTickEvent tick) { if (mob.isDead || !mob.worldObj.loadedEntityList.contains(mob)) { // System.out.println("Removed unloaded Entity "+mob+" with ID "+mob.getEntityId()+" from // rareMobs"); - removeEntFromElites((EntityLivingBase) mob); + removeEntFromElites(mob); } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java index b167c95e..11d11e64 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java @@ -6,10 +6,10 @@ public class InfernalMobsServer implements ISidedProxy { - private ConcurrentHashMap rareMobsServer; + private final ConcurrentHashMap rareMobsServer; public InfernalMobsServer() { - rareMobsServer = new ConcurrentHashMap(); + rareMobsServer = new ConcurrentHashMap<>(); } @Override diff --git a/src/main/java/atomicstryker/infernalmobs/common/MobModifier.java b/src/main/java/atomicstryker/infernalmobs/common/MobModifier.java index 77ea1bde..b0ee8f4c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/MobModifier.java +++ b/src/main/java/atomicstryker/infernalmobs/common/MobModifier.java @@ -23,12 +23,12 @@ public abstract class MobModifier { * next MobModifier in a linked chain, on the last one this field is null */ @Nullable - protected MobModifier nextMod; + protected final MobModifier nextMod; /** * name of this particular MobModifier instance */ - protected String modName; + protected final String modName; /** * keeps track of our past-max-bounds health patch @@ -128,8 +128,7 @@ public boolean containsModifierClass(Class checkfor) { /** * Called when local Spawn Processing is completed or when a client remote-attached Modifiers to a local Entity - * - * @param entity + * */ public void onSpawningComplete(EntityLivingBase entity) { String oldTag = entity.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); @@ -200,7 +199,6 @@ public float onAttack(EntityLivingBase entity, DamageSource source, float amount /** * Modified Mob is being hurt * - * @param mob * @param source Damagesource doing the hurting * @param amount unmitigated damage value * @return damage to be applied after we processed the value @@ -265,8 +263,7 @@ public boolean onUpdate(EntityLivingBase mob) { /** * clientside helper method. Due to the health not being networked, we keep track of it internally, here. Also, this * is a good spot for the more-than-allowed health hack. - * - * @param mob + * */ public float getActualHealth(EntityLivingBase mob) { if (!mob.worldObj.isRemote) { @@ -296,7 +293,6 @@ private void increaseHealthForMob(EntityLivingBase mob, float baseHealth) { } /** - * @param mob * @return buffered modified max health */ public float getActualMaxHealth(EntityLivingBase mob) { @@ -309,8 +305,7 @@ public float getActualMaxHealth(EntityLivingBase mob) { /** * clientside receiving end of health packets sent from the InfernalMobs server instance - * - * @param packetReadout + * */ public void setActualHealth(float health, float maxHealth) { actualHealth = health; diff --git a/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java index 9980c45f..e7f5dd22 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java @@ -1,8 +1,5 @@ package atomicstryker.infernalmobs.common; -import java.util.Iterator; -import java.util.Map.Entry; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.chunk.Chunk; @@ -41,7 +38,7 @@ public void onChunkLoad(ChunkEvent.Load event) { newEnt = (Entity) chunk.entityLists[i].get(j); if (newEnt instanceof EntityLivingBase) { String savedMods = newEnt.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); - if (!savedMods.equals("")) { + if (!savedMods.isEmpty()) { InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) newEnt, savedMods); } } @@ -51,14 +48,6 @@ public void onChunkLoad(ChunkEvent.Load event) { @SubscribeEvent public void onWorldUnload(WorldEvent.Unload event) { - Iterator> iterator = InfernalMobsCore.proxy.getRareMobs().entrySet() - .iterator(); - while (iterator.hasNext()) { - Entry entry = iterator.next(); - - if (entry.getKey().worldObj == event.world) { - iterator.remove(); - } - } + InfernalMobsCore.proxy.getRareMobs().entrySet().removeIf(entry -> entry.getKey().worldObj == event.world); } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java index 6c02ac85..d944518a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java @@ -35,21 +35,21 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntityCreeper.class }; + private static final Class[] disallowed = { EntityCreeper.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRecurrence", "theUndying", "oftwinLives" }; + private static final String[] suffix = { "ofRecurrence", "theUndying", "oftwinLives" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "recurring", "undying", "twinlived" }; + private static final String[] prefix = { "recurring", "undying", "twinlived" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java index 97cb46a9..962e65b9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java @@ -63,14 +63,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theWitchkin", "theBrewmaster", "theSinged" }; + private static final String[] suffix = { "theWitchkin", "theBrewmaster", "theSinged" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "witchkin", "brewing", "singed" }; + private static final String[] prefix = { "witchkin", "brewing", "singed" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java index 6390d9ab..44d21a41 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java @@ -34,21 +34,21 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntityCreeper.class }; + private static final Class[] disallowed = { EntityCreeper.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRecklessness", "theRaging", "ofSmashing" }; + private static final String[] suffix = { "ofRecklessness", "theRaging", "ofSmashing" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "reckless", "raging", "smashing" }; + private static final String[] prefix = { "reckless", "raging", "smashing" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java index 22b1e099..c8d5f6dd 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java @@ -25,8 +25,7 @@ public MM_Blastoff(@Nullable MobModifier next) { public boolean onUpdate(EntityLivingBase mob) { EntityLivingBase target = getMobTarget(); - if (target != null && target instanceof EntityPlayer - && !(target instanceof EntityPlayer && ((EntityPlayer) target).capabilities.disableDamage)) { + if (target instanceof EntityPlayer && !((EntityPlayer) target).capabilities.disableDamage) { tryAbility(mob, target); } @@ -71,21 +70,21 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static Class[] modBans = { MM_Webber.class }; + private static final Class[] modBans = { MM_Webber.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofMissionControl", "theNASA", "ofWEE" }; + private static final String[] suffix = { "ofMissionControl", "theNASA", "ofWEE" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "thumping", "trolling", "byebye" }; + private static final String[] prefix = { "thumping", "trolling", "byebye" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java index 9035602f..bd1c456b 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java @@ -27,14 +27,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofTurtling", "theDefender", "ofeffingArmor" }; + private static final String[] suffix = { "ofTurtling", "theDefender", "ofeffingArmor" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "turtling", "defensive", "armoured" }; + private static final String[] prefix = { "turtling", "defensive", "armoured" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java index ddbc9307..e4c8fab8 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java @@ -80,7 +80,7 @@ private void updateAir() { if (lastTarget instanceof EntityPlayerMP) { InfernalMobsCore.instance().sendAirPacket((EntityPlayerMP) lastTarget, lastAir); - UUID id = ((EntityPlayerMP) lastTarget).getUniqueID(); + UUID id = lastTarget.getUniqueID(); if (id != null) { InfernalMobsCore.instance().getModifiedPlayerTimes().put(id, System.currentTimeMillis()); } @@ -97,14 +97,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofBreathlessness", "theAnaerobic", "ofDeprivation" }; + private static final String[] suffix = { "ofBreathlessness", "theAnaerobic", "ofDeprivation" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "Sith Lord", "Dark Lord", "Darth" }; + private static final String[] prefix = { "Sith Lord", "Dark Lord", "Darth" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java index 27bf5391..12c40e5b 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java @@ -54,21 +54,21 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntitySpider.class }; + private static final Class[] disallowed = { EntitySpider.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofStalking", "theUnseen", "thePredator" }; + private static final String[] suffix = { "ofStalking", "theUnseen", "thePredator" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "stalking", "unseen", "hunting" }; + private static final String[] prefix = { "stalking", "unseen", "hunting" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java index d574038f..78fb0b36 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java @@ -48,14 +48,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofDarkness", "theShadow", "theEclipse" }; + private static final String[] suffix = { "ofDarkness", "theShadow", "theEclipse" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "dark", "shadowkin", "eclipsed" }; + private static final String[] prefix = { "dark", "shadowkin", "eclipsed" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java index d924de7f..9a4a2723 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java @@ -112,8 +112,7 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou double var26 = oldY + (mob.posY - oldY) * var19 + mob.worldObj.rand.nextDouble() * (double) mob.height; double var28 = oldZ + (mob.posZ - oldZ) * var19 + (mob.worldObj.rand.nextDouble() - 0.5D) * (double) mob.width * 2.0D; - mob.worldObj - .spawnParticle("portal", var24, var26, var28, (double) var21, (double) var22, (double) var23); + mob.worldObj.spawnParticle("portal", var24, var26, var28, var21, var22, var23); } mob.worldObj.playSoundEffect(oldX, oldY, oldZ, "mob.endermen.portal", 1.0F, 1.0F); @@ -127,14 +126,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theEnderborn", "theTrickster" }; + private static final String[] suffix = { "theEnderborn", "theTrickster" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "enderborn", "tricky" }; + private static final String[] prefix = { "enderborn", "tricky" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java index b5d32d95..26b61435 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java @@ -26,7 +26,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && entity instanceof EntityPlayer) { + if (entity instanceof EntityPlayer) { ((EntityPlayer) entity).addExhaustion(1F); } @@ -38,14 +38,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofFatigue", "theDrainer" }; + private static final String[] suffix = { "ofFatigue", "theDrainer" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "exhausting", "draining" }; + private static final String[] prefix = { "exhausting", "draining" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java index cd9c650a..8ba0a9d1 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java @@ -23,7 +23,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) && !(source instanceof EntityDamageSourceIndirect) && !source.isProjectile()) { - ((EntityLivingBase) source.getEntity()).setFire(fireDuration); + source.getEntity().setFire(fireDuration); } mob.extinguish(); @@ -44,14 +44,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofConflagration", "thePhoenix", "ofCrispyness" }; + private static final String[] suffix = { "ofConflagration", "thePhoenix", "ofCrispyness" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "burning", "toasting" }; + private static final String[] prefix = { "burning", "toasting" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java index 2a02d748..bc641ee9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java @@ -3,7 +3,6 @@ import javax.annotation.Nullable; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.util.Vec3; import net.minecraftforge.common.config.Configuration; @@ -43,8 +42,7 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { double diffZ = target.posZ - mob.posZ; mob.renderYawOffset = mob.rotationYaw = -((float) Math.atan2(diffX, diffZ)) * 180.0F / (float) Math.PI; - mob.worldObj - .playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) mob.posX, (int) mob.posY, (int) mob.posZ, 0); + mob.worldObj.playAuxSFXAtEntity(null, 1008, (int) mob.posX, (int) mob.posY, (int) mob.posZ, 0); EntityLargeFireball entFB = new EntityLargeFireball(mob.worldObj, mob, diffX, diffY, diffZ); double spawnOffset = 2.0D; Vec3 mobLook = mob.getLook(1.0F); @@ -60,14 +58,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "OMFGFIREBALLS", "theBomber", "ofBallsofFire" }; + private static final String[] suffix = { "OMFGFIREBALLS", "theBomber", "ofBallsofFire" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "bombing", "fireballsy" }; + private static final String[] prefix = { "bombing", "fireballsy" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java index 5a1cc820..0b3cea79 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java @@ -27,8 +27,7 @@ public MM_Gravity(@Nullable MobModifier next) { public boolean onUpdate(EntityLivingBase mob) { EntityLivingBase target = getMobTarget(); - if (target != null && target instanceof EntityPlayer - && !(target instanceof EntityPlayer && ((EntityPlayer) target).capabilities.disableDamage)) { + if (target instanceof EntityPlayer && !((EntityPlayer) target).capabilities.disableDamage) { tryAbility(mob, target); } @@ -84,7 +83,7 @@ public static void knockBack(EntityLivingBase target, double x, double z) { target.motionY /= 2.0D; target.motionZ /= 2.0D; target.motionX -= x / (double) normalizedPower * (double) knockPower; - target.motionY += (double) knockPower; + target.motionY += knockPower; target.motionZ -= z / (double) normalizedPower * (double) knockPower; if (target.motionY > 0.4000000059604645D) { @@ -97,21 +96,21 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static Class[] modBans = { MM_Webber.class }; + private static final Class[] modBans = { MM_Webber.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRepulsion", "theFlipper" }; + private static final String[] suffix = { "ofRepulsion", "theFlipper" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "repulsing", "sproing" }; + private static final String[] prefix = { "repulsing", "sproing" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java index 053bb2ca..a03921b1 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java @@ -34,21 +34,21 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntityCreeper.class }; + private static final Class[] disallowed = { EntityCreeper.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theVampire", "ofTransfusion", "theBloodsucker" }; + private static final String[] suffix = { "theVampire", "ofTransfusion", "theBloodsucker" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "vampiric", "transfusing", "bloodsucking" }; + private static final String[] prefix = { "vampiric", "transfusing", "bloodsucking" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java index 310670c6..adf16ecf 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java @@ -117,14 +117,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theZenMaster", "ofEquilibrium", "ofInnerPeace" }; + private static final String[] suffix = { "theZenMaster", "ofEquilibrium", "ofInnerPeace" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "totallyzen", "innerlypeaceful", "Ronin" }; + private static final String[] prefix = { "totallyzen", "innerlypeaceful", "Ronin" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java index e8479f75..3cd47d0b 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java @@ -50,14 +50,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofVenom", "thedeadlyChalice" }; + private static final String[] suffix = { "ofVenom", "thedeadlyChalice" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "poisonous", "stinging", "despoiling" }; + private static final String[] prefix = { "poisonous", "stinging", "despoiling" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java index 842e4beb..e39307ef 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java @@ -35,14 +35,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofYouCantRun", "theSlowingB" }; + private static final String[] suffix = { "ofYouCantRun", "theSlowingB" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "slowing", "Quicksand" }; + private static final String[] prefix = { "slowing", "Quicksand" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java index 995d323d..975fabb5 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java @@ -35,14 +35,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofWTFIMBA", "theCancerous", "ofFirstAid" }; + private static final String[] suffix = { "ofWTFIMBA", "theCancerous", "ofFirstAid" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "regenerating", "healing", "nighunkillable" }; + private static final String[] prefix = { "regenerating", "healing", "nighunkillable" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java index 865db623..df1f43c6 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java @@ -34,7 +34,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && entity instanceof EntityPlayer) { + if (entity instanceof EntityPlayer) { ((EntityPlayer) entity).inventory.damageArmor(damage * 3); } @@ -46,14 +46,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofDecay", "theEquipmentHaunter" }; + private static final String[] suffix = { "ofDecay", "theEquipmentHaunter" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "rusting", "decaying" }; + private static final String[] prefix = { "rusting", "decaying" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java index 89bf79d2..57e32755 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java @@ -48,14 +48,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofHunger", "thePaleRider" }; + private static final String[] suffix = { "ofHunger", "thePaleRider" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "hungering", "starving" }; + private static final String[] prefix = { "hungering", "starving" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java index 91796951..6b730e59 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java @@ -88,14 +88,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofBolting", "theSwiftOne", "ofbeinginyourFace" }; + private static final String[] suffix = { "ofBolting", "theSwiftOne", "ofbeinginyourFace" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "sprinting", "swift", "charging" }; + private static final String[] prefix = { "sprinting", "swift", "charging" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java index 02e2ee9e..ef741375 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java @@ -33,8 +33,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { ItemStack weapon = p.inventory.getStackInSlot(p.inventory.currentItem); if (weapon != null) { long time = mob.ticksExisted; - if (time > nextAbilityUse && source.getEntity() != null - && !(source instanceof EntityDamageSourceIndirect)) { + if (time > nextAbilityUse && source.getEntity() != null) { nextAbilityUse = time + coolDown; EntityItem drop = p.dropPlayerItemWithRandomChoice( p.inventory.decrStackSize(p.inventory.currentItem, 1), @@ -54,7 +53,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { return super.onHurt(mob, source, damage); } - private Class[] disallowed = { EntityCreeper.class }; + private final Class[] disallowed = { EntityCreeper.class }; @Override public Class[] getBlackListMobClasses() { @@ -66,14 +65,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofSnagging", "theQuickFingered", "ofPettyTheft", "yoink" }; + private static final String[] suffix = { "ofSnagging", "theQuickFingered", "ofPettyTheft", "yoink" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "thieving", "snagging", "quickfingered" }; + private static final String[] prefix = { "thieving", "snagging", "quickfingered" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java index cb95abb3..bb4d0801 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java @@ -52,14 +52,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofLightning", "theRaiden" }; + private static final String[] suffix = { "ofLightning", "theRaiden" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "striking", "thundering", "electrified" }; + private static final String[] prefix = { "striking", "thundering", "electrified" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java index e5856b4b..9fdc712b 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java @@ -38,14 +38,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRetribution", "theThorned", "ofStrikingBack" }; + private static final String[] suffix = { "ofRetribution", "theThorned", "ofStrikingBack" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "thorned", "thorny", "spiky" }; + private static final String[] prefix = { "thorned", "thorny", "spiky" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java index ed99a929..fc3731f7 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java @@ -45,14 +45,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofApathy", "theDeceiver" }; + private static final String[] suffix = { "ofApathy", "theDeceiver" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "apathetic", "deceiving" }; + private static final String[] prefix = { "apathetic", "deceiving" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java index 2588e423..a2e2c169 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java @@ -75,21 +75,21 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static Class[] modBans = { MM_Gravity.class, MM_Blastoff.class }; + private static final Class[] modBans = { MM_Gravity.class, MM_Blastoff.class }; @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofTraps", "theMutated", "theSpider" }; + private static final String[] suffix = { "ofTraps", "theMutated", "theSpider" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "ensnaring", "webbing" }; + private static final String[] prefix = { "ensnaring", "webbing" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java index d66713ba..b2e8a4e2 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java @@ -48,14 +48,14 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofDarkSkulls", "Doomskull" }; + private static final String[] suffix = { "ofDarkSkulls", "Doomskull" }; @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "withering" }; + private static final String[] prefix = { "withering" }; public static class Loader extends ModifierLoader { diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java index b53be83b..52ce2350 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java @@ -53,7 +53,7 @@ public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes) { EntityPlayerMP p = MinecraftServer.getServer().getConfigurationManager().func_152612_a(stringData); if (p != null) { Entity ent = p.worldObj.getEntityByID(entID); - if (ent != null && ent instanceof EntityLivingBase) { + if (ent instanceof EntityLivingBase) { EntityLivingBase e = (EntityLivingBase) ent; MobModifier mod = InfernalMobsCore.getMobModifiers(e); if (mod != null) { diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java index a20fbe9a..26de8c94 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java @@ -50,7 +50,7 @@ public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes) { EntityPlayerMP p = MinecraftServer.getServer().getConfigurationManager().func_152612_a(stringData); if (p != null) { Entity ent = p.worldObj.getEntityByID(entID); - if (ent != null && ent instanceof EntityLivingBase) { + if (ent instanceof EntityLivingBase) { EntityLivingBase e = (EntityLivingBase) ent; MobModifier mod = InfernalMobsCore.getMobModifiers(e); if (mod != null) { diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java index 7184d29d..fff59fef 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java @@ -1,5 +1,6 @@ package atomicstryker.infernalmobs.common.network; +import java.util.Arrays; import java.util.EnumMap; import java.util.HashSet; @@ -51,10 +52,8 @@ public NetworkHelper(String channelName, Class... handledPack clientOutboundChannel = channelPair.get(Side.CLIENT); serverOutboundChannel = channelPair.get(Side.SERVER); - registeredClasses = new HashSet>(handledPacketClasses.length); - for (Class c : handledPacketClasses) { - registeredClasses.add(c); - } + registeredClasses = new HashSet<>(handledPacketClasses.length); + registeredClasses.addAll(Arrays.asList(handledPacketClasses)); } /** @@ -63,7 +62,7 @@ public NetworkHelper(String channelName, Class... handledPack * Packets don't distinguish between being sent from client to server or the other way around, so be careful using * them bidirectional or avoid doing that altogether. */ - public static interface IPacket { + public interface IPacket { /** * Executed upon sending a Packet away. Put your arbitrary data into the ByteBuffer, and retrieve it on the @@ -72,7 +71,7 @@ public static interface IPacket { * @param ctx channel context * @param bytes data being sent */ - public void writeBytes(ChannelHandlerContext ctx, ByteBuf bytes); + void writeBytes(ChannelHandlerContext ctx, ByteBuf bytes); /** * Executed upon arrival of a Packet at a recipient. Byte order matches writeBytes exactly. @@ -80,13 +79,12 @@ public static interface IPacket { * @param ctx channel context, you can send answers through here directly * @param bytes data being received */ - public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes); + void readBytes(ChannelHandlerContext ctx, ByteBuf bytes); } /** * Sends the supplied Packet from a client to the server - * - * @param packet + * */ public void sendPacketToServer(IPacket packet) { checkClassAndSync(packet.getClass()); @@ -98,9 +96,7 @@ public void sendPacketToServer(IPacket packet) { /** * Sends the supplied Packet from the server to the chosen Player - * - * @param packet - * @param player + * */ public void sendPacketToPlayer(IPacket packet, EntityPlayerMP player) { checkClassAndSync(packet.getClass()); @@ -112,8 +108,7 @@ public void sendPacketToPlayer(IPacket packet, EntityPlayerMP player) { /** * Sends a packet from the server to all currently connected players - * - * @param packet + * */ public void sendPacketToAllPlayers(IPacket packet) { checkClassAndSync(packet.getClass()); @@ -124,9 +119,7 @@ public void sendPacketToAllPlayers(IPacket packet) { /** * Sends a packet from the server to all players in a dimension around a location - * - * @param packet - * @param tp + * */ public void sendPacketToAllAroundPoint(IPacket packet, TargetPoint tp) { checkClassAndSync(packet.getClass()); @@ -139,9 +132,7 @@ public void sendPacketToAllAroundPoint(IPacket packet, TargetPoint tp) { /** * Sends a packet from the server to all players in a dimension - * - * @param packet - * @param dimension + * */ public void sendPacketToAllInDimension(IPacket packet, int dimension) { checkClassAndSync(packet.getClass()); @@ -170,7 +161,7 @@ private void checkClassAndSync(Class clazz) { /** * Internal Channel Codec, automatic discrimination and data forwarding */ - private class ChannelCodec extends FMLIndexedMessageToMessageCodec { + private static class ChannelCodec extends FMLIndexedMessageToMessageCodec { @SafeVarargs public ChannelCodec(Class... handledPacketClasses) { @@ -192,7 +183,7 @@ public void decodeInto(ChannelHandlerContext ctx, ByteBuf bytes, IPacket msg) { } @Sharable - public class ChannelHandler extends SimpleChannelInboundHandler { + public static class ChannelHandler extends SimpleChannelInboundHandler { public ChannelHandler() {} From eacb66445f917c7c2cc7a7d046c4256d066b81d6 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 18:41:15 +0200 Subject: [PATCH 02/12] delete changelog.txt --- src/main/resources/changelog.txt | 318 ------------------------------- 1 file changed, 318 deletions(-) delete mode 100644 src/main/resources/changelog.txt diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt deleted file mode 100644 index 7e01d459..00000000 --- a/src/main/resources/changelog.txt +++ /dev/null @@ -1,318 +0,0 @@ -1.6.6gtnh1 -- backport fixes from 1.12.0 branches - - Add German and Chinese translations - - Choke modifier fix (overlay not disappearing) - - Unified Ninja and Ender teleport (and fixes teleport into solid spaces) -- don't render spawn particles while the game is paused -- fix sound effects -- make many aspects of modifiers configurable -- fix health bar for 1UP, Regen, and Lifesteal -- fix modifiers being activated even though mob is neutral -- make certain modifiers no longer effect creative players -- make certain modifiers no long effect attackers using ranged attacks -- added 3 second time out for the choke modifier bubble overlay in case of a desync -- drop maxOneShotDamage config option in favor of individual modifier options - -1.6.6 -- now disregards instances of IEntityOwnable's (mod added mobs which can be tamed) -- merged 1.7.10's version number to 1.6.6, since it is feature identical with 18 and 188 branches - -1.6.2 -- fixed Infernal Mobs health bars never showing up again after a vanilla healthbar showed up once - -1.6.1 -- added configurable dimension blacklist, pull request by Namikon thank you very much - -1.6.0 -- fixed reflecting modifiers causing infinite loops when meeting other damage reflecting entities -- changed update tick from client render to world tick -- added IT translation, courtesy of CapoFantasma97 of MCF - -1.5.9 -- and neither will infernal mobs send packets to fake player entities - -1.5.8 -- ongoing efforts to fix other peoples mods for them ._. -- infernal mobs will now never apply potion effects to fakeplayer entities - -1.5.7 -- fixes stalling issue when item droplist is empty - -#hotfix 1.5.6 -- gradle still adding java 8 dependency. WELL F*** YOU TOO -- sidestepping the issue by forcing a map typecast - -1.5.6 -- added support for "~" in /spawninfernal command -- improved responses to invalid/errored /spawninfernal commands -- fixed gradle introducing a java 8 dependency by the backdoor - -1.5.5 -- added simple entity names to attempted translations -- example: if you want "Creeper" translated to "Schleicher" put this in the lang file: -- translation.infernalmobs:entity.Creeper=Schleicher - -1.5.4 -- updated to mc 1.7.10 - -1.5.3 -- moved infernal mobs overlay rendering into an overlay render event -- also disabled infernal mob overlay when a bossfight is on - -1.5.2 -- added Channel Handler which does nothing so FML would stop complaining about Packets - -1.5.1 -- fixed rare classcast problems leading to crashes -- fixed central proxy not distinguishing client/server properly - this fixes subsequent issues with infernal mobs not gaining health - and healthbars not working -- added target caching to GUI infernal healthbar - if you stop having an infernal in your sights, the display will remain for 3 seconds - -1.5.0 -- fixed possible crash with player packets - -1.4.9 hotfix -- fixed player having unlimited breath unless chocked - -1.4.9 -- added new Modifier "Choke" -- so you like breathing? Well, SUCKS TO BE YOU -- attacks on the Choke mob give momentary respiratory respite -- fixed what might have been a major issue on over-time mods not attacking when they should have -- added 2 admin commands to infernal mobs -- /feclass X returns all currently registered Entities containing X in their classname's -- aka if you need an entity classname and only know its "Dark" something, /feclass Dark -- /spawninfernal x y z ENTCLASS X spawns an Infernal Mob of class ENTCLASS at x,y,z with Modifiers X -- example /spawninfernal -112 65 234 Zombie Bulwark Fiery Vengeance Choke Regen 1UP Sticky Rust Wither -- your tears, they are delicious -- this update has not been heavily tested yet. be abused at your own peril - -1.4.8 -- added new configuration variable maxOneShotDamage which limits how high infernally enhanced attacks - or reflected damage can go for a single strike. Default is 10 which is 5 hearts. - -1.4.7 -- fixed packet code to work on dedicated servers - -1.4.6 -- lowered default modifier attack target aquisition range to 7 blocks (from 12) -- introducing anti mob farm mechanic. when mobs take a lot of non-playercaused damage in a confined area... things might happen. - -1.4.5 -- fixed problem where derpy entities attacked themselves causing an infinite loop with vengeance - -1.4.4 -- updated for MC 1.7.2 -- remember to delete old config files - -1.4.3 -- fixed Infernal Mobs overwriting the vanilla mc objectMouseOver - -(Hotfix) -- fixed crash issue with seperate droplists at atomicstryker.infernalmobs.common.InfernalMobsCore.getRandomItem(InfernalMobsCore.java:733) -- thanks to sparroha for pointing it out - -1.4.2 -- seperated drop lists for the the 3 mod strength classes. Using the same list for all 3 is possible of course. - -1.4.1 -- sticky, poison, fiery, rust and wither no longer get applied to attackers using indirect damage sources -- depending on code implementation this may or may not work on ranged weapons, magic etc - -1.4.0 -- updated for MC 1.6.4 - -1.3.9 -- useSimpleEntityClassName now defaults to true -- base infernal health values for each mob can now be specified in the config (will be auto-created) -- extended networking to also send the max health over, to prevent health bar corruption - -1.3.8 -- fixed exponential mob health increases by repeated loading - -1.3.7 -- fixed Modifiers not being randomized -- fixed Modifiers not being saved/loaded properly -- fixed some translation typos - -1.3.6 -- fixed Infernal Mob health not being increased - -1.3.5 -- fixed translations breaking client-server communications - -1.3.4 -- added translation support -- hotfixed crash in packet handling when entity IDs are not in sync - -1.3.3 -- updated for MC 1.6.2 - -1.3.2 -- updated for MC 1.6.1 - -1.3.1 -- added mod prefix naming -- added Line-of-Sight checks to several Mod effects -- "improved" Ender teleport code - -1.3.0 -- updated for MC 1.5.2 - -1.2.9 (rev 2) -- now catching and logging getEntityName() crashes, using the classname instead -- compatible with 1.2.9, update optional - -1.2.9 -- fixed infernal particle spam when pausing/unpausing -- added randomized stacksize ability to config, a setting of "1-0-32-8" will yield a stack of 32 +-8, eg. 24 to 40, stone -- added mob health factor for further customization. Rare Mob health is multiplied with the Mod count, and is then multiplied with the "mobHealthFactor" -- added some explanation as configuration comments - -1.2.8 -- boss designation now has color! -- added useSimpleEntityClassnames to config, set to true if you have config problems with generated entity names - you will likely have to re-configure all entities with their new designations if you do so - i do suggest deleting the old lines if you do this -- added first iteration of monster name suffixes (not really happy with them yet) -- added option to disable the GUI overlay (clientside) - -1.2.7 -- moved Item config to postInit, might fix mod issues -- added another Item config parse run (on failed settings) to the first loot drop as last ditch effort -- added partial matches to work for Item configs -- if no full match for a Block or Item name can be found, the mod will go with the first that merely contains the target string - -1.2.6 -- fixed bug where all EntityMob types got infernal by default - -1.2.5 -- added Ultra and Inferno Mob chances to configuration. These stack iteratively: -- the Ultra chance only applies ONTOP of the Elite (old) chance -- the Inferno chance only applies ONTOP of the Ultra chance -- Values of 3, 5, 10 would mean one out of 3 Mobs gets Rare, of those Rares one out of 5 becomes Ultra, of those Ultras one out of 10 becomes Infernal -- absolute chances for an Infernal then: 1/3 * 1/5 * 1/10 = 1/150 one out of 150 Mobs gets Infernal - -1.2.4 -- added IMob to the possible Infernal Mobs. Now both IMob and EntityMob entities can become infernal! - -1.2.3 (fix) -- in Forge IRC chat was so kind to provide a fix to health bars - -1.2.3 -- fixed Vengeance, Ninja, Ender self-damage stackoverflow crashes - -1.2.2 -- updated for MC 1.5.1 - -1.2.1 (fix) -- fixed Infernal Mob Name display - -1.2.1 -- updated for MC 1.5 - -1.2.0 -- Infernal Mob health now directly scales with the amount of Modifiers on it -- added Ultra and Infernal modified Mobs with up to 15 Modifiers on them -- reworked enchanting Items to also scale with amount of Modifiers -- its possible that very weak monsters do not yield enchantments on the loot -- every 5 Modifiers the Mob will drop an additional Item -- 25% of Rare Mobs will become Ultra Mobs, 25% of Ultra Mobs will become Infernal -- added new Modifier Alchemist -- giant clusterfuck rewrite of Modifier classes fixing around a million bugs -- may or may not have introduced new bugs -- removed leather and gold loot. mojang pls buff - -1.1.9 -- added possibility for Blocks and metadata/damage in dropped loot -- old config syntax remains valid, to add Item "500" with meta/damage "3" add "500-3" to config -- Blocks are added similar, "blockID-metaValue-stackSize", example "35-4-10" is 10 Blocks of yellow Wool (id 35, meta 4) -- meta and stacksize need not be specified and default to 0 and 1 -- instead of a numeric ID you may also use the code name, example "tile.cloth-4-10" is the same Wool as above -- this may help with mod items or blocks whose IDs are subject to change -- only Items can and will be randomly enchanted -- automatically detects and randomly enchants Enchanted Books. Added those to default ID list (403) - -1.1.8 -- fixed Storm mod to no longer work while under a roof -- added "always infernal" option for entity classes to config - -1.1.7 -- fixed crash with entitylist comodification - -1.1.6 -- fixed crash in Webber mod - -1.1.5 -- fixed bug preventing several Mods from being used - -1.1.4 -- changed health hack to fire later and be more robust -- added new Modifiers Cloaking, Sapper and Wither -- reworked targeting on all mods, should fix bugs with old/new AI system clashing -- nerfed Vengeance damage reflection from 100% to 50% of damage dealt -- nerfed Ninja to deal a maximum of 15 damage when reflecting an attack - -1.1.3 -- new types of infernal Entities now register in the config. If you want to disallow certain -Entities to become infernal, say so in the config. ONLY HAS EFFECT UPON RESTARTING - -1.1.2 -- scrapped "enchant glow" code for enchanted Mobs, it broke with 1.4.6 and i cannot get it working again -- fixed/readded particles to enchanted Mobs -- made health bar updates more aggressive on client -- changed loot dropping back to the "must have been recently hit by player" system - -1.1.1 -- update to Minecraft 1.4.6 - -1.1.0 -- fix for NPE in overlayrenderer -- made modifiers removable via config. CAUTION: Removing mods on client may cause crash when on a server -- note: disabling too many (more than half?) will probably crash somehow too - -1.0.9 -- update to Minecraft 1.4.4 -- made enchanted drop IDs configurable - -1.0.8 -- made sure Wither doesn't get Infernal anymore - -1.0.7 -- fixed onHurt hook calling client method on server Side - -1.0.6 -- fixed name Display to not show obfuscated classnames -- fixed health Display propagation not really working - let me stress how much of an issue this was to get going -- changed Spawn Handler: - Now only Mob Entities will become infernal - Now every Mob joining the World through any means can become infernal (that includes eggs) -- fixed broken xp and enchantment dropping -- fixed a whole bunch of broken or not working modifiers -- fixed broken saving and loading of modifiers -- fixed clients inverting the mod order locally - there is a massive client/server mixup issue that i dont remember from last version, mc 1.4.2 yay - -1.0.5 -- updated to minecraft 1.4.2 and Forge 6.x - -1.0.4 -- updated to minecraft 1.4 and Forge 5.x -- fixed serverside load - -1.0.3 -- bugfixes, removed faulty DataWatcher addition -- ported to minecraft 1.3.2 and Forge 4.x - -Update, 1.0.2 -- bug- and crashfixes -- added Serverside mod -- added Update Manager - -Update, 1.0.1 -- bug- and crashfixes - -Initial release From ca5bf377f178308610ffbb19e07af0a11ff1fa5b Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:53:33 +0200 Subject: [PATCH 03/12] refactor : create dedicated packages --- .../client/InfernalMobsClient.java | 8 +- .../infernalmobs/client/RendererBossGlow.java | 2 +- .../infernalmobs/common/ISidedProxy.java | 2 + .../infernalmobs/common/InfernalMobsCore.java | 79 ++++++++++--------- .../common/InfernalMobsServer.java | 2 + .../InfernalCommandFindEntityClass.java | 2 +- .../InfernalCommandSpawnInfernal.java | 4 +- .../{ => events}/EntityEventHandler.java | 4 +- .../common/{ => events}/SaveEventHandler.java | 3 +- .../common/{mods => modifiers}/MM_1UP.java | 4 +- .../{mods => modifiers}/MM_Alchemist.java | 5 +- .../{mods => modifiers}/MM_Berserk.java | 5 +- .../{mods => modifiers}/MM_Blastoff.java | 4 +- .../{mods => modifiers}/MM_Bulwark.java | 5 +- .../common/{mods => modifiers}/MM_Choke.java | 4 +- .../{mods => modifiers}/MM_Cloaking.java | 5 +- .../{mods => modifiers}/MM_Darkness.java | 4 +- .../common/{mods => modifiers}/MM_Ender.java | 4 +- .../{mods => modifiers}/MM_Exhaust.java | 5 +- .../common/{mods => modifiers}/MM_Fiery.java | 5 +- .../{mods => modifiers}/MM_Ghastly.java | 5 +- .../{mods => modifiers}/MM_Gravity.java | 4 +- .../{mods => modifiers}/MM_Lifesteal.java | 4 +- .../common/{mods => modifiers}/MM_Ninja.java | 4 +- .../{mods => modifiers}/MM_Poisonous.java | 4 +- .../{mods => modifiers}/MM_Quicksand.java | 4 +- .../common/{mods => modifiers}/MM_Regen.java | 4 +- .../common/{mods => modifiers}/MM_Rust.java | 5 +- .../common/{mods => modifiers}/MM_Sapper.java | 4 +- .../common/{mods => modifiers}/MM_Sprint.java | 5 +- .../common/{mods => modifiers}/MM_Sticky.java | 5 +- .../common/{mods => modifiers}/MM_Storm.java | 5 +- .../{mods => modifiers}/MM_Vengeance.java | 4 +- .../{mods => modifiers}/MM_Weakness.java | 4 +- .../common/{mods => modifiers}/MM_Webber.java | 5 +- .../common/{mods => modifiers}/MM_Wither.java | 4 +- .../common/{ => modifiers}/MobModifier.java | 9 ++- .../api => modifiers}/ModifierLoader.java | 4 +- .../network/{ => packets}/AirPacket.java | 2 +- .../network/{ => packets}/HealthPacket.java | 4 +- .../{ => packets}/KnockBackPacket.java | 2 +- .../network/{ => packets}/MobModsPacket.java | 4 +- .../network/{ => packets}/VelocityPacket.java | 2 +- 43 files changed, 102 insertions(+), 151 deletions(-) rename src/main/java/atomicstryker/infernalmobs/common/{ => commands}/InfernalCommandFindEntityClass.java (97%) rename src/main/java/atomicstryker/infernalmobs/common/{ => commands}/InfernalCommandSpawnInfernal.java (95%) rename src/main/java/atomicstryker/infernalmobs/common/{ => events}/EntityEventHandler.java (98%) rename src/main/java/atomicstryker/infernalmobs/common/{ => events}/SaveEventHandler.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_1UP.java (92%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Alchemist.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Berserk.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Blastoff.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Bulwark.java (90%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Choke.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Cloaking.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Darkness.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Ender.java (97%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Exhaust.java (89%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Fiery.java (92%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Ghastly.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Gravity.java (96%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Lifesteal.java (92%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Ninja.java (97%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Poisonous.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Quicksand.java (89%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Regen.java (90%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Rust.java (92%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Sapper.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Sprint.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Sticky.java (94%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Storm.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Vengeance.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Weakness.java (92%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Webber.java (95%) rename src/main/java/atomicstryker/infernalmobs/common/{mods => modifiers}/MM_Wither.java (93%) rename src/main/java/atomicstryker/infernalmobs/common/{ => modifiers}/MobModifier.java (98%) rename src/main/java/atomicstryker/infernalmobs/common/{mods/api => modifiers}/ModifierLoader.java (83%) rename src/main/java/atomicstryker/infernalmobs/common/network/{ => packets}/AirPacket.java (91%) rename src/main/java/atomicstryker/infernalmobs/common/network/{ => packets}/HealthPacket.java (95%) rename src/main/java/atomicstryker/infernalmobs/common/network/{ => packets}/KnockBackPacket.java (92%) rename src/main/java/atomicstryker/infernalmobs/common/network/{ => packets}/MobModsPacket.java (95%) rename src/main/java/atomicstryker/infernalmobs/common/network/{ => packets}/VelocityPacket.java (93%) diff --git a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java index 0d6a7b93..0bd43bbc 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java +++ b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java @@ -25,10 +25,10 @@ import atomicstryker.infernalmobs.common.ISidedProxy; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.MM_Gravity; -import atomicstryker.infernalmobs.common.network.HealthPacket; -import atomicstryker.infernalmobs.common.network.MobModsPacket; +import atomicstryker.infernalmobs.common.modifiers.MM_Gravity; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; +import atomicstryker.infernalmobs.common.network.packets.HealthPacket; +import atomicstryker.infernalmobs.common.network.packets.MobModsPacket; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; diff --git a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java index 8ddae79c..af03cbf7 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java +++ b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java @@ -9,7 +9,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class RendererBossGlow { diff --git a/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java b/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java index 6ac2bd32..838be8a1 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java +++ b/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java @@ -4,6 +4,8 @@ import net.minecraft.entity.EntityLivingBase; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; + public interface ISidedProxy { void preInit(); diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index 3ba15d61..ae930fce 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -34,40 +34,45 @@ import com.google.common.collect.Lists; -import atomicstryker.infernalmobs.common.mods.MM_1UP; -import atomicstryker.infernalmobs.common.mods.MM_Alchemist; -import atomicstryker.infernalmobs.common.mods.MM_Berserk; -import atomicstryker.infernalmobs.common.mods.MM_Blastoff; -import atomicstryker.infernalmobs.common.mods.MM_Bulwark; -import atomicstryker.infernalmobs.common.mods.MM_Choke; -import atomicstryker.infernalmobs.common.mods.MM_Cloaking; -import atomicstryker.infernalmobs.common.mods.MM_Darkness; -import atomicstryker.infernalmobs.common.mods.MM_Ender; -import atomicstryker.infernalmobs.common.mods.MM_Exhaust; -import atomicstryker.infernalmobs.common.mods.MM_Fiery; -import atomicstryker.infernalmobs.common.mods.MM_Ghastly; -import atomicstryker.infernalmobs.common.mods.MM_Gravity; -import atomicstryker.infernalmobs.common.mods.MM_Lifesteal; -import atomicstryker.infernalmobs.common.mods.MM_Ninja; -import atomicstryker.infernalmobs.common.mods.MM_Poisonous; -import atomicstryker.infernalmobs.common.mods.MM_Quicksand; -import atomicstryker.infernalmobs.common.mods.MM_Regen; -import atomicstryker.infernalmobs.common.mods.MM_Rust; -import atomicstryker.infernalmobs.common.mods.MM_Sapper; -import atomicstryker.infernalmobs.common.mods.MM_Sprint; -import atomicstryker.infernalmobs.common.mods.MM_Sticky; -import atomicstryker.infernalmobs.common.mods.MM_Storm; -import atomicstryker.infernalmobs.common.mods.MM_Vengeance; -import atomicstryker.infernalmobs.common.mods.MM_Weakness; -import atomicstryker.infernalmobs.common.mods.MM_Webber; -import atomicstryker.infernalmobs.common.mods.MM_Wither; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; -import atomicstryker.infernalmobs.common.network.AirPacket; -import atomicstryker.infernalmobs.common.network.HealthPacket; -import atomicstryker.infernalmobs.common.network.KnockBackPacket; -import atomicstryker.infernalmobs.common.network.MobModsPacket; +import atomicstryker.infernalmobs.common.commands.InfernalCommandFindEntityClass; +import atomicstryker.infernalmobs.common.commands.InfernalCommandSpawnInfernal; +import atomicstryker.infernalmobs.common.events.EntityEventHandler; +import atomicstryker.infernalmobs.common.events.SaveEventHandler; +import atomicstryker.infernalmobs.common.modifiers.MM_1UP; +import atomicstryker.infernalmobs.common.modifiers.MM_Alchemist; +import atomicstryker.infernalmobs.common.modifiers.MM_Berserk; +import atomicstryker.infernalmobs.common.modifiers.MM_Blastoff; +import atomicstryker.infernalmobs.common.modifiers.MM_Bulwark; +import atomicstryker.infernalmobs.common.modifiers.MM_Choke; +import atomicstryker.infernalmobs.common.modifiers.MM_Cloaking; +import atomicstryker.infernalmobs.common.modifiers.MM_Darkness; +import atomicstryker.infernalmobs.common.modifiers.MM_Ender; +import atomicstryker.infernalmobs.common.modifiers.MM_Exhaust; +import atomicstryker.infernalmobs.common.modifiers.MM_Fiery; +import atomicstryker.infernalmobs.common.modifiers.MM_Ghastly; +import atomicstryker.infernalmobs.common.modifiers.MM_Gravity; +import atomicstryker.infernalmobs.common.modifiers.MM_Lifesteal; +import atomicstryker.infernalmobs.common.modifiers.MM_Ninja; +import atomicstryker.infernalmobs.common.modifiers.MM_Poisonous; +import atomicstryker.infernalmobs.common.modifiers.MM_Quicksand; +import atomicstryker.infernalmobs.common.modifiers.MM_Regen; +import atomicstryker.infernalmobs.common.modifiers.MM_Rust; +import atomicstryker.infernalmobs.common.modifiers.MM_Sapper; +import atomicstryker.infernalmobs.common.modifiers.MM_Sprint; +import atomicstryker.infernalmobs.common.modifiers.MM_Sticky; +import atomicstryker.infernalmobs.common.modifiers.MM_Storm; +import atomicstryker.infernalmobs.common.modifiers.MM_Vengeance; +import atomicstryker.infernalmobs.common.modifiers.MM_Weakness; +import atomicstryker.infernalmobs.common.modifiers.MM_Webber; +import atomicstryker.infernalmobs.common.modifiers.MM_Wither; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; +import atomicstryker.infernalmobs.common.modifiers.ModifierLoader; import atomicstryker.infernalmobs.common.network.NetworkHelper; -import atomicstryker.infernalmobs.common.network.VelocityPacket; +import atomicstryker.infernalmobs.common.network.packets.AirPacket; +import atomicstryker.infernalmobs.common.network.packets.HealthPacket; +import atomicstryker.infernalmobs.common.network.packets.KnockBackPacket; +import atomicstryker.infernalmobs.common.network.packets.MobModsPacket; +import atomicstryker.infernalmobs.common.network.packets.VelocityPacket; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; @@ -541,7 +546,7 @@ public void setEntityHealthPastMax(EntityLivingBase entity, float amount) { * @return null or the first linked MobModifier instance for the Entity */ @SuppressWarnings("unchecked") - MobModifier createMobModifiers(EntityLivingBase entity) { + public MobModifier createMobModifiers(EntityLivingBase entity) { /* lets just be lazy and scratch mods off a list copy */ ArrayList> possibleMods = (ArrayList>) modifierLoaders.clone(); @@ -621,7 +626,7 @@ public void addEntityModifiers(EntityLivingBase entity, MobModifier mod, boolean */ public void addEntityModifiersByString(EntityLivingBase entity, String savedMods) { if (!getIsRareEntity(entity)) { - MobModifier mod = stringToMobModifiers(entity, savedMods); + MobModifier mod = stringToMobModifiers(savedMods); if (mod != null) { addEntityModifiers(entity, mod, true); } else { @@ -633,7 +638,7 @@ public void addEntityModifiersByString(EntityLivingBase entity, String savedMods } } - private MobModifier stringToMobModifiers(EntityLivingBase entity, String buffer) { + private MobModifier stringToMobModifiers(String buffer) { MobModifier lastMod = null; String[] tokens = buffer.split("\\s"); @@ -644,7 +649,7 @@ private MobModifier stringToMobModifiers(EntityLivingBase entity, String buffer) for (ModifierLoader loader : modifierLoaders) { nextMod = loader.make(lastMod); - if (nextMod.modName.equalsIgnoreCase(modName)) { + if (nextMod.getModName().equalsIgnoreCase(modName)) { /* * Only actually keep the new linked instance if it's what we wanted */ diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java index 11d11e64..1ca9f2b0 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java @@ -4,6 +4,8 @@ import net.minecraft.entity.EntityLivingBase; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; + public class InfernalMobsServer implements ISidedProxy { private final ConcurrentHashMap rareMobsServer; diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java similarity index 97% rename from src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java rename to src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java index 1d20d2c9..875fea14 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java +++ b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common; +package atomicstryker.infernalmobs.common.commands; import java.util.Collection; diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java similarity index 95% rename from src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java rename to src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java index 7ad277c1..a94cb98c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common; +package atomicstryker.infernalmobs.common.commands; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommand; @@ -10,6 +10,8 @@ import org.apache.logging.log4j.Level; +import atomicstryker.infernalmobs.common.InfernalMobsCore; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; import cpw.mods.fml.common.FMLCommonHandler; public class InfernalCommandSpawnInfernal extends CommandBase { diff --git a/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java similarity index 98% rename from src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java rename to src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java index a86d4b4e..b7fcf937 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common; +package atomicstryker.infernalmobs.common.events; import java.util.HashMap; import java.util.Map.Entry; @@ -21,6 +21,8 @@ import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.world.ChunkEvent; +import atomicstryker.infernalmobs.common.InfernalMobsCore; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class EntityEventHandler { diff --git a/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java rename to src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java index e7f5dd22..9c7db5bc 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common; +package atomicstryker.infernalmobs.common.events; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -6,6 +6,7 @@ import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; +import atomicstryker.infernalmobs.common.InfernalMobsCore; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class SaveEventHandler { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java similarity index 92% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java index d944518a..31060031 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_1UP.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -7,8 +7,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_1UP extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java index 962e65b9..59eabd8f 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Alchemist.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -8,9 +8,6 @@ import net.minecraft.util.MathHelper; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Alchemist extends MobModifier { public MM_Alchemist(@Nullable MobModifier next) { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java index 44d21a41..001360f9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Berserk.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -7,9 +7,6 @@ import net.minecraft.util.DamageSource; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Berserk extends MobModifier { private static float damageMultiplier; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java index c8d5f6dd..366fdadb 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Blastoff.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -9,8 +9,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Blastoff extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java similarity index 90% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java index bd1c456b..73549e9d 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Bulwark.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -6,9 +6,6 @@ import net.minecraft.util.DamageSource; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Bulwark extends MobModifier { private static float damageMultiplier; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java index e4c8fab8..4426c891 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Choke.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import java.util.UUID; @@ -10,8 +10,6 @@ import net.minecraft.util.DamageSource; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Choke extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java index 12c40e5b..b6c25afe 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Cloaking.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -10,9 +10,6 @@ import net.minecraft.util.DamageSource; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Cloaking extends MobModifier { private long nextAbilityUse = 0L; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java index 78fb0b36..7d416ae0 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Darkness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -10,8 +10,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Darkness extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java similarity index 97% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java index 9a4a2723..13b0c4be 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ender.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -11,8 +11,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Ender extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java similarity index 89% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java index 26b61435..6069b518 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Exhaust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -6,9 +6,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Exhaust extends MobModifier { public MM_Exhaust(@Nullable MobModifier next) { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java similarity index 92% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java index 8ba0a9d1..e07acb9c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Fiery.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -7,9 +7,6 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Fiery extends MobModifier { private static int fireDuration; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java index bc641ee9..354d937d 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -7,9 +7,6 @@ import net.minecraft.util.Vec3; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Ghastly extends MobModifier { private long nextAbilityUse = 0L; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java similarity index 96% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java index 0b3cea79..2026aae2 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Gravity.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -10,8 +10,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Gravity extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java similarity index 92% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java index a03921b1..9d454e39 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Lifesteal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -8,8 +8,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Lifesteal extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java similarity index 97% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java index adf16ecf..bf1e220a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ninja.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -11,8 +11,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Ninja extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java index 3cd47d0b..d8bdb617 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Poisonous.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -10,8 +10,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Poisonous extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java similarity index 89% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java index e39307ef..6aa9b56a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Quicksand.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -7,8 +7,6 @@ import net.minecraft.potion.PotionEffect; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Quicksand extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java similarity index 90% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java index 975fabb5..dae4e0b2 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Regen.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -6,8 +6,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Regen extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java similarity index 92% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java index df1f43c6..d9693354 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Rust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -8,9 +8,6 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Rust extends MobModifier { private static int itemDamage; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java index 57e32755..4ee05415 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sapper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -9,8 +9,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Sapper extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java index 6b730e59..7d33f01e 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java @@ -1,13 +1,10 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Sprint extends MobModifier { private long nextAbilityUse = 0L; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java similarity index 94% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java index ef741375..99c6a293 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sticky.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -11,9 +11,6 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Sticky extends MobModifier { private long nextAbilityUse = 0L; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java index bb4d0801..295ebc5e 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Storm.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -8,9 +8,6 @@ import net.minecraft.util.MathHelper; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Storm extends MobModifier { private long nextAbilityUse = 0L; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java index 9fdc712b..90cd1f64 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -7,8 +7,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Vengeance extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java similarity index 92% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java index fc3731f7..c366a2d8 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Weakness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -9,8 +9,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Weakness extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java similarity index 95% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java index a2e2c169..2534beee 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Webber.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -9,9 +9,6 @@ import net.minecraft.util.MathHelper; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - public class MM_Webber extends MobModifier { private long lastAbilityUse = 0L; diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java index b2e8a4e2..9d48fd1c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Wither.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; @@ -10,8 +10,6 @@ import net.minecraftforge.common.config.Configuration; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; public class MM_Wither extends MobModifier { diff --git a/src/main/java/atomicstryker/infernalmobs/common/MobModifier.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java similarity index 98% rename from src/main/java/atomicstryker/infernalmobs/common/MobModifier.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java index b0ee8f4c..157b2e8e 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/MobModifier.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common; +package atomicstryker.infernalmobs.common.modifiers; import java.util.ArrayList; @@ -15,6 +15,7 @@ import org.apache.logging.log4j.Level; +import atomicstryker.infernalmobs.common.InfernalMobsCore; import cpw.mods.fml.common.FMLLog; public abstract class MobModifier { @@ -28,7 +29,7 @@ public abstract class MobModifier { /** * name of this particular MobModifier instance */ - protected final String modName; + private final String modName; /** * keeps track of our past-max-bounds health patch @@ -441,4 +442,8 @@ public String getEntityDisplayName(EntityLivingBase target) { public void resetModifiedVictim(EntityPlayer victim) { // NOOP by default } + + public String getModName() { + return modName; + } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/api/ModifierLoader.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/ModifierLoader.java similarity index 83% rename from src/main/java/atomicstryker/infernalmobs/common/mods/api/ModifierLoader.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/ModifierLoader.java index 62f6532c..f1a75ad7 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/api/ModifierLoader.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/ModifierLoader.java @@ -1,11 +1,9 @@ -package atomicstryker.infernalmobs.common.mods.api; +package atomicstryker.infernalmobs.common.modifiers; import javax.annotation.Nullable; import net.minecraftforge.common.config.Configuration; -import atomicstryker.infernalmobs.common.MobModifier; - public abstract class ModifierLoader { private final String modifierClassName; diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/AirPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/AirPacket.java similarity index 91% rename from src/main/java/atomicstryker/infernalmobs/common/network/AirPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/AirPacket.java index c9eb0c42..604f68bb 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/AirPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/AirPacket.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.network; +package atomicstryker.infernalmobs.common.network.packets; import atomicstryker.infernalmobs.common.InfernalMobsCore; import atomicstryker.infernalmobs.common.network.NetworkHelper.IPacket; diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java similarity index 95% rename from src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java index 52ce2350..bd48901d 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.network; +package atomicstryker.infernalmobs.common.network.packets; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -6,7 +6,7 @@ import net.minecraft.server.MinecraftServer; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; import atomicstryker.infernalmobs.common.network.NetworkHelper.IPacket; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/KnockBackPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/KnockBackPacket.java similarity index 92% rename from src/main/java/atomicstryker/infernalmobs/common/network/KnockBackPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/KnockBackPacket.java index fe078981..976aaac9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/KnockBackPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/KnockBackPacket.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.network; +package atomicstryker.infernalmobs.common.network.packets; import atomicstryker.infernalmobs.common.InfernalMobsCore; import atomicstryker.infernalmobs.common.network.NetworkHelper.IPacket; diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java similarity index 95% rename from src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java index 26de8c94..ac437bd9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.network; +package atomicstryker.infernalmobs.common.network.packets; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -6,7 +6,7 @@ import net.minecraft.server.MinecraftServer; import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.MobModifier; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; import atomicstryker.infernalmobs.common.network.NetworkHelper.IPacket; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/VelocityPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/VelocityPacket.java similarity index 93% rename from src/main/java/atomicstryker/infernalmobs/common/network/VelocityPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/VelocityPacket.java index 193d3ac7..a8e5422c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/VelocityPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/VelocityPacket.java @@ -1,4 +1,4 @@ -package atomicstryker.infernalmobs.common.network; +package atomicstryker.infernalmobs.common.network.packets; import atomicstryker.infernalmobs.common.InfernalMobsCore; import atomicstryker.infernalmobs.common.network.NetworkHelper.IPacket; From 11546ba105da29da3476f84de33d6284ec389ab8 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 21:10:40 +0200 Subject: [PATCH 04/12] use resolution of the event --- .../infernalmobs/client/InfernalMobsClient.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java index 0bd43bbc..462268e5 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java +++ b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java @@ -7,7 +7,6 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngame; -import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.BossStatus; @@ -109,8 +108,7 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { EntityLivingBase target = (EntityLivingBase) ent; String buffer = mod.getEntityDisplayName(target); - ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - int screenwidth = resolution.getScaledWidth(); + int screenwidth = event.resolution.getScaledWidth(); FontRenderer fontR = mc.fontRenderer; GuiIngame gui = mc.ingameGUI; @@ -269,16 +267,12 @@ public void onTick(RenderGameOverlayEvent.Pre event) { if (event.type == RenderGameOverlayEvent.ElementType.AIR) { if (!mc.thePlayer.isInsideOfMaterial(Material.water) && airOverrideValue != -999) { - final ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); GL11.glEnable(GL11.GL_BLEND); - int right_height = 39; - - final int left = res.getScaledWidth() / 2 + 91; - final int top = res.getScaledHeight() - right_height; + final int left = event.resolution.getScaledWidth() / 2 + 91; + final int top = event.resolution.getScaledHeight() - right_height; final int full = MathHelper.ceiling_double_int((double) (airOverrideValue - 2) * 10.0D / 300.0D); final int partial = MathHelper.ceiling_double_int((double) airOverrideValue * 10.0D / 300.0D) - full; - for (int i = 0; i < full + partial; ++i) { mc.ingameGUI.drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); } From 64bd0326472724738f1298d9fadc118c2a445906 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:46:21 +0200 Subject: [PATCH 05/12] replace references of the mod's instance with this --- .../infernalmobs/common/InfernalMobsCore.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index ae930fce..5a7f4cdb 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -329,7 +329,7 @@ private void loadConfig() { "iron_shovel,iron_pickaxe,iron_axe,iron_sword,iron_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,iron_helmet,iron_chestplate,iron_leggings,iron_boots,cookie-0-6", "List of equally likely to drop Items for Elites, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") .getString(), - instance.dropIdListElite); + this.dropIdListElite); parseItemsForList( config.get( @@ -338,7 +338,7 @@ private void loadConfig() { "bow,iron_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,iron_helmet,iron_chestplate,iron_leggings,iron_boots,golden_helmet,golden_chestplate,golden_leggings,golden_boots,golden_apple,blaze_powder-0-3,enchanted_book", "List of equally likely to drop Items for Ultras, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") .getString(), - instance.dropIdListUltra); + this.dropIdListUltra); parseItemsForList( config.get( @@ -347,7 +347,7 @@ private void loadConfig() { "diamond-0-3,diamond_sword,diamond_shovel,diamond_pickaxe,diamond_axe,diamond_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,diamond_helmet,diamond_chestplate,diamond_leggings,diamond_boots,ender_pearl,enchanted_book", "List of equally likely to drop Items for Infernals, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") .getString(), - instance.dropIdListInfernal); + this.dropIdListInfernal); parseIDsForList( config.get( @@ -355,7 +355,7 @@ private void loadConfig() { "dimensionIDBlackList", "", "List of DimensionIDs where InfernalMobs will NEVER spawn").getString(), - instance.dimensionBlackList); + this.dimensionBlackList); for (ModifierLoader loader : modifierLoaders) { loader.loadConfig(config); @@ -433,8 +433,8 @@ private Object parseOrFind(String s) { public void processEntitySpawn(EntityLivingBase entity) { if (!entity.worldObj.isRemote) { if (!getIsRareEntity(entity)) { - if (isClassAllowed(entity) && (instance.checkEntityClassForced(entity) - || entity.worldObj.rand.nextInt(eliteRarity) == 0)) { + if (isClassAllowed(entity) + && (checkEntityClassForced(entity) || entity.worldObj.rand.nextInt(eliteRarity) == 0)) { try { Integer tEntityDim = entity.dimension; @@ -443,7 +443,7 @@ public void processEntitySpawn(EntityLivingBase entity) { // System.out.println("InfernalMobsCore skipped spawning InfernalMob due blacklisted // Dimension"); } else { - MobModifier mod = instance.createMobModifiers(entity); + MobModifier mod = createMobModifiers(entity); if (mod != null) { addEntityModifiers(entity, mod, false); // System.out.println("InfernalMobsCore modded mob: "+entity+", id @@ -464,7 +464,7 @@ public boolean isClassAllowed(EntityLivingBase entity) { if (entity instanceof IEntityOwnable) { return false; } - return instance.checkEntityClassAllowed(entity); + return checkEntityClassAllowed(entity); } return false; } @@ -536,7 +536,7 @@ public float getMobClassMaxHealth(EntityLivingBase entity) { */ public void setEntityHealthPastMax(EntityLivingBase entity, float amount) { entity.setHealth(amount); - instance.sendHealthPacket(entity, amount); + this.sendHealthPacket(entity, amount); } /** @@ -755,8 +755,8 @@ private void enchantRandomly(Random rand, ItemStack itemStack, int itemEnchantab * @return ItemStack instance to drop to the World */ private ItemStack getRandomItem(EntityLivingBase mob, int prefix) { - ArrayList list = (prefix == 0) ? instance.dropIdListElite - : (prefix == 1) ? instance.dropIdListUltra : instance.dropIdListInfernal; + ArrayList list = (prefix == 0) ? dropIdListElite + : (prefix == 1) ? dropIdListUltra : dropIdListInfernal; return !list.isEmpty() ? list.get(mob.worldObj.rand.nextInt(list.size())).copy() : null; } From 694b6b6fa3a27fe78241799bc34cde237a3b4bd3 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:52:34 +0200 Subject: [PATCH 06/12] don't save config file every time but only if it has changed --- .../infernalmobs/common/InfernalMobsCore.java | 10 +++++----- .../infernalmobs/common/events/EntityEventHandler.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index 5a7f4cdb..be04f8f9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -243,7 +243,7 @@ private void loadMods() { loader -> !config.get(Configuration.CATEGORY_GENERAL, loader.getModifierClassName() + " enabled", true) .getBoolean(true)); - config.save(); + if (config.hasChanged()) config.save(); } /** @@ -361,7 +361,7 @@ private void loadConfig() { loader.loadConfig(config); } - config.save(); + if (config.hasChanged()) config.save(); } private void parseIDsForList(String dimensionIDs, ArrayList list) { @@ -493,7 +493,7 @@ private boolean checkEntityClassAllowed(EntityLivingBase entity) { config.load(); boolean result = config.get("permittedentities", entName, true).getBoolean(true); - config.save(); + if (config.hasChanged()) config.save(); classesAllowedMap.put(entName, result); return result; @@ -507,7 +507,7 @@ public boolean checkEntityClassForced(EntityLivingBase entity) { config.load(); boolean result = config.get("entitiesalwaysinfernal", entName, false).getBoolean(false); - config.save(); + if (config.hasChanged()) config.save(); classesForcedMap.put(entName, result); return result; @@ -522,7 +522,7 @@ public float getMobClassMaxHealth(EntityLivingBase entity) { config.load(); float result = (float) config.get("entitybasehealth", entName, entity.getMaxHealth()) .getDouble(entity.getMaxHealth()); - config.save(); + if (config.hasChanged()) config.save(); classesHealthMap.put(entName, result); return result; diff --git a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java index b7fcf937..0f495774 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java @@ -59,7 +59,7 @@ public EntityEventHandler() { "mobFarmDamageThreshold", 150D, "Damage in chunk per interval that triggers anti farm effects").getDouble(150D); - config.save(); + if (config.hasChanged()) config.save(); damageMap = new HashMap<>(); nextMapEvaluation = System.currentTimeMillis(); From 3059bc3f11c31a03ea7779b289de5d4d5c5beef7 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:56:57 +0200 Subject: [PATCH 07/12] update README.md --- README.md | 81 +++++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index fc5d0992..518391a7 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,33 @@ -Folder structure this file resides in - -./ - ./../forgegradle -> contains gradlew.bat along with the new forge setup - ./**/ -> contains the Eclipse Workspace with projects in it. There is a master gradle build file each project accesses - -To setup my workspace in your eclipse, simply setup Forge, then move your eclipse workspace into this folder. - - -Each project/mod refers to the master gradle build file which creates download files in their respective /build/libs (or /build/distributions) folders. -Gradle is required, however one could also use the gradlew wrapper found in forgegradle to do this. -The build file reacts to certain conditions like a "META-INF.mf" being present, "makezip" being present... - -THIS ASSUMES YOUR MOD COMPILES AGAINST FORGEGRADLE - if there are compile errors in the eclipse project, it will fail. - - -NOTE: Some projects attempt to include the Update Checker into their packages, which means it should be built first. -NOTE #2: Pet Bat relies on Dynamic Lights to have been compiled first. - -Stuff that needs changing each mc version: - -- in "./properties.xml" you find the minecraft and forge versions which are used by the build scripts for building and all resulting mod- and archivenames. -(artifacts are named by mc version only, so that filehoster linked files can be overwritten without breaking links) - -- each mod has a changelog, add new versions in here -- each mod has a @Mod sourcefile, generally in the common package, in which you need to bump "version =" property accordingly - - -Mods with special Needs: - --- Multi Mine -- Multi Mine needs it's dummy jar (containing only the Manifest.MF) in the runtime /mods/ folder if you want it to work during debugging -- Multi Mine uses hardcoded obfuscated names in it's sourcefile "common\atomicstryker\multimine\common\fmlmagic\MMTransformer.java" -- those need to be fixed to the current Searge names each time minecraft obfuscation changes -- a good place to get current obfuscated names from is joined.srg, methods.csv and fields.csv somewhere in the forgegradle folders -- another good place is MCPBot in the MCP IRC channels, assuming it runs the version you need - --- Dynamic Lights -- similar to Multi Mine. sourcefile is "common\atomicstryker\dynamiclights\common\DLTransformer.java" - --- Stalker Creepers -- similar to Multi Mine. sourcefile is "common\atomicstryker\stalkercreepers\common\SCTransformer.java" - --- Kenshiro Mod -- uses some hacky stuff for rendering and manipulating punched entities. Will probably crash if broken. - --- Advanced Machines and Ropes+ -- rely on external packages, namely IC2 and NEI +# Infernal Mobs + +#### This mod randomly imbues spawning Living Things in the World with Diablo-style random Enchantments, making them much harder and much more rewarding to kill. They also drop the quadruple amount of xp and a random enchanted item. + +List of modifiers that the mobs can have : + +- 1UP - Mob heals fully, once, upon getting low +- Alchimist - throws Potions at you +- Berserk - Mob deals double damage, but hurts itself on attacking +- Blastoff - Tosses Players into the air +- Bulwark - Mob has 50% damage resistance +- Choke - Drown on land, hit Mob to breathe for a moment +- Cloaking - Invisibility Potion effect on Mob +- Darkness - Blindness Potion effect on Player +- Ender - can teleport dodge attacks, reflecting damage on the Player +- Exhaust - Exhaust Potion effect on Player +- Fiery - sets Player on Fire +- Ghastly - shoots Fireballs +- Gravity - knocks back or pulls Players +- Lifesteal - heals from attacking +- Ninja - can teleport dodge attacks, reflecting damage on the Player +- Poisonous - poisons Player +- Quicksand - Slow Potion effect on Player +- Regen - heals Health back +- Rust - causes high amounts of wear on weapons and armour when fought +- Sapper - Hunger Potion effect on Player +- Sprint - high movement speed bursts +- Sticky - can snatch Items the Player attacks them with +- Storm - calls down Lightning +- Vengeance - reflects a portion of all damage done +- Weakness - Weakness Potion effect on Player +- Webber - spawns Webs at the Players legs +- Wither - Wither effect \ No newline at end of file From 01350ab2664b6de73c4fa22954557324930ce886 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 7 Sep 2024 00:19:34 +0200 Subject: [PATCH 08/12] refactor : rearrange entries --- .../infernalmobs/common/InfernalMobsCore.java | 2 +- .../common/events/EntityEventHandler.java | 27 ++++---- .../common/events/SaveEventHandler.java | 2 +- .../infernalmobs/common/modifiers/MM_1UP.java | 10 +-- .../common/modifiers/MM_Alchemist.java | 14 ++--- .../common/modifiers/MM_Berserk.java | 9 +-- .../common/modifiers/MM_Blastoff.java | 11 ++-- .../common/modifiers/MM_Bulwark.java | 6 +- .../common/modifiers/MM_Choke.java | 6 +- .../common/modifiers/MM_Cloaking.java | 11 ++-- .../common/modifiers/MM_Darkness.java | 6 +- .../common/modifiers/MM_Ender.java | 9 +-- .../common/modifiers/MM_Exhaust.java | 7 +-- .../common/modifiers/MM_Fiery.java | 6 +- .../common/modifiers/MM_Ghastly.java | 10 ++- .../common/modifiers/MM_Gravity.java | 11 ++-- .../common/modifiers/MM_Lifesteal.java | 9 +-- .../common/modifiers/MM_Ninja.java | 9 +-- .../common/modifiers/MM_Poisonous.java | 6 +- .../common/modifiers/MM_Quicksand.java | 10 ++- .../common/modifiers/MM_Regen.java | 8 +-- .../common/modifiers/MM_Rust.java | 6 +- .../common/modifiers/MM_Sapper.java | 6 +- .../common/modifiers/MM_Sprint.java | 13 ++-- .../common/modifiers/MM_Sticky.java | 15 ++--- .../common/modifiers/MM_Storm.java | 10 ++- .../common/modifiers/MM_Vengeance.java | 6 +- .../common/modifiers/MM_Weakness.java | 6 +- .../common/modifiers/MM_Webber.java | 11 ++-- .../common/modifiers/MM_Wither.java | 6 +- .../common/modifiers/MobModifier.java | 17 +++-- .../common/network/NetworkHelper.java | 63 +++++++++---------- 32 files changed, 136 insertions(+), 212 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index be04f8f9..3bbe1f07 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -121,7 +121,7 @@ public static InfernalMobsCore instance() { return instance; } - public String getNBTTag() { + public static String getNBTTag() { return "InfernalMobsMod"; } diff --git a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java index 0f495774..86d3a2da 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java @@ -37,7 +37,6 @@ public class EntityEventHandler { /** * Links the Forge Event Handler to the registered Entity MobModifier Events (if present) Also keeps track of the * anti mobfarm mechanic if enabled - * */ public EntityEventHandler() { Configuration config = InfernalMobsCore.instance().config; @@ -68,7 +67,7 @@ public EntityEventHandler() { @SubscribeEvent public void onEntityJoinedWorld(EntityJoinWorldEvent event) { if (event.entity instanceof EntityLivingBase) { - String savedMods = event.entity.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); + String savedMods = event.entity.getEntityData().getString(InfernalMobsCore.getNBTTag()); if (!savedMods.isEmpty()) { InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) event.entity, savedMods); } else { @@ -216,18 +215,6 @@ public void onEntityLivingUpdate(LivingEvent.LivingUpdateEvent event) { } } - public static class MobFarmDetectedEvent extends ChunkEvent { - - public final long triggeringInterval; - public final float triggeringDamage; - - public MobFarmDetectedEvent(Chunk chunk, long ti, float td) { - super(chunk); - triggeringInterval = ti; - triggeringDamage = td; - } - } - @SubscribeEvent public void onEntityLivingDrops(LivingDropsEvent event) { if (!event.entity.worldObj.isRemote) { @@ -244,4 +231,16 @@ public void onEntityLivingDrops(LivingDropsEvent event) { } } } + + public static class MobFarmDetectedEvent extends ChunkEvent { + + public final long triggeringInterval; + public final float triggeringDamage; + + public MobFarmDetectedEvent(Chunk chunk, long ti, float td) { + super(chunk); + triggeringInterval = ti; + triggeringDamage = td; + } + } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java index 9c7db5bc..7b9887ac 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java @@ -38,7 +38,7 @@ public void onChunkLoad(ChunkEvent.Load event) { for (int j = 0; j < chunk.entityLists[i].size(); j++) { newEnt = (Entity) chunk.entityLists[i].get(j); if (newEnt instanceof EntityLivingBase) { - String savedMods = newEnt.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); + String savedMods = newEnt.getEntityData().getString(InfernalMobsCore.getNBTTag()); if (!savedMods.isEmpty()) { InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) newEnt, savedMods); } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java index 31060031..fd9f9b62 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java @@ -10,8 +10,10 @@ public class MM_1UP extends MobModifier { + private static final Class[] disallowed = { EntityCreeper.class }; + private static final String[] suffix = { "ofRecurrence", "theUndying", "oftwinLives" }; + private static final String[] prefix = { "recurring", "undying", "twinlived" }; private static double healAmount; - private boolean healed = false; public MM_1UP(@Nullable MobModifier next) { @@ -33,22 +35,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static final Class[] disallowed = { EntityCreeper.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofRecurrence", "theUndying", "oftwinLives" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "recurring", "undying", "twinlived" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java index 59eabd8f..4deafcae 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java @@ -10,14 +10,16 @@ public class MM_Alchemist extends MobModifier { + private static final float MIN_DISTANCE = 2F; + private static final String[] suffix = { "theWitchkin", "theBrewmaster", "theSinged" }; + private static final String[] prefix = { "witchkin", "brewing", "singed" }; + private static long coolDown; + private long nextAbilityUse = 0L; + public MM_Alchemist(@Nullable MobModifier next) { super("Alchemist", next); } - private long nextAbilityUse = 0L; - private static long coolDown; - private final static float MIN_DISTANCE = 2F; - @Override public boolean onUpdate(EntityLivingBase mob) { long time = mob.ticksExisted; @@ -60,15 +62,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "theWitchkin", "theBrewmaster", "theSinged" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "witchkin", "brewing", "singed" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java index 001360f9..c19173a2 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java @@ -9,6 +9,9 @@ public class MM_Berserk extends MobModifier { + private static final Class[] disallowed = { EntityCreeper.class }; + private static final String[] suffix = { "ofRecklessness", "theRaging", "ofSmashing" }; + private static final String[] prefix = { "reckless", "raging", "smashing" }; private static float damageMultiplier; private static float maxBerserkDamage; @@ -31,22 +34,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static final Class[] disallowed = { EntityCreeper.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofRecklessness", "theRaging", "ofSmashing" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "reckless", "raging", "smashing" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java index 366fdadb..a14bebf9 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java @@ -12,8 +12,11 @@ public class MM_Blastoff extends MobModifier { - private long nextAbilityUse = 0L; + private static final Class[] modBans = { MM_Webber.class }; + private static final String[] suffix = { "ofMissionControl", "theNASA", "ofWEE" }; + private static final String[] prefix = { "thumping", "trolling", "byebye" }; private static long coolDown; + private long nextAbilityUse = 0L; public MM_Blastoff(@Nullable MobModifier next) { super("Blastoff", next); @@ -68,22 +71,16 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static final Class[] modBans = { MM_Webber.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofMissionControl", "theNASA", "ofWEE" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "thumping", "trolling", "byebye" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java index 73549e9d..9873c964 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java @@ -8,6 +8,8 @@ public class MM_Bulwark extends MobModifier { + private static final String[] suffix = { "ofTurtling", "theDefender", "ofeffingArmor" }; + private static final String[] prefix = { "turtling", "defensive", "armoured" }; private static float damageMultiplier; public MM_Bulwark(@Nullable MobModifier next) { @@ -24,15 +26,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofTurtling", "theDefender", "ofeffingArmor" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "turtling", "defensive", "armoured" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java index 4426c891..9803823d 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java @@ -13,6 +13,8 @@ public class MM_Choke extends MobModifier { + private static final String[] suffix = { "ofBreathlessness", "theAnaerobic", "ofDeprivation" }; + private static final String[] prefix = { "Sith Lord", "Dark Lord", "Darth" }; private EntityLivingBase lastTarget; private int lastAir = -999; @@ -95,15 +97,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofBreathlessness", "theAnaerobic", "ofDeprivation" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "Sith Lord", "Dark Lord", "Darth" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java index b6c25afe..d1138257 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java @@ -12,9 +12,12 @@ public class MM_Cloaking extends MobModifier { - private long nextAbilityUse = 0L; + private static final Class[] disallowed = { EntitySpider.class }; + private static final String[] suffix = { "ofStalking", "theUnseen", "thePredator" }; + private static final String[] prefix = { "stalking", "unseen", "hunting" }; private static long coolDown; private static int potionDuration; + private long nextAbilityUse = 0L; public MM_Cloaking(@Nullable MobModifier next) { super("Cloaking", next); @@ -51,22 +54,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static final Class[] disallowed = { EntitySpider.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofStalking", "theUnseen", "thePredator" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "stalking", "unseen", "hunting" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java index 7d416ae0..b59f1567 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java @@ -13,6 +13,8 @@ public class MM_Darkness extends MobModifier { + private static final String[] suffix = { "ofDarkness", "theShadow", "theEclipse" }; + private static final String[] prefix = { "dark", "shadowkin", "eclipsed" }; private static int potionDuration; public MM_Darkness(@Nullable MobModifier next) { @@ -46,15 +48,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofDarkness", "theShadow", "theEclipse" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "dark", "shadowkin", "eclipsed" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java index 13b0c4be..054ce2fa 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java @@ -14,11 +14,12 @@ public class MM_Ender extends MobModifier { - private long nextAbilityUse = 0L; - + private static final String[] suffix = { "theEnderborn", "theTrickster" }; + private static final String[] prefix = { "enderborn", "tricky" }; private static long coolDown; private static float reflectMultiplier; private static float maxReflectDamage; + private long nextAbilityUse = 0L; public MM_Ender(@Nullable MobModifier next) { super("Ender", next); @@ -124,15 +125,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "theEnderborn", "theTrickster" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "enderborn", "tricky" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java index 6069b518..635e99f1 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java @@ -8,6 +8,9 @@ public class MM_Exhaust extends MobModifier { + private static final String[] suffix = { "ofFatigue", "theDrainer" }; + private static final String[] prefix = { "exhausting", "draining" }; + public MM_Exhaust(@Nullable MobModifier next) { super("Exhaust", next); } @@ -35,15 +38,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofFatigue", "theDrainer" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "exhausting", "draining" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java index e07acb9c..43ed0327 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java @@ -9,6 +9,8 @@ public class MM_Fiery extends MobModifier { + private static final String[] suffix = { "ofConflagration", "thePhoenix", "ofCrispyness" }; + private static final String[] prefix = { "burning", "toasting" }; private static int fireDuration; public MM_Fiery(@Nullable MobModifier next) { @@ -41,15 +43,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofConflagration", "thePhoenix", "ofCrispyness" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "burning", "toasting" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java index 354d937d..d9811e3e 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java @@ -9,9 +9,11 @@ public class MM_Ghastly extends MobModifier { - private long nextAbilityUse = 0L; - private static long coolDown; private final static float MIN_DISTANCE = 3F; + private static final String[] suffix = { "OMFGFIREBALLS", "theBomber", "ofBallsofFire" }; + private static final String[] prefix = { "bombing", "fireballsy" }; + private static long coolDown; + private long nextAbilityUse = 0L; public MM_Ghastly(@Nullable MobModifier next) { super("Ghastly", next); @@ -55,15 +57,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "OMFGFIREBALLS", "theBomber", "ofBallsofFire" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "bombing", "fireballsy" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java index 2026aae2..7386c896 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java @@ -13,9 +13,12 @@ public class MM_Gravity extends MobModifier { - private long nextAbilityUse = 0L; + private static final Class[] modBans = { MM_Webber.class }; + private static final String[] suffix = { "ofRepulsion", "theFlipper" }; + private static final String[] prefix = { "repulsing", "sproing" }; private static long coolDown; private static double maxDistanceSquared; + private long nextAbilityUse = 0L; public MM_Gravity(@Nullable MobModifier next) { super("Gravity", next); @@ -94,22 +97,16 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static final Class[] modBans = { MM_Webber.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofRepulsion", "theFlipper" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "repulsing", "sproing" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java index 9d454e39..599b995f 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java @@ -11,6 +11,9 @@ public class MM_Lifesteal extends MobModifier { + private static final Class[] disallowed = { EntityCreeper.class }; + private static final String[] suffix = { "theVampire", "ofTransfusion", "theBloodsucker" }; + private static final String[] prefix = { "vampiric", "transfusing", "bloodsucking" }; private static float lifestealMultiplier; public MM_Lifesteal(@Nullable MobModifier next) { @@ -32,22 +35,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static final Class[] disallowed = { EntityCreeper.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "theVampire", "ofTransfusion", "theBloodsucker" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "vampiric", "transfusing", "bloodsucking" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java index bf1e220a..7a989911 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java @@ -14,11 +14,12 @@ public class MM_Ninja extends MobModifier { - private long nextAbilityUse = 0L; - + private static final String[] suffix = { "theZenMaster", "ofEquilibrium", "ofInnerPeace" }; + private static final String[] prefix = { "totallyzen", "innerlypeaceful", "Ronin" }; private static long coolDown; private static float reflectMultiplier; private static float maxReflectDamage; + private long nextAbilityUse = 0L; public MM_Ninja(@Nullable MobModifier next) { super("Ninja", next); @@ -115,15 +116,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "theZenMaster", "ofEquilibrium", "ofInnerPeace" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "totallyzen", "innerlypeaceful", "Ronin" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java index d8bdb617..04156191 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java @@ -13,6 +13,8 @@ public class MM_Poisonous extends MobModifier { + private static final String[] suffix = { "ofVenom", "thedeadlyChalice" }; + private static final String[] prefix = { "poisonous", "stinging", "despoiling" }; private static int potionDuration; public MM_Poisonous(@Nullable MobModifier next) { @@ -48,15 +50,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofVenom", "thedeadlyChalice" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "poisonous", "stinging", "despoiling" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java index 6aa9b56a..84dc0114 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java @@ -10,12 +10,14 @@ public class MM_Quicksand extends MobModifier { + private static final String[] suffix = { "ofYouCantRun", "theSlowingB" }; + private static final String[] prefix = { "slowing", "Quicksand" }; + int ticker = 0; + public MM_Quicksand(@Nullable MobModifier next) { super("Quicksand", next); } - int ticker = 0; - @Override public boolean onUpdate(EntityLivingBase mob) { if (getMobTarget() != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(getMobTarget()) @@ -33,15 +35,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofYouCantRun", "theSlowingB" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "slowing", "Quicksand" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java index dae4e0b2..e309ec46 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java @@ -9,8 +9,10 @@ public class MM_Regen extends MobModifier { - private long nextAbilityUse = 0L; + private static final String[] suffix = { "ofWTFIMBA", "theCancerous", "ofFirstAid" }; + private static final String[] prefix = { "regenerating", "healing", "nighunkillable" }; private static long coolDown; + private long nextAbilityUse = 0L; public MM_Regen(@Nullable MobModifier next) { super("Regen", next); @@ -33,15 +35,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofWTFIMBA", "theCancerous", "ofFirstAid" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "regenerating", "healing", "nighunkillable" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java index d9693354..70274abd 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java @@ -10,6 +10,8 @@ public class MM_Rust extends MobModifier { + private static final String[] suffix = { "ofDecay", "theEquipmentHaunter" }; + private static final String[] prefix = { "rusting", "decaying" }; private static int itemDamage; public MM_Rust(@Nullable MobModifier next) { @@ -43,15 +45,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofDecay", "theEquipmentHaunter" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "rusting", "decaying" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java index 4ee05415..0308bc4a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java @@ -12,6 +12,8 @@ public class MM_Sapper extends MobModifier { + private static final String[] suffix = { "ofHunger", "thePaleRider" }; + private static final String[] prefix = { "hungering", "starving" }; private static int potionDuration; public MM_Sapper(@Nullable MobModifier next) { @@ -46,15 +48,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofHunger", "thePaleRider" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "hungering", "starving" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java index 7d33f01e..316616bb 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java @@ -7,9 +7,13 @@ public class MM_Sprint extends MobModifier { - private long nextAbilityUse = 0L; + private static final String[] suffix = { "ofBolting", "theSwiftOne", "ofbeinginyourFace" }; + private static final String[] prefix = { "sprinting", "swift", "charging" }; private static long coolDown; + private long nextAbilityUse = 0L; private boolean sprinting; + private double modMotionX; + private double modMotionZ; public MM_Sprint(@Nullable MobModifier next) { super("Sprint", next); @@ -32,9 +36,6 @@ public boolean onUpdate(EntityLivingBase mob) { return super.onUpdate(mob); } - private double modMotionX; - private double modMotionZ; - private void doSprint(EntityLivingBase mob) { float rotationMovement = (float) ((Math.atan2(mob.motionX, mob.motionZ) * 180D) / 3.1415D); float rotationLook = mob.rotationYaw; @@ -85,15 +86,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofBolting", "theSwiftOne", "ofbeinginyourFace" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "sprinting", "swift", "charging" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java index 99c6a293..411ccf05 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java @@ -13,11 +13,14 @@ public class MM_Sticky extends MobModifier { - private long nextAbilityUse = 0L; + private static final String[] suffix = { "ofSnagging", "theQuickFingered", "ofPettyTheft", "yoink" }; + private static final String[] prefix = { "thieving", "snagging", "quickfingered" }; private static long coolDown; + private final Class[] disallowed = { EntityCreeper.class }; + private long nextAbilityUse = 0L; - public MM_Sticky(@Nullable MobModifier prevMod) { - super("Sticky", prevMod); + public MM_Sticky(@Nullable MobModifier next) { + super("Sticky", next); } @Override @@ -50,8 +53,6 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { return super.onHurt(mob, source, damage); } - private final Class[] disallowed = { EntityCreeper.class }; - @Override public Class[] getBlackListMobClasses() { return disallowed; @@ -62,15 +63,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofSnagging", "theQuickFingered", "ofPettyTheft", "yoink" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "thieving", "snagging", "quickfingered" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java index 295ebc5e..bdc627d7 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java @@ -10,9 +10,11 @@ public class MM_Storm extends MobModifier { - private long nextAbilityUse = 0L; - private static long coolDown; private final static float MIN_DISTANCE = 3F; + private static final String[] suffix = { "ofLightning", "theRaiden" }; + private static final String[] prefix = { "striking", "thundering", "electrified" }; + private static long coolDown; + private long nextAbilityUse = 0L; public MM_Storm(@Nullable MobModifier next) { super("Storm", next); @@ -49,15 +51,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofLightning", "theRaiden" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "striking", "thundering", "electrified" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java index 90cd1f64..3312a8bc 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java @@ -10,6 +10,8 @@ public class MM_Vengeance extends MobModifier { + private static final String[] suffix = { "ofRetribution", "theThorned", "ofStrikingBack" }; + private static final String[] prefix = { "thorned", "thorny", "spiky" }; private static float reflectMultiplier; private static float maxReflectDamage; @@ -36,15 +38,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofRetribution", "theThorned", "ofStrikingBack" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "thorned", "thorny", "spiky" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java index c366a2d8..792907b6 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java @@ -12,6 +12,8 @@ public class MM_Weakness extends MobModifier { + private static final String[] suffix = { "ofApathy", "theDeceiver" }; + private static final String[] prefix = { "apathetic", "deceiving" }; private static int potionDuration; public MM_Weakness(@Nullable MobModifier next) { @@ -43,15 +45,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofApathy", "theDeceiver" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "apathetic", "deceiving" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java index 2534beee..3075f574 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java @@ -11,8 +11,11 @@ public class MM_Webber extends MobModifier { - private long lastAbilityUse = 0L; + private static final Class[] modBans = { MM_Gravity.class, MM_Blastoff.class }; + private static final String[] suffix = { "ofTraps", "theMutated", "theSpider" }; + private static final String[] prefix = { "ensnaring", "webbing" }; private static long coolDown; + private long lastAbilityUse = 0L; public MM_Webber(@Nullable MobModifier next) { super("Webber", next); @@ -72,22 +75,16 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static final Class[] modBans = { MM_Gravity.class, MM_Blastoff.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofTraps", "theMutated", "theSpider" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "ensnaring", "webbing" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java index 9d48fd1c..1a163ec0 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java @@ -13,6 +13,8 @@ public class MM_Wither extends MobModifier { + private static final String[] suffix = { "ofDarkSkulls", "Doomskull" }; + private static final String[] prefix = { "withering" }; private static int potionDuration; public MM_Wither(@Nullable MobModifier next) { @@ -46,15 +48,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static final String[] suffix = { "ofDarkSkulls", "Doomskull" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static final String[] prefix = { "withering" }; - public static class Loader extends ModifierLoader { public Loader() { diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java index 157b2e8e..aaf50edb 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java @@ -129,10 +129,9 @@ public boolean containsModifierClass(Class checkfor) { /** * Called when local Spawn Processing is completed or when a client remote-attached Modifiers to a local Entity - * */ public void onSpawningComplete(EntityLivingBase entity) { - String oldTag = entity.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); + String oldTag = entity.getEntityData().getString(InfernalMobsCore.getNBTTag()); if (!oldTag.isEmpty() && !oldTag.equals(getLinkedModNameUntranslated())) { FMLLog.log( "InfernalMobs", @@ -142,12 +141,12 @@ public void onSpawningComplete(EntityLivingBase entity) { oldTag, getLinkedModNameUntranslated())); } - entity.getEntityData().setString(InfernalMobsCore.instance().getNBTTag(), getLinkedModNameUntranslated()); + entity.getEntityData().setString(InfernalMobsCore.getNBTTag(), getLinkedModNameUntranslated()); } /** * Passes the death event to the modifier list - * + * * @return true if death should be aborted */ public boolean onDeath() { @@ -171,7 +170,7 @@ public void onDropItems(EntityLivingBase moddedMob, DamageSource killSource, Arr /** * passes the setAttackTarget event to the modifier list - * + * * @param target being passed from the event */ public void onSetAttackTarget(EntityLivingBase target) { @@ -183,7 +182,7 @@ public void onSetAttackTarget(EntityLivingBase target) { /** * Modified Mob attacks something - * + * * @param entity Entity being attacked * @param source DamageSource instance doing the attacking * @param amount unmitigated damage value @@ -199,7 +198,7 @@ public float onAttack(EntityLivingBase entity, DamageSource source, float amount /** * Modified Mob is being hurt - * + * * @param source Damagesource doing the hurting * @param amount unmitigated damage value * @return damage to be applied after we processed the value @@ -264,7 +263,6 @@ public boolean onUpdate(EntityLivingBase mob) { /** * clientside helper method. Due to the health not being networked, we keep track of it internally, here. Also, this * is a good spot for the more-than-allowed health hack. - * */ public float getActualHealth(EntityLivingBase mob) { if (!mob.worldObj.isRemote) { @@ -306,7 +304,6 @@ public float getActualMaxHealth(EntityLivingBase mob) { /** * clientside receiving end of health packets sent from the InfernalMobs server instance - * */ public void setActualHealth(float health, float maxHealth) { actualHealth = health; @@ -370,7 +367,7 @@ protected String[] getModNameSuffix() { /** * Creates the Entity name the Infernal Mobs GUI displays, and buffers it - * + * * @param target Entity to create the Name from * @return Entity display name such as 'Rare Zombie' */ diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java index fff59fef..1963685c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java @@ -18,13 +18,11 @@ import io.netty.channel.SimpleChannelInboundHandler; /** - * * Helper class to wrap the new 1.7 Netty channels and packets into something resembling the older packet system. Create * one instance of this for a Mod, then use the helper methods to send Packets. Packet Handling is done inside the * packet classes themselves. - * - * @author AtomicStryker * + * @author AtomicStryker */ public class NetworkHelper { @@ -41,7 +39,7 @@ public class NetworkHelper { /** * Creates an instance of the NetworkHelper with included channels for client and server communication. * Automatically registers the necessary channels and discriminators for the supplied Packet classes. - * + * * @param channelName channel name to use, anything but already taken designations goes * @param handledPacketClasses provide the IPacket classes you want to use for communication here */ @@ -56,35 +54,8 @@ public NetworkHelper(String channelName, Class... handledPack registeredClasses.addAll(Arrays.asList(handledPacketClasses)); } - /** - * Packets only need to implement this and offer a constructor with no args, unless you don't have constructors with - * >0 args. The class MUST also be statically accessible, else you will suffer an InstantiationException! Note - * Packets don't distinguish between being sent from client to server or the other way around, so be careful using - * them bidirectional or avoid doing that altogether. - */ - public interface IPacket { - - /** - * Executed upon sending a Packet away. Put your arbitrary data into the ByteBuffer, and retrieve it on the - * receiving side when readBytes is executed. - * - * @param ctx channel context - * @param bytes data being sent - */ - void writeBytes(ChannelHandlerContext ctx, ByteBuf bytes); - - /** - * Executed upon arrival of a Packet at a recipient. Byte order matches writeBytes exactly. - * - * @param ctx channel context, you can send answers through here directly - * @param bytes data being received - */ - void readBytes(ChannelHandlerContext ctx, ByteBuf bytes); - } - /** * Sends the supplied Packet from a client to the server - * */ public void sendPacketToServer(IPacket packet) { checkClassAndSync(packet.getClass()); @@ -96,7 +67,6 @@ public void sendPacketToServer(IPacket packet) { /** * Sends the supplied Packet from the server to the chosen Player - * */ public void sendPacketToPlayer(IPacket packet, EntityPlayerMP player) { checkClassAndSync(packet.getClass()); @@ -108,7 +78,6 @@ public void sendPacketToPlayer(IPacket packet, EntityPlayerMP player) { /** * Sends a packet from the server to all currently connected players - * */ public void sendPacketToAllPlayers(IPacket packet) { checkClassAndSync(packet.getClass()); @@ -119,7 +88,6 @@ public void sendPacketToAllPlayers(IPacket packet) { /** * Sends a packet from the server to all players in a dimension around a location - * */ public void sendPacketToAllAroundPoint(IPacket packet, TargetPoint tp) { checkClassAndSync(packet.getClass()); @@ -132,7 +100,6 @@ public void sendPacketToAllAroundPoint(IPacket packet, TargetPoint tp) { /** * Sends a packet from the server to all players in a dimension - * */ public void sendPacketToAllInDimension(IPacket packet, int dimension) { checkClassAndSync(packet.getClass()); @@ -158,6 +125,32 @@ private void checkClassAndSync(Class clazz) { isCurrentlySendingSemaphor = true; } + /** + * Packets only need to implement this and offer a constructor with no args, unless you don't have constructors with + * >0 args. The class MUST also be statically accessible, else you will suffer an InstantiationException! Note + * Packets don't distinguish between being sent from client to server or the other way around, so be careful using + * them bidirectional or avoid doing that altogether. + */ + public interface IPacket { + + /** + * Executed upon sending a Packet away. Put your arbitrary data into the ByteBuffer, and retrieve it on the + * receiving side when readBytes is executed. + * + * @param ctx channel context + * @param bytes data being sent + */ + void writeBytes(ChannelHandlerContext ctx, ByteBuf bytes); + + /** + * Executed upon arrival of a Packet at a recipient. Byte order matches writeBytes exactly. + * + * @param ctx channel context, you can send answers through here directly + * @param bytes data being received + */ + void readBytes(ChannelHandlerContext ctx, ByteBuf bytes); + } + /** * Internal Channel Codec, automatic discrimination and data forwarding */ From 5b41f87de40bb4dd00ee5f9474b0e0117032c0c3 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 7 Sep 2024 00:34:23 +0200 Subject: [PATCH 09/12] update gradle.properties and use the generated Tag class --- gradle.properties | 26 ++++++------------- .../infernalmobs/common/InfernalMobsCore.java | 3 ++- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/gradle.properties b/gradle.properties index 51830766..0513fe2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable. # LOCAL to test local config updates. -gtnh.settings.blowdryerTag = 0.2.0 +gtnh.settings.blowdryerTag = 0.2.2 # Human-readable mod name, available for mcmod.info population. modName = Infernal Mobs @@ -37,32 +37,23 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co # Select a default username for testing your mod. You can always override this per-run by running # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. -developmentEnvironmentUserName = "Developer" +developmentEnvironmentUserName = Developer # Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. # See https://github.com/bsideup/jabel for details on how this works. -enableModernJavaSyntax = false +enableModernJavaSyntax = true # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. -enableGenericInjection = false +enableGenericInjection = true # Generate a class with a String field for the mod version named as defined below. # If generateGradleTokenClass is empty or not missing, no such class will be generated. # If gradleTokenVersion is empty or missing, the field will not be present in the class. -generateGradleTokenClass = +generateGradleTokenClass = atomicstryker.infernalmobs.Tags # Name of the token containing the project's current version to generate/replace. -gradleTokenVersion = GRADLETOKEN_VERSION - -# [DEPRECATED] Mod ID replacement token. -gradleTokenModId = - -# [DEPRECATED] Mod name replacement token. -gradleTokenModName = - -# [DEPRECATED] Mod Group replacement token. -gradleTokenGroupName = +gradleTokenVersion = VERSION # [DEPRECATED] # Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java @@ -70,7 +61,7 @@ gradleTokenGroupName = # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]). # Leave these properties empty to skip individual token replacements. -replaceGradleTokenInFile = InfernalMobsCore.java +replaceGradleTokenInFile = # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # leave this property empty. @@ -187,7 +178,7 @@ curseForgeRelations = # disableSpotless = true # Uncomment this to disable Checkstyle checks (currently wildcard import check). -disableCheckstyle = true +# disableCheckstyle = true # Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle" # (force use delegated build). @@ -200,4 +191,3 @@ disableCheckstyle = true # Whether IDEA should run spotless checks when pressing the Build button. # This is meant to be set in $HOME/.gradle/gradle.properties. # ideaCheckSpotlessOnBuild = true - diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index 3bbe1f07..6971e9f4 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -9,6 +9,7 @@ import java.util.Random; import java.util.UUID; +import atomicstryker.infernalmobs.Tags; import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.enchantment.EnchantmentHelper; @@ -89,7 +90,7 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.registry.GameData; -@Mod(modid = "InfernalMobs", name = "Infernal Mobs", version = "GRADLETOKEN_VERSION") +@Mod(modid = "InfernalMobs", name = "Infernal Mobs", version = Tags.VERSION) public class InfernalMobsCore { private final long existCheckDelay = 5000L; From e29aa5510da5ccbc5a9235d6bae50f4b7fa96427 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 7 Sep 2024 01:19:13 +0200 Subject: [PATCH 10/12] todo --- .../infernalmobs/common/InfernalMobsCore.java | 2 +- .../infernalmobs/common/modifiers/MobModifier.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index 6971e9f4..8291ab0a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -138,7 +138,7 @@ public static String getNBTTag() { private int maxUltraModifiers; private int minInfernoModifiers; private int maxInfernoModifiers; - public Configuration config; + public Configuration config; // TODO load the config only once... @SidedProxy( clientSide = "atomicstryker.infernalmobs.client.InfernalMobsClient", diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java index aaf50edb..2d4f40f4 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java @@ -150,6 +150,7 @@ public void onSpawningComplete(EntityLivingBase entity) { * @return true if death should be aborted */ public boolean onDeath() { + // TODO does it properly fires for every mod in the chain including the first that it was called on ? attackTarget = null; if (nextMod != null) { return nextMod.onDeath(); @@ -189,10 +190,10 @@ public void onSetAttackTarget(EntityLivingBase target) { * @return damage to be applied after we processed the value */ public float onAttack(EntityLivingBase entity, DamageSource source, float amount) { + // TODO does it properly fires for every mod in the chain including the first that it was called on ? if (nextMod != null) { return nextMod.onAttack(entity, source, amount); } - return amount; } @@ -204,6 +205,7 @@ public float onAttack(EntityLivingBase entity, DamageSource source, float amount * @return damage to be applied after we processed the value */ public float onHurt(EntityLivingBase mob, DamageSource source, float amount) { + // TODO does it properly fires for every mod in the chain including the first that it was called on ? if (nextMod != null) { amount = nextMod.onHurt(mob, source, amount); } else if (source.getEntity() != null) { @@ -219,10 +221,10 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float amount) { * passes the fall event to the modifier list */ public boolean onFall(float distance) { + // TODO does it properly fires for every mod in the chain including the first that it was called on ? if (nextMod != null) { return nextMod.onFall(distance); } - return false; } @@ -230,6 +232,7 @@ public boolean onFall(float distance) { * passes the jump event to the modifier list */ public void onJump(EntityLivingBase entityLiving) { + // TODO does it properly fires for every mod in the chain including the first that it was called on ? if (nextMod != null) { nextMod.onJump(entityLiving); } @@ -239,6 +242,7 @@ public void onJump(EntityLivingBase entityLiving) { * passes the update event to the modifier list the return value is currently unused */ public boolean onUpdate(EntityLivingBase mob) { + // TODO does it properly fires for every mod in the chain including the first that it was called on ? if (nextMod != null) { return nextMod.onUpdate(mob); } else { @@ -347,7 +351,6 @@ public int getModSize() { nextmod = nextmod.nextMod; } } - return bufferedSize; } From a798d024952a36e00cd1732f021e241c8e9035ea Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:23:44 +0200 Subject: [PATCH 11/12] new spotless --- .../client/InfernalMobsClient.java | 95 +++-- .../infernalmobs/client/RendererBossGlow.java | 20 +- .../infernalmobs/common/InfernalMobsCore.java | 378 ++++++++++-------- .../InfernalCommandFindEntityClass.java | 18 +- .../InfernalCommandSpawnInfernal.java | 50 ++- .../common/events/EntityEventHandler.java | 64 +-- .../common/events/SaveEventHandler.java | 10 +- .../infernalmobs/common/modifiers/MM_1UP.java | 8 +- .../common/modifiers/MM_Alchemist.java | 11 +- .../common/modifiers/MM_Berserk.java | 21 +- .../common/modifiers/MM_Blastoff.java | 17 +- .../common/modifiers/MM_Bulwark.java | 6 +- .../common/modifiers/MM_Choke.java | 7 +- .../common/modifiers/MM_Cloaking.java | 4 +- .../common/modifiers/MM_Darkness.java | 16 +- .../common/modifiers/MM_Ender.java | 53 +-- .../common/modifiers/MM_Fiery.java | 9 +- .../common/modifiers/MM_Ghastly.java | 4 +- .../common/modifiers/MM_Gravity.java | 21 +- .../common/modifiers/MM_Lifesteal.java | 9 +- .../common/modifiers/MM_Ninja.java | 61 +-- .../common/modifiers/MM_Poisonous.java | 12 +- .../common/modifiers/MM_Quicksand.java | 5 +- .../common/modifiers/MM_Regen.java | 5 +- .../common/modifiers/MM_Rust.java | 9 +- .../common/modifiers/MM_Sapper.java | 10 +- .../common/modifiers/MM_Sprint.java | 2 +- .../common/modifiers/MM_Sticky.java | 21 +- .../common/modifiers/MM_Storm.java | 12 +- .../common/modifiers/MM_Vengeance.java | 23 +- .../common/modifiers/MM_Weakness.java | 12 +- .../common/modifiers/MM_Webber.java | 12 +- .../common/modifiers/MM_Wither.java | 15 +- .../common/modifiers/MobModifier.java | 60 +-- .../common/network/NetworkHelper.java | 23 +- .../common/network/packets/HealthPacket.java | 6 +- .../common/network/packets/MobModsPacket.java | 9 +- 37 files changed, 632 insertions(+), 486 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java index 462268e5..fad2d417 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java +++ b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java @@ -46,8 +46,11 @@ public class InfernalMobsClient implements ISidedProxy { @Override public void preInit() { - FMLCommonHandler.instance().bus().register(this); - mc = FMLClientHandler.instance().getClient(); + FMLCommonHandler.instance() + .bus() + .register(this); + mc = FMLClientHandler.instance() + .getClient(); } @Override @@ -65,26 +68,35 @@ public void load() { @SubscribeEvent public void onEntityJoinedWorld(EntityJoinWorldEvent event) { if (event.world.isRemote && mc.thePlayer != null - && (event.entity instanceof EntityMob - || (event.entity instanceof EntityLivingBase && event.entity instanceof IMob))) { + && (event.entity instanceof EntityMob + || (event.entity instanceof EntityLivingBase && event.entity instanceof IMob))) { InfernalMobsCore.instance().networkHelper.sendPacketToServer( - new MobModsPacket(mc.thePlayer.getGameProfile().getName(), event.entity.getEntityId(), (byte) 0)); + new MobModsPacket( + mc.thePlayer.getGameProfile() + .getName(), + event.entity.getEntityId(), + (byte) 0)); } } private void askServerHealth(Entity ent) { if (System.currentTimeMillis() > nextPacketTime) { InfernalMobsCore.instance().networkHelper.sendPacketToServer( - new HealthPacket(mc.thePlayer.getGameProfile().getName(), ent.getEntityId(), 0f, 0f)); + new HealthPacket( + mc.thePlayer.getGameProfile() + .getName(), + ent.getEntityId(), + 0f, + 0f)); nextPacketTime = System.currentTimeMillis() + 100L; } } @SubscribeEvent public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { - if (InfernalMobsCore.instance().getIsHealthBarDisabled() - || event.type != RenderGameOverlayEvent.ElementType.BOSSHEALTH - || (BossStatus.bossName != null && BossStatus.statusBarTime > 0)) { + if (InfernalMobsCore.instance() + .getIsHealthBarDisabled() || event.type != RenderGameOverlayEvent.ElementType.BOSSHEALTH + || (BossStatus.bossName != null && BossStatus.statusBarTime > 0)) { return; } @@ -102,7 +114,8 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { askServerHealth(ent); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Gui.icons); + this.mc.getTextureManager() + .bindTexture(Gui.icons); GL11.glDisable(GL11.GL_BLEND); EntityLivingBase target = (EntityLivingBase) ent; @@ -116,7 +129,7 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { int x = screenwidth / 2 - lifeBarLength / 2; int lifeBarLeft = (int) (mod.getActualHealth(target) / mod.getActualMaxHealth(target) - * (float) (lifeBarLength + 1)); + * (float) (lifeBarLength + 1)); byte y = 12; gui.drawTexturedModalRect(x, y, 0, 74, lifeBarLength, 5); gui.drawTexturedModalRect(x, y, 0, 74, lifeBarLength, 5); @@ -126,26 +139,24 @@ public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre event) { } int yCoord = 10; - fontR.drawStringWithShadow( - buffer, - screenwidth / 2 - fontR.getStringWidth(buffer) / 2, - yCoord, - 0x2F96EB); + fontR + .drawStringWithShadow(buffer, screenwidth / 2 - fontR.getStringWidth(buffer) / 2, yCoord, 0x2F96EB); String[] display = mod.getDisplayNames(); int i = 0; while (i < display.length && display[i] != null) { yCoord += 10; fontR.drawStringWithShadow( - display[i], - screenwidth / 2 - fontR.getStringWidth(display[i]) / 2, - yCoord, - 0xffffff); + display[i], + screenwidth / 2 - fontR.getStringWidth(display[i]) / 2, + yCoord, + 0xffffff); i++; } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Gui.icons); + this.mc.getTextureManager() + .bindTexture(Gui.icons); if (!retained) { retainedTarget = target; @@ -172,28 +183,28 @@ private Entity getEntityCrosshairOver(float renderTick, Minecraft mc) { final Vec3 viewEntityLookVec = mc.renderViewEntity.getLook(renderTick); final Vec3 actualReachVector = viewEntPositionVec.addVector( - viewEntityLookVec.xCoord * reachDistance, - viewEntityLookVec.yCoord * reachDistance, - viewEntityLookVec.zCoord * reachDistance); + viewEntityLookVec.xCoord * reachDistance, + viewEntityLookVec.yCoord * reachDistance, + viewEntityLookVec.zCoord * reachDistance); float expandBBvalue = 1.0F; double lowestDistance = reachDist2; Entity iterEnt; Entity pointedEntity = null; for (Object obj : mc.theWorld.getEntitiesWithinAABBExcludingEntity( - mc.renderViewEntity, - mc.renderViewEntity.boundingBox - .addCoord( - viewEntityLookVec.xCoord * reachDistance, - viewEntityLookVec.yCoord * reachDistance, - viewEntityLookVec.zCoord * reachDistance) - .expand(expandBBvalue, expandBBvalue, expandBBvalue))) { + mc.renderViewEntity, + mc.renderViewEntity.boundingBox + .addCoord( + viewEntityLookVec.xCoord * reachDistance, + viewEntityLookVec.yCoord * reachDistance, + viewEntityLookVec.zCoord * reachDistance) + .expand(expandBBvalue, expandBBvalue, expandBBvalue))) { iterEnt = (Entity) obj; if (iterEnt.canBeCollidedWith()) { float entBorderSize = iterEnt.getCollisionBorderSize(); AxisAlignedBB entHitBox = iterEnt.boundingBox - .expand(entBorderSize, entBorderSize, entBorderSize); + .expand(entBorderSize, entBorderSize, entBorderSize); MovingObjectPosition interceptObjectPosition = entHitBox - .calculateIntercept(viewEntPositionVec, actualReachVector); + .calculateIntercept(viewEntPositionVec, actualReachVector); if (entHitBox.isVecInside(viewEntPositionVec)) { if (0.0D < lowestDistance || lowestDistance == 0.0D) { @@ -227,7 +238,8 @@ public ConcurrentHashMap getRareMobs() { @Override public void onHealthPacketForClient(String stringData, int entID, float health, float maxhealth) { - Entity ent = FMLClientHandler.instance().getClient().theWorld.getEntityByID(entID); + Entity ent = FMLClientHandler.instance() + .getClient().theWorld.getEntityByID(entID); if (ent instanceof EntityLivingBase) { MobModifier mod = InfernalMobsCore.getMobModifiers((EntityLivingBase) ent); if (mod != null) { @@ -239,18 +251,27 @@ public void onHealthPacketForClient(String stringData, int entID, float health, @Override public void onKnockBackPacket(float xv, float zv) { - MM_Gravity.knockBack(FMLClientHandler.instance().getClient().thePlayer, xv, zv); + MM_Gravity.knockBack( + FMLClientHandler.instance() + .getClient().thePlayer, + xv, + zv); } @Override public void onMobModsPacketToClient(String stringData, int entID) { InfernalMobsCore.instance() - .addRemoteEntityModifiers(FMLClientHandler.instance().getClient().theWorld, entID, stringData); + .addRemoteEntityModifiers( + FMLClientHandler.instance() + .getClient().theWorld, + entID, + stringData); } @Override public void onVelocityPacket(float xv, float yv, float zv) { - FMLClientHandler.instance().getClient().thePlayer.addVelocity(xv, yv, zv); + FMLClientHandler.instance() + .getClient().thePlayer.addVelocity(xv, yv, zv); } @Override diff --git a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java index af03cbf7..bb1f4394 100644 --- a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java +++ b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java @@ -43,17 +43,17 @@ private void renderBossGlow(float renderTick) { Map mobsmap = InfernalMobsCore.proxy.getRareMobs(); for (EntityLivingBase ent : mobsmap.keySet()) { if (viewEnt.worldObj.provider.dimensionId == ent.worldObj.provider.dimensionId - && ent.isInRangeToRenderDist(curPos.distanceTo(ent.getPosition(1.0f))) - && (ent.ignoreFrustumCheck || f.isBoundingBoxInFrustum(ent.boundingBox)) - && ent.isEntityAlive()) { + && ent.isInRangeToRenderDist(curPos.distanceTo(ent.getPosition(1.0f))) + && (ent.ignoreFrustumCheck || f.isBoundingBoxInFrustum(ent.boundingBox)) + && ent.isEntityAlive()) { mc.renderGlobal.spawnParticle( - "mobSpell", - ent.posX + (ent.worldObj.rand.nextDouble() - 0.5D) * (double) ent.width, - ent.posY + ent.worldObj.rand.nextDouble() * (double) ent.height - 0.25D, - ent.posZ + (ent.worldObj.rand.nextDouble() - 0.5D) * (double) ent.width, - (ent.worldObj.rand.nextDouble() - 0.5D) * 2.0D, - -ent.worldObj.rand.nextDouble(), - (ent.worldObj.rand.nextDouble() - 0.5D) * 2.0D); + "mobSpell", + ent.posX + (ent.worldObj.rand.nextDouble() - 0.5D) * (double) ent.width, + ent.posY + ent.worldObj.rand.nextDouble() * (double) ent.height - 0.25D, + ent.posZ + (ent.worldObj.rand.nextDouble() - 0.5D) * (double) ent.width, + (ent.worldObj.rand.nextDouble() - 0.5D) * 2.0D, + -ent.worldObj.rand.nextDouble(), + (ent.worldObj.rand.nextDouble() - 0.5D) * 2.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index 8291ab0a..78939f9f 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -9,7 +9,6 @@ import java.util.Random; import java.util.UUID; -import atomicstryker.infernalmobs.Tags; import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.enchantment.EnchantmentHelper; @@ -35,6 +34,7 @@ import com.google.common.collect.Lists; +import atomicstryker.infernalmobs.Tags; import atomicstryker.infernalmobs.common.commands.InfernalCommandFindEntityClass; import atomicstryker.infernalmobs.common.commands.InfernalCommandSpawnInfernal; import atomicstryker.infernalmobs.common.events.EntityEventHandler; @@ -141,8 +141,8 @@ public static String getNBTTag() { public Configuration config; // TODO load the config only once... @SidedProxy( - clientSide = "atomicstryker.infernalmobs.client.InfernalMobsClient", - serverSide = "atomicstryker.infernalmobs.common.InfernalMobsServer") + clientSide = "atomicstryker.infernalmobs.client.InfernalMobsClient", + serverSide = "atomicstryker.infernalmobs.common.InfernalMobsServer") public static ISidedProxy proxy; public NetworkHelper networkHelper; @@ -169,15 +169,17 @@ public void preInit(FMLPreInitializationEvent evt) { loadMods(); proxy.preInit(); - FMLCommonHandler.instance().bus().register(this); + FMLCommonHandler.instance() + .bus() + .register(this); networkHelper = new NetworkHelper( - "AS_IF", - MobModsPacket.class, - HealthPacket.class, - VelocityPacket.class, - KnockBackPacket.class, - AirPacket.class); + "AS_IF", + MobModsPacket.class, + HealthPacket.class, + VelocityPacket.class, + KnockBackPacket.class, + AirPacket.class); } @EventHandler @@ -188,9 +190,9 @@ public void load(FMLInitializationEvent evt) { proxy.load(); FMLLog.log( - "InfernalMobs", - Level.INFO, - String.format("InfernalMobsCore load() completed! Modifiers ready: %s", modifierLoaders.size())); + "InfernalMobs", + Level.INFO, + String.format("InfernalMobsCore load() completed! Modifiers ready: %s", modifierLoaders.size())); } @EventHandler @@ -210,39 +212,39 @@ public void serverStarted(FMLServerStartingEvent evt) { */ private void loadMods() { modifierLoaders = Lists.newArrayList( - new MM_1UP.Loader(), - new MM_Alchemist.Loader(), - new MM_Berserk.Loader(), - new MM_Blastoff.Loader(), - new MM_Bulwark.Loader(), - new MM_Choke.Loader(), - new MM_Cloaking.Loader(), - new MM_Darkness.Loader(), - new MM_Ender.Loader(), - new MM_Exhaust.Loader(), - new MM_Fiery.Loader(), - new MM_Ghastly.Loader(), - new MM_Gravity.Loader(), - new MM_Lifesteal.Loader(), - new MM_Ninja.Loader(), - new MM_Poisonous.Loader(), - new MM_Quicksand.Loader(), - new MM_Regen.Loader(), - new MM_Rust.Loader(), - new MM_Sapper.Loader(), - new MM_Sprint.Loader(), - new MM_Sticky.Loader(), - new MM_Storm.Loader(), - new MM_Vengeance.Loader(), - new MM_Weakness.Loader(), - new MM_Webber.Loader(), - new MM_Wither.Loader()); + new MM_1UP.Loader(), + new MM_Alchemist.Loader(), + new MM_Berserk.Loader(), + new MM_Blastoff.Loader(), + new MM_Bulwark.Loader(), + new MM_Choke.Loader(), + new MM_Cloaking.Loader(), + new MM_Darkness.Loader(), + new MM_Ender.Loader(), + new MM_Exhaust.Loader(), + new MM_Fiery.Loader(), + new MM_Ghastly.Loader(), + new MM_Gravity.Loader(), + new MM_Lifesteal.Loader(), + new MM_Ninja.Loader(), + new MM_Poisonous.Loader(), + new MM_Quicksand.Loader(), + new MM_Regen.Loader(), + new MM_Rust.Loader(), + new MM_Sapper.Loader(), + new MM_Sprint.Loader(), + new MM_Sticky.Loader(), + new MM_Storm.Loader(), + new MM_Vengeance.Loader(), + new MM_Weakness.Loader(), + new MM_Webber.Loader(), + new MM_Wither.Loader()); config.load(); modifierLoaders.removeIf( - loader -> !config.get(Configuration.CATEGORY_GENERAL, loader.getModifierClassName() + " enabled", true) - .getBoolean(true)); + loader -> !config.get(Configuration.CATEGORY_GENERAL, loader.getModifierClassName() + " enabled", true) + .getBoolean(true)); if (config.hasChanged()) config.save(); } @@ -254,109 +256,135 @@ private void loadConfig() { config.load(); eliteRarity = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "eliteRarity", - 15, - "One in THIS many Mobs will become atleast rare").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "eliteRarity", + 15, + "One in THIS many Mobs will become atleast rare") + .getString()); ultraRarity = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "ultraRarity", - 7, - "One in THIS many already rare Mobs will become atleast ultra").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "ultraRarity", + 7, + "One in THIS many already rare Mobs will become atleast ultra") + .getString()); infernoRarity = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "infernoRarity", - 7, - "One in THIS many already ultra Mobs will become infernal").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "infernoRarity", + 7, + "One in THIS many already ultra Mobs will become infernal") + .getString()); minEliteModifiers = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "minEliteModifiers", - 2, - "Minimum number of Modifiers an Elite mob will receive").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "minEliteModifiers", + 2, + "Minimum number of Modifiers an Elite mob will receive") + .getString()); maxEliteModifiers = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "maxEliteModifiers", - 5, - "Maximum number of Modifiers an Elite mob will receive").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "maxEliteModifiers", + 5, + "Maximum number of Modifiers an Elite mob will receive") + .getString()); minUltraModifiers = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "minUltraModifiers", - 5, - "Minimum number of Modifiers an Ultra mob will receive").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "minUltraModifiers", + 5, + "Minimum number of Modifiers an Ultra mob will receive") + .getString()); maxUltraModifiers = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "maxUltraModifiers", - 10, - "Maximum number of Modifiers an Ultra mob will receive").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "maxUltraModifiers", + 10, + "Maximum number of Modifiers an Ultra mob will receive") + .getString()); minInfernoModifiers = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "minInfernoModifiers", - 8, - "Minimum number of Modifiers an Inferno mob will receive").getString()); + config + .get( + Configuration.CATEGORY_GENERAL, + "minInfernoModifiers", + 8, + "Minimum number of Modifiers an Inferno mob will receive") + .getString()); maxInfernoModifiers = Integer.parseInt( - config.get( - Configuration.CATEGORY_GENERAL, - "maxInfernoModifiers", - 15, - "Maximum number of Modifiers an Inferno mob will receive").getString()); - useSimpleEntityClassNames = config.get( + config + .get( + Configuration.CATEGORY_GENERAL, + "maxInfernoModifiers", + 15, + "Maximum number of Modifiers an Inferno mob will receive") + .getString()); + useSimpleEntityClassNames = config + .get( Configuration.CATEGORY_GENERAL, "useSimpleEntityClassnames", true, - "Use Entity class names instead of ingame Entity names for the config").getBoolean(true); - disableHealthBar = config.get( + "Use Entity class names instead of ingame Entity names for the config") + .getBoolean(true); + disableHealthBar = config + .get( Configuration.CATEGORY_GENERAL, "disableGUIoverlay", false, - "Disables the ingame Health and Name overlay").getBoolean(false); - modHealthFactor = config.get( + "Disables the ingame Health and Name overlay") + .getBoolean(false); + modHealthFactor = config + .get( Configuration.CATEGORY_GENERAL, "mobHealthFactor", "1.0", - "Multiplier applied ontop of all of the modified Mobs health").getDouble(1.0D); + "Multiplier applied ontop of all of the modified Mobs health") + .getDouble(1.0D); parseItemsForList( - config.get( - Configuration.CATEGORY_GENERAL, - "droppedItemIDsElite", - "iron_shovel,iron_pickaxe,iron_axe,iron_sword,iron_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,iron_helmet,iron_chestplate,iron_leggings,iron_boots,cookie-0-6", - "List of equally likely to drop Items for Elites, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") - .getString(), - this.dropIdListElite); + config.get( + Configuration.CATEGORY_GENERAL, + "droppedItemIDsElite", + "iron_shovel,iron_pickaxe,iron_axe,iron_sword,iron_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,iron_helmet,iron_chestplate,iron_leggings,iron_boots,cookie-0-6", + "List of equally likely to drop Items for Elites, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") + .getString(), + this.dropIdListElite); parseItemsForList( - config.get( - Configuration.CATEGORY_GENERAL, - "droppedItemIDsUltra", - "bow,iron_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,iron_helmet,iron_chestplate,iron_leggings,iron_boots,golden_helmet,golden_chestplate,golden_leggings,golden_boots,golden_apple,blaze_powder-0-3,enchanted_book", - "List of equally likely to drop Items for Ultras, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") - .getString(), - this.dropIdListUltra); + config.get( + Configuration.CATEGORY_GENERAL, + "droppedItemIDsUltra", + "bow,iron_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,iron_helmet,iron_chestplate,iron_leggings,iron_boots,golden_helmet,golden_chestplate,golden_leggings,golden_boots,golden_apple,blaze_powder-0-3,enchanted_book", + "List of equally likely to drop Items for Ultras, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") + .getString(), + this.dropIdListUltra); parseItemsForList( - config.get( - Configuration.CATEGORY_GENERAL, - "droppedItemIDsInfernal", - "diamond-0-3,diamond_sword,diamond_shovel,diamond_pickaxe,diamond_axe,diamond_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,diamond_helmet,diamond_chestplate,diamond_leggings,diamond_boots,ender_pearl,enchanted_book", - "List of equally likely to drop Items for Infernals, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") - .getString(), - this.dropIdListInfernal); + config.get( + Configuration.CATEGORY_GENERAL, + "droppedItemIDsInfernal", + "diamond-0-3,diamond_sword,diamond_shovel,diamond_pickaxe,diamond_axe,diamond_hoe,chainmail_helmet,chainmail_chestplate,chainmail_leggings,chainmail_boots,diamond_helmet,diamond_chestplate,diamond_leggings,diamond_boots,ender_pearl,enchanted_book", + "List of equally likely to drop Items for Infernals, seperated by commas, syntax: ID-meta-stackSize-stackSizeRandomizer, everything but ID is optional, see changelog") + .getString(), + this.dropIdListInfernal); parseIDsForList( - config.get( - Configuration.CATEGORY_GENERAL, - "dimensionIDBlackList", - "", - "List of DimensionIDs where InfernalMobs will NEVER spawn").getString(), - this.dimensionBlackList); + config + .get( + Configuration.CATEGORY_GENERAL, + "dimensionIDBlackList", + "", + "List of DimensionIDs where InfernalMobs will NEVER spawn") + .getString(), + this.dimensionBlackList); for (ModifierLoader loader : modifierLoaders) { loader.loadConfig(config); @@ -375,16 +403,16 @@ private void parseIDsForList(String dimensionIDs, ArrayList list) { Integer tDimID = Integer.parseInt(trimmedDimIDString); list.add(tDimID); FMLLog.log( - "InfernalMobs", - Level.INFO, - String.format("DimensionID %d is now Blacklisted for InfernalMobs spawn", tDimID)); + "InfernalMobs", + Level.INFO, + String.format("DimensionID %d is now Blacklisted for InfernalMobs spawn", tDimID)); } catch (Exception e) { FMLLog.log( - "InfernalMobs", - Level.ERROR, - String.format( - "Configured DimensionID %s is not an integer! All values must be numeric. Ignoring entry", - trimmedDimIDString)); + "InfernalMobs", + Level.ERROR, + String.format( + "Configured DimensionID %s is not an integer! All values must be numeric. Ignoring entry", + trimmedDimIDString)); } } } @@ -414,12 +442,14 @@ private void parseItemsForList(String itemIDs, ArrayList list) { } private Object parseOrFind(String s) { - Item item = GameData.getItemRegistry().getObject(s); + Item item = GameData.getItemRegistry() + .getObject(s); if (item != null) { return item; } - Block block = GameData.getBlockRegistry().getObject(s); + Block block = GameData.getBlockRegistry() + .getObject(s); if (block != Blocks.air) { return block; } @@ -435,7 +465,7 @@ public void processEntitySpawn(EntityLivingBase entity) { if (!entity.worldObj.isRemote) { if (!getIsRareEntity(entity)) { if (isClassAllowed(entity) - && (checkEntityClassForced(entity) || entity.worldObj.rand.nextInt(eliteRarity) == 0)) { + && (checkEntityClassForced(entity) || entity.worldObj.rand.nextInt(eliteRarity) == 0)) { try { Integer tEntityDim = entity.dimension; @@ -475,25 +505,28 @@ private String getEntityNameSafe(Entity entity) { try { result = EntityList.getEntityString(entity); } catch (Exception e) { - result = entity.getClass().getSimpleName(); + result = entity.getClass() + .getSimpleName(); FMLLog.log( - "InfernalMobs", - Level.INFO, - String.format( - "Entity of class %s crashed when EntityList.getEntityString was queried, for shame! Using classname instead. If this message is spamming too much for your taste set useSimpleEntityClassnames true in your Infernal Mobs config", - result)); + "InfernalMobs", + Level.INFO, + String.format( + "Entity of class %s crashed when EntityList.getEntityString was queried, for shame! Using classname instead. If this message is spamming too much for your taste set useSimpleEntityClassnames true in your Infernal Mobs config", + result)); } return result; } private boolean checkEntityClassAllowed(EntityLivingBase entity) { - String entName = useSimpleEntityClassNames ? entity.getClass().getSimpleName() : getEntityNameSafe(entity); + String entName = useSimpleEntityClassNames ? entity.getClass() + .getSimpleName() : getEntityNameSafe(entity); if (classesAllowedMap.containsKey(entName)) { return classesAllowedMap.get(entName); } config.load(); - boolean result = config.get("permittedentities", entName, true).getBoolean(true); + boolean result = config.get("permittedentities", entName, true) + .getBoolean(true); if (config.hasChanged()) config.save(); classesAllowedMap.put(entName, result); @@ -501,13 +534,15 @@ private boolean checkEntityClassAllowed(EntityLivingBase entity) { } public boolean checkEntityClassForced(EntityLivingBase entity) { - String entName = useSimpleEntityClassNames ? entity.getClass().getSimpleName() : getEntityNameSafe(entity); + String entName = useSimpleEntityClassNames ? entity.getClass() + .getSimpleName() : getEntityNameSafe(entity); if (classesForcedMap.containsKey(entName)) { return classesForcedMap.get(entName); } config.load(); - boolean result = config.get("entitiesalwaysinfernal", entName, false).getBoolean(false); + boolean result = config.get("entitiesalwaysinfernal", entName, false) + .getBoolean(false); if (config.hasChanged()) config.save(); classesForcedMap.put(entName, result); @@ -515,14 +550,15 @@ public boolean checkEntityClassForced(EntityLivingBase entity) { } public float getMobClassMaxHealth(EntityLivingBase entity) { - String entName = useSimpleEntityClassNames ? entity.getClass().getSimpleName() : getEntityNameSafe(entity); + String entName = useSimpleEntityClassNames ? entity.getClass() + .getSimpleName() : getEntityNameSafe(entity); if (classesHealthMap.containsKey(entName)) { return classesHealthMap.get(entName); } config.load(); float result = (float) config.get("entitybasehealth", entName, entity.getMaxHealth()) - .getDouble(entity.getMaxHealth()); + .getDouble(entity.getMaxHealth()); if (config.hasChanged()) config.save(); classesHealthMap.put(entName, result); @@ -564,7 +600,7 @@ public MobModifier createMobModifiers(EntityLivingBase entity) { } } int number = Math.min(minModifiers, maxModifiers) + entity.worldObj.rand - .nextInt((Math.max(minModifiers, maxModifiers) - Math.min(minModifiers, maxModifiers)) + 1); + .nextInt((Math.max(minModifiers, maxModifiers) - Math.min(minModifiers, maxModifiers)) + 1); MobModifier lastMod = null; while (number > 0 && !possibleMods.isEmpty()) // so long we need more @@ -573,12 +609,14 @@ public MobModifier createMobModifiers(EntityLivingBase entity) { /* random index of mod list */ int index = entity.worldObj.rand.nextInt(possibleMods.size()); - MobModifier nextMod = possibleMods.get(index).make(lastMod); + MobModifier nextMod = possibleMods.get(index) + .make(lastMod); boolean allowed = true; if (nextMod.getBlackListMobClasses() != null) { for (Class cl : nextMod.getBlackListMobClasses()) { - if (entity.getClass().isAssignableFrom(cl)) { + if (entity.getClass() + .isAssignableFrom(cl)) { allowed = false; break; } @@ -611,7 +649,8 @@ public MobModifier createMobModifiers(EntityLivingBase entity) { public void addEntityModifiers(EntityLivingBase entity, MobModifier mod, boolean isHealthHacked) { if (mod != null) { - proxy.getRareMobs().put(entity, mod); + proxy.getRareMobs() + .put(entity, mod); mod.onSpawningComplete(entity); if (isHealthHacked) { mod.setHealthAlreadyHacked(entity); @@ -632,9 +671,9 @@ public void addEntityModifiersByString(EntityLivingBase entity, String savedMods addEntityModifiers(entity, mod, true); } else { FMLLog.log( - "InfernalMobs", - Level.DEBUG, - String.format("Infernal Mobs error, could not instantiate modifier(s) %s", savedMods)); + "InfernalMobs", + Level.DEBUG, + String.format("Infernal Mobs error, could not instantiate modifier(s) %s", savedMods)); } } } @@ -650,7 +689,8 @@ private MobModifier stringToMobModifiers(String buffer) { for (ModifierLoader loader : modifierLoaders) { nextMod = loader.make(lastMod); - if (nextMod.getModName().equalsIgnoreCase(modName)) { + if (nextMod.getModName() + .equalsIgnoreCase(modName)) { /* * Only actually keep the new linked instance if it's what we wanted */ @@ -664,15 +704,18 @@ private MobModifier stringToMobModifiers(String buffer) { } public static MobModifier getMobModifiers(EntityLivingBase ent) { - return proxy.getRareMobs().get(ent); + return proxy.getRareMobs() + .get(ent); } public static boolean getIsRareEntity(EntityLivingBase ent) { - return proxy.getRareMobs().containsKey(ent); + return proxy.getRareMobs() + .containsKey(ent); } public static void removeEntFromElites(EntityLivingBase entity) { - proxy.getRareMobs().remove(entity); + proxy.getRareMobs() + .remove(entity); } /** @@ -757,8 +800,9 @@ private void enchantRandomly(Random rand, ItemStack itemStack, int itemEnchantab */ private ItemStack getRandomItem(EntityLivingBase mob, int prefix) { ArrayList list = (prefix == 0) ? dropIdListElite - : (prefix == 1) ? dropIdListUltra : dropIdListInfernal; - return !list.isEmpty() ? list.get(mob.worldObj.rand.nextInt(list.size())).copy() : null; + : (prefix == 1) ? dropIdListUltra : dropIdListInfernal; + return !list.isEmpty() ? list.get(mob.worldObj.rand.nextInt(list.size())) + .copy() : null; } public void sendVelocityPacket(EntityPlayerMP target, float xVel, float yVel, float zVel) { @@ -775,17 +819,19 @@ public void sendKnockBackPacket(EntityPlayerMP target, float xVel, float zVel) { public void sendHealthPacket(EntityLivingBase mob, float health) { networkHelper.sendPacketToAllAroundPoint( - new HealthPacket("", mob.getEntityId(), mob.getHealth(), mob.getMaxHealth()), - new TargetPoint(mob.dimension, mob.posX, mob.posY, mob.posZ, 32d)); + new HealthPacket("", mob.getEntityId(), mob.getHealth(), mob.getMaxHealth()), + new TargetPoint(mob.dimension, mob.posX, mob.posY, mob.posZ, 32d)); } public void sendHealthRequestPacket(EntityLivingBase mob) { networkHelper.sendPacketToServer( - new HealthPacket( - FMLClientHandler.instance().getClient().thePlayer.getGameProfile().getName(), - mob.getEntityId(), - 0f, - 0f)); + new HealthPacket( + FMLClientHandler.instance() + .getClient().thePlayer.getGameProfile() + .getName(), + mob.getEntityId(), + 0f, + 0f)); } public void sendAirPacket(EntityPlayerMP target, int lastAir) { @@ -817,7 +863,8 @@ public void onTick(TickEvent.WorldTickEvent tick) { } private void resetModifiedPlayerEntitiesAsNeeded(World world) { - Iterator> iterator = modifiedPlayerTimes.entrySet().iterator(); + Iterator> iterator = modifiedPlayerTimes.entrySet() + .iterator(); while (iterator.hasNext()) { Entry entry = iterator.next(); if (System.currentTimeMillis() > entry.getValue() + (existCheckDelay * 2)) { @@ -825,7 +872,8 @@ private void resetModifiedPlayerEntitiesAsNeeded(World world) { for (Object p : world.playerEntities) { if (p instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) p; - if (player.getUniqueID().equals(id)) { + if (player.getUniqueID() + .equals(id)) { for (ModifierLoader loader : modifierLoaders) { MobModifier modifier = loader.make(null); modifier.resetModifiedVictim(player); diff --git a/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java index 875fea14..f3a0f60e 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java +++ b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java @@ -32,19 +32,24 @@ public void processCommand(ICommandSender sender, String[] args) { } else { StringBuilder classname = new StringBuilder(args[0]); for (int i = 1; i < args.length; i++) { - classname.append(" ").append(args[i]); + classname.append(" ") + .append(args[i]); } StringBuilder result = new StringBuilder("Found Entity classes: "); final Collection classes = EntityList.classToStringMapping.values(); boolean found = false; for (String entclass : classes) { - if (entclass.toLowerCase().contains(classname.toString().toLowerCase())) { + if (entclass.toLowerCase() + .contains( + classname.toString() + .toLowerCase())) { if (!found) { result.append(entclass); found = true; } else { - result.append(", ").append(entclass); + result.append(", ") + .append(entclass); } } } @@ -53,7 +58,9 @@ public void processCommand(ICommandSender sender, String[] args) { result.append("Nothing found."); } - FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, sender.getCommandSenderName() + ": " + result); + FMLCommonHandler.instance() + .getFMLLogger() + .log(Level.INFO, sender.getCommandSenderName() + ": " + result); } } @@ -65,7 +72,8 @@ public int getRequiredPermissionLevel() { @Override public int compareTo(Object o) { if (o instanceof ICommand) { - return ((ICommand) o).getCommandName().compareTo(getCommandName()); + return ((ICommand) o).getCommandName() + .compareTo(getCommandName()); } return 0; } diff --git a/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java index a94cb98c..5ecba592 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java @@ -38,36 +38,47 @@ public void processCommand(ICommandSender sender, String[] args) { final int z = (args[2].equals("~")) ? sender.getPlayerCoordinates().posZ : Integer.parseInt(args[2]); StringBuilder modifier = new StringBuilder(args[4]); for (int i = 5; i < args.length; i++) { - modifier.append(" ").append(args[i]); + modifier.append(" ") + .append(args[i]); } final Class entClass = (Class) EntityList.stringToClassMapping - .get(args[3]); + .get(args[3]); if (entClass != null) { - EntityLivingBase mob = entClass.getConstructor(World.class).newInstance(sender.getEntityWorld()); + EntityLivingBase mob = entClass.getConstructor(World.class) + .newInstance(sender.getEntityWorld()); mob.setPosition(x + 0.5, y + 0.5, z + 0.5); - sender.getEntityWorld().spawnEntityInWorld(mob); + sender.getEntityWorld() + .spawnEntityInWorld(mob); - InfernalMobsCore.proxy.getRareMobs().remove(mob); - if (modifier.toString().equals("~")) { - MobModifier mod = InfernalMobsCore.instance().createMobModifiers(mob); - InfernalMobsCore.instance().addEntityModifiers(mob, mod, true); + InfernalMobsCore.proxy.getRareMobs() + .remove(mob); + if (modifier.toString() + .equals("~")) { + MobModifier mod = InfernalMobsCore.instance() + .createMobModifiers(mob); + InfernalMobsCore.instance() + .addEntityModifiers(mob, mod, true); } else { - InfernalMobsCore.instance().addEntityModifiersByString(mob, modifier.toString()); + InfernalMobsCore.instance() + .addEntityModifiersByString(mob, modifier.toString()); } MobModifier mod = InfernalMobsCore.getMobModifiers(mob); if (mod != null) { - FMLCommonHandler.instance().getFMLLogger().log( + FMLCommonHandler.instance() + .getFMLLogger() + .log( Level.INFO, sender.getCommandSenderName() + " spawned: " - + InfernalMobsCore.getMobModifiers(mob).getLinkedModNameUntranslated() - + " at [" - + x - + "|" - + y - + "|" - + z - + "]"); + + InfernalMobsCore.getMobModifiers(mob) + .getLinkedModNameUntranslated() + + " at [" + + x + + "|" + + y + + "|" + + z + + "]"); } else { throw new WrongUsageException("Error adding Infernal Modifier " + modifier + " to mob " + mob); } @@ -89,7 +100,8 @@ public int getRequiredPermissionLevel() { @Override public int compareTo(Object o) { if (o instanceof ICommand) { - return ((ICommand) o).getCommandName().compareTo(getCommandName()); + return ((ICommand) o).getCommandName() + .compareTo(getCommandName()); } return 0; } diff --git a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java index 86d3a2da..849da7f8 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java @@ -42,22 +42,26 @@ public EntityEventHandler() { Configuration config = InfernalMobsCore.instance().config; config.load(); - antiMobFarm = config.get( + antiMobFarm = config + .get( Configuration.CATEGORY_GENERAL, "AntiMobfarmingEnabled", true, - "Anti Mob farming mechanic. Might cause overhead if enabled.").getBoolean(true); + "Anti Mob farming mechanic. Might cause overhead if enabled.") + .getBoolean(true); mobFarmCheckIntervals = config.get( - Configuration.CATEGORY_GENERAL, - "AntiMobFarmCheckInterval", - 30, - "time in seconds between mob check intervals. Higher values cost more performance, but might be more accurate.") - .getInt() * 1000L; - mobFarmDamageTrigger = (float) config.get( + Configuration.CATEGORY_GENERAL, + "AntiMobFarmCheckInterval", + 30, + "time in seconds between mob check intervals. Higher values cost more performance, but might be more accurate.") + .getInt() * 1000L; + mobFarmDamageTrigger = (float) config + .get( Configuration.CATEGORY_GENERAL, "mobFarmDamageThreshold", 150D, - "Damage in chunk per interval that triggers anti farm effects").getDouble(150D); + "Damage in chunk per interval that triggers anti farm effects") + .getDouble(150D); if (config.hasChanged()) config.save(); damageMap = new HashMap<>(); @@ -67,11 +71,14 @@ public EntityEventHandler() { @SubscribeEvent public void onEntityJoinedWorld(EntityJoinWorldEvent event) { if (event.entity instanceof EntityLivingBase) { - String savedMods = event.entity.getEntityData().getString(InfernalMobsCore.getNBTTag()); + String savedMods = event.entity.getEntityData() + .getString(InfernalMobsCore.getNBTTag()); if (!savedMods.isEmpty()) { - InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) event.entity, savedMods); + InfernalMobsCore.instance() + .addEntityModifiersByString((EntityLivingBase) event.entity, savedMods); } else { - InfernalMobsCore.instance().processEntitySpawn((EntityLivingBase) event.entity); + InfernalMobsCore.instance() + .processEntitySpawn((EntityLivingBase) event.entity); } } } @@ -131,13 +138,13 @@ public void onEntityLivingHurt(LivingHurtEvent event) { * check for an environmental/automated damage type, aka mob farms */ if (event.source == DamageSource.cactus || event.source == DamageSource.drown - || event.source == DamageSource.fall - || event.source == DamageSource.inWall - || event.source == DamageSource.lava - || event.source.getEntity() instanceof FakePlayer) { + || event.source == DamageSource.fall + || event.source == DamageSource.inWall + || event.source == DamageSource.lava + || event.source.getEntity() instanceof FakePlayer) { ChunkCoordIntPair cpair = new ChunkCoordIntPair( - (int) event.entityLiving.posX, - (int) event.entityLiving.posZ); + (int) event.entityLiving.posX, + (int) event.entityLiving.posZ); Float value = damageMap.get(cpair); if (value == null) { for (Entry e : damageMap.entrySet()) { @@ -202,11 +209,10 @@ public void onEntityLivingUpdate(LivingEvent.LivingUpdateEvent event) { // maxC.getCenterZPosition())); if (maxDamage > mobFarmDamageTrigger) { MinecraftForge.EVENT_BUS.post( - new MobFarmDetectedEvent( - event.entityLiving.worldObj - .getChunkFromChunkCoords(maxC.chunkXPos, maxC.chunkZPos), - mobFarmCheckIntervals, - maxDamage)); + new MobFarmDetectedEvent( + event.entityLiving.worldObj.getChunkFromChunkCoords(maxC.chunkXPos, maxC.chunkZPos), + mobFarmCheckIntervals, + maxDamage)); } damageMap.clear(); } @@ -221,12 +227,12 @@ public void onEntityLivingDrops(LivingDropsEvent event) { MobModifier mod = InfernalMobsCore.getMobModifiers(event.entityLiving); if (mod != null) { mod.onDropItems( - event.entityLiving, - event.source, - event.drops, - event.lootingLevel, - event.recentlyHit, - event.specialDropValue); + event.entityLiving, + event.source, + event.drops, + event.lootingLevel, + event.recentlyHit, + event.specialDropValue); InfernalMobsCore.removeEntFromElites(event.entityLiving); } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java index 7b9887ac..10fce816 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java @@ -38,9 +38,11 @@ public void onChunkLoad(ChunkEvent.Load event) { for (int j = 0; j < chunk.entityLists[i].size(); j++) { newEnt = (Entity) chunk.entityLists[i].get(j); if (newEnt instanceof EntityLivingBase) { - String savedMods = newEnt.getEntityData().getString(InfernalMobsCore.getNBTTag()); + String savedMods = newEnt.getEntityData() + .getString(InfernalMobsCore.getNBTTag()); if (!savedMods.isEmpty()) { - InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) newEnt, savedMods); + InfernalMobsCore.instance() + .addEntityModifiersByString((EntityLivingBase) newEnt, savedMods); } } } @@ -49,6 +51,8 @@ public void onChunkLoad(ChunkEvent.Load event) { @SubscribeEvent public void onWorldUnload(WorldEvent.Unload event) { - InfernalMobsCore.proxy.getRareMobs().entrySet().removeIf(entry -> entry.getKey().worldObj == event.world); + InfernalMobsCore.proxy.getRareMobs() + .entrySet() + .removeIf(entry -> entry.getKey().worldObj == event.world); } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java index fd9f9b62..17a23404 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_1UP.java @@ -23,7 +23,8 @@ public MM_1UP(@Nullable MobModifier next) { @Override public boolean onUpdate(EntityLivingBase mob) { if (!healed && mob.getHealth() < (getActualMaxHealth(mob) * 0.25)) { - InfernalMobsCore.instance().setEntityHealthPastMax(mob, getActualMaxHealth(mob) * (float) healAmount); + InfernalMobsCore.instance() + .setEntityHealthPastMax(mob, getActualMaxHealth(mob) * (float) healAmount); mob.worldObj.playSoundAtEntity(mob, "random.levelup", 1.0F, 1.0F); healed = true; } @@ -58,12 +59,13 @@ public MM_1UP make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { - healAmount = config.get( + healAmount = config + .get( getModifierClassName(), "healAmountMultiplier", 1.0D, "Multiplies the mob maximum health when healing back up, cannot get past maximum mob health") - .getDouble(1.0D); + .getDouble(1.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java index 4deafcae..c78e094a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java @@ -47,10 +47,11 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { potion.setPotionDamage(32698); } else if (target.getHealth() >= 8 && !target.isPotionActive(Potion.poison)) { potion.setPotionDamage(32660); - } else - if (distance <= 3.0F && !target.isPotionActive(Potion.weakness) && mob.getRNG().nextFloat() < 0.25F) { - potion.setPotionDamage(32696); - } + } else if (distance <= 3.0F && !target.isPotionActive(Potion.weakness) + && mob.getRNG() + .nextFloat() < 0.25F) { + potion.setPotionDamage(32696); + } potion.setThrowableHeading(diffX, diffY + (double) (distance * 0.2F), diffZ, 0.75F, 8.0F); mob.worldObj.spawnEntityInWorld(potion); @@ -81,7 +82,7 @@ public MM_Alchemist make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 6000L, "Time between ability uses") - .getInt(6000) / 50; + .getInt(6000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java index c19173a2..e8132561 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java @@ -22,7 +22,8 @@ public MM_Berserk(@Nullable MobModifier next) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { if (entity != null) { - source.getEntity().attackEntityFrom(DamageSource.generic, damage); + source.getEntity() + .attackEntityFrom(DamageSource.generic, damage); damage = Math.min(maxBerserkDamage, damage * damageMultiplier); } @@ -57,17 +58,15 @@ public MM_Berserk make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { - damageMultiplier = (float) config.get( - getModifierClassName(), - "damageMultiplier", - 2.0D, - "Damage multiplier, limited by maxOneShotDamage").getDouble(2.0D); + damageMultiplier = (float) config + .get(getModifierClassName(), "damageMultiplier", 2.0D, "Damage multiplier, limited by maxOneShotDamage") + .getDouble(2.0D); maxBerserkDamage = (float) config.get( - getModifierClassName(), - "berserkMaxDamage", - 0.0D, - "Maximum amount of damage that a mob with Berserk can deal (0, or less than zero for unlimited berserk damage)") - .getDouble(0.0D); + getModifierClassName(), + "berserkMaxDamage", + 0.0D, + "Maximum amount of damage that a mob with Berserk can deal (0, or less than zero for unlimited berserk damage)") + .getDouble(0.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java index a14bebf9..a4bc29d1 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java @@ -36,8 +36,8 @@ public boolean onUpdate(EntityLivingBase mob) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && source.getEntity() instanceof EntityLivingBase - && !(source.getEntity() instanceof EntityPlayer - && ((EntityPlayer) source.getEntity()).capabilities.disableDamage)) { + && !(source.getEntity() instanceof EntityPlayer + && ((EntityPlayer) source.getEntity()).capabilities.disableDamage)) { tryAbility(mob, (EntityLivingBase) source.getEntity()); } @@ -53,15 +53,16 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { if (time > nextAbilityUse) { nextAbilityUse = time + coolDown; mob.worldObj.playSoundAtEntity( - mob, - "mob.slime.attack", - 1.0F, - (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F + 1.0F); + mob, + "mob.slime.attack", + 1.0F, + (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F + 1.0F); if (target.worldObj.isRemote || !(target instanceof EntityPlayerMP)) { target.addVelocity(0, 1.1D, 0); } else { - InfernalMobsCore.instance().sendVelocityPacket((EntityPlayerMP) target, 0f, 1.1f, 0f); + InfernalMobsCore.instance() + .sendVelocityPacket((EntityPlayerMP) target, 0f, 1.1f, 0f); } } } @@ -95,7 +96,7 @@ public MM_Blastoff make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 15000L, "Time between ability uses") - .getInt(15000) / 50; + .getInt(15000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java index 9873c964..1af9f365 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java @@ -44,11 +44,13 @@ public MM_Bulwark make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { - damageMultiplier = (float) config.get( + damageMultiplier = (float) config + .get( getModifierClassName(), "damageMultiplier", 0.5D, - "Damage (taken) multiplier, only makes sense for values < 1.0").getDouble(0.5D); + "Damage (taken) multiplier, only makes sense for values < 1.0") + .getDouble(0.5D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java index 9803823d..1ce417f0 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java @@ -78,11 +78,14 @@ public boolean onDeath() { private void updateAir() { lastTarget.setAir(lastAir); if (lastTarget instanceof EntityPlayerMP) { - InfernalMobsCore.instance().sendAirPacket((EntityPlayerMP) lastTarget, lastAir); + InfernalMobsCore.instance() + .sendAirPacket((EntityPlayerMP) lastTarget, lastAir); UUID id = lastTarget.getUniqueID(); if (id != null) { - InfernalMobsCore.instance().getModifiedPlayerTimes().put(id, System.currentTimeMillis()); + InfernalMobsCore.instance() + .getModifiedPlayerTimes() + .put(id, System.currentTimeMillis()); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java index d1138257..a928d8ba 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Cloaking.java @@ -78,9 +78,9 @@ public MM_Cloaking make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { potionDuration = config.get(getModifierClassName(), "cloakingDurationTicks", 200L, "Time mob is cloaked") - .getInt(200); + .getInt(200); coolDown = config.get(getModifierClassName(), "coolDownMillis", 12000L, "Time between ability uses") - .getInt(12000) / 50; + .getInt(12000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java index b59f1567..73486841 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java @@ -24,11 +24,12 @@ public MM_Darkness(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) - && InfernalMobsCore.instance().getIsEntityAllowedTarget(source.getEntity()) - && !(source instanceof EntityDamageSourceIndirect) - && !source.isProjectile()) { + && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(source.getEntity()) + && !(source instanceof EntityDamageSourceIndirect) + && !source.isProjectile()) { ((EntityLivingBase) source.getEntity()) - .addPotionEffect(new PotionEffect(Potion.blindness.id, potionDuration, 0)); + .addPotionEffect(new PotionEffect(Potion.blindness.id, potionDuration, 0)); } return super.onHurt(mob, source, damage); @@ -36,7 +37,8 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(entity)) { + if (entity != null && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(entity)) { entity.addPotionEffect(new PotionEffect(Potion.blindness.id, potionDuration, 0)); } @@ -67,8 +69,8 @@ public MM_Darkness make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { potionDuration = config - .get(getModifierClassName(), "darknessDurationTicks", 120L, "Time attacker is darkened") - .getInt(120); + .get(getModifierClassName(), "darknessDurationTicks", 120L, "Time attacker is darkened") + .getInt(120); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java index 054ce2fa..aea1e556 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java @@ -29,11 +29,13 @@ public MM_Ender(@Nullable MobModifier next) { public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { long time = mob.ticksExisted; if (time > nextAbilityUse && source.getEntity() != null - && source.getEntity() != mob - && teleportToEntity(mob, source.getEntity()) - && !InfernalMobsCore.instance().isInfiniteLoop(mob, source.getEntity())) { + && source.getEntity() != mob + && teleportToEntity(mob, source.getEntity()) + && !InfernalMobsCore.instance() + .isInfiniteLoop(mob, source.getEntity())) { nextAbilityUse = time + coolDown; - source.getEntity().attackEntityFrom( + source.getEntity() + .attackEntityFrom( DamageSource.causeMobDamage(mob), Math.min(maxReflectDamage, damage * reflectMultiplier)); @@ -45,11 +47,9 @@ && teleportToEntity(mob, source.getEntity()) private boolean teleportToEntity(EntityLivingBase mob, Entity par1Entity) { Vec3 vector = Vec3.createVectorHelper( - mob.posX - par1Entity.posX, - mob.boundingBox.minY + (double) (mob.height / 2.0F) - - par1Entity.posY - + (double) par1Entity.getEyeHeight(), - mob.posZ - par1Entity.posZ); + mob.posX - par1Entity.posX, + mob.boundingBox.minY + (double) (mob.height / 2.0F) - par1Entity.posY + (double) par1Entity.getEyeHeight(), + mob.posZ - par1Entity.posZ); vector = vector.normalize(); double telDist = 16.0D; double destX = mob.posX + (mob.worldObj.rand.nextDouble() - 0.5D) * 8.0D - vector.xCoord * telDist; @@ -75,7 +75,8 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou boolean hitGround = false; while (!hitGround && y < 96 && y > 0) { blockID = mob.worldObj.getBlock(x, y - 1, z); - if (blockID.getMaterial().blocksMovement()) { + if (blockID.getMaterial() + .blocksMovement()) { hitGround = true; } else { --mob.posY; @@ -86,9 +87,9 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou if (hitGround) { mob.setPosition(mob.posX, mob.posY, mob.posZ); - if (mob.worldObj.getCollidingBoundingBoxes(mob, mob.boundingBox).isEmpty() - && !mob.worldObj.isAnyLiquid(mob.boundingBox) - && !mob.worldObj.checkBlockCollision(mob.boundingBox)) { + if (mob.worldObj.getCollidingBoundingBoxes(mob, mob.boundingBox) + .isEmpty() && !mob.worldObj.isAnyLiquid(mob.boundingBox) + && !mob.worldObj.checkBlockCollision(mob.boundingBox)) { success = true; } } else { @@ -107,10 +108,10 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou float var22 = (mob.worldObj.rand.nextFloat() - 0.5F) * 0.2F; float var23 = (mob.worldObj.rand.nextFloat() - 0.5F) * 0.2F; double var24 = oldX + (mob.posX - oldX) * var19 - + (mob.worldObj.rand.nextDouble() - 0.5D) * (double) mob.width * 2.0D; + + (mob.worldObj.rand.nextDouble() - 0.5D) * (double) mob.width * 2.0D; double var26 = oldY + (mob.posY - oldY) * var19 + mob.worldObj.rand.nextDouble() * (double) mob.height; double var28 = oldZ + (mob.posZ - oldZ) * var19 - + (mob.worldObj.rand.nextDouble() - 0.5D) * (double) mob.width * 2.0D; + + (mob.worldObj.rand.nextDouble() - 0.5D) * (double) mob.width * 2.0D; mob.worldObj.spawnParticle("portal", var24, var26, var28, var21, var22, var23); } @@ -144,19 +145,19 @@ public MM_Ender make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 15000L, "Time between ability uses") - .getInt(15000) / 50; + .getInt(15000) / 50; reflectMultiplier = (float) config.get( - getModifierClassName(), - "enderReflectMultiplier", - 0.75D, - "When a mob with Ender modifier gets hurt it teleports and reflects some of the damage originally dealt. This sets the multiplier for the reflected damage") - .getDouble(0.75D); + getModifierClassName(), + "enderReflectMultiplier", + 0.75D, + "When a mob with Ender modifier gets hurt it teleports and reflects some of the damage originally dealt. This sets the multiplier for the reflected damage") + .getDouble(0.75D); maxReflectDamage = (float) config.get( - getModifierClassName(), - "enderReflectMaxDamage", - 10.0D, - "When a mob with Ender modifier gets hurt it teleports and reflects some of the damage originally dealt. This sets the maximum amount that can be inflicted (0, or less than zero for unlimited reflect damage)") - .getDouble(10.0D); + getModifierClassName(), + "enderReflectMaxDamage", + 10.0D, + "When a mob with Ender modifier gets hurt it teleports and reflects some of the damage originally dealt. This sets the maximum amount that can be inflicted (0, or less than zero for unlimited reflect damage)") + .getDouble(10.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java index 43ed0327..2f7ab186 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Fiery.java @@ -20,9 +20,10 @@ public MM_Fiery(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) - && !(source instanceof EntityDamageSourceIndirect) - && !source.isProjectile()) { - source.getEntity().setFire(fireDuration); + && !(source instanceof EntityDamageSourceIndirect) + && !source.isProjectile()) { + source.getEntity() + .setFire(fireDuration); } mob.extinguish(); @@ -62,7 +63,7 @@ public MM_Fiery make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { fireDuration = config.get(getModifierClassName(), "fieryDurationSecs", 3L, "Time attacker is set on fire") - .getInt(3); + .getInt(3); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java index d9811e3e..a4cb2dde 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java @@ -37,7 +37,7 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { if (mob.getDistanceToEntity(target) > MIN_DISTANCE) { double diffX = target.posX - mob.posX; double diffY = target.boundingBox.minY + (double) (target.height / 2.0F) - - (mob.posY + (double) (mob.height / 2.0F)); + - (mob.posY + (double) (mob.height / 2.0F)); double diffZ = target.posZ - mob.posZ; mob.renderYawOffset = mob.rotationYaw = -((float) Math.atan2(diffX, diffZ)) * 180.0F / (float) Math.PI; @@ -76,7 +76,7 @@ public MM_Ghastly make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 6000L, "Time between ability uses") - .getInt(6000) / 50; + .getInt(6000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java index 7386c896..80ec6137 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java @@ -38,8 +38,8 @@ public boolean onUpdate(EntityLivingBase mob) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && source.getEntity() instanceof EntityLivingBase - && !(source.getEntity() instanceof EntityPlayer - && ((EntityPlayer) source.getEntity()).capabilities.disableDamage)) { + && !(source.getEntity() instanceof EntityPlayer + && ((EntityPlayer) source.getEntity()).capabilities.disableDamage)) { tryAbility(mob, (EntityLivingBase) source.getEntity()); } @@ -58,20 +58,21 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { double diffX = target.posX - mob.posX; double diffZ; for (diffZ = target.posZ - mob.posZ; diffX * diffX + diffZ * diffZ - < 1.0E-4D; diffZ = (Math.random() - Math.random()) * 0.01D) { + < 1.0E-4D; diffZ = (Math.random() - Math.random()) * 0.01D) { diffX = (Math.random() - Math.random()) * 0.01D; } mob.worldObj.playSoundAtEntity( - mob, - "mob.irongolem.throw", - 1.0F, - (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F + 1.0F); + mob, + "mob.irongolem.throw", + 1.0F, + (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F + 1.0F); if (mob.worldObj.isRemote || !(target instanceof EntityPlayerMP)) { knockBack(target, diffX, diffZ); } else { - InfernalMobsCore.instance().sendKnockBackPacket((EntityPlayerMP) target, (float) diffX, (float) diffZ); + InfernalMobsCore.instance() + .sendKnockBackPacket((EntityPlayerMP) target, (float) diffX, (float) diffZ); } } } @@ -121,9 +122,9 @@ public MM_Gravity make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 5000L, "Time between ability uses") - .getInt(5000) / 50; + .getInt(5000) / 50; double maxDistance = config.get(getModifierClassName(), "maxDistance", 40, "Range of ability.") - .getDouble(40); + .getDouble(40); maxDistanceSquared = maxDistance * maxDistance; } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java index 599b995f..7bb58e6a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java @@ -24,7 +24,8 @@ public MM_Lifesteal(@Nullable MobModifier next) { public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { EntityLivingBase mob = (EntityLivingBase) source.getEntity(); if (entity != null && mob.getHealth() < getActualMaxHealth(mob)) { - InfernalMobsCore.instance().setEntityHealthPastMax(mob, mob.getHealth() + (damage * lifestealMultiplier)); + InfernalMobsCore.instance() + .setEntityHealthPastMax(mob, mob.getHealth() + (damage * lifestealMultiplier)); } return super.onAttack(entity, source, damage); @@ -58,11 +59,13 @@ public MM_Lifesteal make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { - lifestealMultiplier = (float) config.get( + lifestealMultiplier = (float) config + .get( getModifierClassName(), "lifestealMultiplier", 1.0D, - "Multiplies damage dealt, result is added to mob health").getDouble(1.0D); + "Multiplies damage dealt, result is added to mob health") + .getDouble(1.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java index 7a989911..57b2ecd0 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java @@ -29,11 +29,13 @@ public MM_Ninja(@Nullable MobModifier next) { public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { long time = mob.ticksExisted; if (time > nextAbilityUse && source.getEntity() != null - && source.getEntity() != mob - && !InfernalMobsCore.instance().isInfiniteLoop(mob, source.getEntity()) - && teleportToEntity(mob, source.getEntity())) { + && source.getEntity() != mob + && !InfernalMobsCore.instance() + .isInfiniteLoop(mob, source.getEntity()) + && teleportToEntity(mob, source.getEntity())) { nextAbilityUse = time + coolDown; - source.getEntity().attackEntityFrom( + source.getEntity() + .attackEntityFrom( DamageSource.causeMobDamage(mob), Math.min(maxReflectDamage, damage * reflectMultiplier)); return super.onHurt(mob, source, 0); @@ -44,11 +46,9 @@ && teleportToEntity(mob, source.getEntity())) { private boolean teleportToEntity(EntityLivingBase mob, Entity par1Entity) { Vec3 vector = Vec3.createVectorHelper( - mob.posX - par1Entity.posX, - mob.boundingBox.minY + (double) (mob.height / 2.0F) - - par1Entity.posY - + (double) par1Entity.getEyeHeight(), - mob.posZ - par1Entity.posZ); + mob.posX - par1Entity.posX, + mob.boundingBox.minY + (double) (mob.height / 2.0F) - par1Entity.posY + (double) par1Entity.getEyeHeight(), + mob.posZ - par1Entity.posZ); vector = vector.normalize(); double telDist = 8.0D; double destX = mob.posX + (mob.worldObj.rand.nextDouble() - 0.5D) * 4.0D - vector.xCoord * telDist; @@ -74,7 +74,8 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou boolean hitGround = false; while (!hitGround && y < 96 && y > 0) { blockID = mob.worldObj.getBlock(x, y - 1, z); - if (blockID.getMaterial().blocksMovement()) { + if (blockID.getMaterial() + .blocksMovement()) { hitGround = true; } else { --mob.posY; @@ -85,9 +86,9 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou if (hitGround) { mob.setPosition(mob.posX, mob.posY, mob.posZ); - if (mob.worldObj.getCollidingBoundingBoxes(mob, mob.boundingBox).isEmpty() - && !mob.worldObj.isAnyLiquid(mob.boundingBox) - && !mob.worldObj.checkBlockCollision(mob.boundingBox)) { + if (mob.worldObj.getCollidingBoundingBoxes(mob, mob.boundingBox) + .isEmpty() && !mob.worldObj.isAnyLiquid(mob.boundingBox) + && !mob.worldObj.checkBlockCollision(mob.boundingBox)) { success = true; } } else { @@ -99,12 +100,12 @@ private boolean teleportTo(EntityLivingBase mob, double destX, double destY, dou return false; } else { mob.worldObj.playSoundEffect( - oldX, - oldY, - oldZ, - "random.explode", - 2.0F, - (1.0F + (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + oldX, + oldY, + oldZ, + "random.explode", + 2.0F, + (1.0F + (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); mob.worldObj.spawnParticle("hugeexplosion", oldX, oldY, oldZ, 0D, 0D, 0D); } } @@ -135,19 +136,19 @@ public MM_Ninja make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 15000L, "Time between ability uses") - .getInt(15000) / 50; + .getInt(15000) / 50; reflectMultiplier = (float) config.get( - getModifierClassName(), - "ninjaReflectMultiplier", - 0.75D, - "When a mob with Ninja modifier gets hurt it teleports to the attacker and reflects some of the damage originally dealt. This sets the multiplier for the reflected damage") - .getDouble(0.75D); + getModifierClassName(), + "ninjaReflectMultiplier", + 0.75D, + "When a mob with Ninja modifier gets hurt it teleports to the attacker and reflects some of the damage originally dealt. This sets the multiplier for the reflected damage") + .getDouble(0.75D); maxReflectDamage = (float) config.get( - getModifierClassName(), - "ninjaReflectMaxDamage", - 10.0D, - "When a mob with Ninja modifier gets hurt it teleports to the attacker and reflects some of the damage originally dealt. This sets the maximum amount that can be inflicted (0, or less than zero for unlimited reflect damage)") - .getDouble(10.0D); + getModifierClassName(), + "ninjaReflectMaxDamage", + 10.0D, + "When a mob with Ninja modifier gets hurt it teleports to the attacker and reflects some of the damage originally dealt. This sets the maximum amount that can be inflicted (0, or less than zero for unlimited reflect damage)") + .getDouble(10.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java index 04156191..ffe8ba5c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java @@ -24,10 +24,11 @@ public MM_Poisonous(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) - && InfernalMobsCore.instance().getIsEntityAllowedTarget(source.getEntity())) { + && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(source.getEntity())) { EntityLivingBase ent = (EntityLivingBase) source.getEntity(); if (!ent.isPotionActive(Potion.poison) && !(source instanceof EntityDamageSourceIndirect) - && !source.isProjectile()) { + && !source.isProjectile()) { ent.addPotionEffect(new PotionEffect(Potion.poison.id, potionDuration, 0)); } } @@ -37,8 +38,8 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(entity) - && !entity.isPotionActive(Potion.poison)) { + if (entity != null && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(entity) && !entity.isPotionActive(Potion.poison)) { entity.addPotionEffect(new PotionEffect(Potion.poison.id, potionDuration, 0)); } @@ -69,7 +70,8 @@ public MM_Poisonous make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { potionDuration = config - .get(getModifierClassName(), "poisonDurationTicks", 120L, "Time attacker is poisoned").getInt(120); + .get(getModifierClassName(), "poisonDurationTicks", 120L, "Time attacker is poisoned") + .getInt(120); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java index 84dc0114..1981582b 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java @@ -20,9 +20,8 @@ public MM_Quicksand(@Nullable MobModifier next) { @Override public boolean onUpdate(EntityLivingBase mob) { - if (getMobTarget() != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(getMobTarget()) - && mob.canEntityBeSeen(getMobTarget()) - && ++ticker >= 80) { + if (getMobTarget() != null && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(getMobTarget()) && mob.canEntityBeSeen(getMobTarget()) && ++ticker >= 80) { ticker = 0; getMobTarget().addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java index e309ec46..34b2f0fd 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Regen.java @@ -24,7 +24,8 @@ public boolean onUpdate(EntityLivingBase mob) { long time = mob.ticksExisted; if (time > nextAbilityUse) { nextAbilityUse = time + coolDown; - InfernalMobsCore.instance().setEntityHealthPastMax(mob, mob.getHealth() + 1); + InfernalMobsCore.instance() + .setEntityHealthPastMax(mob, mob.getHealth() + 1); } } return super.onUpdate(mob); @@ -54,7 +55,7 @@ public MM_Regen make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 500L, "Time between ability uses") - .getInt(500) / 50; + .getInt(500) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java index 70274abd..73a4de26 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java @@ -21,10 +21,11 @@ public MM_Rust(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityPlayer) - && !(source instanceof EntityDamageSourceIndirect)) { + && !(source instanceof EntityDamageSourceIndirect)) { EntityPlayer p = (EntityPlayer) source.getEntity(); if (p.inventory.getCurrentItem() != null) { - p.inventory.getCurrentItem().damageItem(itemDamage, (EntityLivingBase) source.getEntity()); + p.inventory.getCurrentItem() + .damageItem(itemDamage, (EntityLivingBase) source.getEntity()); } } @@ -64,8 +65,8 @@ public MM_Rust make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { itemDamage = config - .get(getModifierClassName(), "itemDamage", 4, "Damage dealt to Item in hand of attacking entity") - .getInt(4); + .get(getModifierClassName(), "itemDamage", 4, "Damage dealt to Item in hand of attacking entity") + .getInt(4); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java index 0308bc4a..29020096 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java @@ -23,7 +23,8 @@ public MM_Sapper(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) - && InfernalMobsCore.instance().getIsEntityAllowedTarget(source.getEntity())) { + && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(source.getEntity())) { EntityLivingBase ent = (EntityLivingBase) source.getEntity(); if (!ent.isPotionActive(Potion.hunger)) { ent.addPotionEffect(new PotionEffect(Potion.hunger.id, potionDuration, 0)); @@ -35,8 +36,8 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(entity) - && !entity.isPotionActive(Potion.poison)) { + if (entity != null && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(entity) && !entity.isPotionActive(Potion.poison)) { entity.addPotionEffect(new PotionEffect(Potion.hunger.id, potionDuration, 0)); } @@ -67,7 +68,8 @@ public MM_Sapper make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { potionDuration = config - .get(getModifierClassName(), "hungerDurationTicks", 120L, "Time attacker is hungering").getInt(120); + .get(getModifierClassName(), "hungerDurationTicks", 120L, "Time attacker is hungering") + .getInt(120); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java index 316616bb..12115a09 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java @@ -105,7 +105,7 @@ public MM_Sprint make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 5000L, "Time between ability uses") - .getInt(5000) / 50; + .getInt(5000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java index 411ccf05..d05b84df 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java @@ -26,25 +26,24 @@ public MM_Sticky(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityPlayer) - && !((EntityPlayer) source.getEntity()).capabilities.isCreativeMode - && !(source instanceof EntityDamageSourceIndirect) - && !source.isProjectile()) { + && !((EntityPlayer) source.getEntity()).capabilities.isCreativeMode + && !(source instanceof EntityDamageSourceIndirect) + && !source.isProjectile()) { EntityPlayer p = (EntityPlayer) source.getEntity(); ItemStack weapon = p.inventory.getStackInSlot(p.inventory.currentItem); if (weapon != null) { long time = mob.ticksExisted; if (time > nextAbilityUse && source.getEntity() != null) { nextAbilityUse = time + coolDown; - EntityItem drop = p.dropPlayerItemWithRandomChoice( - p.inventory.decrStackSize(p.inventory.currentItem, 1), - false); + EntityItem drop = p + .dropPlayerItemWithRandomChoice(p.inventory.decrStackSize(p.inventory.currentItem, 1), false); if (drop != null) { drop.delayBeforeCanPickup = 50; p.worldObj.playSoundAtEntity( - mob, - "mob.slime.attack", - 1.0F, - (p.worldObj.rand.nextFloat() - p.worldObj.rand.nextFloat()) * 0.2F + 1.0F); + mob, + "mob.slime.attack", + 1.0F, + (p.worldObj.rand.nextFloat() - p.worldObj.rand.nextFloat()) * 0.2F + 1.0F); } } } @@ -82,7 +81,7 @@ public MM_Sticky make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 15000L, "Time between ability uses") - .getInt(15000) / 50; + .getInt(15000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java index bdc627d7..ec2ce80b 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java @@ -36,13 +36,13 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { long time = mob.ticksExisted; if (time > nextAbilityUse && mob.getDistanceToEntity(target) > MIN_DISTANCE - && target.worldObj.canBlockSeeTheSky( - MathHelper.floor_double(target.posX), - MathHelper.floor_double(target.posY), - MathHelper.floor_double(target.posZ))) { + && target.worldObj.canBlockSeeTheSky( + MathHelper.floor_double(target.posX), + MathHelper.floor_double(target.posY), + MathHelper.floor_double(target.posZ))) { nextAbilityUse = time + coolDown; mob.worldObj - .addWeatherEffect(new EntityLightningBolt(mob.worldObj, target.posX, target.posY - 1, target.posZ)); + .addWeatherEffect(new EntityLightningBolt(mob.worldObj, target.posX, target.posY - 1, target.posZ)); } } @@ -70,7 +70,7 @@ public MM_Storm make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 15000L, "Time between ability uses") - .getInt(15000) / 50; + .getInt(15000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java index 3312a8bc..675ebca2 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java @@ -22,12 +22,14 @@ public MM_Vengeance(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && source.getEntity() != mob - && !InfernalMobsCore.instance().isInfiniteLoop(mob, source.getEntity())) { + && !InfernalMobsCore.instance() + .isInfiniteLoop(mob, source.getEntity())) { float reflectedDamage = Math.max(Math.min(damage, mob.getHealth()) * reflectMultiplier, 1); if (maxReflectDamage > 0.0f) { reflectedDamage = Math.min(maxReflectDamage, reflectedDamage); } - source.getEntity().attackEntityFrom(DamageSource.causeThornsDamage(mob), reflectedDamage); + source.getEntity() + .attackEntityFrom(DamageSource.causeThornsDamage(mob), reflectedDamage); } return super.onHurt(mob, source, damage); @@ -57,18 +59,19 @@ public MM_Vengeance make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { reflectMultiplier = (float) config - .get( - getModifierClassName(), - "vengeanceMultiplier", - 0.5D, - "Multiplies damage received, result is subtracted from attacking entity's health") - .getDouble(0.5D); - maxReflectDamage = (float) config.get( + .get( + getModifierClassName(), + "vengeanceMultiplier", + 0.5D, + "Multiplies damage received, result is subtracted from attacking entity's health") + .getDouble(0.5D); + maxReflectDamage = (float) config + .get( getModifierClassName(), "vengeanceMaxDamage", 0.0D, "Maximum amount of damage that is reflected (0, or less than zero for unlimited vengeance damage)") - .getDouble(0.0D); + .getDouble(0.0D); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java index 792907b6..9f0ea761 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java @@ -23,9 +23,10 @@ public MM_Weakness(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) - && InfernalMobsCore.instance().getIsEntityAllowedTarget(source.getEntity())) { + && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(source.getEntity())) { ((EntityLivingBase) source.getEntity()) - .addPotionEffect(new PotionEffect(Potion.weakness.id, potionDuration, 0)); + .addPotionEffect(new PotionEffect(Potion.weakness.id, potionDuration, 0)); } return super.onHurt(mob, source, damage); @@ -33,7 +34,8 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(entity)) { + if (entity != null && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(entity)) { entity.addPotionEffect(new PotionEffect(Potion.weakness.id, potionDuration, 0)); } @@ -64,8 +66,8 @@ public MM_Weakness make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { potionDuration = config - .get(getModifierClassName(), "weaknessDurationTicks", 120L, "Time attacker is weakened") - .getInt(120); + .get(getModifierClassName(), "weaknessDurationTicks", 120L, "Time attacker is weakened") + .getInt(120); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java index 3075f574..cbf376c2 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java @@ -41,7 +41,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { if (target == null || !mob.canEntityBeSeen(target) - || (target instanceof EntityPlayer && ((EntityPlayer) target).capabilities.disableDamage)) { + || (target instanceof EntityPlayer && ((EntityPlayer) target).capabilities.disableDamage)) { return; } @@ -63,10 +63,10 @@ private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { lastAbilityUse = time; target.worldObj.setBlock(x, y + offset, z, Blocks.web, 0, 3); mob.worldObj.playSoundAtEntity( - mob, - "mob.spider.say", - 1.0F, - (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F + 1.0F); + mob, + "mob.spider.say", + 1.0F, + (mob.worldObj.rand.nextFloat() - mob.worldObj.rand.nextFloat()) * 0.2F + 1.0F); } } @@ -99,7 +99,7 @@ public MM_Webber make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { coolDown = config.get(getModifierClassName(), "coolDownMillis", 15000L, "Time between ability uses") - .getInt(15000) / 50; + .getInt(15000) / 50; } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java index 1a163ec0..e7f71b40 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java @@ -24,11 +24,12 @@ public MM_Wither(@Nullable MobModifier next) { @Override public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { if (source.getEntity() != null && (source.getEntity() instanceof EntityLivingBase) - && InfernalMobsCore.instance().getIsEntityAllowedTarget(source.getEntity()) - && !(source instanceof EntityDamageSourceIndirect) - && !source.isProjectile()) { + && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(source.getEntity()) + && !(source instanceof EntityDamageSourceIndirect) + && !source.isProjectile()) { ((EntityLivingBase) source.getEntity()) - .addPotionEffect(new PotionEffect(Potion.wither.id, potionDuration, 0)); + .addPotionEffect(new PotionEffect(Potion.wither.id, potionDuration, 0)); } return super.onHurt(mob, source, damage); @@ -36,7 +37,8 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { @Override public float onAttack(EntityLivingBase entity, DamageSource source, float damage) { - if (entity != null && InfernalMobsCore.instance().getIsEntityAllowedTarget(entity)) { + if (entity != null && InfernalMobsCore.instance() + .getIsEntityAllowedTarget(entity)) { entity.addPotionEffect(new PotionEffect(Potion.wither.id, potionDuration, 0)); } @@ -67,7 +69,8 @@ public MM_Wither make(@Nullable MobModifier next) { @Override public void loadConfig(Configuration config) { potionDuration = config - .get(getModifierClassName(), "witherDurationTicks", 120L, "Time attacker is withered").getInt(120); + .get(getModifierClassName(), "witherDurationTicks", 120L, "Time attacker is withered") + .getInt(120); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java index 2d4f40f4..d664a407 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java @@ -80,7 +80,7 @@ public MobModifier(String name, @Nullable MobModifier next) { */ public String getLinkedModName() { return (StatCollector.translateToLocal("translation.infernalmobs:mod." + modName) + " " - + ((nextMod != null) ? nextMod.getLinkedModName() : "")); + + ((nextMod != null) ? nextMod.getLinkedModName() : "")); } /** @@ -131,17 +131,19 @@ public boolean containsModifierClass(Class checkfor) { * Called when local Spawn Processing is completed or when a client remote-attached Modifiers to a local Entity */ public void onSpawningComplete(EntityLivingBase entity) { - String oldTag = entity.getEntityData().getString(InfernalMobsCore.getNBTTag()); + String oldTag = entity.getEntityData() + .getString(InfernalMobsCore.getNBTTag()); if (!oldTag.isEmpty() && !oldTag.equals(getLinkedModNameUntranslated())) { FMLLog.log( - "InfernalMobs", - Level.DEBUG, - String.format( - "Infernal Mobs tag mismatch!! Was [%s], now trying to set [%s] \n", - oldTag, - getLinkedModNameUntranslated())); + "InfernalMobs", + Level.DEBUG, + String.format( + "Infernal Mobs tag mismatch!! Was [%s], now trying to set [%s] \n", + oldTag, + getLinkedModNameUntranslated())); } - entity.getEntityData().setString(InfernalMobsCore.getNBTTag(), getLinkedModNameUntranslated()); + entity.getEntityData() + .setString(InfernalMobsCore.getNBTTag(), getLinkedModNameUntranslated()); } /** @@ -163,9 +165,10 @@ public boolean onDeath() { * Passes the loot drop event to the modifier list */ public void onDropItems(EntityLivingBase moddedMob, DamageSource killSource, ArrayList drops, - int lootingLevel, boolean recentlyHit, int specialDropValue) { + int lootingLevel, boolean recentlyHit, int specialDropValue) { if (recentlyHit) { - InfernalMobsCore.instance().dropLootForEnt(moddedMob, this); + InfernalMobsCore.instance() + .dropLootForEnt(moddedMob, this); } } @@ -210,7 +213,8 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float amount) { amount = nextMod.onHurt(mob, source, amount); } else if (source.getEntity() != null) { if (source.getEntity().worldObj.isRemote && source.getEntity() instanceof EntityPlayer) { - InfernalMobsCore.instance().sendHealthRequestPacket(mob); + InfernalMobsCore.instance() + .sendHealthRequestPacket(mob); } } @@ -254,8 +258,8 @@ public boolean onUpdate(EntityLivingBase mob) { if (attackTarget != null) { if (attackTarget.isDead || attackTarget.getDistanceToEntity(mob) > 15f - || (attackTarget instanceof EntityPlayer - && ((EntityPlayer) attackTarget).capabilities.disableDamage)) { + || (attackTarget instanceof EntityPlayer + && ((EntityPlayer) attackTarget).capabilities.disableDamage)) { attackTarget = null; } } @@ -290,7 +294,8 @@ private void increaseHealthForMob(EntityLivingBase mob, float baseHealth) { if (!healthHacked) { actualMaxHealth = getActualMaxHealth(mob); actualHealth = actualMaxHealth; - InfernalMobsCore.instance().setEntityHealthPastMax(mob, actualHealth); + InfernalMobsCore.instance() + .setEntityHealthPastMax(mob, actualHealth); healthHacked = true; } } @@ -300,8 +305,10 @@ private void increaseHealthForMob(EntityLivingBase mob, float baseHealth) { */ public float getActualMaxHealth(EntityLivingBase mob) { if (actualMaxHealth < 0) { - actualMaxHealth = (float) (InfernalMobsCore.instance().getMobClassMaxHealth(mob) * getModSize() - * InfernalMobsCore.instance().getMobModHealthFactor()); + actualMaxHealth = (float) (InfernalMobsCore.instance() + .getMobClassMaxHealth(mob) * getModSize() + * InfernalMobsCore.instance() + .getMobModHealthFactor()); } return actualMaxHealth; } @@ -394,7 +401,8 @@ public String getEntityDisplayName(EntityLivingBase target) { int size = getModSize(); - int randomMod = target.getRNG().nextInt(getModSize()); + int randomMod = target.getRNG() + .nextInt(getModSize()); MobModifier mod = this; while (randomMod > 0) { mod = mod.nextMod; @@ -403,17 +411,17 @@ public String getEntityDisplayName(EntityLivingBase target) { String modprefix = ""; if (mod.getModNamePrefix() != null) { - modprefix = mod.getModNamePrefix()[target.getRNG().nextInt(mod.getModNamePrefix().length)]; + modprefix = mod.getModNamePrefix()[target.getRNG() + .nextInt(mod.getModNamePrefix().length)]; modprefix = StatCollector.translateToLocal("translation.infernalmobs:prefix." + modprefix); } String prefix = size <= 5 - ? EnumChatFormatting.AQUA + StatCollector.translateToLocal("translation.infernalmobs:rareClass") - : size <= 10 - ? EnumChatFormatting.YELLOW - + StatCollector.translateToLocal("translation.infernalmobs:ultraClass") - : EnumChatFormatting.GOLD - + StatCollector.translateToLocal("translation.infernalmobs:infernalClass"); + ? EnumChatFormatting.AQUA + StatCollector.translateToLocal("translation.infernalmobs:rareClass") + : size <= 10 + ? EnumChatFormatting.YELLOW + StatCollector.translateToLocal("translation.infernalmobs:ultraClass") + : EnumChatFormatting.GOLD + + StatCollector.translateToLocal("translation.infernalmobs:infernalClass"); buffer = prefix + modprefix + buffer; @@ -421,7 +429,7 @@ public String getEntityDisplayName(EntityLivingBase target) { mod = mod.nextMod != null ? mod.nextMod : this; if (mod.getModNameSuffix() != null) { String pickedSuffix = mod.getModNameSuffix()[target.getRNG() - .nextInt(mod.getModNameSuffix().length)]; + .nextInt(mod.getModNameSuffix().length)]; pickedSuffix = StatCollector.translateToLocal("translation.infernalmobs:suffix." + pickedSuffix); buffer = buffer + pickedSuffix; } diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java index 1963685c..be2d9754 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java @@ -46,7 +46,7 @@ public class NetworkHelper { @SafeVarargs public NetworkHelper(String channelName, Class... handledPacketClasses) { EnumMap channelPair = NetworkRegistry.INSTANCE - .newChannel(channelName, new ChannelCodec(handledPacketClasses), new ChannelHandler()); + .newChannel(channelName, new ChannelCodec(handledPacketClasses), new ChannelHandler()); clientOutboundChannel = channelPair.get(Side.CLIENT); serverOutboundChannel = channelPair.get(Side.SERVER); @@ -60,7 +60,7 @@ public NetworkHelper(String channelName, Class... handledPack public void sendPacketToServer(IPacket packet) { checkClassAndSync(packet.getClass()); clientOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET) - .set(FMLOutboundHandler.OutboundTarget.TOSERVER); + .set(FMLOutboundHandler.OutboundTarget.TOSERVER); clientOutboundChannel.writeOutbound(packet); isCurrentlySendingSemaphor = false; } @@ -70,8 +70,10 @@ public void sendPacketToServer(IPacket packet) { */ public void sendPacketToPlayer(IPacket packet, EntityPlayerMP player) { checkClassAndSync(packet.getClass()); - serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); - serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); + serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.PLAYER); + serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS) + .set(player); serverOutboundChannel.writeOutbound(packet); isCurrentlySendingSemaphor = false; } @@ -81,7 +83,8 @@ public void sendPacketToPlayer(IPacket packet, EntityPlayerMP player) { */ public void sendPacketToAllPlayers(IPacket packet) { checkClassAndSync(packet.getClass()); - serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.ALL); serverOutboundChannel.writeOutbound(packet); isCurrentlySendingSemaphor = false; } @@ -92,8 +95,9 @@ public void sendPacketToAllPlayers(IPacket packet) { public void sendPacketToAllAroundPoint(IPacket packet, TargetPoint tp) { checkClassAndSync(packet.getClass()); serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET) - .set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); - serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(tp); + .set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS) + .set(tp); serverOutboundChannel.writeOutbound(packet); isCurrentlySendingSemaphor = false; } @@ -104,8 +108,9 @@ public void sendPacketToAllAroundPoint(IPacket packet, TargetPoint tp) { public void sendPacketToAllInDimension(IPacket packet, int dimension) { checkClassAndSync(packet.getClass()); serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET) - .set(FMLOutboundHandler.OutboundTarget.DIMENSION); - serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimension); + .set(FMLOutboundHandler.OutboundTarget.DIMENSION); + serverOutboundChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS) + .set(dimension); serverOutboundChannel.writeOutbound(packet); isCurrentlySendingSemaphor = false; } diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java index bd48901d..85453bd5 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java @@ -50,7 +50,9 @@ public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes) { if (maxhealth > 0) { InfernalMobsCore.proxy.onHealthPacketForClient(stringData, entID, health, maxhealth); } else { - EntityPlayerMP p = MinecraftServer.getServer().getConfigurationManager().func_152612_a(stringData); + EntityPlayerMP p = MinecraftServer.getServer() + .getConfigurationManager() + .func_152612_a(stringData); if (p != null) { Entity ent = p.worldObj.getEntityByID(entID); if (ent instanceof EntityLivingBase) { @@ -60,7 +62,7 @@ public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes) { health = e.getHealth(); maxhealth = e.getMaxHealth(); InfernalMobsCore.instance().networkHelper - .sendPacketToPlayer(new HealthPacket(stringData, entID, health, maxhealth), p); + .sendPacketToPlayer(new HealthPacket(stringData, entID, health, maxhealth), p); } } } diff --git a/src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java b/src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java index ac437bd9..e6264eeb 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java +++ b/src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java @@ -47,7 +47,9 @@ public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes) { InfernalMobsCore.proxy.onMobModsPacketToClient(stringData, entID); } else { // else we are on serverside - EntityPlayerMP p = MinecraftServer.getServer().getConfigurationManager().func_152612_a(stringData); + EntityPlayerMP p = MinecraftServer.getServer() + .getConfigurationManager() + .func_152612_a(stringData); if (p != null) { Entity ent = p.worldObj.getEntityByID(entID); if (ent instanceof EntityLivingBase) { @@ -56,8 +58,9 @@ public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes) { if (mod != null) { stringData = mod.getLinkedModNameUntranslated(); InfernalMobsCore.instance().networkHelper - .sendPacketToPlayer(new MobModsPacket(stringData, entID, (byte) 1), p); - InfernalMobsCore.instance().sendHealthPacket(e, mod.getActualHealth(e)); + .sendPacketToPlayer(new MobModsPacket(stringData, entID, (byte) 1), p); + InfernalMobsCore.instance() + .sendHealthPacket(e, mod.getActualHealth(e)); } } } From 25d6edc01208d153e5a96b8be01d37b74b236d60 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 28 Sep 2024 23:59:39 +0200 Subject: [PATCH 12/12] load config only once --- .../infernalmobs/common/InfernalMobsCore.java | 28 ++++++++----------- .../common/events/EntityEventHandler.java | 2 -- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index 78939f9f..e94c5918 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java @@ -138,7 +138,7 @@ public static String getNBTTag() { private int maxUltraModifiers; private int minInfernoModifiers; private int maxInfernoModifiers; - public Configuration config; // TODO load the config only once... + public Configuration config; @SidedProxy( clientSide = "atomicstryker.infernalmobs.client.InfernalMobsClient", @@ -166,6 +166,8 @@ public void preInit(FMLPreInitializationEvent evt) { modifiedPlayerTimes = new HashMap<>(); config = new Configuration(evt.getSuggestedConfigurationFile()); + config.load(); + if (config.hasChanged()) config.save(); loadMods(); proxy.preInit(); @@ -239,9 +241,6 @@ private void loadMods() { new MM_Weakness.Loader(), new MM_Webber.Loader(), new MM_Wither.Loader()); - - config.load(); - modifierLoaders.removeIf( loader -> !config.get(Configuration.CATEGORY_GENERAL, loader.getModifierClassName() + " enabled", true) .getBoolean(true)); @@ -253,8 +252,6 @@ private void loadMods() { * Forge Config file */ private void loadConfig() { - config.load(); - eliteRarity = Integer.parseInt( config .get( @@ -458,7 +455,7 @@ private Object parseOrFind(String s) { /** * Called when an Entity is spawned by natural (Biome Spawning) means, turn them into Elites here - * + * * @param entity Entity in question */ public void processEntitySpawn(EntityLivingBase entity) { @@ -524,7 +521,6 @@ private boolean checkEntityClassAllowed(EntityLivingBase entity) { return classesAllowedMap.get(entName); } - config.load(); boolean result = config.get("permittedentities", entName, true) .getBoolean(true); if (config.hasChanged()) config.save(); @@ -540,7 +536,6 @@ public boolean checkEntityClassForced(EntityLivingBase entity) { return classesForcedMap.get(entName); } - config.load(); boolean result = config.get("entitiesalwaysinfernal", entName, false) .getBoolean(false); if (config.hasChanged()) config.save(); @@ -556,7 +551,6 @@ public float getMobClassMaxHealth(EntityLivingBase entity) { return classesHealthMap.get(entName); } - config.load(); float result = (float) config.get("entitybasehealth", entName, entity.getMaxHealth()) .getDouble(entity.getMaxHealth()); if (config.hasChanged()) config.save(); @@ -567,7 +561,7 @@ public float getMobClassMaxHealth(EntityLivingBase entity) { /** * Allows setting Entity Health past the hardcoded getMaxHealth() constraint - * + * * @param entity Entity instance whose health you want changed * @param amount value to set */ @@ -578,7 +572,7 @@ public void setEntityHealthPastMax(EntityLivingBase entity, float amount) { /** * Decides on what, if any, of the possible Modifications to apply to the Entity - * + * * @param entity Target Entity * @return null or the first linked MobModifier instance for the Entity */ @@ -604,7 +598,7 @@ public MobModifier createMobModifiers(EntityLivingBase entity) { MobModifier lastMod = null; while (number > 0 && !possibleMods.isEmpty()) // so long we need more - // and have some + // and have some { /* random index of mod list */ int index = entity.worldObj.rand.nextInt(possibleMods.size()); @@ -660,7 +654,7 @@ public void addEntityModifiers(EntityLivingBase entity, MobModifier mod, boolean /** * Converts a String to MobModifier instances and connects them to an Entity - * + * * @param entity Target Entity * @param savedMods String depicting the MobModifiers, equal to the ingame Display */ @@ -720,7 +714,7 @@ public static void removeEntFromElites(EntityLivingBase entity) { /** * Used by the client side to answer to a server packet carrying the Entity ID and mod string - * + * * @param world World the client is in, and the Entity aswell * @param entID unique Entity ID * @param mods MobModifier compliant data String from the server @@ -774,7 +768,7 @@ private void dropRandomEnchantedItems(EntityLivingBase mob, MobModifier mods) { /** * Custom Enchanting Helper - * + * * @param rand Random gen to use * @param itemStack ItemStack to be enchanted * @param itemEnchantability ItemStack max enchantability level @@ -902,7 +896,7 @@ public boolean getIsEntityAllowedTarget(Entity entity) { /** * By caching the last reflection pairing we make sure it doesn't trigger more than once (reflections battling each * other, infinite loop, crash) - * + * * @return true when inf loop is suspected, false otherwise */ public boolean isInfiniteLoop(EntityLivingBase mob, Entity entity) { diff --git a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java index 849da7f8..174ba9e3 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java @@ -40,8 +40,6 @@ public class EntityEventHandler { */ public EntityEventHandler() { Configuration config = InfernalMobsCore.instance().config; - - config.load(); antiMobFarm = config .get( Configuration.CATEGORY_GENERAL,