mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 18:59:49 +00:00
Trim comments
This commit is contained in:
1 parent
f175e3fb82
commit
98c94bd406
32 files changed
+13
-137
No files matched your search
@@ -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();
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user