From 0658c53732233a9c5ae4bb34729dfd1dfdb84a1e Mon Sep 17 00:00:00 2001 From: layue13 Date: Tue, 30 Jun 2026 17:33:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=87=E7=89=A9=E5=85=B5?= =?UTF-8?q?=E5=88=83=E6=8A=80=E8=83=BD=E5=AE=9E=E4=BD=93=E8=B4=9F=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + compile-decompiled.sh | 12 ++--- .../com/moe/allweapon/AllWeaponLimits.java | 24 +++++++++ .../java/com/moe/allweapon/ClientProxy.java | 3 +- .../java/com/moe/allweapon/CommonProxy.java | 7 ++- .../allweapon/Entityadd/EntityDriveAdd.java | 3 +- .../Entityadd/EntitySlashDimensionAdd.java | 8 ++- .../Entityadd/EntitySummonedButterfly.java | 53 ++++++++++++++++--- .../Entityadd/EntitySummonedSwordAdd.java | 53 ++++++++++++++++--- .../java/com/moe/allweapon/SA/SAbaoku.java | 13 +++-- .../com/moe/allweapon/SA/SAhuanyingdie.java | 8 ++- .../com/moe/allweapon/SA/SAhuanyingdie2.java | 8 ++- .../java/com/moe/allweapon/SA/SAweizhan.java | 11 ++-- .../render/RenderSlashDimensionAdd.java | 7 ++- 14 files changed, 172 insertions(+), 39 deletions(-) create mode 100644 .gitignore create mode 100644 src/main/java/com/moe/allweapon/AllWeaponLimits.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/compile-decompiled.sh b/compile-decompiled.sh index 36759f1..f9ce8f8 100755 --- a/compile-decompiled.sh +++ b/compile-decompiled.sh @@ -7,14 +7,14 @@ TDLM_ROOT="$(cd "$ROOT/../.." && pwd)" CP="${CP:-}" if [ -z "$CP" ]; then CP_ENTRIES=() - for jar in \ - "$TDLM_ROOT/modsource/IndustrialCraft2/build/rfg/srg_patched_minecraft-classes.jar" \ - "$TDLM_ROOT/Uranium/eclipse/cauldron/build/libs/cauldron.jar" \ - "$TDLM_ROOT/Uranium/build/tmp/deobfuscateJar/deobfed.jar" \ - "$TDLM_ROOT/modsource/CodeChickenCore/build/rfg/srg_merged_minecraft.jar"; do + for jar in \ + "$TDLM_ROOT/modsource/CodeChickenCore/build/rfg/srg_merged_minecraft.jar" \ + "$TDLM_ROOT/modsource/CodeChickenCore/build/rfg/recompiled_minecraft-1.7.10.jar" \ + "$TDLM_ROOT/modsource/IndustrialCraft2/build/rfg/srg_patched_minecraft-classes.jar" \ + ; do [ -f "$jar" ] && CP_ENTRIES+=("$jar") done - for dir in "$TDLM_ROOT/Uranium/build/bundle/libraries" "$TDLM_ROOT/Uranium-server-run/mods" "$TDLM_ROOT/client/mods" "$TDLM_ROOT/_downloaded-deps" "$TDLM_ROOT/modsource/ImmersiveEngineering/externalLibs" "$TDLM_ROOT/modsource/CodeChickenCore/run/client/mods" "$TDLM_ROOT/modsource/CodeChickenCore/run/mods" "$TDLM_ROOT/modsource/Mekanism-Community-Edition/libs" "$TDLM_ROOT/modsource/ExtraBotany/libs"; do + for dir in "$TDLM_ROOT/Uranium/build/bundle/libraries" "$TDLM_ROOT/Uranium-server-run/libraries" "$TDLM_ROOT/Uranium-server-run/mods" "$TDLM_ROOT/client/mods" "$TDLM_ROOT/_downloaded-deps" "$TDLM_ROOT/modsource/ImmersiveEngineering/externalLibs" "$TDLM_ROOT/modsource/CodeChickenCore/run/client/mods" "$TDLM_ROOT/modsource/CodeChickenCore/run/mods" "$TDLM_ROOT/modsource/Mekanism-Community-Edition/libs" "$TDLM_ROOT/modsource/ExtraBotany/libs"; do if [ -d "$dir" ]; then while IFS= read -r jar; do case "$jar" in diff --git a/src/main/java/com/moe/allweapon/AllWeaponLimits.java b/src/main/java/com/moe/allweapon/AllWeaponLimits.java new file mode 100644 index 0000000..ba9db6d --- /dev/null +++ b/src/main/java/com/moe/allweapon/AllWeaponLimits.java @@ -0,0 +1,24 @@ +package com.moe.allweapon; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public final class AllWeaponLimits { + private AllWeaponLimits() { + } + + public static boolean isOnCooldown(NBTTagCompound tag, World world, String key, long ticks) { + long now = world.func_82737_E(); + if (tag.func_74763_f(key) > now) { + return true; + } + tag.func_74772_a(key, now + ticks); + return false; + } + + public static boolean isPlayerTarget(Entity entity) { + return entity instanceof EntityPlayer; + } +} diff --git a/src/main/java/com/moe/allweapon/ClientProxy.java b/src/main/java/com/moe/allweapon/ClientProxy.java index 56db186..5dbbe5d 100644 --- a/src/main/java/com/moe/allweapon/ClientProxy.java +++ b/src/main/java/com/moe/allweapon/ClientProxy.java @@ -15,6 +15,7 @@ import com.moe.allweapon.Entityadd.EntityDriveAdd; import com.moe.allweapon.Entityadd.EntitySlashDimensionAdd; import com.moe.allweapon.Entityadd.EntitySummonedButterfly; import com.moe.allweapon.Entityadd.EntitySummonedSwordAdd; +import com.moe.allweapon.Entityadd.EntitySummonedSwordPotionEffectAdd; import com.moe.allweapon.render.RenderDriveAdd; import com.moe.allweapon.render.RenderSlashDimensionAdd; import com.moe.allweapon.render.RenderSummonedButterfly; @@ -38,6 +39,7 @@ extends CommonProxy { RenderingRegistry.registerEntityRenderingHandler(EntityDriveAdd.class, (Render)new RenderDriveAdd()); RenderingRegistry.registerEntityRenderingHandler(EntitySlashDimensionAdd.class, (Render)new RenderSlashDimensionAdd()); RenderingRegistry.registerEntityRenderingHandler(EntitySummonedSwordAdd.class, (Render)new RenderSummonedSwordAdd()); + RenderingRegistry.registerEntityRenderingHandler(EntitySummonedSwordPotionEffectAdd.class, (Render)new RenderSummonedSwordAdd()); RenderingRegistry.registerEntityRenderingHandler(EntitySummonedButterfly.class, (Render)new RenderSummonedButterfly()); } @@ -46,4 +48,3 @@ extends CommonProxy { super.postInit(event); } } - diff --git a/src/main/java/com/moe/allweapon/CommonProxy.java b/src/main/java/com/moe/allweapon/CommonProxy.java index 1567227..09a2d27 100644 --- a/src/main/java/com/moe/allweapon/CommonProxy.java +++ b/src/main/java/com/moe/allweapon/CommonProxy.java @@ -33,6 +33,9 @@ import com.moe.allweapon.Blade.YouMing; import com.moe.allweapon.Blade.ZhanYue; import com.moe.allweapon.Entityadd.EntityDriveAdd; import com.moe.allweapon.Entityadd.EntitySlashDimensionAdd; +import com.moe.allweapon.Entityadd.EntitySummonedButterfly; +import com.moe.allweapon.Entityadd.EntitySummonedSwordAdd; +import com.moe.allweapon.Entityadd.EntitySummonedSwordPotionEffectAdd; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @@ -64,6 +67,9 @@ public class CommonProxy { SlashBlade.InitEventBus.register((Object)AllWeapon.instance); EntityRegistry.registerModEntity(EntityDriveAdd.class, (String)"DriveM1", (int)1701, (Object)AllWeapon.instance, (int)250, (int)1, (boolean)true); EntityRegistry.registerModEntity(EntitySlashDimensionAdd.class, (String)"SlashDimensionM1", (int)1702, (Object)AllWeapon.instance, (int)250, (int)200, (boolean)true); + EntityRegistry.registerModEntity(EntitySummonedSwordAdd.class, (String)"SummonedSwordAddM1", (int)1703, (Object)AllWeapon.instance, (int)250, (int)1, (boolean)true); + EntityRegistry.registerModEntity(EntitySummonedButterfly.class, (String)"SummonedButterflyM1", (int)1704, (Object)AllWeapon.instance, (int)250, (int)1, (boolean)true); + EntityRegistry.registerModEntity(EntitySummonedSwordPotionEffectAdd.class, (String)"SummonedSwordPotionAddM1", (int)1705, (Object)AllWeapon.instance, (int)250, (int)1, (boolean)true); } public void init(FMLInitializationEvent event) { @@ -72,4 +78,3 @@ public class CommonProxy { public void postInit(FMLPostInitializationEvent event) { } } - diff --git a/src/main/java/com/moe/allweapon/Entityadd/EntityDriveAdd.java b/src/main/java/com/moe/allweapon/Entityadd/EntityDriveAdd.java index adb4a2d..dde45b7 100644 --- a/src/main/java/com/moe/allweapon/Entityadd/EntityDriveAdd.java +++ b/src/main/java/com/moe/allweapon/Entityadd/EntityDriveAdd.java @@ -322,7 +322,7 @@ implements IThrowableEntity { ((ItemSlashBlade)this.blade.func_77973_b()).func_77644_a(this.blade, (EntityLivingBase)curEntity, (EntityLivingBase)this.thrower); } } - if (!(nBlock = this.field_70170_p.func_147439_a(nPosX = MathHelper.func_76128_c((double)this.field_70165_t), nPosY = MathHelper.func_76128_c((double)this.field_70163_u), nPosZ = MathHelper.func_76128_c((double)this.field_70161_v))).isAir((IBlockAccess)this.field_70170_p, nPosX, nPosY, nPosZ) && nBlock.func_149668_a(this.field_70170_p, nPosX, nPosY, nPosZ) != null) { + if ((nBlock = this.field_70170_p.func_147439_a(nPosX = MathHelper.func_76128_c((double)this.field_70165_t), nPosY = MathHelper.func_76128_c((double)this.field_70163_u), nPosZ = MathHelper.func_76128_c((double)this.field_70161_v))).func_149668_a(this.field_70170_p, nPosX, nPosY, nPosZ) != null) { this.func_70106_y(); } } @@ -487,4 +487,3 @@ implements IThrowableEntity { } } } - diff --git a/src/main/java/com/moe/allweapon/Entityadd/EntitySlashDimensionAdd.java b/src/main/java/com/moe/allweapon/Entityadd/EntitySlashDimensionAdd.java index dcdc812..8f43103 100644 --- a/src/main/java/com/moe/allweapon/Entityadd/EntitySlashDimensionAdd.java +++ b/src/main/java/com/moe/allweapon/Entityadd/EntitySlashDimensionAdd.java @@ -65,11 +65,11 @@ implements IThrowableEntity { private static final int THROWER_ENTITY_ID = 6; private static final int INTERVAL = 7; private static final int COLOR = 8; + private static final int SEED = 9; public EntitySlashDimensionAdd(World par1World) { super(par1World); this.field_70173_aa = 0; - this.getEntityData().func_74768_a("seed", this.field_70146_Z.nextInt(50)); } public EntitySlashDimensionAdd(World par1World, EntityLivingBase entityLiving, float AttackLevel, boolean multiHit) { @@ -102,6 +102,11 @@ implements IThrowableEntity { this.func_70096_w().func_75682_a(24, (Object)String.valueOf("model/util/SAhuixuanqiu/texture.png")); this.func_70096_w().func_75682_a(25, (Object)String.valueOf("model/util/SAhuixuanqiu/model.obj")); this.func_70096_w().func_75682_a(8, (Object)0x3333FF); + this.func_70096_w().func_75682_a(9, (Object)this.field_70146_Z.nextInt(50)); + } + + public int getSeed() { + return this.func_70096_w().func_75679_c(SEED); } public String getTexture() { @@ -346,4 +351,3 @@ implements IThrowableEntity { this.thrower = entity; } } - diff --git a/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedButterfly.java b/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedButterfly.java index ed33029..5ba3809 100644 --- a/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedButterfly.java +++ b/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedButterfly.java @@ -35,8 +35,11 @@ import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Random; +import java.util.WeakHashMap; import mods.flammpfeil.slashblade.ItemSlashBlade; import mods.flammpfeil.slashblade.ability.StylishRankManager; import net.minecraft.block.Block; @@ -63,6 +66,8 @@ public class EntitySummonedButterfly extends Entity implements IProjectile, IThrowableEntity { + private static final long PLAYER_HIT_COOLDOWN_TICKS = 5L; + private static final Map playerHitCooldown = Collections.synchronizedMap(new WeakHashMap()); protected Entity thrower; protected ItemStack blade = null; protected List alreadyHitEntity = new ArrayList(); @@ -78,6 +83,7 @@ IThrowableEntity { float hitPitch; private Block block; public Entity ridingEntity2 = null; + private IEntitySelector lastHitSelector = null; public EntitySummonedButterfly(World par1World) { super(par1World); @@ -235,7 +241,7 @@ IThrowableEntity { continue; } if (movingobjectposition == null || !((d3 = entityPos.func_72438_d(movingobjectposition.field_72307_f)) < tmpDistance) && tmpDistance != 0.0) continue; - if (entity == this.field_70154_o && !entity.canRiderInteract()) { + if (entity == this.field_70154_o) { if (tmpDistance != 0.0) continue; pointedEntity = entity; continue; @@ -302,6 +308,21 @@ IThrowableEntity { return par1 + f3; } + private boolean shouldSkipPlayerHit(Entity hitEntity) { + if (!(hitEntity instanceof EntityPlayer)) { + return false; + } + this.alreadyHitEntity.add(hitEntity); + long now = this.field_70170_p.func_82737_E(); + Long nextTick = playerHitCooldown.get(hitEntity); + if (nextTick != null && nextTick.longValue() > now) { + this.func_70106_y(); + return true; + } + playerHitCooldown.put(hitEntity, Long.valueOf(now + PLAYER_HIT_COOLDOWN_TICKS)); + return false; + } + public void setDriveVector(float fYVecOfset) { this.setDriveVector(fYVecOfset, true); } @@ -372,6 +393,7 @@ IThrowableEntity { protected MovingObjectPosition getMovingObjectPosition() { IEntitySelector[] selectors; + this.lastHitSelector = null; Vec3 vec3 = Vec3.func_72443_a((double)this.field_70165_t, (double)this.field_70163_u, (double)this.field_70161_v); Vec3 vec31 = Vec3.func_72443_a((double)(this.field_70165_t + this.field_70159_w), (double)(this.field_70163_u + this.field_70181_x), (double)(this.field_70161_v + this.field_70179_y)); MovingObjectPosition movingobjectposition = this.field_70170_p.func_72933_a(vec3, vec31); @@ -416,7 +438,7 @@ IThrowableEntity { } if (entity == null) continue; movingobjectposition = new MovingObjectPosition(entity); - movingobjectposition.hitInfo = selector; + this.lastHitSelector = selector; break; } if (movingobjectposition != null && movingobjectposition.field_72308_g != null && movingobjectposition.field_72308_g instanceof EntityPlayer) { @@ -494,9 +516,15 @@ IThrowableEntity { protected void attackEntity(Entity target) { if (this.thrower != null) { - this.thrower.getEntityData().func_74768_a("LastHitSummonedSwords", this.func_145782_y()); + EntitySummonedButterfly.setLastHitSummonedSwords(this.thrower, this.func_145782_y()); + } + boolean hitPlayer = target instanceof EntityPlayer; + if (this.shouldSkipPlayerHit(target)) { + return; + } + if (!hitPlayer) { + this.func_70078_a(target); } - this.func_70078_a(target); if (!this.field_70170_p.field_72995_K) { float magicDamage = 0.0f; target.field_70172_ad = 0; @@ -513,6 +541,9 @@ IThrowableEntity { ((ItemSlashBlade)this.blade.func_77973_b()).setDaunting((EntityLivingBase)target); } } + if (hitPlayer) { + this.func_70106_y(); + } } protected void blastAttackEntity(Entity target) { @@ -538,7 +569,7 @@ IThrowableEntity { boolean result = true; if (mop.field_72308_g != null) { Entity target = mop.field_72308_g; - if (mop.hitInfo.equals(ItemSlashBlade.AttackableSelector)) { + if (ItemSlashBlade.AttackableSelector.equals(this.lastHitSelector)) { this.attackEntity(target); } else { this.destructEntity(target); @@ -613,6 +644,17 @@ IThrowableEntity { return this.field_70146_Z; } + private static void setLastHitSummonedSwords(Entity entity, int entityId) { + try { + Object data = Entity.class.getMethod("getEntityData", new Class[0]).invoke(entity, new Object[0]); + if (data instanceof NBTTagCompound) { + ((NBTTagCompound)data).func_74768_a("LastHitSummonedSwords", entityId); + } + } + catch (Exception ignored) { + } + } + public boolean func_70038_c(double par1, double par3, double par5) { return false; } @@ -724,4 +766,3 @@ IThrowableEntity { this.thrower = entity; } } - diff --git a/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedSwordAdd.java b/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedSwordAdd.java index 920375f..9ef9240 100644 --- a/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedSwordAdd.java +++ b/src/main/java/com/moe/allweapon/Entityadd/EntitySummonedSwordAdd.java @@ -34,8 +34,11 @@ import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Random; +import java.util.WeakHashMap; import mods.flammpfeil.slashblade.ItemSlashBlade; import mods.flammpfeil.slashblade.ability.StylishRankManager; import net.minecraft.block.Block; @@ -62,6 +65,8 @@ public class EntitySummonedSwordAdd extends Entity implements IProjectile, IThrowableEntity { + private static final long PLAYER_HIT_COOLDOWN_TICKS = 5L; + private static final Map playerHitCooldown = Collections.synchronizedMap(new WeakHashMap()); protected Entity thrower; protected ItemStack blade = null; protected List alreadyHitEntity = new ArrayList(); @@ -77,6 +82,7 @@ IThrowableEntity { float hitPitch; private Block block; public Entity ridingEntity2 = null; + private IEntitySelector lastHitSelector = null; public EntitySummonedSwordAdd(World par1World) { super(par1World); @@ -234,7 +240,7 @@ IThrowableEntity { continue; } if (movingobjectposition == null || !((d3 = entityPos.func_72438_d(movingobjectposition.field_72307_f)) < tmpDistance) && tmpDistance != 0.0) continue; - if (entity == this.field_70154_o && !entity.canRiderInteract()) { + if (entity == this.field_70154_o) { if (tmpDistance != 0.0) continue; pointedEntity = entity; continue; @@ -301,6 +307,21 @@ IThrowableEntity { return par1 + f3; } + private boolean shouldSkipPlayerHit(Entity hitEntity) { + if (!(hitEntity instanceof EntityPlayer)) { + return false; + } + this.alreadyHitEntity.add(hitEntity); + long now = this.field_70170_p.func_82737_E(); + Long nextTick = playerHitCooldown.get(hitEntity); + if (nextTick != null && nextTick.longValue() > now) { + this.func_70106_y(); + return true; + } + playerHitCooldown.put(hitEntity, Long.valueOf(now + PLAYER_HIT_COOLDOWN_TICKS)); + return false; + } + public void setDriveVector(float fYVecOfset) { this.setDriveVector(fYVecOfset, true); } @@ -371,6 +392,7 @@ IThrowableEntity { protected MovingObjectPosition getMovingObjectPosition() { IEntitySelector[] selectors; + this.lastHitSelector = null; Vec3 vec3 = Vec3.func_72443_a((double)this.field_70165_t, (double)this.field_70163_u, (double)this.field_70161_v); Vec3 vec31 = Vec3.func_72443_a((double)(this.field_70165_t + this.field_70159_w), (double)(this.field_70163_u + this.field_70181_x), (double)(this.field_70161_v + this.field_70179_y)); MovingObjectPosition movingobjectposition = this.field_70170_p.func_72933_a(vec3, vec31); @@ -415,7 +437,7 @@ IThrowableEntity { } if (entity == null) continue; movingobjectposition = new MovingObjectPosition(entity); - movingobjectposition.hitInfo = selector; + this.lastHitSelector = selector; break; } if (movingobjectposition != null && movingobjectposition.field_72308_g != null && movingobjectposition.field_72308_g instanceof EntityPlayer) { @@ -493,9 +515,15 @@ IThrowableEntity { protected void attackEntity(Entity target) { if (this.thrower != null) { - this.thrower.getEntityData().func_74768_a("LastHitSummonedSwords", this.func_145782_y()); + EntitySummonedSwordAdd.setLastHitSummonedSwords(this.thrower, this.func_145782_y()); + } + boolean hitPlayer = target instanceof EntityPlayer; + if (this.shouldSkipPlayerHit(target)) { + return; + } + if (!hitPlayer) { + this.func_70078_a(target); } - this.func_70078_a(target); if (!this.field_70170_p.field_72995_K) { float magicDamage = 0.0f; target.field_70172_ad = 0; @@ -512,6 +540,9 @@ IThrowableEntity { ((ItemSlashBlade)this.blade.func_77973_b()).setDaunting((EntityLivingBase)target); } } + if (hitPlayer) { + this.func_70106_y(); + } } protected void blastAttackEntity(Entity target) { @@ -537,7 +568,7 @@ IThrowableEntity { boolean result = true; if (mop.field_72308_g != null) { Entity target = mop.field_72308_g; - if (mop.hitInfo.equals(ItemSlashBlade.AttackableSelector)) { + if (ItemSlashBlade.AttackableSelector.equals(this.lastHitSelector)) { this.attackEntity(target); } else { this.destructEntity(target); @@ -612,6 +643,17 @@ IThrowableEntity { return this.field_70146_Z; } + private static void setLastHitSummonedSwords(Entity entity, int entityId) { + try { + Object data = Entity.class.getMethod("getEntityData", new Class[0]).invoke(entity, new Object[0]); + if (data instanceof NBTTagCompound) { + ((NBTTagCompound)data).func_74768_a("LastHitSummonedSwords", entityId); + } + } + catch (Exception ignored) { + } + } + public boolean func_70038_c(double par1, double par3, double par5) { return false; } @@ -723,4 +765,3 @@ IThrowableEntity { this.thrower = entity; } } - diff --git a/src/main/java/com/moe/allweapon/SA/SAbaoku.java b/src/main/java/com/moe/allweapon/SA/SAbaoku.java index 12d95d3..0510a04 100644 --- a/src/main/java/com/moe/allweapon/SA/SAbaoku.java +++ b/src/main/java/com/moe/allweapon/SA/SAbaoku.java @@ -20,6 +20,7 @@ */ package com.moe.allweapon.SA; +import com.moe.allweapon.AllWeaponLimits; import com.moe.allweapon.Entityadd.EntitySummonedSwordPotionEffectAdd; import java.util.List; import java.util.Random; @@ -48,6 +49,9 @@ extends SpecialAttackBase { NBTTagCompound tag = ItemSlashBlade.getItemTagCompound((ItemStack)stack); if (!world.field_72995_K) { Entity tmp; + if (AllWeaponLimits.isOnCooldown(tag, world, "allweapon.baokuNextTick", 10L)) { + return; + } int cost = -50; if (!ItemSlashBlade.ProudSoul.tryAdd(tag, Integer.valueOf(-50), false)) { ItemSlashBlade.damageItem((ItemStack)stack, (int)5, (EntityLivingBase)player); @@ -70,7 +74,8 @@ extends SpecialAttackBase { StylishRankManager.setNextAttackType((Entity)player, (String)StylishRankManager.AttackTypes.PhantomSword); blade.attackTargetEntity(stack, target, player, Boolean.valueOf(true)); player.func_71009_b(target); - double o = target.field_70163_u + 10.0; + boolean targetIsPlayer = AllWeaponLimits.isPlayerTarget(target); + double o = targetIsPlayer ? target.field_70163_u : target.field_70163_u + 10.0; target.field_70159_w = 0.0; target.field_70181_x = 0.0; target.field_70179_y = 0.0; @@ -81,7 +86,8 @@ extends SpecialAttackBase { } int count = 1 + StylishRankManager.getStylishRank((Entity)player); Random rand = new Random(); - for (int i = 0; i < 32; ++i) { + int maxSwords = targetIsPlayer ? 4 : 16; + for (int i = 0; i < maxSwords; ++i) { target.func_70107_b(target.field_70165_t, o, target.field_70161_v); if (world.field_72995_K) continue; boolean isBurst = i % 2 == 0; @@ -92,7 +98,7 @@ extends SpecialAttackBase { if (entityDrive == null) continue; entityDrive.func_70012_b(target.field_70165_t + (double)(50.0f - a), target.field_70163_u + (double)b, target.field_70161_v + (double)(50.0f - c), target.field_70177_z + b * 36.0f, 0.0f); entityDrive.setInterval(50); - entityDrive.setLifeTime(80); + entityDrive.setLifeTime(targetIsPlayer ? 30 : 80); entityDrive.setColor(0xFFFF00); entityDrive.setTargetEntityId(target.func_145782_y()); world.func_72838_d((Entity)entityDrive); @@ -124,4 +130,3 @@ extends SpecialAttackBase { return target; } } - diff --git a/src/main/java/com/moe/allweapon/SA/SAhuanyingdie.java b/src/main/java/com/moe/allweapon/SA/SAhuanyingdie.java index 5fc95e0..5e77aad 100644 --- a/src/main/java/com/moe/allweapon/SA/SAhuanyingdie.java +++ b/src/main/java/com/moe/allweapon/SA/SAhuanyingdie.java @@ -19,6 +19,7 @@ */ package com.moe.allweapon.SA; +import com.moe.allweapon.AllWeaponLimits; import com.moe.allweapon.Entityadd.EntitySummonedButterfly; import java.util.Random; import mods.flammpfeil.slashblade.EntityDirectAttackDummy; @@ -45,6 +46,9 @@ extends SpecialAttackBase { World world = player.field_70170_p; NBTTagCompound tag = ItemSlashBlade.getItemTagCompound((ItemStack)stack); if (!world.field_72995_K) { + if (AllWeaponLimits.isOnCooldown(tag, world, "allweapon.huanyingdieNextTick", 6L)) { + return; + } int cost = -20; if (!ItemSlashBlade.ProudSoul.tryAdd(tag, Integer.valueOf(-20), false)) { ItemSlashBlade.damageItem((ItemStack)stack, (int)10, (EntityLivingBase)player); @@ -70,7 +74,7 @@ extends SpecialAttackBase { ItemSlashBlade.setComboSequence((NBTTagCompound)tag, (ItemSlashBlade.ComboSequence)ItemSlashBlade.ComboSequence.HiraTuki); if (!world.field_72995_K) { Random rand = new Random(); - for (int i = 0; i < 12; ++i) { + for (int i = 0; i < 8; ++i) { float a = rand.nextInt(30); float b = rand.nextInt(30); float e = rand.nextInt(30); @@ -83,7 +87,7 @@ extends SpecialAttackBase { entityDrive.func_70012_b(player.field_70165_t + (double)((15.0f - a) / 10.0f), player.field_70163_u + (double)((15.0f - b) / 10.0f) + (double)player.func_70047_e() / 2.0, player.field_70161_v + (double)((15.0f - e) / 10.0f), player.field_70177_z + (float)(i * 30), 0.0f); entityDrive.setDriveVector((float)(1.0E-4 * (double)a * (double)i + 1.0E-4)); entityDrive.setInterval((i + 1) * 3); - entityDrive.setLifeTime(40); + entityDrive.setLifeTime(30); entityDrive.setColor(65407); world.func_72838_d((Entity)entityDrive); } diff --git a/src/main/java/com/moe/allweapon/SA/SAhuanyingdie2.java b/src/main/java/com/moe/allweapon/SA/SAhuanyingdie2.java index 3b40ea5..780d6a4 100644 --- a/src/main/java/com/moe/allweapon/SA/SAhuanyingdie2.java +++ b/src/main/java/com/moe/allweapon/SA/SAhuanyingdie2.java @@ -16,6 +16,7 @@ */ package com.moe.allweapon.SA; +import com.moe.allweapon.AllWeaponLimits; import com.moe.allweapon.Entityadd.EntitySummonedButterfly; import java.util.Random; import mods.flammpfeil.slashblade.ItemSlashBlade; @@ -39,6 +40,9 @@ extends SpecialAttackBase { World world = player.field_70170_p; NBTTagCompound tag = ItemSlashBlade.getItemTagCompound((ItemStack)stack); if (!world.field_72995_K) { + if (AllWeaponLimits.isOnCooldown(tag, world, "allweapon.huanyingdie2NextTick", 8L)) { + return; + } int cost = -20; if (!ItemSlashBlade.ProudSoul.tryAdd(tag, Integer.valueOf(-20), false)) { ItemSlashBlade.damageItem((ItemStack)stack, (int)10, (EntityLivingBase)player); @@ -48,7 +52,7 @@ extends SpecialAttackBase { ItemSlashBlade.setComboSequence((NBTTagCompound)tag, (ItemSlashBlade.ComboSequence)ItemSlashBlade.ComboSequence.HiraTuki); if (!world.field_72995_K) { Random rand = new Random(); - for (int i = 0; i < 24; ++i) { + for (int i = 0; i < 12; ++i) { float a = rand.nextInt(100); float b = rand.nextInt(30); float e = rand.nextInt(100); @@ -61,7 +65,7 @@ extends SpecialAttackBase { entityDrive.func_70012_b(player.field_70165_t + (double)((50.0f - a) / 10.0f), player.field_70163_u + (double)((15.0f - b) / 10.0f) + (double)player.func_70047_e() / 2.0, player.field_70161_v + (double)((50.0f - e) / 10.0f), player.field_70177_z + (float)(i * 30), 0.0f); entityDrive.setDriveVector((float)(1.0E-4 * (double)a * (double)i + 1.0E-4)); entityDrive.setInterval((i + 1) * 3); - entityDrive.setLifeTime(80); + entityDrive.setLifeTime(40); entityDrive.setColor(0xFFFFFF); world.func_72838_d((Entity)entityDrive); } diff --git a/src/main/java/com/moe/allweapon/SA/SAweizhan.java b/src/main/java/com/moe/allweapon/SA/SAweizhan.java index d6719c4..8add628 100644 --- a/src/main/java/com/moe/allweapon/SA/SAweizhan.java +++ b/src/main/java/com/moe/allweapon/SA/SAweizhan.java @@ -20,6 +20,7 @@ */ package com.moe.allweapon.SA; +import com.moe.allweapon.AllWeaponLimits; import com.moe.allweapon.Entityadd.EntityDriveAdd; import java.util.List; import mods.flammpfeil.slashblade.ItemSlashBlade; @@ -47,6 +48,9 @@ extends SpecialAttackBase { NBTTagCompound tag = ItemSlashBlade.getItemTagCompound((ItemStack)stack); if (!world.field_72995_K) { Entity tmp; + if (AllWeaponLimits.isOnCooldown(tag, world, "allweapon.weizhanNextTick", 6L)) { + return; + } int cost = -10; if (!ItemSlashBlade.ProudSoul.tryAdd(tag, Integer.valueOf(-10), false)) { ItemSlashBlade.damageItem((ItemStack)stack, (int)5, (EntityLivingBase)player); @@ -80,7 +84,9 @@ extends SpecialAttackBase { if (5 <= rank) { magicDamage += ItemSlashBlade.AttackAmplifier.get(tag).floatValue() * (0.5f + (float)level / 5.0f); } - for (int i = 0; i < 8; ++i) { + boolean targetIsPlayer = AllWeaponLimits.isPlayerTarget(target); + int driveCount = targetIsPlayer ? 3 : 8; + for (int i = 0; i < driveCount; ++i) { EntityDriveAdd entityDrive = new EntityDriveAdd(world, (EntityLivingBase)player, magicDamage, false, 0.0f - ItemSlashBlade.ComboSequence.Battou.swingDirection); entityDrive.func_70034_d(i); entityDrive.field_70165_t = target.field_70165_t; @@ -90,7 +96,7 @@ extends SpecialAttackBase { entityDrive.setc(Float.valueOf(0.0f)); entityDrive.setk(Float.valueOf(0.0f)); entityDrive.setg(Float.valueOf(0.0f)); - entityDrive.setLifeTime(10); + entityDrive.setLifeTime(targetIsPlayer ? 8 : 10); entityDrive.setParticle("enchantmenttable"); if (entityDrive == null) continue; world.func_72838_d((Entity)entityDrive); @@ -123,4 +129,3 @@ extends SpecialAttackBase { return target; } } - diff --git a/src/main/java/com/moe/allweapon/render/RenderSlashDimensionAdd.java b/src/main/java/com/moe/allweapon/render/RenderSlashDimensionAdd.java index 4f03baa..5d0aa63 100644 --- a/src/main/java/com/moe/allweapon/render/RenderSlashDimensionAdd.java +++ b/src/main/java/com/moe/allweapon/render/RenderSlashDimensionAdd.java @@ -65,7 +65,7 @@ extends Render { boolean inverse = color < 0; double deathTime = lifetime; double baseAlpha = Math.sin(1.570796326794897 * (Math.min(deathTime, (double)((float)(lifetime - entity.field_70173_aa) - partialRenderTick)) / deathTime)); - int seed = entity.getEntityData().func_74762_e("seed"); + int seed = entity instanceof EntitySlashDimensionAdd ? ((EntitySlashDimensionAdd)entity).getSeed() : 0; int baseColor = color; Color col = new Color(baseColor); float[] hsb = Color.RGBtoHSB(col.getRed(), col.getGreen(), col.getBlue(), null); @@ -76,8 +76,8 @@ extends Render { float rot = (float)entity.field_70173_aa % rotParTicks / rotParTicks * 360.0f + partialRenderTick * (360.0f / rotParTicks); float scale = 0.01f; GL11.glScalef((float)scale, (float)scale, (float)scale); - float lastx = OpenGlHelper.lastBrightnessX; - float lasty = OpenGlHelper.lastBrightnessY; + float lastx = 0.0f; + float lasty = 0.0f; OpenGlHelper.func_77475_a((int)OpenGlHelper.field_77476_b, (float)240.0f, (float)240.0f); Color tmpColor = new Color(baseColor, true); GL11.glColor4f((float)((float)tmpColor.getRed() / 255.0f), (float)((float)tmpColor.getGreen() / 255.0f), (float)((float)tmpColor.getBlue() / 255.0f), (float)((float)tmpColor.getAlpha() / 255.0f)); @@ -137,4 +137,3 @@ extends Render { return textureLocation; } } -