mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
19292ee426
22 files changed
+274
-169
No files matched your search
@@ -483,7 +483,11 @@ public class CustomItems {
|
||||
shield = new ItemRotatedShield(26744,EnumNpcToolMaterial.DIA).setUnlocalizedName("npcFullDiaShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullDiaShield");
|
||||
shield = new ItemRotatedShield(26745,EnumNpcToolMaterial.BRONZE).setUnlocalizedName("npcFullBronzeShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullBronzeShield");
|
||||
shield = new ItemRotatedShield(26727,EnumNpcToolMaterial.EMERALD).setUnlocalizedName("npcFullEmeraldShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullEmeraldShield");
|
||||
|
||||
shield = new ItemRotatedShield(26727,EnumNpcToolMaterial.DEMONIC).setUnlocalizedName("npcFullDemonicShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullDemonicShield");
|
||||
shield = new ItemRotatedShield(26727,EnumNpcToolMaterial.FROST).setUnlocalizedName("npcFullFrostShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullFrostShield");
|
||||
shield = new ItemRotatedShield(26727,EnumNpcToolMaterial.MITHRIL).setUnlocalizedName("npcFullMithrilShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullMithrilShield");
|
||||
|
||||
|
||||
shield = new ItemShield(26746,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcHeaterShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcHeaterShield");
|
||||
shield = new ItemShield(26747,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcCryscentShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCryscentShield");
|
||||
shield = new ItemShield(26748,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcScutumShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcScutumShield");
|
||||
|
||||
@@ -30,6 +30,7 @@ public class DataAI {
|
||||
public EnumCombatPolicy combatPolicy = EnumCombatPolicy.Flip;
|
||||
public int useRangeMelee = 0;
|
||||
public int tacticalRadius = 8;
|
||||
public int tacticalChance = 5;
|
||||
|
||||
public int movementType = 0;
|
||||
public double flySpeed = 1.0D;
|
||||
@@ -75,7 +76,8 @@ public class DataAI {
|
||||
canFireIndirect = compound.getInteger("FireIndirect");
|
||||
useRangeMelee = compound.getInteger("RangeAndMelee");
|
||||
distanceToMelee = compound.getInteger("DistanceToMelee");
|
||||
tacticalRadius = compound.getInteger("TacticalRadius");
|
||||
tacticalRadius = compound.getInteger("TacticalRadius");
|
||||
tacticalChance = compound.getInteger("TacticalChance");
|
||||
movingPause = compound.getBoolean("MovingPause");
|
||||
ignoreCobweb = compound.getBoolean("IgnoreCobweb");
|
||||
npcInteracting = compound.getBoolean("npcInteracting");
|
||||
@@ -145,6 +147,7 @@ public class DataAI {
|
||||
compound.setInteger("RangeAndMelee", useRangeMelee);
|
||||
compound.setInteger("DistanceToMelee", distanceToMelee);
|
||||
compound.setInteger("TacticalRadius", tacticalRadius);
|
||||
compound.setInteger("TacticalChance", tacticalChance);
|
||||
compound.setBoolean("MovingPause", movingPause);
|
||||
compound.setBoolean("IgnoreCobweb", ignoreCobweb);
|
||||
compound.setBoolean("npcInteracting", npcInteracting);
|
||||
|
||||
@@ -132,4 +132,19 @@ public class CombatHandler {
|
||||
|
||||
return threatLevel;
|
||||
}
|
||||
|
||||
public boolean shouldChangeTarget(double chance) {
|
||||
// Assuming randomNum is a random number between 0 and 100
|
||||
double randomNum = Math.random() * 100; // Generates a random number between 0 and 100
|
||||
return randomNum <= chance;
|
||||
}
|
||||
|
||||
public boolean shouldSwitchTactically(EntityLivingBase originalTarget, EntityLivingBase newTarget) {
|
||||
// Implement your Tactical Switcher conditions here
|
||||
// Example: Switch if the new target has a higher threat level
|
||||
float currentThreat = calculateThreatLevel(originalTarget);
|
||||
float newThreat = calculateThreatLevel(newTarget);
|
||||
|
||||
return newThreat > currentThreat;
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,6 @@ public class EntityAIDodgeShoot extends EntityAIBase
|
||||
public void updateTask()
|
||||
{
|
||||
if (this.entity.getAttackTarget() != null)
|
||||
this.entity.getLookHelper().setLookPositionWithEntity(this.entity.getAttackTarget(), 30.0F, 30.0F);
|
||||
this.entity.getLookHelper().setLookPositionWithEntity(this.entity.getAttackTarget(), 30.0F, 30.0F);
|
||||
}
|
||||
}
|
||||
@@ -19,14 +19,14 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
private int entityPosX;
|
||||
private int entityPosY;
|
||||
private int entityPosZ;
|
||||
private double field_75425_f;
|
||||
private float field_75426_g;
|
||||
private double speed;
|
||||
private float tacticalRange;
|
||||
|
||||
public EntityAIZigZagTarget(EntityCreature par1EntityCreature, double par2, float par4)
|
||||
{
|
||||
this.theEntity = par1EntityCreature;
|
||||
this.field_75425_f = par2;
|
||||
this.field_75426_g = par4;
|
||||
this.speed = par2;
|
||||
this.tacticalRange = par4;
|
||||
this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double)(this.field_75426_g * this.field_75426_g))
|
||||
else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double)(this.tacticalRange * this.tacticalRange))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -51,19 +51,18 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
|
||||
if (pathentity != null)
|
||||
{
|
||||
if (pathentity.getCurrentPathLength() >= this.field_75426_g)
|
||||
if (pathentity.getCurrentPathLength() >= this.tacticalRange)
|
||||
{
|
||||
PathPoint pathpoint = pathentity.getPathPointFromIndex(MathHelper.floor_double(this.field_75426_g / 2.0D));
|
||||
PathPoint pathpoint = pathentity.getPathPointFromIndex(MathHelper.floor_double(this.tacticalRange / 2.0D));
|
||||
this.entityPosX = pathpoint.xCoord;
|
||||
this.entityPosY = pathpoint.yCoord;
|
||||
this.entityPosZ = pathpoint.zCoord;
|
||||
|
||||
Vec3 vec3 = RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.theEntity, (int)field_75426_g, 3, Vec3.createVectorHelper(this.entityPosX, this.entityPosY, this.entityPosZ));
|
||||
Vec3 vec3 = RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.theEntity, (int) tacticalRange, 3, Vec3.createVectorHelper(this.entityPosX, this.entityPosY, this.entityPosZ));
|
||||
|
||||
if (vec3 != null)
|
||||
{
|
||||
if (this.targetEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.targetEntity.getDistanceSq(entityPosX, entityPosY, entityPosZ))
|
||||
// if (this.theEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) > field_75426_g * field_75426_g && this.targetEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.targetEntity.getDistanceSq(entityPosX, entityPosY, entityPosZ))
|
||||
{
|
||||
this.movePosX = vec3.xCoord;
|
||||
this.movePosY = vec3.yCoord;
|
||||
@@ -82,7 +81,7 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
*/
|
||||
public boolean continueExecuting()
|
||||
{
|
||||
return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double)(this.field_75426_g * this.field_75426_g);
|
||||
return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double)(this.tacticalRange * this.tacticalRange);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +89,7 @@ public class EntityAIZigZagTarget extends EntityAIBase
|
||||
*/
|
||||
public void startExecuting()
|
||||
{
|
||||
this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.field_75425_f);
|
||||
this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.speed);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ public class GuiNPCDialogSelection extends GuiNPCInterface implements IScrollDat
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "mco.template.button.select"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollDa
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "mco.template.button.select"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData
|
||||
}
|
||||
addTextField(new GuiNpcTextField(i,this, fontRendererObj, guiLeft + 4, guiTop + 4 + i * 24, 200, 20,text));
|
||||
addTextField(new GuiNpcTextField(i + 8,this, fontRendererObj, guiLeft + 208, guiTop + 4 + i * 24, 146, 20,sound));
|
||||
addButton(new GuiNpcButton(i, guiLeft + 358, guiTop + 4 + i * 24, 60, 20, "mco.template.button.select"));
|
||||
addButton(new GuiNpcButton(i, guiLeft + 358, guiTop + 4 + i * 24, 60, 20, "gui.select"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
|
||||
addLabel(new GuiNpcLabel(9, "gui.selectSound", guiLeft + 7, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 90, guiTop + 100, 194, 20, dialog.sound));
|
||||
addButton(new GuiNpcButton(9, guiLeft + 293, guiTop + 100, 60, 20, "mco.template.button.select"));
|
||||
addButton(new GuiNpcButton(9, guiLeft + 293, guiTop + 100, 60, 20, "gui.select"));
|
||||
|
||||
addLabel(new GuiNpcLabel(4, "availability.options", guiLeft + 180, guiTop + 33));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 303, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi
|
||||
getTextField(6).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
addTextField(new GuiNpcTextField(7,this, fontRendererObj, guiLeft + 85, y += 22, 100, 20, stats.fireSound));
|
||||
addLabel(new GuiNpcLabel(7, "stats.firesound:", guiLeft + 5, y + 5));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 187, y, 60, 20, "mco.template.button.select"));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 187, y, 60, 20, "gui.select"));
|
||||
addTextField(new GuiNpcTextField(8, this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.shotCount + ""));
|
||||
addLabel(new GuiNpcLabel(8, "stats.shotcount", guiLeft + 5, y + 5));
|
||||
getTextField(8).integersOnly = true;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GuiNPCQuestSelection extends GuiNPCInterface implements IScrollData
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "mco.template.button.select"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,15 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
}
|
||||
addLabel(new GuiNpcLabel(25,"ai.combatpolicy", guiLeft + 150, guiTop + 165));
|
||||
addButton(new GuiNpcButton(25 ,guiLeft + 230, guiTop + 160, 60, 20, EnumCombatPolicy.names(), ai.combatPolicy.ordinal()));
|
||||
if (ai.combatPolicy == EnumCombatPolicy.Stubborn)
|
||||
{
|
||||
String label = "";
|
||||
label = "gui.combatchance";
|
||||
addLabel(new GuiNpcLabel(21, label, guiLeft + 300, guiTop + 140));
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 380, guiTop + 135, 30, 20, ai.tacticalChance + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(1, 100, 5);
|
||||
}
|
||||
|
||||
getButton(17).setEnabled(this.ai.onAttack == 0);
|
||||
getButton(15).setEnabled(this.ai.onAttack == 0);
|
||||
@@ -91,6 +100,9 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
if(textfield.id == 3){
|
||||
ai.tacticalRadius = textfield.getInteger();
|
||||
}
|
||||
if(textfield.id == 4){
|
||||
ai.tacticalChance = textfield.getInteger();
|
||||
}
|
||||
if(textfield.id == 6){
|
||||
ai.distanceToMelee = textfield.getInteger();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.skinType == 0?display.texture:display.url));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "mco.template.button.select"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "gui.select"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url", "display.urlSix"},display.skinType));
|
||||
getButton(3).setEnabled(display.skinType == 0);
|
||||
if(display.skinType == 1 && display.playerProfile != null)
|
||||
|
||||
@@ -293,30 +293,6 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGeoModel(EntityNPCInterface npc, float rot, float partial)
|
||||
{
|
||||
((ModelMPM) mainModel).entity.renderYawOffset = ((ModelMPM) mainModel).entity.prevRenderYawOffset = 0;
|
||||
if (!npc.isInvisible())
|
||||
{
|
||||
RenderManager.instance.renderEntityWithPosYaw(((ModelMPM) mainModel).entity, 0,0,0,rot,partial);
|
||||
}
|
||||
else if (!npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(((ModelMPM) mainModel).entity, 0,0,0,rot,partial);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected float handleRotationFloat(EntityLivingBase par1EntityLiving, float par2){
|
||||
EntityNPCInterface npc = (EntityNPCInterface) par1EntityLiving;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public enum EnumPartyExchange {
|
||||
Leader("party.leader"),
|
||||
All("party.all"),
|
||||
Enrolled("party.enrolled"),
|
||||
Completer("party.completer");
|
||||
|
||||
String name;
|
||||
|
||||
EnumPartyExchange(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public static String[] names(){
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for(EnumPartyExchange e : values())
|
||||
list.add(e.name);
|
||||
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public enum EnumPartyRequirements {
|
||||
Leader("party.leader"),
|
||||
All("party.all"),
|
||||
Enrolled("party.enrolled"),
|
||||
Valid("party.valid");
|
||||
|
||||
String name;
|
||||
|
||||
EnumPartyRequirements(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public static String[] names(){
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for(EnumPartyRequirements e : values())
|
||||
list.add(e.name);
|
||||
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ public class Party {
|
||||
|
||||
private int currentQuestID = -1;
|
||||
private boolean friendlyFire;
|
||||
private boolean partyLocked = false;
|
||||
|
||||
//Client-sided
|
||||
private String partyLeaderName;
|
||||
@@ -45,6 +46,14 @@ public class Party {
|
||||
return this.partyUUID;
|
||||
}
|
||||
|
||||
public boolean getIsLocked() {
|
||||
return this.partyLocked;
|
||||
}
|
||||
|
||||
public void setIsLocked(boolean val) {
|
||||
this.partyLocked = val;
|
||||
}
|
||||
|
||||
public int getCurrentQuestID() {
|
||||
return currentQuestID;
|
||||
}
|
||||
@@ -219,6 +228,7 @@ public class Party {
|
||||
this.partyLeaderName = compound.getString("PartyLeader");
|
||||
this.currentQuestID = compound.getInteger("PartyQuestID");
|
||||
this.friendlyFire = compound.getBoolean("FriendlyFire");
|
||||
this.partyLocked = compound.getBoolean("PartyLocked");
|
||||
|
||||
NBTTagList list = compound.getTagList("PartyMembers", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
@@ -236,6 +246,7 @@ public class Party {
|
||||
compound.setString("PartyUUID", this.partyUUID.toString());
|
||||
compound.setInteger("PartyQuestID", this.currentQuestID);
|
||||
compound.setBoolean("FriendlyFire", this.friendlyFire);
|
||||
compound.setBoolean("PartyLocked", this.partyLocked);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (UUID uuid : this.partyOrder) {
|
||||
|
||||
@@ -11,10 +11,7 @@ import noppes.npcs.api.handler.data.IQuestCategory;
|
||||
import noppes.npcs.api.handler.data.IQuestInterface;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestCompletion;
|
||||
import noppes.npcs.constants.EnumQuestRepeat;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.quests.*;
|
||||
@@ -38,9 +35,10 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
public String command = "";
|
||||
|
||||
public boolean allowParty = false;
|
||||
public byte partyRequirements = 0; // 0 - Only Party Leaders, 1 - Everyone
|
||||
public byte rewardControl = 0; // 0 - Only Party Leaders, 1 - Everyone, 2 - Completer
|
||||
public int maxPartySize = 4;
|
||||
public EnumPartyRequirements partyRequirements = EnumPartyRequirements.Leader;
|
||||
public EnumPartyExchange rewardControl = EnumPartyExchange.Leader;
|
||||
public EnumPartyExchange completeFor = EnumPartyExchange.Leader;
|
||||
public int maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
|
||||
public QuestInterface questInterface = new QuestItem();
|
||||
|
||||
@@ -86,8 +84,9 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
// Party Management
|
||||
allowParty = compound.getBoolean("AllowParty");
|
||||
if(allowParty){
|
||||
partyRequirements = compound.getByte("PartyRequirements");
|
||||
rewardControl = compound.getByte("RewardControl");
|
||||
partyRequirements = EnumPartyRequirements.values()[compound.getInteger("PartyRequirements")];
|
||||
rewardControl = EnumPartyExchange.values()[compound.getInteger("RewardControl")];
|
||||
completeFor = EnumPartyExchange.values()[compound.getInteger("CompleteFor")];
|
||||
maxPartySize = compound.getInteger("MaxPartySize");
|
||||
}
|
||||
else {
|
||||
@@ -97,12 +96,16 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
if(compound.hasKey("RewardControl")){
|
||||
compound.removeTag("RewardControl");
|
||||
}
|
||||
if(compound.hasKey("CompleteFor")){
|
||||
compound.removeTag("CompleteFor");
|
||||
}
|
||||
if(compound.hasKey("MaxPartySize")){
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
|
||||
partyRequirements = 0;
|
||||
rewardControl = 0;
|
||||
partyRequirements = EnumPartyRequirements.Leader;
|
||||
rewardControl = EnumPartyExchange.Leader;
|
||||
completeFor = EnumPartyExchange.Leader;
|
||||
maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
}
|
||||
}
|
||||
@@ -149,8 +152,9 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
|
||||
compound.setBoolean("AllowParty", allowParty);
|
||||
if(allowParty){
|
||||
compound.setByte("PartyRequirements", partyRequirements);
|
||||
compound.setByte("RewardControl", rewardControl);
|
||||
compound.setInteger("PartyRequirements", partyRequirements.ordinal());
|
||||
compound.setInteger("RewardControl", rewardControl.ordinal());
|
||||
compound.setInteger("CompleteFor", completeFor.ordinal());
|
||||
compound.setInteger("MaxPartySize", maxPartySize);
|
||||
}
|
||||
else {
|
||||
@@ -160,6 +164,9 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
if(compound.hasKey("RewardControl")){
|
||||
compound.removeTag("RewardControl");
|
||||
}
|
||||
if(compound.hasKey("CompleteFor")){
|
||||
compound.removeTag("CompleteFor");
|
||||
}
|
||||
if(compound.hasKey("MaxPartySize")){
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
@@ -328,20 +335,37 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
this.allowParty = allowParty;
|
||||
}
|
||||
|
||||
public byte getPartyRequirements() {
|
||||
return partyRequirements;
|
||||
public int getPartyRequirements() {
|
||||
return partyRequirements.ordinal();
|
||||
}
|
||||
|
||||
public void setPartyRequirements(byte partyRequirements) {
|
||||
this.partyRequirements = partyRequirements;
|
||||
public void setPartyRequirements(int partyReq) {
|
||||
if (partyReq < 0 || partyReq >= EnumPartyRequirements.values().length) {
|
||||
return;
|
||||
}
|
||||
this.partyRequirements = EnumPartyRequirements.values()[partyReq];
|
||||
}
|
||||
|
||||
public byte getRewardControl() {
|
||||
return rewardControl;
|
||||
public int getRewardControl() {
|
||||
return rewardControl.ordinal();
|
||||
}
|
||||
|
||||
public void setRewardControl(byte rewardControl) {
|
||||
this.rewardControl = rewardControl;
|
||||
public void setRewardControl(int rewardCon) {
|
||||
if (rewardCon < 0 || rewardCon >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
}
|
||||
this.rewardControl = EnumPartyExchange.values()[rewardCon];
|
||||
}
|
||||
|
||||
public int getCompleteFor() {
|
||||
return completeFor.ordinal();
|
||||
}
|
||||
|
||||
public void setCompleteFor(int compFor) {
|
||||
if (compFor < 0 || compFor >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
}
|
||||
this.completeFor = EnumPartyExchange.values()[compFor];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -535,7 +535,12 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
break;
|
||||
case Stubborn:
|
||||
if (closerTargetFound && shouldChangeTarget(5.0)) {
|
||||
if (closerTargetFound && combatHandler.shouldChangeTarget((double) ai.tacticalChance / 100)) {
|
||||
setAttackTarget(attackingEntity);
|
||||
}
|
||||
break;
|
||||
case Tactical:
|
||||
if (attackingEntity != getAttackTarget() && combatHandler.shouldSwitchTactically(getAttackTarget(), attackingEntity)) {
|
||||
setAttackTarget(attackingEntity);
|
||||
}
|
||||
break;
|
||||
@@ -714,6 +719,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
case HitNRun : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); break;
|
||||
case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ai.tacticalRadius, false)); break;
|
||||
case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ai.tacticalRadius)); break;
|
||||
// case Twist: this.tasks.addTask(this.taskCount++, aiResponse = new EntityAITwistTarget(this, 1.3D, this.ai.tacticalRadius)); break;
|
||||
default :
|
||||
}
|
||||
}
|
||||
@@ -1927,10 +1933,4 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
|
||||
protected void updateLeashedState(){}
|
||||
|
||||
private boolean shouldChangeTarget(double chance) {
|
||||
// Assuming randomNum is a random number between 0 and 100
|
||||
double randomNum = Math.random() * 100; // Generates a random number between 0 and 100
|
||||
return randomNum <= chance;
|
||||
}
|
||||
}
|
||||
@@ -82,94 +82,7 @@ public abstract class MixinModelRenderer {
|
||||
float prevAngleY = this.rotateAngleY;
|
||||
float prevAngleZ = this.rotateAngleZ;
|
||||
|
||||
FramePart currentPart = null;
|
||||
AnimationData animData = null;
|
||||
EnumAnimationPart partType = null;
|
||||
if (ClientEventHandler.renderingNpc != null && ClientEventHandler.renderingNpc.display.animationData.isActive()) {
|
||||
animData = ClientEventHandler.renderingNpc.display.animationData;
|
||||
partType = this.getPartType((ModelRenderer) (Object) this);
|
||||
}
|
||||
if (partType != null && animData != null) {
|
||||
Frame frame = (Frame) animData.animation.currentFrame();
|
||||
if (frame.frameParts.containsKey(partType)) {
|
||||
currentPart = frame.frameParts.get(partType);
|
||||
currentPart.interpolateOffset();
|
||||
currentPart.interpolateAngles();
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPart != null) {
|
||||
this.rotationPointX += currentPart.prevPivots[0];
|
||||
this.rotationPointY += currentPart.prevPivots[1];
|
||||
this.rotationPointZ += currentPart.prevPivots[2];
|
||||
this.rotateAngleX = currentPart.prevRotations[0];
|
||||
this.rotateAngleY = currentPart.prevRotations[1];
|
||||
this.rotateAngleZ = currentPart.prevRotations[2];
|
||||
}
|
||||
|
||||
if (ClientEventHandler.renderingPlayer != null) {
|
||||
ClientEventHandler.playerModel = ((ModelRenderer) (Object) this).baseModel;
|
||||
}
|
||||
if (ClientEventHandler.renderingPlayer != null && ClientCacheHandler.playerAnimations.containsKey(ClientEventHandler.renderingPlayer.getUniqueID())) {
|
||||
animData = ClientCacheHandler.playerAnimations.get(ClientEventHandler.renderingPlayer.getUniqueID());
|
||||
|
||||
EnumAnimationPart mainPartType = null;
|
||||
try{
|
||||
EnumAnimationPart pivotEqualPart = null;
|
||||
mainPartType = this.getPlayerPartType((ModelRenderer) (Object) this);
|
||||
if (mainPartType == null) {
|
||||
pivotEqualPart = this.pivotEqualPart((ModelRenderer) (Object) this);
|
||||
}
|
||||
partType = mainPartType != null ? mainPartType : pivotEqualPart;
|
||||
}
|
||||
catch (Exception ignored){}
|
||||
|
||||
if (partType != null && animData != null && animData.animation != null) {
|
||||
boolean animDataActive = animData.isActive();
|
||||
|
||||
if (!ClientEventHandler.originalValues.containsKey((ModelRenderer) (Object) this)) {
|
||||
FramePart part = new FramePart();
|
||||
part.pivot = new float[]{prevPointX, prevPointY, prevPointZ};
|
||||
part.rotation = new float[]{prevAngleX, prevAngleY, prevAngleZ};
|
||||
ClientEventHandler.originalValues.put((ModelRenderer) (Object) this, part);
|
||||
}
|
||||
FramePart originalPart = ClientEventHandler.originalValues.get((ModelRenderer) (Object) this);
|
||||
Frame frame = (Frame) animData.animation.currentFrame();
|
||||
if (!animDataActive && animData.finishedFrame >= 0 && animData.finishedFrame < animData.animation.frames.size()) {
|
||||
frame = animData.animation.frames.get(animData.finishedFrame);
|
||||
}
|
||||
|
||||
if (frame != null && frame.frameParts.containsKey(partType)) {
|
||||
FramePart part = frame.frameParts.get(partType);
|
||||
if (partType == mainPartType) {
|
||||
if (animDataActive) {
|
||||
part.interpolateAngles();
|
||||
part.interpolateOffset();
|
||||
} else {
|
||||
float speed = 0.4F;
|
||||
part.prevPivots[0] = part.prevPivots[0] * (1.0F - speed);
|
||||
part.prevPivots[1] = part.prevPivots[1] * (1.0F - speed);
|
||||
part.prevPivots[2] = part.prevPivots[2] * (1.0F - speed);
|
||||
part.prevRotations[0] = part.prevRotations[0] * (1.0F - speed) + (this.rotateAngleX * speed);
|
||||
part.prevRotations[1] = part.prevRotations[1] * (1.0F - speed) + (this.rotateAngleY * speed);
|
||||
part.prevRotations[2] = part.prevRotations[2] * (1.0F - speed) + (this.rotateAngleZ * speed);
|
||||
}
|
||||
|
||||
if (animDataActive || (partType != EnumAnimationPart.HEAD && ClientEventHandler.renderingPlayer.getAge() - animData.finishedTime < 20)) {
|
||||
this.rotationPointX = originalPart.pivot[0] + part.prevPivots[0];
|
||||
this.rotationPointY = originalPart.pivot[1] + part.prevPivots[1];
|
||||
this.rotationPointZ = originalPart.pivot[2] + part.prevPivots[2];
|
||||
this.rotateAngleX = part.prevRotations[0];
|
||||
this.rotateAngleY = part.prevRotations[1];
|
||||
this.rotateAngleZ = part.prevRotations[2];
|
||||
}
|
||||
} else {
|
||||
currentPart = part;
|
||||
this.rotateAngleZ += part.prevRotations[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setAnimationValues();
|
||||
|
||||
GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ);
|
||||
int i;
|
||||
@@ -242,17 +155,110 @@ public abstract class MixinModelRenderer {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (currentPart != null) {
|
||||
this.rotationPointX = prevPointX;
|
||||
this.rotationPointY = prevPointY;
|
||||
this.rotationPointZ = prevPointZ;
|
||||
this.rotateAngleX = prevAngleX;
|
||||
this.rotateAngleY = prevAngleY;
|
||||
this.rotateAngleZ = prevAngleZ;
|
||||
this.rotationPointX = prevPointX;
|
||||
this.rotationPointY = prevPointY;
|
||||
this.rotationPointZ = prevPointZ;
|
||||
this.rotateAngleX = prevAngleX;
|
||||
this.rotateAngleY = prevAngleY;
|
||||
this.rotateAngleZ = prevAngleZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setAnimationValues() {
|
||||
float prevPointX = this.rotationPointX;
|
||||
float prevPointY = this.rotationPointY;
|
||||
float prevPointZ = this.rotationPointZ;
|
||||
float prevAngleX = this.rotateAngleX;
|
||||
float prevAngleY = this.rotateAngleY;
|
||||
float prevAngleZ = this.rotateAngleZ;
|
||||
|
||||
if (ClientEventHandler.renderingNpc != null && ClientEventHandler.renderingNpc.display.animationData.isActive()) {
|
||||
AnimationData animData = ClientEventHandler.renderingNpc.display.animationData;
|
||||
EnumAnimationPart partType = this.getPartType((ModelRenderer) (Object) this);
|
||||
|
||||
if (partType != null && animData != null) {
|
||||
Frame frame = (Frame) animData.animation.currentFrame();
|
||||
if (frame.frameParts.containsKey(partType)) {
|
||||
FramePart currentPart = frame.frameParts.get(partType);
|
||||
currentPart.interpolateOffset();
|
||||
currentPart.interpolateAngles();
|
||||
|
||||
this.rotationPointX += currentPart.prevPivots[0];
|
||||
this.rotationPointY += currentPart.prevPivots[1];
|
||||
this.rotationPointZ += currentPart.prevPivots[2];
|
||||
this.rotateAngleX = currentPart.prevRotations[0];
|
||||
this.rotateAngleY = currentPart.prevRotations[1];
|
||||
this.rotateAngleZ = currentPart.prevRotations[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ClientEventHandler.renderingPlayer != null) {
|
||||
ClientEventHandler.playerModel = ((ModelRenderer) (Object) this).baseModel;
|
||||
}
|
||||
if (ClientEventHandler.renderingPlayer != null && ClientCacheHandler.playerAnimations.containsKey(ClientEventHandler.renderingPlayer.getUniqueID())) {
|
||||
AnimationData animData = ClientCacheHandler.playerAnimations.get(ClientEventHandler.renderingPlayer.getUniqueID());
|
||||
|
||||
EnumAnimationPart partType = null;
|
||||
EnumAnimationPart mainPartType = null;
|
||||
try{
|
||||
EnumAnimationPart pivotEqualPart = null;
|
||||
mainPartType = this.getPlayerPartType((ModelRenderer) (Object) this);
|
||||
if (mainPartType == null) {
|
||||
pivotEqualPart = this.pivotEqualPart((ModelRenderer) (Object) this);
|
||||
}
|
||||
partType = mainPartType != null ? mainPartType : pivotEqualPart;
|
||||
}
|
||||
catch (Exception ignored){}
|
||||
|
||||
if (partType != null && animData != null && animData.animation != null) {
|
||||
boolean animDataActive = animData.isActive();
|
||||
|
||||
if (!ClientEventHandler.originalValues.containsKey((ModelRenderer) (Object) this)) {
|
||||
FramePart part = new FramePart();
|
||||
part.pivot = new float[]{prevPointX, prevPointY, prevPointZ};
|
||||
part.rotation = new float[]{prevAngleX, prevAngleY, prevAngleZ};
|
||||
ClientEventHandler.originalValues.put((ModelRenderer) (Object) this, part);
|
||||
}
|
||||
FramePart originalPart = ClientEventHandler.originalValues.get((ModelRenderer) (Object) this);
|
||||
Frame frame = (Frame) animData.animation.currentFrame();
|
||||
if (!animDataActive && animData.finishedFrame >= 0 && animData.finishedFrame < animData.animation.frames.size()) {
|
||||
frame = animData.animation.frames.get(animData.finishedFrame);
|
||||
}
|
||||
|
||||
if (frame != null && frame.frameParts.containsKey(partType)) {
|
||||
FramePart part = frame.frameParts.get(partType);
|
||||
if (partType == mainPartType) {
|
||||
if (animDataActive) {
|
||||
part.interpolateAngles();
|
||||
part.interpolateOffset();
|
||||
} else {
|
||||
float speed = 0.4F;
|
||||
part.prevPivots[0] = part.prevPivots[0] * (1.0F - speed);
|
||||
part.prevPivots[1] = part.prevPivots[1] * (1.0F - speed);
|
||||
part.prevPivots[2] = part.prevPivots[2] * (1.0F - speed);
|
||||
part.prevRotations[0] = part.prevRotations[0] * (1.0F - speed) + (this.rotateAngleX * speed);
|
||||
part.prevRotations[1] = part.prevRotations[1] * (1.0F - speed) + (this.rotateAngleY * speed);
|
||||
part.prevRotations[2] = part.prevRotations[2] * (1.0F - speed) + (this.rotateAngleZ * speed);
|
||||
}
|
||||
|
||||
if (animDataActive || (partType != EnumAnimationPart.HEAD && ClientEventHandler.renderingPlayer.getAge() - animData.finishedTime < 20)) {
|
||||
this.rotationPointX = originalPart.pivot[0] + part.prevPivots[0];
|
||||
this.rotationPointY = originalPart.pivot[1] + part.prevPivots[1];
|
||||
this.rotationPointZ = originalPart.pivot[2] + part.prevPivots[2];
|
||||
this.rotateAngleX = part.prevRotations[0];
|
||||
this.rotateAngleY = part.prevRotations[1];
|
||||
this.rotateAngleZ = part.prevRotations[2];
|
||||
}
|
||||
} else {
|
||||
this.rotateAngleZ += part.prevRotations[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnumAnimationPart getPlayerPartType(ModelRenderer renderer) {
|
||||
if (renderer.baseModel instanceof ModelBiped) {
|
||||
if (renderer == ((ModelBiped) renderer.baseModel).bipedHead
|
||||
|
||||
Reference in new issue
Block a user