diff --git a/README.md b/README.md index fc5d09921..518391a7f 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 diff --git a/gradle.properties b/gradle.properties index 51830766c..0513fe2d2 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/client/InfernalMobsClient.java b/src/main/java/atomicstryker/infernalmobs/client/InfernalMobsClient.java index 44fd7e37d..fad2d417a 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; @@ -25,17 +24,17 @@ 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; 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; @@ -47,14 +46,17 @@ 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 public void load() { nextPacketTime = 0; - rareMobsClient = new ConcurrentHashMap(); + rareMobsClient = new ConcurrentHashMap<>(); MinecraftForge.EVENT_BUS.register(new RendererBossGlow()); MinecraftForge.EVENT_BUS.register(this); @@ -66,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)); - nextPacketTime = System.currentTimeMillis() + 100l; + 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; } @@ -97,28 +108,28 @@ 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); 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; 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; short lifeBarLength = 182; int x = screenwidth / 2 - lifeBarLength / 2; - int lifeBarLeft = (int) ((float) mod.getActualHealth(target) / (float) mod.getActualMaxHealth(target) - * (float) (lifeBarLength + 1)); + int lifeBarLeft = (int) (mod.getActualHealth(target) / mod.getActualMaxHealth(target) + * (float) (lifeBarLength + 1)); byte y = 12; gui.drawTexturedModalRect(x, y, 0, 74, lifeBarLength, 5); gui.drawTexturedModalRect(x, y, 0, 74, lifeBarLength, 5); @@ -128,30 +139,28 @@ 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; - healthBarRetainTime = System.currentTimeMillis() + 3000l; + healthBarRetainTime = System.currentTimeMillis() + 3000L; } } @@ -174,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((double) expandBBvalue, (double) expandBBvalue, (double) 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((double) entBorderSize, (double) entBorderSize, (double) 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) { @@ -229,8 +238,9 @@ 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) { + Entity ent = FMLClientHandler.instance() + .getClient().theWorld.getEntityByID(entID); + 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); @@ -241,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 @@ -269,16 +288,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); } diff --git a/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java b/src/main/java/atomicstryker/infernalmobs/client/RendererBossGlow.java index c47137fb9..bb1f43949 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 { @@ -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); } } @@ -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/ISidedProxy.java b/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java index df7e55f4b..838be8a17 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java +++ b/src/main/java/atomicstryker/infernalmobs/common/ISidedProxy.java @@ -4,21 +4,23 @@ import net.minecraft.entity.EntityLivingBase; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; + 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/InfernalMobsCore.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java index e6fd2cb84..e94c5918a 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,46 @@ import com.google.common.collect.Lists; -import atomicstryker.infernalmobs.common.mods.*; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; -import atomicstryker.infernalmobs.common.network.*; +import atomicstryker.infernalmobs.Tags; +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.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; @@ -47,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; @@ -79,7 +122,7 @@ public static InfernalMobsCore instance() { return instance; } - public String getNBTTag() { + public static String getNBTTag() { return "InfernalMobsMod"; } @@ -98,8 +141,8 @@ public String getNBTTag() { public Configuration config; @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; @@ -112,29 +155,33 @@ 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()); + config.load(); + if (config.hasChanged()) config.save(); 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 @@ -145,9 +192,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 @@ -167,182 +214,202 @@ 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()); - - config.load(); - + 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()); 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)); - config.save(); + if (config.hasChanged()) config.save(); } /** * Forge Config file */ 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(), - instance.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(), - instance.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(), - instance.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(), - instance.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); } - config.save(); + if (config.hasChanged()) config.save(); } 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); 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)); - continue; + "InfernalMobs", + Level.ERROR, + String.format( + "Configured DimensionID %s is not an integer! All values must be numeric. Ignoring entry", + trimmedDimIDString)); } } } @@ -372,12 +439,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; } @@ -386,14 +455,14 @@ 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) { 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; @@ -401,9 +470,8 @@ 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); + MobModifier mod = createMobModifiers(entity); if (mod != null) { addEntityModifiers(entity, mod, false); // System.out.println("InfernalMobsCore modded mob: "+entity+", id @@ -412,7 +480,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 +492,7 @@ public boolean isClassAllowed(EntityLivingBase entity) { if (entity instanceof IEntityOwnable) { return false; } - if (instance.checkEntityClassAllowed(entity)) { - return true; - } + return checkEntityClassAllowed(entity); } return false; } @@ -436,55 +502,58 @@ 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); - config.save(); + boolean result = config.get("permittedentities", entName, true) + .getBoolean(true); + if (config.hasChanged()) config.save(); classesAllowedMap.put(entName, result); return result; } 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); - config.save(); + boolean result = config.get("entitiesalwaysinfernal", entName, false) + .getBoolean(false); + if (config.hasChanged()) config.save(); classesForcedMap.put(entName, result); return result; } 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()); - config.save(); + .getDouble(entity.getMaxHealth()); + if (config.hasChanged()) config.save(); classesHealthMap.put(entName, result); return result; @@ -492,23 +561,23 @@ 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 */ public void setEntityHealthPastMax(EntityLivingBase entity, float amount) { entity.setHealth(amount); - instance.sendHealthPacket(entity, amount); + this.sendHealthPacket(entity, 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 */ @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(); @@ -525,21 +594,23 @@ 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 - // and have some + // and have some { /* 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; } @@ -572,7 +643,8 @@ 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); @@ -582,25 +654,25 @@ 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 */ 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 { 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)); } } } - private MobModifier stringToMobModifiers(EntityLivingBase entity, String buffer) { + private MobModifier stringToMobModifiers(String buffer) { MobModifier lastMod = null; String[] tokens = buffer.split("\\s"); @@ -611,7 +683,8 @@ 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 */ @@ -625,20 +698,23 @@ private MobModifier stringToMobModifiers(EntityLivingBase entity, 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); } /** * 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 @@ -670,7 +746,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 { @@ -692,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 @@ -717,9 +793,10 @@ 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; - return list.size() > 0 ? list.get(mob.worldObj.rand.nextInt(list.size())).copy() : null; + ArrayList list = (prefix == 0) ? dropIdListElite + : (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) { @@ -736,17 +813,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) { @@ -764,7 +843,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); } } @@ -778,7 +857,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)) { @@ -786,7 +866,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); @@ -815,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/InfernalMobsServer.java b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java index b167c95e8..1ca9f2b04 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java +++ b/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsServer.java @@ -4,12 +4,14 @@ import net.minecraft.entity.EntityLivingBase; +import atomicstryker.infernalmobs.common.modifiers.MobModifier; + 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/InfernalCommandFindEntityClass.java b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java similarity index 64% rename from src/main/java/atomicstryker/infernalmobs/common/InfernalCommandFindEntityClass.java rename to src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandFindEntityClass.java index 587769877..f3a0f60e3 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; @@ -30,30 +30,37 @@ 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); + 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/InfernalCommandSpawnInfernal.java b/src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java similarity index 59% rename from src/main/java/atomicstryker/infernalmobs/common/InfernalCommandSpawnInfernal.java rename to src/main/java/atomicstryker/infernalmobs/common/commands/InfernalCommandSpawnInfernal.java index e218b2e4c..5ecba5921 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 { @@ -31,41 +33,52 @@ 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 - .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.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); + 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); } @@ -87,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/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java similarity index 80% rename from src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java rename to src/main/java/atomicstryker/infernalmobs/common/events/EntityEventHandler.java index c5bcf286f..174ba9e32 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 { @@ -35,43 +37,46 @@ 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; - - 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); - config.save(); + "Damage in chunk per interval that triggers anti farm effects") + .getDouble(150D); + if (config.hasChanged()) config.save(); - damageMap = new HashMap(); + damageMap = new HashMap<>(); nextMapEvaluation = System.currentTimeMillis(); } @SubscribeEvent public void onEntityJoinedWorld(EntityJoinWorldEvent event) { if (event.entity instanceof EntityLivingBase) { - String savedMods = event.entity.getEntityData().getString(InfernalMobsCore.instance().getNBTTag()); - if (!savedMods.equals("")) { - InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) event.entity, savedMods); + String savedMods = event.entity.getEntityData() + .getString(InfernalMobsCore.getNBTTag()); + if (!savedMods.isEmpty()) { + InfernalMobsCore.instance() + .addEntityModifiersByString((EntityLivingBase) event.entity, savedMods); } else { - InfernalMobsCore.instance().processEntitySpawn((EntityLivingBase) event.entity); + InfernalMobsCore.instance() + .processEntitySpawn((EntityLivingBase) event.entity); } } } @@ -131,13 +136,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 +207,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(); } @@ -215,6 +219,23 @@ public void onEntityLivingUpdate(LivingEvent.LivingUpdateEvent event) { } } + @SubscribeEvent + public void onEntityLivingDrops(LivingDropsEvent event) { + if (!event.entity.worldObj.isRemote) { + MobModifier mod = InfernalMobsCore.getMobModifiers(event.entityLiving); + if (mod != null) { + mod.onDropItems( + event.entityLiving, + event.source, + event.drops, + event.lootingLevel, + event.recentlyHit, + event.specialDropValue); + InfernalMobsCore.removeEntFromElites(event.entityLiving); + } + } + } + public static class MobFarmDetectedEvent extends ChunkEvent { public final long triggeringInterval; @@ -226,21 +247,4 @@ public MobFarmDetectedEvent(Chunk chunk, long ti, float td) { triggeringDamage = td; } } - - @SubscribeEvent - public void onEntityLivingDrops(LivingDropsEvent event) { - if (!event.entity.worldObj.isRemote) { - MobModifier mod = InfernalMobsCore.getMobModifiers(event.entityLiving); - if (mod != null) { - mod.onDropItems( - 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/SaveEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java similarity index 68% rename from src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java rename to src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java index 9980c45fe..10fce8168 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/SaveEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/events/SaveEventHandler.java @@ -1,7 +1,4 @@ -package atomicstryker.infernalmobs.common; - -import java.util.Iterator; -import java.util.Map.Entry; +package atomicstryker.infernalmobs.common.events; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -9,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 { @@ -40,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.instance().getNBTTag()); - if (!savedMods.equals("")) { - InfernalMobsCore.instance().addEntityModifiersByString((EntityLivingBase) newEnt, savedMods); + String savedMods = newEnt.getEntityData() + .getString(InfernalMobsCore.getNBTTag()); + if (!savedMods.isEmpty()) { + InfernalMobsCore.instance() + .addEntityModifiersByString((EntityLivingBase) newEnt, savedMods); } } } @@ -51,14 +51,8 @@ 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/modifiers/MM_1UP.java similarity index 72% 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 6c02ac85b..17a234049 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,13 +7,13 @@ 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 { + 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) { @@ -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; } @@ -35,22 +36,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntityCreeper.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRecurrence", "theUndying", "oftwinLives" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "recurring", "undying", "twinlived" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -64,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/mods/MM_Alchemist.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Alchemist.java similarity index 80% 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 97cb46a96..c78e094a2 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,19 +8,18 @@ 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 { + 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; @@ -48,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); @@ -63,15 +63,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theWitchkin", "theBrewmaster", "theSinged" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "witchkin", "brewing", "singed" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -86,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/mods/MM_Berserk.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Berserk.java similarity index 58% 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 6390d9ab4..e81325612 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,11 +7,11 @@ 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 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; @@ -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); } @@ -34,22 +35,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntityCreeper.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRecklessness", "theRaging", "ofSmashing" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "reckless", "raging", "smashing" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -63,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/mods/MM_Blastoff.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Blastoff.java similarity index 69% 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 22b1e099e..a4bc29d19 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,13 +9,14 @@ 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 { - 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); @@ -25,8 +26,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); } @@ -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); } } } @@ -71,22 +72,16 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static Class[] modBans = { MM_Webber.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofMissionControl", "theNASA", "ofWEE" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "thumping", "trolling", "byebye" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -101,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/mods/MM_Bulwark.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Bulwark.java similarity index 74% 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 9035602f7..1af9f3655 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,11 +6,10 @@ 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 final String[] suffix = { "ofTurtling", "theDefender", "ofeffingArmor" }; + private static final String[] prefix = { "turtling", "defensive", "armoured" }; private static float damageMultiplier; public MM_Bulwark(@Nullable MobModifier next) { @@ -27,15 +26,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofTurtling", "theDefender", "ofeffingArmor" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "turtling", "defensive", "armoured" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -49,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/mods/MM_Choke.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Choke.java similarity index 81% 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 ddbc93072..1ce417f0a 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,11 +10,11 @@ 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 { + 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; @@ -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 = ((EntityPlayerMP) lastTarget).getUniqueID(); + UUID id = lastTarget.getUniqueID(); if (id != null) { - InfernalMobsCore.instance().getModifiedPlayerTimes().put(id, System.currentTimeMillis()); + InfernalMobsCore.instance() + .getModifiedPlayerTimes() + .put(id, System.currentTimeMillis()); } } } @@ -97,15 +100,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofBreathlessness", "theAnaerobic", "ofDeprivation" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "Sith Lord", "Dark Lord", "Darth" }; - public static class Loader extends ModifierLoader { public Loader() { 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 82% 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 27bf5391f..a928d8ba2 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,14 +10,14 @@ 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; + 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); @@ -54,22 +54,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntitySpider.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofStalking", "theUnseen", "thePredator" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "stalking", "unseen", "hunting" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -84,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/mods/MM_Darkness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Darkness.java similarity index 66% 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 d574038fc..734868418 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,11 +10,11 @@ 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 { + 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) { @@ -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)); } @@ -48,15 +50,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofDarkness", "theShadow", "theEclipse" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "dark", "shadowkin", "eclipsed" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -71,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/mods/MM_Ender.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ender.java similarity index 68% 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 d924de7fb..aea1e5569 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,16 +11,15 @@ 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 { - 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); @@ -30,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)); @@ -46,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; @@ -76,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; @@ -87,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 { @@ -108,12 +108,11 @@ 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 - .spawnParticle("portal", var24, var26, var28, (double) var21, (double) var22, (double) var23); + + (mob.worldObj.rand.nextDouble() - 0.5D) * (double) mob.width * 2.0D; + mob.worldObj.spawnParticle("portal", var24, var26, var28, var21, var22, var23); } mob.worldObj.playSoundEffect(oldX, oldY, oldZ, "mob.endermen.portal", 1.0F, 1.0F); @@ -127,15 +126,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theEnderborn", "theTrickster" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "enderborn", "tricky" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -150,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/mods/MM_Exhaust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Exhaust.java similarity index 78% 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 b5d32d95b..635e99f1f 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,11 +6,11 @@ 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 { + private static final String[] suffix = { "ofFatigue", "theDrainer" }; + private static final String[] prefix = { "exhausting", "draining" }; + public MM_Exhaust(@Nullable MobModifier next) { super("Exhaust", next); } @@ -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,15 +38,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofFatigue", "theDrainer" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "exhausting", "draining" }; - public static class Loader extends ModifierLoader { public Loader() { 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 74% 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 cd9c650ab..2f7ab186b 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,11 +7,10 @@ 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 final String[] suffix = { "ofConflagration", "thePhoenix", "ofCrispyness" }; + private static final String[] prefix = { "burning", "toasting" }; private static int fireDuration; public MM_Fiery(@Nullable MobModifier next) { @@ -21,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()) { - ((EntityLivingBase) source.getEntity()).setFire(fireDuration); + && !(source instanceof EntityDamageSourceIndirect) + && !source.isProjectile()) { + source.getEntity() + .setFire(fireDuration); } mob.extinguish(); @@ -44,15 +44,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofConflagration", "thePhoenix", "ofCrispyness" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "burning", "toasting" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -67,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/mods/MM_Ghastly.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java similarity index 79% 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 2a02d748f..a4cb2dde8 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Ghastly.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ghastly.java @@ -1,21 +1,19 @@ -package atomicstryker.infernalmobs.common.mods; +package atomicstryker.infernalmobs.common.modifiers; 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; -import atomicstryker.infernalmobs.common.MobModifier; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; - 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); @@ -39,12 +37,11 @@ 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; - 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,15 +57,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "OMFGFIREBALLS", "theBomber", "ofBallsofFire" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "bombing", "fireballsy" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -83,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/mods/MM_Gravity.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Gravity.java similarity index 74% 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 5a1cc8208..80ec61372 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,14 +10,15 @@ 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 { - 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); @@ -27,8 +28,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); } @@ -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); } } } @@ -84,7 +85,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,22 +98,16 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static Class[] modBans = { MM_Webber.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRepulsion", "theFlipper" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "repulsing", "sproing" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -127,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/mods/MM_Lifesteal.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Lifesteal.java similarity index 72% 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 053bb2ca6..7bb58e6a2 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,11 +8,12 @@ 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 { + 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) { @@ -23,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); @@ -34,22 +36,16 @@ public Class[] getBlackListMobClasses() { return disallowed; } - private static Class[] disallowed = { EntityCreeper.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theVampire", "ofTransfusion", "theBloodsucker" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "vampiric", "transfusing", "bloodsucking" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -63,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/mods/MM_Ninja.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Ninja.java similarity index 64% 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 310670c6f..57b2ecd07 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,16 +11,15 @@ 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 { - 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); @@ -30,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); @@ -45,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; @@ -75,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; @@ -86,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 { @@ -100,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); } } @@ -117,15 +117,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "theZenMaster", "ofEquilibrium", "ofInnerPeace" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "totallyzen", "innerlypeaceful", "Ronin" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -140,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/mods/MM_Poisonous.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Poisonous.java similarity index 72% 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 e8479f755..ffe8ba5cc 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,11 +10,11 @@ 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 { + 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) { @@ -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)); } @@ -50,15 +51,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofVenom", "thedeadlyChalice" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "poisonous", "stinging", "despoiling" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -73,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/mods/MM_Quicksand.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Quicksand.java similarity index 72% 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 842e4beb9..1981582b3 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,22 +7,21 @@ 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 { + 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()) - && 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)); } @@ -35,15 +34,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofYouCantRun", "theSlowingB" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "slowing", "Quicksand" }; - public static class Loader extends ModifierLoader { public Loader() { 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 74% 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 995d323de..34b2f0fdf 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,13 +6,13 @@ 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 { - 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); @@ -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); @@ -35,15 +36,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofWTFIMBA", "theCancerous", "ofFirstAid" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "regenerating", "healing", "nighunkillable" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -58,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/mods/MM_Rust.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Rust.java similarity index 70% 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 865db6237..73a4de265 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,11 +8,10 @@ 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 final String[] suffix = { "ofDecay", "theEquipmentHaunter" }; + private static final String[] prefix = { "rusting", "decaying" }; private static int itemDamage; public MM_Rust(@Nullable MobModifier next) { @@ -22,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()); } } @@ -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,15 +46,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofDecay", "theEquipmentHaunter" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "rusting", "decaying" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -69,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/mods/MM_Sapper.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sapper.java similarity index 73% 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 89bf79d2b..290200968 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,11 +9,11 @@ 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 { + private static final String[] suffix = { "ofHunger", "thePaleRider" }; + private static final String[] prefix = { "hungering", "starving" }; private static int potionDuration; public MM_Sapper(@Nullable MobModifier next) { @@ -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)); } @@ -48,15 +49,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofHunger", "thePaleRider" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "hungering", "starving" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -71,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/mods/MM_Sprint.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java similarity index 88% 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 91796951e..12115a09a 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Sprint.java +++ b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sprint.java @@ -1,18 +1,19 @@ -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; + 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); @@ -35,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; @@ -88,15 +86,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofBolting", "theSwiftOne", "ofbeinginyourFace" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "sprinting", "swift", "charging" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -111,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/mods/MM_Sticky.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Sticky.java similarity index 62% 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 02e2ee9e5..d05b84df1 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,41 +11,39 @@ 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; + 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 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 - && !(source instanceof EntityDamageSourceIndirect)) { + 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); } } } @@ -54,8 +52,6 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { return super.onHurt(mob, source, damage); } - private Class[] disallowed = { EntityCreeper.class }; - @Override public Class[] getBlackListMobClasses() { return disallowed; @@ -66,15 +62,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofSnagging", "theQuickFingered", "ofPettyTheft", "yoink" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "thieving", "snagging", "quickfingered" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -89,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/mods/MM_Storm.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Storm.java similarity index 71% 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 cb95abb35..ec2ce80b1 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,14 +8,13 @@ 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; - 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); @@ -37,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)); } } @@ -52,15 +51,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofLightning", "theRaiden" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "striking", "thundering", "electrified" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -75,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/mods/MM_Vengeance.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Vengeance.java similarity index 65% 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 e5856b4bd..675ebca2f 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,11 +7,11 @@ 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 { + private static final String[] suffix = { "ofRetribution", "theThorned", "ofStrikingBack" }; + private static final String[] prefix = { "thorned", "thorny", "spiky" }; private static float reflectMultiplier; private static float maxReflectDamage; @@ -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); @@ -38,15 +40,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofRetribution", "theThorned", "ofStrikingBack" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "thorned", "thorny", "spiky" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -61,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/mods/MM_Weakness.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Weakness.java similarity index 69% 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 ed99a9296..9f0ea7615 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,11 +9,11 @@ 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 { + private static final String[] suffix = { "ofApathy", "theDeceiver" }; + private static final String[] prefix = { "apathetic", "deceiving" }; private static int potionDuration; public MM_Weakness(@Nullable MobModifier next) { @@ -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)); } @@ -45,15 +47,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofApathy", "theDeceiver" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "apathetic", "deceiving" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -68,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/mods/MM_Webber.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Webber.java similarity index 78% 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 2588e423d..cbf376c2d 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,13 +9,13 @@ 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; + 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); @@ -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); } } @@ -75,22 +75,16 @@ public Class[] getModsNotToMixWith() { return modBans; } - private static Class[] modBans = { MM_Gravity.class, MM_Blastoff.class }; - @Override protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofTraps", "theMutated", "theSpider" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "ensnaring", "webbing" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -105,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/mods/MM_Wither.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MM_Wither.java similarity index 67% 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 d66713ba9..e7f71b401 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,11 +10,11 @@ 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 { + private static final String[] suffix = { "ofDarkSkulls", "Doomskull" }; + private static final String[] prefix = { "withering" }; private static int potionDuration; public MM_Wither(@Nullable MobModifier next) { @@ -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)); } @@ -48,15 +50,11 @@ protected String[] getModNameSuffix() { return suffix; } - private static String[] suffix = { "ofDarkSkulls", "Doomskull" }; - @Override protected String[] getModNamePrefix() { return prefix; } - private static String[] prefix = { "withering" }; - public static class Loader extends ModifierLoader { public Loader() { @@ -71,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/MobModifier.java b/src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java similarity index 81% rename from src/main/java/atomicstryker/infernalmobs/common/MobModifier.java rename to src/main/java/atomicstryker/infernalmobs/common/modifiers/MobModifier.java index 77ea1bdee..d664a407c 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 { @@ -23,12 +24,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; + private final String modName; /** * keeps track of our past-max-bounds health patch @@ -79,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() : "")); } /** @@ -128,29 +129,30 @@ 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()); + 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.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() { + // 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(); @@ -163,15 +165,16 @@ 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); } } /** * passes the setAttackTarget event to the modifier list - * + * * @param target being passed from the event */ public void onSetAttackTarget(EntityLivingBase target) { @@ -183,34 +186,35 @@ 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 * @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; } /** * 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 */ 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) { if (source.getEntity().worldObj.isRemote && source.getEntity() instanceof EntityPlayer) { - InfernalMobsCore.instance().sendHealthRequestPacket(mob); + InfernalMobsCore.instance() + .sendHealthRequestPacket(mob); } } @@ -221,10 +225,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; } @@ -232,6 +236,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); } @@ -241,6 +246,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 { @@ -252,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; } } @@ -265,8 +271,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. - * - * @param mob */ public float getActualHealth(EntityLivingBase mob) { if (!mob.worldObj.isRemote) { @@ -290,27 +294,27 @@ 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; } } /** - * @param mob * @return buffered modified max health */ 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; } /** * clientside receiving end of health packets sent from the InfernalMobs server instance - * - * @param packetReadout */ public void setActualHealth(float health, float maxHealth) { actualHealth = health; @@ -354,7 +358,6 @@ public int getModSize() { nextmod = nextmod.nextMod; } } - return bufferedSize; } @@ -374,7 +377,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' */ @@ -398,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; @@ -407,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; @@ -425,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; } @@ -446,4 +450,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 62f6532c8..f1a75ad7a 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/NetworkHelper.java b/src/main/java/atomicstryker/infernalmobs/common/network/NetworkHelper.java index 7184d29d6..be2d9754b 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; @@ -17,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 { @@ -40,114 +39,78 @@ 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 */ @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); - registeredClasses = new HashSet>(handledPacketClasses.length); - for (Class c : handledPacketClasses) { - registeredClasses.add(c); - } - } - - /** - * 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 static 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 - */ - public 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 - */ - public void readBytes(ChannelHandlerContext ctx, ByteBuf bytes); + registeredClasses = new HashSet<>(handledPacketClasses.length); + registeredClasses.addAll(Arrays.asList(handledPacketClasses)); } /** * Sends the supplied Packet from a client to the server - * - * @param packet */ 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; } /** * 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()); - 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; } /** * Sends a packet from the server to all currently connected players - * - * @param packet */ 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; } /** * 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()); 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; } /** * 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()); 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; } @@ -167,10 +130,36 @@ 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 */ - private class ChannelCodec extends FMLIndexedMessageToMessageCodec { + private static class ChannelCodec extends FMLIndexedMessageToMessageCodec { @SafeVarargs public ChannelCodec(Class... handledPacketClasses) { @@ -192,7 +181,7 @@ public void decodeInto(ChannelHandlerContext ctx, ByteBuf bytes, IPacket msg) { } @Sharable - public class ChannelHandler extends SimpleChannelInboundHandler { + public static class ChannelHandler extends SimpleChannelInboundHandler { public ChannelHandler() {} 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 c9eb0c42d..604f68bb2 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 83% rename from src/main/java/atomicstryker/infernalmobs/common/network/HealthPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/HealthPacket.java index b53be83b8..85453bd5e 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; @@ -50,17 +50,19 @@ 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 != null && ent instanceof EntityLivingBase) { + if (ent instanceof EntityLivingBase) { EntityLivingBase e = (EntityLivingBase) ent; MobModifier mod = InfernalMobsCore.getMobModifiers(e); if (mod != null) { 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/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 fe0789817..976aaac90 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 78% rename from src/main/java/atomicstryker/infernalmobs/common/network/MobModsPacket.java rename to src/main/java/atomicstryker/infernalmobs/common/network/packets/MobModsPacket.java index a20fbe9a1..e6264eebc 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; @@ -47,17 +47,20 @@ 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 != null && ent instanceof EntityLivingBase) { + if (ent instanceof EntityLivingBase) { EntityLivingBase e = (EntityLivingBase) ent; MobModifier mod = InfernalMobsCore.getMobModifiers(e); 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)); } } } 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 193d3ac71..a8e5422cf 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; diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt deleted file mode 100644 index 7e01d459d..000000000 --- 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