Trim comments

This commit is contained in:
KAMKEEL committed 2026-08-11 11:32:01 -04:00
1 parent f175e3fb82
commit 98c94bd406
32 files changed
+13 -137

No files matched your search

@@ -474,8 +474,6 @@ public class AbilityController implements IAbilityHandler {
changed = true;
}
// An active toggle holds the resolved Ability directly and keeps ticking it,
// so drop it without firing onToggle against an unregistered ability.
if (uuid != null && !uuid.isEmpty()) {
pData.abilityData.setToggleEntryDirect(uuid, 0);
}
@@ -1172,8 +1172,6 @@ public abstract class Ability implements IAbility, IAbilityAction {
this.burstIndex = 0;
this.burstEntities.clear();
// Use the effective windup, not the raw field: when the windup is synced to an
// animation the raw field is not the duration that actually applies.
if (getWindUpTicks() <= 0) {
this.phase = AbilityPhase.ACTIVE;
} else {
@@ -110,15 +110,7 @@ public interface IAbilityExtender {
}
/**
* Called when a barrier entity takes a melee hit, allowing extenders to scale the damage.
* A barrier is a plain Entity, so no LivingHurtEvent fires for it and an extender has no
* other opportunity to scale melee against it the way it scales {@link #modifyBarrierHealth}.
* Cumulative: all extenders apply in sequence, each receiving the previous output.
*
* @param barrier The barrier being hit
* @param attacker The entity dealing the hit
* @param baseDamage The damage after the barrier's own melee multiplier
* @return The modified damage value
* Modify melee damage dealt to a barrier. Cumulative across all extenders.
*/
default float modifyBarrierMeleeDamage(EntityEnergyBarrier barrier, EntityLivingBase attacker, float baseDamage) {
return baseDamage;
@@ -74,8 +74,6 @@ public abstract class AbilityDefend extends Ability implements IAbilityDefend {
hitCount = 0;
lastAttacker = null;
lastDamageTaken = 0.0f;
// NPCs reuse one ability instance, so every transient field has to be cleared here.
// A leftover pendingCompletion would end the next activation on its first tick.
pendingDefendAnimation = null;
defendAnimEndTick = -1;
lastDefendTick = -1;
@@ -97,8 +97,6 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
dz /= len;
}
// A rotation-locked NPC cannot turn to follow the target, so it can only hit what its
// frozen heading still covers - the same cone the player hit scan uses.
if (isRotationLockedForCurrentPhase()) {
Vec3 look = caster.getLookVec();
if (look != null && (dx * look.xCoord + dy * look.yCoord + dz * look.zCoord) < 0.95) {
@@ -249,9 +249,6 @@ public abstract class AbilityEnergyProjectile<E extends EntityEnergyProjectile>
*/
protected EntityLivingBase getLaunchTarget(EntityLivingBase caster, EntityLivingBase target) {
if (isPlayerCaster(caster)) return null;
// A rotation-locked NPC cannot turn, so launching from the target's position would let
// it fire a perfectly aimed shot regardless of where it is facing. Fall back to the
// look vector, which reflects the frozen heading.
if (isRotationLockedForCurrentPhase()) return null;
return target;
}
@@ -264,10 +264,7 @@ public class EntityAbilityLaser extends EntityEnergyProjectile {
Vec3 anchorPos = AnchorPointHelper.calculateAnchorPosition(livingOwner, anchorData);
setPosition(anchorPos.xCoord, anchorPos.yCoord, anchorPos.zCoord);
// Converge on the point the owner is aiming at, not on the target itself. Aiming
// straight at the target would re-derive the direction every tick and ignore the
// rotation the owner is actually allowed to reach, which is what track speed and
// rotation lock constrain.
// Aim where the owner is looking so track speed and rotation lock still apply.
double aimX = livingOwner.posX + dirX * maxLength;
double aimY = livingOwner.posY + livingOwner.getEyeHeight() + dirY * maxLength;
double aimZ = livingOwner.posZ + dirZ * maxLength;
@@ -155,7 +155,6 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD
// HAZARD-SPECIFIC PROPERTIES
// ═══════════════════════════════════════════════════════════════════
/** Floor on how often a hazard pulses, so a small interval cannot turn into a per-tick scan. */
public static final int MIN_DAMAGE_INTERVAL = 5;
private float damagePerSecond = 1.0f;
@@ -520,8 +519,6 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD
if (!isInZone(entity)) continue;
if (damagePerSecond > 0) {
// The configured value is damage per second, so a pulse deals the share of a
// second it covers. Applying it whole made the real rate depend on the interval.
applyDamage(entity, owner, damagePerSecond * (damageInterval / 20.0f));
}
@@ -117,7 +117,6 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
protected EnergyBarrierData barrierData = new EnergyBarrierData();
protected float currentHealth;
protected int ticksAlive = 0;
/** Absolute world time the barrier expires at, so ticks it misses cannot extend it. */
protected long barrierDeathTime = -1;
// ==================== DATA WATCHER INDICES ====================
@@ -443,9 +442,7 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
Entity attacker = source.getEntity();
// A barrier is a plain Entity, so no LivingHurtEvent fires for it and nothing scales the
// hit the way it would against a living target - vanilla hands us the bare attackDamage
// attribute. Run the scaling here instead, or the barrier only ever takes a point of it.
// No LivingHurtEvent fires for a barrier, so scale the hit here.
if (attacker instanceof EntityLivingBase) {
damage = AbilityController.Instance.fireModifyBarrierMeleeDamage(this, (EntityLivingBase) attacker, damage);
}
@@ -526,15 +523,12 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
}
}
// Set the deadline on the first tick after charging, so lifetime starts when the
// barrier is actually up. Counting elapsed ticks instead would let any tick the
// entity misses - chunk unload, for one - extend it past its configured duration.
if (barrierDeathTime < 0 && !isCharging()) {
barrierDeathTime = worldObj.getTotalWorldTime()
+ (barrierData.useDuration ? barrierData.durationTicks : BARRIER_HARD_LIFETIME_CAP);
}
// Duration check, and the hard lifetime cap for barriers with no duration
// Duration check
if (barrierDeathTime >= 0 && worldObj.getTotalWorldTime() >= barrierDeathTime) {
onBarrierDestroyed();
this.setDead();
@@ -50,8 +50,6 @@ public final class AbilityHotbarSelectPacket extends AbstractPacket {
// Deselect
data.abilityData.setSelectedIndex(-1);
} else {
// A key the player no longer has deselects rather than leaving the previous
// selection in place, which would fire a different ability than the one shown.
data.abilityData.setSelectedIndex(data.abilityData.getUnlockedAbilityList().indexOf(key));
}
data.save();
@@ -788,8 +788,7 @@ public abstract class AbstractDataAbilities {
// Script may have completed/cancelled the ability during the tick event
if (currentAbility == null) return;
if (!currentAbility.isExecuting()) {
// tick() itself can end the ability (DAZED -> IDLE). Run its completion here,
// otherwise it stays the current ability forever and nothing else can start.
// tick() can end the ability (DAZED -> IDLE)
if (phaseChanged && currentAbility.getPhase() == AbilityPhase.IDLE) {
handleAbilityCompletion(target);
}
@@ -225,11 +225,6 @@ public class CommonProxy implements IGuiHandler {
public void buildPackageIndex() {
}
/**
* Called from the mod's FMLLoadCompleteEvent, after every other mod has finished loading.
* Anything that has to observe another mod's registrations belongs here rather than in
* load(), and it stays on the proxy so client-only types never reach the server.
*/
public void loadComplete() {
}
@@ -343,9 +343,6 @@ public class CustomNpcs {
@EventHandler
public void loadComplete(FMLLoadCompleteEvent ev) {
// Runs after every other mod has loaded. Kept on the proxy: the client side registers
// inventory tabs, and naming those types here would drag client-only GUI classes into
// a class the server loads.
proxy.loadComplete();
proxy.buildPackageIndex();
+1 -3
View File
@@ -191,9 +191,7 @@ public class DataAbilities extends AbstractDataAbilities {
long now = npc.worldObj.getTotalWorldTime();
if (ability.isPerAbilityCooldown() && ability.getCooldownTicks() > 0) {
// The ability's own cooldown is tracked against the ability, so the global timer
// only paces how often the NPC acts. Folding the ability's cooldown into it as
// well would always outlast the per-ability entry and make it unreachable.
// Global timer only paces the NPC; the ability tracks its own cooldown
cooldownEndTime = now + baseCooldown;
setPerAbilityCooldown(ability.getName(), now + ability.getCooldownTicks(), ability.getCooldownTicks());
} else {
@@ -25,10 +25,7 @@ public class VersionCompatibility {
compound.setInteger("AimType", !aimShot ? 0 : 1);
}
// Fire projectiles used to ignite unconditionally. The ignite check now also requires
// pBurnItem, which reads false when the key is absent, so restore it for anything
// saved before the flag existed. Shipped alongside revision 23, so anything already
// at 23 was written by a build that had the flag.
// Restore burning on Fire projectiles saved before pBurnItem existed
if (compound.hasKey("pEffect") && !compound.hasKey("pBurnItem")) {
if (EnumPotionType.fromOrdinal(compound.getInteger("pEffect")) == EnumPotionType.Fire) {
compound.setBoolean("pBurnItem", true);
@@ -10,9 +10,6 @@ public class EntityAITransform extends EntityAIBase {
public EntityAITransform(EntityNPCInterface npc) {
this.npc = npc;
// No mutex: this only polls the world time and flips the transform, it drives nothing.
// Claiming PASSIVE let any running movement or look task starve it, so the day/night
// swap only fired in the gaps where those yielded - such as while saying a line.
setMutexBits(0);
}
@@ -852,8 +852,7 @@ public class ClientProxy extends CommonProxy {
@Override
public void loadComplete() {
// Deferred from load() so TConstruct has registered its own tabs first - registering
// ours before it left the vanilla tab duplicated.
// Deferred from load() so TConstruct registers its tabs first
if (ConfigClient.InventoryGuiEnabled) {
MinecraftForge.EVENT_BUS.register(new TabRegistry());
if (TabRegistry.getTabList().isEmpty()) {
@@ -13,14 +13,6 @@ public class SubGuiTrapPresetSelector extends SubGuiInterface {
public String selectedPreset = null;
/**
* Builds the trap editor's preset field.
* <p>
* This lives here rather than in AbilityTrap because the lambda below carries this class in
* its method descriptor. AbilityTrap is a both-side class, and @SideOnly does not strip the
* synthetic lambda methods it generates - so anything reflecting over its declared methods
* on a server would resolve that descriptor and fail to find this client-only type.
*/
public static FieldDef createPresetField(java.util.function.Consumer<String> applyPreset) {
return FieldDef.subGuiField("gui.applyPreset",
SubGuiTrapPresetSelector::new,
@@ -13,14 +13,6 @@ public class SubGuiZonePresetSelector extends SubGuiInterface {
public String selectedPreset = null;
/**
* Builds the zone editor's preset field.
* <p>
* This lives here rather than in AbilityZone because the lambda below carries this class in
* its method descriptor. AbilityZone is a both-side class, and @SideOnly does not strip the
* synthetic lambda methods it generates - so anything reflecting over its declared methods
* on a server would resolve that descriptor and fail to find this client-only type.
*/
public static FieldDef createPresetField(java.util.function.Consumer<String> applyPreset) {
return FieldDef.subGuiField("gui.applyPreset",
SubGuiZonePresetSelector::new,
@@ -39,14 +39,6 @@ public class SubGuiAbilityMagic extends SubGuiInterface implements ICustomScroll
private GuiNpcTextField splitField;
/**
* Builds the ability editor's magic field.
* <p>
* This lives here rather than in Ability because the lambdas below carry this class in
* their method descriptors. Ability is a both-side class, and anything reflecting over its
* declared methods on a server - Nashorn's adapter generator, for one - would resolve those
* descriptors and fail to find this client-only type.
*/
public static FieldDef createMagicField(MagicData magicData) {
return FieldDef.subGuiField("ability.magic.editor",
() -> new SubGuiAbilityMagic(magicData.copy()),
@@ -27,14 +27,6 @@ import java.util.Map;
@SideOnly(Side.CLIENT)
public class SubGuiCustomEffectSelect extends SubGuiInterface implements ICustomScrollListener, ITextfieldListener {
/**
* Builds the condition editor's effect-select field.
* <p>
* This lives here rather than in ConditionHasEffect because the lambdas below carry this
* class in their method descriptors. The condition is a both-side class, and @SideOnly does
* not strip the synthetic lambda methods it generates - so anything reflecting over its
* declared methods on a server would resolve those descriptors and fail to find this type.
*/
public static FieldDef createSelectField(ConditionHasEffect condition) {
return FieldDef.subGuiField("condition.select_effect",
() -> new SubGuiCustomEffectSelect(condition.getEffectId(), condition.getEffectIndex()),
@@ -117,12 +117,11 @@ public class GuiNpcTraderSetup extends GuiContainerNPCInterface2 implements ITex
@Override
public void save() {
// Linking to a different market already replaced the server's role with that market's
// data. Pushing this GUI's pre-link state back would overwrite the market being linked to.
// Relinking already loaded the target market server-side
if (marketRelinked)
return;
// Save the role first so the market is written from the edited data, not the stale data.
// Role first, so the market is written from the edited data
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
PacketClient.sendClient(new TraderMarketSavePacket(role.marketName, false));
}
@@ -29,14 +29,6 @@ public class GuiQuestSelection extends SubGuiInterface implements ICustomScrollL
private QuestCategory selectedCategory;
public Quest selectedQuest;
/**
* Builds the condition editor's quest-select field.
* <p>
* This lives here rather than in ConditionQuestCompleted because the lambdas below carry
* this class in their method descriptors. The condition is a both-side class, and @SideOnly
* does not strip the synthetic lambda methods it generates - so anything reflecting over its
* declared methods on a server would resolve those descriptors and fail to find this type.
*/
public static FieldDef createConditionField(ConditionQuestCompleted condition) {
return FieldDef.subGuiField("condition.select_quest",
() -> new GuiQuestSelection(condition.getQuestId()),
@@ -516,10 +516,7 @@ public abstract class GuiNPCInterface extends GuiScreen {
boolean subGui = hasSubGui();
// Mouse.getDWheel() clears the accumulated delta, so only the first caller in a frame
// ever sees it. Read it once here and let each widget take it in turn; anything that
// consumes it zeroes it so later widgets - the script editor, for one - are not left
// reading an already-drained wheel.
// Read the wheel once; each widget zeroes it when it consumes it
mouseScroll = Mouse.getDWheel();
drawCenteredString(fontRendererObj, title, width / 2, guiTop + 4, 0xffffff);
@@ -624,8 +624,6 @@ public class GuiScriptTextArea extends GuiNpcTextField {
int maxScroll = Math.max(0, getPaddedLineCount() - container.visibleLines);
// Handle mouse wheel scroll
// Take whatever the parent screen has left for this frame rather than polling the wheel
// again - the poll is destructive and the parent has already drained it.
int wheelDelta = listener instanceof GuiNPCInterface ? ((GuiNPCInterface) listener).mouseScroll : Mouse.getDWheel();
if (listener instanceof GuiNPCInterface) {
((GuiNPCInterface) listener).mouseScroll = 0;
@@ -486,8 +486,6 @@ public class GuiScriptTextArea1 extends GuiNpcTextField {
int maxScroll = Math.max(0, getPaddedLineCount() - container.visibleLines);
// Handle mouse wheel scroll
// Take whatever the parent screen has left for this frame rather than polling the wheel
// again - the poll is destructive and the parent has already drained it.
int wheelDelta = listener instanceof GuiNPCInterface ? ((GuiNPCInterface) listener).mouseScroll : Mouse.getDWheel();
if (listener instanceof GuiNPCInterface) {
((GuiNPCInterface) listener).mouseScroll = 0;
@@ -328,10 +328,6 @@ public class TypeInfo {
return fromGenericType(type, new HashSet<TypeVariable<?>>());
}
/**
* @param resolving type variables whose bounds are currently being expanded, so a
* self-referential bound such as {@code E extends Enum<E>} terminates
*/
private static TypeInfo fromGenericType(Type type, Set<TypeVariable<?>> resolving) {
if (type == null) return null;
@@ -383,7 +379,6 @@ public class TypeInfo {
if (type instanceof TypeVariable<?>) {
TypeVariable<?> typeVar = (TypeVariable<?>) type;
String varName = typeVar.getName();
// Already expanding this variable - emit it unbounded rather than recursing forever
if (!resolving.add(typeVar)) {
return TypeInfo.typeParameter(varName);
}
@@ -34,8 +34,6 @@ public class ModelMonkeyTail extends ModelRenderer {
public ModelMonkeyTail(ModelBiped base) {
super(base);
// Cancels ModelTail's rotationPointY of 11 so the boxes land where JBRA puts them
// on players: plain tail at 10, wrapped tail at 0.
float heightFactor = -11.0f;
(this.monkey_large = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6);
@@ -84,14 +84,9 @@ public class DialogController implements IDialogHandler {
lastUsedDialogID = id;
Dialog dialog = category.dialogs.get(id);
if (dialogs.containsKey(id)) {
// Dialog IDs live in the filename, not inside the JSON body,
// so a simple rename permanently resolves the conflict.
File catDir = new File(getDir(), category.title);
// Find the next free ID. It has to clear three things: the ids already
// registered globally, the ids this category still holds but has not
// reached yet, and any file already on disk - renameTo overwrites
// silently on POSIX, so landing on an existing file would destroy it.
// Skip ids held globally, by this category, or already on disk
int newId = lastUsedDialogID;
do {
newId++;
@@ -78,14 +78,9 @@ public class QuestController implements IQuestHandler {
lastUsedQuestID = id;
Quest quest = category.quests.get(id);
if (quests.containsKey(id)) {
// Quest IDs live in the filename, not inside the JSON body,
// so a simple rename permanently resolves the conflict.
File catDir = new File(getDir(), category.title);
// Find the next free ID. It has to clear three things: the ids already
// registered globally, the ids this category still holds but has not
// reached yet, and any file already on disk - renameTo overwrites
// silently on POSIX, so landing on an existing file would destroy it.
// Skip ids held globally, by this category, or already on disk
int newId = lastUsedQuestID;
do {
newId++;
@@ -832,8 +832,6 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
currentTarget = null;
lastAbilityActivationTime = -1;
// Cooldowns are absolute world-time deadlines and are restored from NBT, so relogging
// must not clear them or it becomes a way to bypass them.
interruptCooldownRolled = false;
// Reset sync tracking so next sync sends fresh state
@@ -1049,7 +1047,6 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
}
compound.setTag("ActiveToggles", toggleList);
// Cooldowns are absolute world-time deadlines, so they stay meaningful across sessions
NBTTagCompound cooldowns = new NBTTagCompound();
cooldowns.setLong("GlobalEnd", cooldownEndTime);
cooldowns.setInteger("GlobalDuration", globalCooldownDuration);
@@ -97,11 +97,6 @@ public class RoleTrader extends RoleInterface {
readFromNBT(nbttagcompound, true);
}
/**
* @param loadFromMarket pull the linked market's stored data over the compound just read.
* False when the compound is an admin edit, which is authoritative and
* would otherwise be overwritten by the market it is about to be saved to.
*/
public void readFromNBT(NBTTagCompound nbttagcompound, boolean loadFromMarket) {
String oldMarket = marketName;
marketName = nbttagcompound.getString("TraderMarket");