From e194bd71cd1b37d2d4699839e62bc3d64d6205ae Mon Sep 17 00:00:00 2001 From: Vidal Date: Sat, 21 Feb 2026 17:13:42 -0300 Subject: [PATCH 1/7] Fixed setRace --- src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java b/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java index c1f4f9bb2..fb596b677 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptDBCPlayer.java @@ -789,7 +789,7 @@ public class ScriptDBCPlayer extends ScriptPlayer i } public void setRace(byte race) { - if (race < 0 || race > 1) + if (race < 0 || race > 5) return; player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcRace", race); From 8873705ce7d0e37664f35b4be29c85666bb25c81 Mon Sep 17 00:00:00 2001 From: Kam Date: Sat, 21 Feb 2026 15:28:59 -0500 Subject: [PATCH 2/7] Fix Some Flying Logic --- .../noppes/npcs/entity/EntityNPCFlying.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java index 18c730dd3..8c062fdda 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java @@ -62,15 +62,16 @@ public abstract class EntityNPCFlying extends EntityNPCInterface { } else if (heightOffGround > this.ais.flyHeightLimit) { aboveLimit = true; } - if (aboveLimit && this.ais.hasFlyLimit || (heightOffGround < Math.ceil(this.height) && this.motionY == 0)) { + if (aboveLimit && this.ais.hasFlyLimit) { this.flyLimitAllow = false; - if (!this.getNavigator().noPath() && this.motionY > 0) { + if (this.motionY > 0) { this.motionY = 0; - } else { - setNpcFlyingState(false); - super.moveEntityWithHeading(p_70612_1_, p_70612_2_); - return; } + } else if (heightOffGround < Math.ceil(this.height) && this.motionY == 0) { + this.flyLimitAllow = false; + setNpcFlyingState(false); + super.moveEntityWithHeading(p_70612_1_, p_70612_2_); + return; } this.flyLimitAllow = true; setNpcFlyingState(true); @@ -120,15 +121,16 @@ public abstract class EntityNPCFlying extends EntityNPCInterface { } else if (heightOffGround > this.ais.flyHeightLimit) { aboveLimit = true; } - if (aboveLimit && this.ais.hasFlyLimit || (heightOffGround < Math.ceil(this.height) && this.motionY == 0)) { + if (aboveLimit && this.ais.hasFlyLimit) { this.flyLimitAllow = false; - if (!this.getNavigator().noPath() && this.motionY > 0) { + if (this.motionY > 0) { this.motionY = 0; - } else { - setNpcFlyingState(false); - super.performMountedMovement(strafe, forward, moveSpeed); - return; } + } else if (heightOffGround < Math.ceil(this.height) && this.motionY == 0) { + this.flyLimitAllow = false; + setNpcFlyingState(false); + super.performMountedMovement(strafe, forward, moveSpeed); + return; } this.flyLimitAllow = true; setNpcFlyingState(true); From 3b198c927cb1a5645cc0abe736bf51abe13cb062 Mon Sep 17 00:00:00 2001 From: somehussar <148253652+somehussar@users.noreply.github.com> Date: Sat, 21 Feb 2026 22:39:12 +0100 Subject: [PATCH 3/7] Fix crash --- .../network/packets/data/RequestProperSpawnData.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java b/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java index afd013a74..af2eeb418 100644 --- a/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java +++ b/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java @@ -28,9 +28,16 @@ public class RequestProperSpawnData extends AbstractPacket { private static final int BATCH_LIMIT = 5; @SideOnly(Side.CLIENT) - private static final Set entitiesToFix = new HashSet<>(); + private static final Set entitiesToFix; @SideOnly(Side.CLIENT) - private static long lastBatchAttemptMillis = 0; + private static long lastBatchAttemptMillis; + + static { + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { + entitiesToFix = new HashSet<>(); + lastBatchAttemptMillis = 0; + } + } private int entityId; From 64e7a5153e0eb3886e1b68c71a95edfb6e5b442c Mon Sep 17 00:00:00 2001 From: Kam Date: Sat, 21 Feb 2026 16:49:21 -0500 Subject: [PATCH 4/7] Fix Crosshair Alignment --- .../npcs/entity/EntityAbilityLaser.java | 62 ++++++++++++------- .../npcs/entity/EntityEnergyProjectile.java | 15 +++++ 2 files changed, 56 insertions(+), 21 deletions(-) diff --git a/src/main/java/kamkeel/npcs/entity/EntityAbilityLaser.java b/src/main/java/kamkeel/npcs/entity/EntityAbilityLaser.java index 6a568a89d..f3a899181 100644 --- a/src/main/java/kamkeel/npcs/entity/EntityAbilityLaser.java +++ b/src/main/java/kamkeel/npcs/entity/EntityAbilityLaser.java @@ -8,6 +8,7 @@ import kamkeel.npcs.controllers.data.ability.data.EnergyTrajectoryData; import kamkeel.npcs.util.AnchorPointHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; @@ -172,18 +173,6 @@ public class EntityAbilityLaser extends EntityEnergyProjectile { EntityLivingBase livingOwner = (EntityLivingBase) owner; - // Update origin from anchor point - if (anchorData != null) { - Vec3 pos = AnchorPointHelper.calculateAnchorPosition(livingOwner, anchorData); - startX = pos.xCoord; - startY = pos.yCoord; - startZ = pos.zCoord; - } else { - startX = owner.posX; - startY = owner.posY + owner.height * 0.7; - startZ = owner.posZ; - } - // Update direction from owner's current rotation float yaw = (float) Math.toRadians(owner.rotationYaw); if (lockVerticalDirection) { @@ -199,6 +188,25 @@ public class EntityAbilityLaser extends EntityEnergyProjectile { dirZ = Math.cos(yaw) * Math.cos(pitch); } + // Update origin: for player casters, snap to look vector so laser aligns with crosshair. + // For NPCs, use the configured anchor point. + if (owner instanceof EntityPlayer) { + double eyeY = owner.posY + owner.getEyeHeight(); + float frontDist = Math.max(0.5f, laserWidth * 0.5f); + startX = owner.posX + dirX * frontDist; + startY = eyeY + dirY * frontDist; + startZ = owner.posZ + dirZ * frontDist; + } else if (anchorData != null) { + Vec3 pos = AnchorPointHelper.calculateAnchorPosition(livingOwner, anchorData); + startX = pos.xCoord; + startY = pos.yCoord; + startZ = pos.zCoord; + } else { + startX = owner.posX; + startY = owner.posY + owner.height * 0.7; + startZ = owner.posZ; + } + // Keep entity positioned at origin prevPosX = startX; prevPosY = startY; @@ -209,12 +217,6 @@ public class EntityAbilityLaser extends EntityEnergyProjectile { public void startMoving(EntityLivingBase target) { setCharging(false); - // Initialize from current anchor position - // updateLaserOriginAndDirection() will keep these updated each tick - startX = posX; - startY = posY; - startZ = posZ; - // Set initial direction from owner's rotation Entity owner = getOwnerEntity(); if (owner != null) { @@ -224,9 +226,9 @@ public class EntityAbilityLaser extends EntityEnergyProjectile { this.dirY = -Math.sin(pitch); this.dirZ = Math.cos(yaw) * Math.cos(pitch); } else if (target != null) { - double dx = target.posX - startX; - double dy = (target.posY + target.getEyeHeight() - 0.4) - startY; - double dz = target.posZ - startZ; + double dx = target.posX - posX; + double dy = (target.posY + target.getEyeHeight() - 0.4) - posY; + double dz = target.posZ - posZ; double len = Math.sqrt(dx * dx + dy * dy + dz * dz); if (len > 0) { this.dirX = dx / len; @@ -235,6 +237,24 @@ public class EntityAbilityLaser extends EntityEnergyProjectile { } } + // For player casters, snap origin to look vector so laser aligns with crosshair. + // For NPCs, use current anchor position. + if (owner instanceof EntityPlayer) { + double eyeY = owner.posY + owner.getEyeHeight(); + float frontDist = Math.max(0.5f, laserWidth * 0.5f); + startX = owner.posX + dirX * frontDist; + startY = eyeY + dirY * frontDist; + startZ = owner.posZ + dirZ * frontDist; + setPosition(startX, startY, startZ); + prevPosX = startX; + prevPosY = startY; + prevPosZ = startZ; + } else { + startX = posX; + startY = posY; + startZ = posZ; + } + // Initialize end point at start (will expand from here) this.endX = startX; this.endY = startY; diff --git a/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java b/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java index 5e48a468f..4a33e2489 100644 --- a/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java +++ b/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java @@ -132,6 +132,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { public EntityEnergyProjectile(World world) { super(world); this.setSize(0.5f, 0.5f); + this.yOffset = this.height / 2.0f; this.noClip = false; } @@ -363,6 +364,20 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { @Override public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements) { + // If position changed significantly (e.g. snap from anchor to look vector), + // skip interpolation and jump directly to prevent visual offset from crosshair + double dx = x - this.posX; + double dy = y - this.posY; + double dz = z - this.posZ; + if (dx * dx + dy * dy + dz * dz > 1.0) { + this.setPosition(x, y, z); + this.prevPosX = x; + this.prevPosY = y; + this.prevPosZ = z; + this.interpSteps = 0; + return; + } + this.interpTargetX = x; this.interpTargetY = y; this.interpTargetZ = z; From 8e734284589d3fef2d590abbbe6619275ece5ba3 Mon Sep 17 00:00:00 2001 From: Kam Date: Sat, 21 Feb 2026 16:50:23 -0500 Subject: [PATCH 5/7] Update RequestProperSpawnData.java --- .../npcs/network/packets/data/RequestProperSpawnData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java b/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java index af2eeb418..76e010660 100644 --- a/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java +++ b/src/main/java/kamkeel/npcs/network/packets/data/RequestProperSpawnData.java @@ -28,7 +28,8 @@ public class RequestProperSpawnData extends AbstractPacket { private static final int BATCH_LIMIT = 5; @SideOnly(Side.CLIENT) - private static final Set entitiesToFix; + private static Set entitiesToFix; + @SideOnly(Side.CLIENT) private static long lastBatchAttemptMillis; From 61d253638ae707f96f85d3f21a2403bd0bc111e7 Mon Sep 17 00:00:00 2001 From: Kam Date: Sat, 21 Feb 2026 17:10:48 -0500 Subject: [PATCH 6/7] Fix Server Side Crash --- .../data/ability/conditions/ConditionHasEffect.java | 7 +++++-- .../data/ability/conditions/ConditionHitCount.java | 4 ++++ .../controllers/data/ability/conditions/ConditionItem.java | 4 ++++ .../data/ability/conditions/ConditionQuestCompleted.java | 7 +++++-- .../data/ability/conditions/ConditionThreshold.java | 4 ++++ src/main/java/noppes/npcs/client/gui/builder/FieldDef.java | 7 ++++--- 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHasEffect.java b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHasEffect.java index 124b34bfb..bf98c73c9 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHasEffect.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHasEffect.java @@ -1,5 +1,7 @@ package kamkeel.npcs.controllers.data.ability.conditions; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import kamkeel.npcs.controllers.data.ability.UserType; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -7,7 +9,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import noppes.npcs.client.gui.advanced.SubGuiCustomEffectSelect; import noppes.npcs.client.gui.builder.FieldDef; -import noppes.npcs.client.gui.util.SubGuiInterface; import noppes.npcs.controllers.CustomEffectController; import noppes.npcs.controllers.data.CustomEffect; @@ -33,11 +34,12 @@ public class ConditionHasEffect extends AbilityCondition { return CustomEffectController.getInstance().hasEffect(player, effectId, effectIndex); } + @SideOnly(Side.CLIENT) @Override public void getConditionDefinitions(List defs) { defs.add(FieldDef.subGuiField("condition.select_effect", () -> new SubGuiCustomEffectSelect(effectId, effectIndex), - (SubGuiInterface gui) -> { + gui -> { SubGuiCustomEffectSelect sel = (SubGuiCustomEffectSelect) gui; if (sel.getSelectedEffectId() >= 0) { effectId = sel.getSelectedEffectId(); @@ -55,6 +57,7 @@ public class ConditionHasEffect extends AbilityCondition { })); } + @SideOnly(Side.CLIENT) @Override public String getConditionSummary() { String filterLabel = StatCollector.translateToLocal(getFilter().toString()); diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHitCount.java b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHitCount.java index 8a326a16c..5678e66df 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHitCount.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionHitCount.java @@ -1,5 +1,7 @@ package kamkeel.npcs.controllers.data.ability.conditions; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; @@ -52,12 +54,14 @@ public class ConditionHitCount extends AbilityCondition { this.withinTicks = Math.max(0, withinTicks); } + @SideOnly(Side.CLIENT) @Override public void getConditionDefinitions(List defs) { defs.add(FieldDef.intField("condition.required_hits", this::getRequiredHits, this::setRequiredHits).min(1)); defs.add(FieldDef.intField("condition.within_ticks", this::getWithinTicks, this::setWithinTicks).min(0)); } + @SideOnly(Side.CLIENT) @Override public String getConditionSummary() { String filterLabel = StatCollector.translateToLocal(getFilter().toString()); diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionItem.java b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionItem.java index a137304ef..f7827d1c3 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionItem.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionItem.java @@ -1,5 +1,7 @@ package kamkeel.npcs.controllers.data.ability.conditions; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -127,6 +129,7 @@ public class ConditionItem extends AbilityCondition { return itemName.equals(registryName); } + @SideOnly(Side.CLIENT) @Override public void getConditionDefinitions(List defs) { defs.add(FieldDef.enumField("condition.usage_type", UsageType.class, @@ -150,6 +153,7 @@ public class ConditionItem extends AbilityCondition { // .hover("condition.hover.required_count")); } + @SideOnly(Side.CLIENT) @Override public String getConditionSummary() { String filterLabel = StatCollector.translateToLocal(getFilter().toString()); diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionQuestCompleted.java b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionQuestCompleted.java index 213358ca5..d47e19506 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionQuestCompleted.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionQuestCompleted.java @@ -1,5 +1,7 @@ package kamkeel.npcs.controllers.data.ability.conditions; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import kamkeel.npcs.controllers.data.ability.UserType; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -7,7 +9,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import noppes.npcs.client.gui.builder.FieldDef; import noppes.npcs.client.gui.select.GuiQuestSelection; -import noppes.npcs.client.gui.util.SubGuiInterface; import noppes.npcs.controllers.QuestController; import noppes.npcs.controllers.data.PlayerData; import noppes.npcs.controllers.data.Quest; @@ -32,11 +33,12 @@ public class ConditionQuestCompleted extends AbilityCondition { return PlayerData.get(player).questData.hasFinishedQuest(questId); } + @SideOnly(Side.CLIENT) @Override public void getConditionDefinitions(List defs) { defs.add(FieldDef.subGuiField("condition.select_quest", () -> new GuiQuestSelection(questId), - (SubGuiInterface gui) -> { + gui -> { GuiQuestSelection sel = (GuiQuestSelection) gui; if (sel.selectedQuest != null) { questId = sel.selectedQuest.id; @@ -50,6 +52,7 @@ public class ConditionQuestCompleted extends AbilityCondition { .clearable(() -> questId = -1)); } + @SideOnly(Side.CLIENT) @Override public String getConditionSummary() { String filterLabel = StatCollector.translateToLocal(getFilter().toString()); diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionThreshold.java b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionThreshold.java index aaa4a6b06..148b0f7b5 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionThreshold.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/conditions/ConditionThreshold.java @@ -1,5 +1,7 @@ package kamkeel.npcs.controllers.data.ability.conditions; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; @@ -95,6 +97,7 @@ public abstract class ConditionThreshold extends AbilityCondition { return thresholdType.test(value, threshold); } + @SideOnly(Side.CLIENT) @Override public void getConditionDefinitions(List defs) { defs.add(FieldDef.floatField("condition.threshold_flat", this::getThresholdFlat, this::setThresholdFlat) @@ -122,6 +125,7 @@ public abstract class ConditionThreshold extends AbilityCondition { thresholdType = ThresholdType.fromOrdinal(nbt.getInteger("thresholdType")); } + @SideOnly(Side.CLIENT) @Override public String getConditionSummary() { String filterLabel = StatCollector.translateToLocal(getFilter().toString()); diff --git a/src/main/java/noppes/npcs/client/gui/builder/FieldDef.java b/src/main/java/noppes/npcs/client/gui/builder/FieldDef.java index 66e433f45..757c37470 100644 --- a/src/main/java/noppes/npcs/client/gui/builder/FieldDef.java +++ b/src/main/java/noppes/npcs/client/gui/builder/FieldDef.java @@ -118,10 +118,11 @@ public class FieldDef { return def; } - public static FieldDef subGuiField(String label, Supplier factory, Consumer resultHandler) { + @SuppressWarnings("unchecked") + public static FieldDef subGuiField(String label, Supplier factory, Consumer resultHandler) { FieldDef def = new FieldDef(label, FieldType.SUB_GUI); - def.subGuiFactory = factory; - def.subGuiResultHandler = resultHandler; + def.subGuiFactory = (Supplier) (Supplier) factory; + def.subGuiResultHandler = (Consumer) (Consumer) resultHandler; return def; } From 26da3ae2f90b835272ad46e01a4c0befa7a7263f Mon Sep 17 00:00:00 2001 From: Kam Date: Sat, 21 Feb 2026 17:43:41 -0500 Subject: [PATCH 7/7] 1.11 Beta 6.1 --- build.gradle | 2 +- src/main/java/noppes/npcs/CustomNpcs.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 626fa347b..2a9f8b1da 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'idea' } -version = "1.11-beta6" +version = "1.11-beta6.1" group= "kamkeel.customnpc-plus" archivesBaseName = "CustomNPC-Plus" diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index cf305f68b..4fd5b3fdf 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -122,7 +122,7 @@ import java.util.HashSet; import java.util.Set; import java.util.function.Consumer; -@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.11-beta6") +@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.11-beta6.1") public class CustomNpcs { @SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")