A various amount of fixes!!!!!

This commit is contained in:
Kam committed 2026-02-24 01:15:37 -05:00
1 parent 083d38b9d3
commit 5d16e79767
40 files changed
+111 -417

No files matched your search

@@ -434,7 +434,7 @@ public abstract class AbstractDataAbilities {
EntityLivingBase entity = getEntity();
List<String> toRemove = null;
for (Map.Entry<String, AbilityToggleEntry> mapEntry : activeToggles.entrySet()) {
for (Map.Entry<String, AbilityToggleEntry> mapEntry : new ArrayList<>(activeToggles.entrySet())) {
AbilityToggleEntry entry = mapEntry.getValue();
entry.incrementTick();
+1 -1
View File
@@ -1109,7 +1109,7 @@ public class DataAbilities extends AbstractDataAbilities {
}
public void readFromNBT(NBTTagCompound compound) {
enabled = compound.getBoolean("AbilitiesEnabled");
enabled = compound.hasKey("AbilitiesEnabled") ? compound.getBoolean("AbilitiesEnabled") : true;
minCooldown = compound.getInteger("AbilityMinCooldown");
maxCooldown = compound.getInteger("AbilityMaxCooldown");
@@ -212,7 +212,7 @@ public class SubGuiChainedAbilityConfig extends SubGuiInterface implements IText
if (allAllowPlayer && allAllowNpc) return UserType.BOTH;
if (allAllowPlayer) return UserType.PLAYER_ONLY;
if (allAllowNpc) return UserType.NPC_ONLY;
return UserType.NPC_ONLY;
return UserType.NONE;
}
// ═══════════════════════════════════════════════════════════════════════════
@@ -750,7 +750,9 @@ public class SubGuiChainedAbilityConfig extends SubGuiInterface implements IText
} else {
entries.add(ChainedAbilityEntry.reference(consumed.getReferenceId(), 0));
}
consumedSlotIndices.add(slotIndex);
if (!consumedSlotIndices.contains(slotIndex)) {
consumedSlotIndices.add(slotIndex);
}
}
}
}
@@ -119,8 +119,7 @@ public class AbilityHotbarSlotRenderer extends Gui {
if (iconNaturalSize <= 0) iconNaturalSize = 16f;
float iconScale = targetSize / iconNaturalSize;
GL11.glScalef(iconScale, iconScale, 1);
GL11.glColor4f(1, 1, 1, slotAlpha);
icon.draw(getToggleState());
icon.draw(getToggleState(), slotAlpha);
GL11.glColor4f(1, 1, 1, 1);
GL11.glPopMatrix();
}
@@ -60,6 +60,10 @@ public class AbilityIcon extends Gui {
}
public void draw(int state) {
draw(state, 1.0f);
}
public void draw(int state, float alpha) {
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
ImageData imageData = null;
@@ -68,7 +72,7 @@ public class AbilityIcon extends Gui {
}
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1);
GL11.glColor4f(1, 1, 1, alpha);
Tessellator t;
@@ -15,16 +15,19 @@ import noppes.npcs.controllers.data.AbilityHotbarData;
import noppes.npcs.controllers.data.PlayerData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* SubGui for selecting an ability to assign to a hotbar slot.
* Uses ability keys internally to avoid duplicate display name collisions.
*/
public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICustomScrollListener, ITextfieldListener {
private HashMap<String, String> displayToKey = new HashMap<>();
private LinkedHashMap<String, String> keyToDisplay = new LinkedHashMap<>();
private List<String> scrollKeys = new ArrayList<>();
private GuiCustomScroll scrollAbilities;
private String selected = null;
private int selectedIndex = -1;
private String search = "";
public boolean confirmed = false;
@@ -36,7 +39,6 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
this.slotIndex = slotIndex;
this.closeOnEsc = true;
this.drawDefaultBackground = true;
guiLeft -= 10;
xSize = 256 + 10;
this.setBackground("menubg.png");
}
@@ -44,7 +46,7 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
@Override
public void initGui() {
super.initGui();
guiTop += 10;
guiTop = (this.height - ySize) / 2 + 10;
if (scrollAbilities == null) {
scrollAbilities = new GuiCustomScroll(this, 0, 0);
@@ -66,7 +68,7 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
}
private void loadAbilities() {
displayToKey.clear();
keyToDisplay.clear();
PlayerData playerData = ClientCacheHandler.playerData;
if (playerData == null || playerData.abilityData == null) {
return;
@@ -85,7 +87,7 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
AbilityController.Instance.resolveAbility(key) : null;
displayName = ability != null ? ability.getDisplayName() : key;
}
displayToKey.put(displayName, key);
keyToDisplay.put(key, displayName);
}
}
@@ -93,9 +95,9 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
public void actionPerformed(GuiButton button) {
int id = button.id;
if (id == 0 && selected != null) {
if (id == 0 && selectedIndex >= 0 && selectedIndex < scrollKeys.size()) {
confirmed = true;
selectedAbilityKey = displayToKey.get(selected);
selectedAbilityKey = scrollKeys.get(selectedIndex);
this.close();
}
if (id == 1) {
@@ -109,15 +111,16 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
@Override
public void customScrollClicked(int i, int i1, int i2, GuiCustomScroll guiCustomScroll) {
if (guiCustomScroll == scrollAbilities)
selected = scrollAbilities.getSelected();
if (guiCustomScroll == scrollAbilities) {
selectedIndex = scrollAbilities.selected;
}
}
@Override
public void customScrollDoubleClicked(String selection, GuiCustomScroll guiCustomScroll) {
if (guiCustomScroll == scrollAbilities && selection != null) {
if (guiCustomScroll == scrollAbilities && selectedIndex >= 0 && selectedIndex < scrollKeys.size()) {
confirmed = true;
selectedAbilityKey = displayToKey.get(selection);
selectedAbilityKey = scrollKeys.get(selectedIndex);
this.close();
}
}
@@ -135,21 +138,23 @@ public class SubGuiSelectAbilityForSlot extends SubGuiInterface implements ICust
return;
search = getTextField(55).getText().toLowerCase();
scrollAbilities.resetScroll();
selectedIndex = -1;
scrollAbilities.setList(getSearchList());
}
}
}
private List<String> getSearchList() {
if (search.isEmpty()) {
return new ArrayList<>(displayToKey.keySet());
}
scrollKeys.clear();
List<String> displayNames = new ArrayList<>();
List<String> list = new ArrayList<>();
for (String name : displayToKey.keySet()) {
if (name.toLowerCase().contains(search))
list.add(name);
for (Map.Entry<String, String> entry : keyToDisplay.entrySet()) {
String displayName = entry.getValue();
if (search.isEmpty() || displayName.toLowerCase().contains(search)) {
scrollKeys.add(entry.getKey());
displayNames.add(displayName);
}
}
return list;
return displayNames;
}
}
@@ -741,7 +741,6 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
// Clean up any executing ability silently (no script events — already fired on old entity)
if (currentAbility != null && currentAbility.isExecuting()) {
removeTelegraph(currentAbility);
currentAbility.cleanup();
currentAbility.interrupt();
stopAbilityAnimation();
releaseRotationControl();
@@ -813,7 +812,6 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
// Silently clean up any stale executing ability
if (currentAbility != null && currentAbility.isExecuting()) {
removeTelegraph(currentAbility);
currentAbility.cleanup();
currentAbility.interrupt();
stopAbilityAnimation();
releaseRotationControl();
@@ -7,7 +7,6 @@ import kamkeel.npcs.controllers.data.ability.data.energy.EnergyDisplayData;
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyHomingData;
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyLifespanData;
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyLightningData;
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyTrajectoryData;
import kamkeel.npcs.entity.EntityAbilityOrb;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -117,8 +116,6 @@ public class ItemStaff extends ItemNpcInterface implements IProjectileCallback {
EnergyLightningData lightning = new EnergyLightningData();
EnergyLifespanData lifespan = new EnergyLifespanData(100, 72000);
EnergyHomingData homing = new EnergyHomingData();
EnergyTrajectoryData trajectory = new EnergyTrajectoryData();
homing.speed = 0.5f;
homing.homingStrength = 0.35f;
homing.homingRange = 20f;
@@ -126,7 +123,7 @@ public class ItemStaff extends ItemNpcInterface implements IProjectileCallback {
EntityAbilityOrb orb = new EntityAbilityOrb(
player.worldObj, player, null,
player.posX, player.posY + player.getEyeHeight(), player.posZ,
1.0f, colorData, combat, homing, lightning, lifespan, trajectory
1.0f, colorData, combat, homing, lightning, lifespan
);
orb.setupCharging(