Merge Dev into Experimental

This commit is contained in:
Kam committed 2024-01-25 01:26:16 -05:00
commit ea217dde75
21 files changed
+746 -81

No files matched your search

@@ -0,0 +1,50 @@
package kamkeel.command;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.math.BlockPos;
import noppes.npcs.EventHooks;
import noppes.npcs.api.IPos;
import noppes.npcs.api.IWorld;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.CustomNPCsEvent;
public class CommandCommand extends CommandKamkeelBase {
@Override
public String getCommandName() {
return "command";
}
@Override
public String getDescription() {
return "command CommandName [arg1 arg2 ... argn]";
}
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
if (args.length < 1) {
sendError(sender, "You must specify the command name");
return;
}
String commandId = args[0];
String[] commandArgs = new String[args.length - 1];
System.arraycopy(args, 1, commandArgs, 0, args.length - 1);
IWorld senderWorld = NpcAPI.Instance().getIWorld(sender.getEntityWorld());
ChunkCoordinates senderCoords = sender.getPlayerCoordinates();
IPos senderPos = NpcAPI.Instance().getIPos(new BlockPos(senderCoords.posX, senderCoords.posY, senderCoords.posZ));
CustomNPCsEvent.ScriptedCommandEvent event = new CustomNPCsEvent.ScriptedCommandEvent(senderWorld, senderPos, sender.getCommandSenderName(), commandId, commandArgs);
EventHooks.onScriptedCommand(event);
if (!event.replyMessage.isEmpty()) {
sendMessage(sender, event.replyMessage);
}
}
}
@@ -32,6 +32,7 @@ public class CommandKamkeel extends CommandBase{
registerCommand(new ConfigCommand());
registerCommand(new AnimationCommand());
registerCommand(new OverlayCommand());
registerCommand(new CommandCommand());
}
public void registerCommand(CommandKamkeelBase command){
+3 -3
View File
@@ -26,7 +26,7 @@ public class DataAI {
public boolean avoidsSun = false;
public boolean returnToStart = true;
public boolean directLOS = true;
public boolean canLeap = false;
public int leapType = 0;
public boolean canSprint = false;
public boolean stopAndInteract = true;
public EnumNavType tacticalVariant = EnumNavType.Default;
@@ -72,7 +72,7 @@ public class DataAI {
doorInteract = compound.getInteger("DoorInteract");
findShelter = compound.getInteger("FindShelter");
directLOS = compound.getBoolean("DirectLOS");
canLeap = compound.getBoolean("CanLeap");
leapType = compound.getInteger("LeapType");
canSprint = compound.getBoolean("CanSprint");
canFireIndirect = compound.getInteger("FireIndirect");
useRangeMelee = compound.getInteger("RangeAndMelee");
@@ -140,7 +140,7 @@ public class DataAI {
compound.setInteger("DoorInteract", doorInteract);
compound.setInteger("FindShelter", findShelter);
compound.setBoolean("DirectLOS", directLOS);
compound.setBoolean("CanLeap", canLeap);
compound.setInteger("LeapType", leapType);
compound.setBoolean("CanSprint", canSprint);
compound.setInteger("FireIndirect", canFireIndirect);
compound.setInteger("RangeAndMelee", useRangeMelee);
@@ -569,6 +569,13 @@ public class EventHooks {
return false;
}
public static void onScriptedCommand(CustomNPCsEvent.ScriptedCommandEvent event) {
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
if (handler.isEnabled()) {
handler.callScript(EnumScriptType.SCRIPT_COMMAND, event);
}
}
public static void onCustomGuiButton(IPlayer player, ICustomGui gui, int buttonId) {
CustomGuiEvent.ButtonEvent event = new CustomGuiEvent.ButtonEvent(player, gui, buttonId);
CustomGuiController.onButton(event);
@@ -856,7 +856,7 @@ public class NoppesUtilServer {
}
public static Entity GetDamageSourcee(DamageSource damagesource) {
Object entity = damagesource.getEntity();
Entity entity = damagesource.getEntity();
if(entity == null) {
entity = damagesource.getSourceOfDamage();
}
@@ -867,7 +867,7 @@ public class NoppesUtilServer {
entity = ((EntityThrowable)entity).getThrower();
}
return (Entity)entity;
return entity;
}
public static void isGUIOpen(ByteBuf buffer, EntityPlayer player) throws IOException {
@@ -13,11 +13,17 @@ import java.util.Collection;
import java.util.List;
public class VersionCompatibility {
public static int ModRev = 21;
public static int ModRev = 22;
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
if(npc.npcVersion == ModRev)
return;
if(npc.npcVersion < 22) {
if (compound.hasKey("CanLeap")) {
boolean canLeap = compound.getBoolean("CanLeap");
compound.setInteger("LeapType", !canLeap ? 0 : 1);
}
}
if(npc.npcVersion < 19) {
if (compound.hasKey("CanDrown")) {
compound.setInteger("DrowningType", (compound.getBoolean("CanDrown") ? 1 : 0));
@@ -0,0 +1,106 @@
package noppes.npcs.ai;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.entity.EntityNPCInterface;
public class CombatHandler {
private Map<EntityLivingBase, Float> aggressors = new HashMap<EntityLivingBase, Float>();
private EntityNPCInterface npc;
private long startTime = 0;
private int combatResetTimer = 0;
public CombatHandler(EntityNPCInterface npc) {
this.npc = npc;
}
public void update(){
if(npc.isKilled()){
if(npc.isAttacking()){
reset();
}
return;
}
if(npc.getAttackTarget() != null && !npc.isAttacking()){
start();
}
if(!shouldCombatContinue()){
if(combatResetTimer++ > 40){
reset();
}
return;
}
combatResetTimer = 0;
}
private boolean shouldCombatContinue() {
if(npc.getAttackTarget() == null)
return false;
return isValidTarget(npc.getAttackTarget());
}
public void damage(DamageSource source, float damageAmount){
combatResetTimer = 0;
Entity e = NoppesUtilServer.GetDamageSourcee(source);
System.out.println(e);
if(e instanceof EntityLivingBase){
EntityLivingBase el = (EntityLivingBase) e;
Float f = aggressors.get(el);
if(f == null)
f = 0f;
aggressors.put(el, f + damageAmount);
}
}
public void start(){
combatResetTimer = 0;
startTime = npc.worldObj.getWorldInfo().getWorldTotalTime();
npc.setBoolFlag(true, 4);
}
public void reset(){
combatResetTimer = 0;
aggressors.clear();
npc.setBoolFlag(true, 4);
}
public boolean checkTarget() {
if(aggressors.isEmpty() || npc.ticksExisted % 10 != 0)
return false;
EntityLivingBase target = npc.getAttackTarget();
Float current = 0f;
if(isValidTarget(target)){
current = aggressors.get(target);
if(current == null)
current = 0f;
}
else
target = null;
for (Map.Entry<EntityLivingBase, Float> entry : aggressors.entrySet()){
if(entry.getValue() > current && isValidTarget(entry.getKey())){
current = entry.getValue();
target = entry.getKey();
}
}
return target == null;
}
public boolean isValidTarget(EntityLivingBase target){
if(target == null || !target.isEntityAlive())
return false;
if(target instanceof EntityPlayer && ((EntityPlayer)target).capabilities.disableDamage)
return false;
return npc.isInRange(target, npc.stats.aggroRange);
}
}
@@ -12,24 +12,24 @@ import noppes.npcs.entity.EntityNPCInterface;
public class EntityAIAttackTarget extends EntityAIBase
{
World worldObj;
EntityNPCInterface attacker;
EntityLivingBase entityTarget;
private World world;
private EntityNPCInterface npc;
private EntityLivingBase entityTarget;
/**
* An amount of decrementing ticks that allows the entity to attack once the tick reaches 0.
*/
int attackTick;
private int attackTick;
/** The PathEntity of our entity. */
PathEntity entityPathEntity;
private PathEntity entityPathEntity;
private int field_75445_i;
private boolean navOverride = false;
public EntityAIAttackTarget(EntityNPCInterface par1EntityLiving){
this.attackTick = 0;
this.attacker = par1EntityLiving;
this.worldObj = par1EntityLiving.worldObj;
this.npc = par1EntityLiving;
this.world = par1EntityLiving.worldObj;
this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE);
}
@@ -37,7 +37,7 @@ public class EntityAIAttackTarget extends EntityAIBase
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute(){
EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();
EntityLivingBase entitylivingbase = this.npc.getAttackTarget();
if (entitylivingbase == null){
return false;
@@ -45,21 +45,21 @@ public class EntityAIAttackTarget extends EntityAIBase
else if (!entitylivingbase.isEntityAlive()){
return false;
}
else if (this.attacker.inventory.getProjectile() != null && this.attacker.ai.useRangeMelee == 0){
else if (this.npc.inventory.getProjectile() != null && this.npc.ai.useRangeMelee == 0){
return false;
}
double var2 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ);
double var3 = this.attacker.ai.distanceToMelee * this.attacker.ai.distanceToMelee;
double var2 = this.npc.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ);
double var3 = this.npc.ai.distanceToMelee * this.npc.ai.distanceToMelee;
if (this.attacker.ai.useRangeMelee == 1 && var2 > var3){
if (this.npc.ai.useRangeMelee == 1 && var2 > var3){
return false;
}
else{
this.entityTarget = entitylivingbase;
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(((EntityNPCInterface) this.attacker).stats.aggroRange);
this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange);
this.npc.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(((EntityNPCInterface) this.npc).stats.aggroRange);
this.entityPathEntity = this.npc.getNavigator().getPathToEntityLiving(entitylivingbase);
this.npc.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange);
return this.entityPathEntity != null;
}
}
@@ -69,16 +69,16 @@ public class EntityAIAttackTarget extends EntityAIBase
*/
public boolean continueExecuting()
{
this.entityTarget = this.attacker.getAttackTarget();
this.entityTarget = this.npc.getAttackTarget();
if(entityTarget == null || !entityTarget.isEntityAlive())
return false;
if(attacker.getDistanceToEntity(entityTarget) > attacker.stats.aggroRange)
if(npc.getDistanceToEntity(entityTarget) > npc.stats.aggroRange)
return false;
if (this.attacker.ai.useRangeMelee == 1 && attacker.getDistanceSqToEntity(entityTarget) > (this.attacker.ai.distanceToMelee * this.attacker.ai.distanceToMelee))
if (this.npc.ai.useRangeMelee == 1 && npc.getDistanceSqToEntity(entityTarget) > (this.npc.ai.distanceToMelee * this.npc.ai.distanceToMelee))
return false;
return this.attacker.isWithinHomeDistance(MathHelper.floor_double(entityTarget.posX), MathHelper.floor_double(entityTarget.posY), MathHelper.floor_double(entityTarget.posZ));
return this.npc.isWithinHomeDistance(MathHelper.floor_double(entityTarget.posX), MathHelper.floor_double(entityTarget.posY), MathHelper.floor_double(entityTarget.posZ));
}
/**
@@ -86,11 +86,11 @@ public class EntityAIAttackTarget extends EntityAIBase
*/
public void startExecuting(){
if(!navOverride)
this.attacker.getNavigator().setPath(this.entityPathEntity, 1.3D);
this.npc.getNavigator().setPath(this.entityPathEntity, 1.3D);
this.field_75445_i = 0;
if (this.attacker.getRangedTask() != null && this.attacker.ai.useRangeMelee == 2)
if (this.npc.getRangedTask() != null && this.npc.ai.useRangeMelee == 2)
{
this.attacker.getRangedTask().navOverride(true);
this.npc.getRangedTask().navOverride(true);
}
}
@@ -101,11 +101,11 @@ public class EntityAIAttackTarget extends EntityAIBase
{
this.entityPathEntity = null;
this.entityTarget = null;
this.attacker.setAttackTarget(null);
this.attacker.getNavigator().clearPathEntity();
if (this.attacker.getRangedTask() != null && this.attacker.ai.useRangeMelee == 2)
this.npc.setAttackTarget(null);
this.npc.getNavigator().clearPathEntity();
if (this.npc.getRangedTask() != null && this.npc.ai.useRangeMelee == 2)
{
this.attacker.getRangedTask().navOverride(false);
this.npc.getRangedTask().navOverride(false);
}
}
@@ -114,26 +114,26 @@ public class EntityAIAttackTarget extends EntityAIBase
*/
public void updateTask()
{
this.attacker.getLookHelper().setLookPositionWithEntity(this.entityTarget, 30.0F, 30.0F);
this.npc.getLookHelper().setLookPositionWithEntity(this.entityTarget, 30.0F, 30.0F);
if (!navOverride && --this.field_75445_i <= 0)
{
this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7);
this.attacker.getNavigator().tryMoveToEntityLiving(this.entityTarget, 1.3f);
this.field_75445_i = 4 + this.npc.getRNG().nextInt(7);
this.npc.getNavigator().tryMoveToEntityLiving(this.entityTarget, 1.3f);
}
this.attackTick = Math.max(this.attackTick - 1, 0);
double distance = this.attacker.getDistanceSq(this.entityTarget.posX, this.entityTarget.boundingBox.minY, this.entityTarget.posZ);
double range = attacker.stats.attackRange * attacker.stats.attackRange + entityTarget.width;
double minRange = this.attacker.width * 2.0F * this.attacker.width * 2.0F + entityTarget.width;
double distance = this.npc.getDistanceSq(this.entityTarget.posX, this.entityTarget.boundingBox.minY, this.entityTarget.posZ);
double range = npc.stats.attackRange * npc.stats.attackRange + entityTarget.width;
double minRange = this.npc.width * 2.0F * this.npc.width * 2.0F + entityTarget.width;
if(minRange > range)
range = minRange;
if (distance <= range && (attacker.canSee(this.entityTarget) || distance < minRange))
if (distance <= range && (npc.canSee(this.entityTarget) || distance < minRange))
{
if (this.attackTick <= 0)
{
this.attackTick = this.attacker.stats.attackSpeed;
this.attacker.swingItem();
this.attacker.attackEntityAsMob(this.entityTarget);
this.attackTick = this.npc.stats.attackSpeed;
this.npc.swingItem();
this.npc.attackEntityAsMob(this.entityTarget);
}
}
}
@@ -0,0 +1,63 @@
package noppes.npcs.ai;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.util.MathHelper;
import noppes.npcs.entity.EntityNPCInterface;
public class EntityAIPounceTarget extends EntityAIBase {
private EntityNPCInterface npc;
private EntityLivingBase leapTarget;
private float leapSpeed = 1.2F;
public EntityAIPounceTarget(EntityNPCInterface leapingEntity){
this.npc = leapingEntity;
this.setMutexBits(4);
}
@Override
public boolean shouldExecute(){
if(!this.npc.onGround)
return false;
this.leapTarget = this.npc.getAttackTarget();
if (this.leapTarget == null || !this.npc.getEntitySenses().canSee(leapTarget))
return false;
return !npc.isInRange(leapTarget, 4) && npc.isInRange(leapTarget, 8) && this.npc.getRNG().nextInt(5) == 0;
}
@Override
public boolean continueExecuting(){
return !this.npc.onGround;
}
@Override
public void startExecuting(){
double varX = this.leapTarget.posX - this.npc.posX;
double varY = this.leapTarget.boundingBox.minY - this.npc.boundingBox.minY;
double varZ = this.leapTarget.posZ - this.npc.posZ;
float varF = MathHelper.sqrt_double(varX * varX + varZ * varZ);
float angle = this.getAngleForXYZ(varX, varY, varZ, varF);
float yaw = (float)(Math.atan2(varX, varZ) * 180.0D / Math.PI);
this.npc.motionX = (double)(MathHelper.sin(yaw / 180.0F * (float)Math.PI) * MathHelper.cos(angle / 180.0F * (float)Math.PI));
this.npc.motionZ = (double)(MathHelper.cos(yaw / 180.0F * (float)Math.PI) * MathHelper.cos(angle / 180.0F * (float)Math.PI));
this.npc.motionY = (double)(MathHelper.sin((angle + 1.0F) / 180.0F * (float)Math.PI));
this.npc.motionX *= this.leapSpeed;
this.npc.motionZ *= this.leapSpeed;
this.npc.motionY *= this.leapSpeed;
}
public float getAngleForXYZ(double varX, double varY, double varZ, double horiDist) {
float g = 0.1F;
float var1 = this.leapSpeed * this.leapSpeed;
double var2 = (g * horiDist);
double var3 = ((g * horiDist * horiDist) + (2 * varY * var1));
double var4 = (var1 * var1) - (g * var3);
if (var4 < 0) return 90.0F;
float var6 = var1 - MathHelper.sqrt_double(var4);
float var7 = (float) (Math.atan2(var6 , var2) * 180.0D / Math.PI);
return var7;
}
}
@@ -8,15 +8,15 @@ import noppes.npcs.entity.EntityNPCInterface;
public class EntityAISprintToTarget extends EntityAIBase
{
/** The entity that is leaping. */
EntityNPCInterface runner;
private EntityNPCInterface runner;
/** The entity that the leaper is leaping towards. */
EntityLivingBase runTarget;
private EntityLivingBase runTarget;
public EntityAISprintToTarget(EntityNPCInterface par1EntityLiving)
{
this.runner = par1EntityLiving;
this.setMutexBits(AiMutex.PASSIVE + AiMutex.PATHING);
this.setMutexBits(AiMutex.PASSIVE);
}
/**
@@ -37,9 +37,9 @@ public class EntityAISprintToTarget extends EntityAIBase
else
{
switch(this.runner.ai.onAttack)
{
case 0 : return this.runner.getDistanceSqToEntity(this.runTarget) >= 64.0D ? (!this.runner.onGround ? false : true) : false;
case 2 : return this.runner.getDistanceSqToEntity(this.runTarget) <= 49.0D ? (!this.runner.onGround ? false : true) : false;
{
case 0 : return !this.runner.isInRange(runTarget, 8)? (!this.runner.onGround ? false : true) : false;
case 2 : return this.runner.isInRange(runTarget, 7)? (!this.runner.onGround ? false : true) : false;
default : return false;
}
}
@@ -38,7 +38,10 @@ public class FlyingMoveHelper extends EntityMoveHelper{
double d5 = MathHelper.sqrt_double(d4);
speed = Math.min(d5/5.0D,speed);
if (this.entity.hurtTime == 0 && d4 > 0.5D) {
// its here louis!
// This is the hurt time that stuns the NPC!!!!!!
// if (this.entity.hurtTime == 0 && d4 > 0.5D) {
if (d4 >= 0.5D) {
this.entity.motionX += (speed * (d0 / d5) - this.entity.motionX) * speed;
this.entity.motionZ += (speed * (d2 / d5) - this.entity.motionZ) * speed;
@@ -16,19 +16,15 @@ public class EntityAIClearTarget extends EntityAITarget
@Override
public boolean shouldExecute(){
target = taskOwner.getAttackTarget();
target = npc.getAttackTarget();
if (target == null)
return false;
if(target instanceof EntityPlayer && ((EntityPlayer)target).capabilities.disableDamage)
return true;
int distance = npc.stats.aggroRange * 2 * npc.stats.aggroRange;
if(npc.getOwner() != null && npc.getDistanceSqToEntity(npc.getOwner()) > distance){
return true;
if(npc.getOwner() != null && !npc.isInRange(npc.getOwner(), npc.stats.aggroRange * 2)){
return true;
}
return npc.getDistanceSqToEntity(target) > distance;
return npc.combatHandler.checkTarget();
}
@Override
@@ -58,7 +58,7 @@ public class BlockScripted extends BlockContainer {
if (world.isRemote)
return true;
ItemStack currentItem = player.inventory.getCurrentItem();
if (currentItem != null && (currentItem.getItem() == CustomItems.wand || currentItem.getItem() == CustomItems.scripter)) {
if (currentItem != null && (currentItem.getItem() == CustomItems.scripter)) {
NoppesUtilServer.sendOpenGui(player, EnumGuiType.ScriptBlock, null, x, y, z);
return true;
}
@@ -6,18 +6,22 @@ import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.*;
import net.minecraftforge.event.entity.living.LivingEvent;
import noppes.npcs.config.ConfigMixin;
import noppes.npcs.controllers.data.AnimationData;
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
import noppes.npcs.client.renderer.RenderCNPCPlayer;
import noppes.npcs.constants.EnumAnimationPart;
import noppes.npcs.controllers.data.Animation;
import noppes.npcs.controllers.data.Frame;
import noppes.npcs.controllers.data.FramePart;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
import java.lang.reflect.Field;
import java.util.ArrayList;
@@ -195,7 +199,26 @@ public class ClientEventHandler {
@SubscribeEvent
public void onRenderHand(RenderHandEvent event) {
partialHandTicks = event.partialTicks;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (ConfigMixin.FirstPersonAnimationMixin && ClientCacheHandler.playerAnimations.containsKey(player.getUniqueID())) {
Render playerRenderer = RenderManager.instance.getEntityRenderObject(player);
if (playerRenderer instanceof RendererLivingEntity) {
ClientEventHandler.renderer = (RendererLivingEntity) playerRenderer;
}
ClientEventHandler.renderingPlayer = player;
ClientEventHandler.partialRenderTick = Minecraft.getMinecraft().timer.renderPartialTicks;
partialHandTicks = event.partialTicks;
AnimationData animData = ClientCacheHandler.playerAnimations.get(player.getUniqueID());
if (animData != null && animData.isActive()) {
Frame frame = (Frame) animData.animation.currentFrame();
if (frame.frameParts.containsKey(EnumAnimationPart.FULL_MODEL)) {
FramePart part = frame.frameParts.get(EnumAnimationPart.FULL_MODEL);
part.interpolateOffset();
part.interpolateAngles();
}
}
}
}
public static boolean hasOverlays(EntityPlayer player) {
@@ -39,7 +39,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
addLabel(new GuiNpcLabel(11,"ai.return", guiLeft + 150, guiTop + 40));
addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.returnToStart ? 1:0));
addLabel(new GuiNpcLabel(17,"ai.leapattarget", guiLeft + 150, guiTop + 65));
addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canLeap ? 1:0));
addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "ai.jump", "ai.pounce"} ,npc.ai.leapType));
addLabel(new GuiNpcLabel(15, "ai.indirect", guiLeft + 150, guiTop + 90));
addButton(new GuiNpcButton(13, guiLeft + 230, guiTop + 85, 60, 20, new String[]{"gui.no", "gui.whendistant", "gui.whenhidden"}, ai.canFireIndirect));
addLabel(new GuiNpcLabel(16, "ai.rangemelee", guiLeft + 150, guiTop + 115));
@@ -129,7 +129,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
initGui();
}
else if (button.id == 15) {
ai.canLeap = (button.getValue() == 1);
ai.leapType = (byte) button.getValue();
}
else if (button.id == 16) {
ai.canSprint = (button.getValue() == 1);
@@ -25,6 +25,9 @@ public class ConfigMixin
public static Property AnimationMixinProperty;
public static boolean AnimationMixin = true;
public static Property FirstPersonAnimationMixinProperty;
public static boolean FirstPersonAnimationMixin = true;
public static void init(File configFile)
{
config = new Configuration(configFile);
@@ -39,6 +42,12 @@ public class ConfigMixin
AnimationMixinProperty = config.get(CLIENT, "Animation Mixin", true, "Enables mixins for the ModelRenderer and RenderPlayer classes, allowing for additional animation functionality in the API. If crashes or visual errors occur, please disable.");
AnimationMixin = AnimationMixinProperty.getBoolean(true);
if (AnimationMixin) {
FirstPersonAnimationMixinProperty = config.get(CLIENT, "First Person Animation Mixin", true, "Enables mixins for the ItemRenderer class, allowing for animations to be visible in first person. Can only be enabled if the animation mixin is enabled. If crashes or visual errors occur, please disable.");
FirstPersonAnimationMixin = FirstPersonAnimationMixinProperty.getBoolean(true);
} else {
FirstPersonAnimationMixin = false;
}
}
catch (Exception e)
{
@@ -67,7 +67,7 @@ import noppes.npcs.util.GameProfileAlt;
import java.io.IOException;
import java.util.*;
public abstract class EntityNPCInterface extends EntityCreature implements IEntityAdditionalSpawnData, ICommandSender, IRangedAttackMob, IBossDisplayData{
public abstract class EntityNPCInterface extends EntityCreature implements IEntityAdditionalSpawnData, ICommandSender, IRangedAttackMob, IBossDisplayData {
public ICustomNpc wrappedNPC;
public static final GameProfileAlt chateventProfile = new GameProfileAlt();
@@ -81,6 +81,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
public DataTransform transform;
public DataTimers timers;
public CombatHandler combatHandler = new CombatHandler(this);
public String linkedName = "";
public long linkedLast = 0;
public LinkedData linkedData;
@@ -311,10 +313,10 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
updateTasks();
updateHitbox();
}
setBoolFlag(this.getAttackTarget() != null, 4);
// setBoolFlag(this.getAttackTarget() != null, 4);
setBoolFlag(!getNavigator().noPath(), 1);
setBoolFlag(isInteracting(), 2);
combatHandler.update();
onCollide();
}
@@ -350,6 +352,12 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
}
@Override
protected void damageEntity(DamageSource damageSrc, float damageAmount){
super.damageEntity(damageSrc, damageAmount);
combatHandler.damage(damageSrc, damageAmount);
}
public void updateClient() {
NBTTagCompound compound = writeSpawnData();
compound.setInteger("EntityId", getEntityId());
@@ -677,17 +685,18 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
removeTask(aiRange);
aiLeap = aiAttackTarget = aiResponse = aiSprint = aiRange = null;
if (this.ai.canSprint)
this.tasks.addTask(this.taskCount++, new EntityAISprintToTarget(this));
if (this.ai.onAttack == 1)
this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIPanic(this, 1.2F));
else if (this.ai.onAttack == 2) {
this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this));
this.setCanSprint();
}
else if (this.ai.onAttack == 0) {
this.setCanLeap();
this.setCanSprint();
this.setLeapTask();
if (this.inventory.getProjectile() == null || this.ai.useRangeMelee == 2)
{
switch(this.ai.tacticalVariant)
@@ -773,17 +782,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
/*
* Branch task function for leaping
*/
public void setCanLeap() {
if (this.ai.canLeap)
public void setLeapTask() {
if (this.ai.leapType == 1)
this.tasks.addTask(this.taskCount++, aiLeap = new EntityAILeapAtTarget(this, 0.4F));
}
/*
* Branch task function for sprinting
*/
public void setCanSprint() {
if (this.ai.canSprint)
this.tasks.addTask(this.taskCount++, aiSprint = new EntityAISprintToTarget(this));
if (this.ai.leapType == 2)
this.tasks.addTask(this.taskCount++, aiLeap = new EntityAIPounceTarget(this));
}
/*
@@ -1079,6 +1082,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
setHealth(getMaxHealth());
dataWatcher.updateObject(14, 0); // animation Normal
dataWatcher.updateObject(15, 0);
combatHandler.reset();
this.setAttackTarget(null);
this.setRevengeTarget(null);
this.deathTime = 0;
@@ -1478,6 +1483,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
this.motionY = 0.4000000059604645D;
}
}
@Override
public void addVelocity(double p_70024_1_, double p_70024_3_, double p_70024_5_) {
if (this.attackingPlayer != null) {
@@ -1685,12 +1691,26 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
super.setInWeb();
}
public boolean isInRange(Entity entity, double range){
return this.isInRange(entity.posX, entity.posY, entity.posZ, range);
}
public boolean isInRange(double posX, double posY, double posZ, double range){
double y = Math.abs(this.posY - posY);
if(posY >= 0 && y > range)
return false;
double x = Math.abs(this.posX - posX);
double z = Math.abs(this.posZ - posZ);
return x <= range && z <= range;
}
@Override
public boolean canBeCollidedWith(){
return !isKilled();
}
// obviously we dont want this
@Override
public boolean canBePushed() {
return this.display.collidesWith == 0;
@@ -53,6 +53,9 @@ public class CustomNPCsMixinPlugin implements IMixinConfigPlugin {
mixins.add("MixinModelRenderer");
mixins.add("MixinRenderPlayer");
}
if (ConfigMixin.FirstPersonAnimationMixin) {
mixins.add("MixinItemRenderer");
}
}
return mixins;
}
@@ -0,0 +1,321 @@
package noppes.npcs.mixin;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import noppes.npcs.client.ClientCacheHandler;
import noppes.npcs.client.ClientEventHandler;
import noppes.npcs.constants.EnumAnimationPart;
import noppes.npcs.controllers.data.Animation;
import noppes.npcs.controllers.data.AnimationData;
import noppes.npcs.controllers.data.Frame;
import noppes.npcs.controllers.data.FramePart;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
@Mixin(ItemRenderer.class)
public class MixinItemRenderer {
@Inject(method = "renderItemInFirstPerson", at = @At(value = "HEAD"), cancellable = true)
public void renderItemInFirstPerson(float p_78440_1_, CallbackInfo callbackInfo)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
Render renderer = RenderManager.instance.getEntityRenderObject(player);
if (renderer instanceof RendererLivingEntity && ((RendererLivingEntity) renderer).mainModel instanceof ModelBiped) {
if (mixin_renderFirstPersonAnimation(p_78440_1_, player, (ModelBiped) ((RendererLivingEntity) renderer).mainModel)) {
callbackInfo.cancel();
}
}
}
private boolean mixin_renderFirstPersonAnimation(float partialRenderTick, EntityPlayer player, ModelBiped model) {
ModelRenderer[] parts = new ModelRenderer[]{model.bipedRightArm, model.bipedLeftArm, model.bipedRightLeg, model.bipedLeftLeg};
EnumAnimationPart[] enumParts = new EnumAnimationPart[]{EnumAnimationPart.RIGHT_ARM, EnumAnimationPart.LEFT_ARM, EnumAnimationPart.RIGHT_LEG, EnumAnimationPart.LEFT_LEG};
Frame frame;
AnimationData animationData = ClientCacheHandler.playerAnimations.get(player.getUniqueID());
if (animationData != null && animationData.isActive() && animationData.getAnimation() != null && animationData.getAnimation().currentFrame() != null) {
Animation animation = (Animation) animationData.getAnimation();
frame = (Frame) animation.currentFrame();
for (int i = 0; i < parts.length; i++) {
ModelRenderer part = parts[i];
EnumAnimationPart enumPart = enumParts[i];
FramePart originalPart = ClientEventHandler.originalValues.get(part);
if (originalPart != null && frame.frameParts.containsKey(enumPart)) {
FramePart animatedPart = frame.frameParts.get(enumPart);
part.rotationPointX = originalPart.pivot[0] + animatedPart.prevPivots[0];
part.rotationPointY = originalPart.pivot[1] + animatedPart.prevPivots[1];
part.rotationPointZ = originalPart.pivot[2] + animatedPart.prevPivots[2];
part.rotateAngleX = animatedPart.prevRotations[0];
part.rotateAngleY = animatedPart.prevRotations[1];
part.rotateAngleZ = animatedPart.prevRotations[2];
}
}
} else {
return false;
}
ItemRenderer itemRenderer = Minecraft.getMinecraft().entityRenderer.itemRenderer;
float f1 = 1.0F;//itemRenderer.prevEquippedProgress + (itemRenderer.equippedProgress - itemRenderer.prevEquippedProgress) * partialRenderTick;
EntityClientPlayerMP entityclientplayermp = Minecraft.getMinecraft().thePlayer;
// float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialRenderTick;
// GL11.glPushMatrix();
// GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F);
// GL11.glRotatef(entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * p_78440_1_, 0.0F, 1.0F, 0.0F);
// RenderHelper.enableStandardItemLighting();
// GL11.glPopMatrix();
EntityPlayerSP entityplayersp = (EntityPlayerSP)entityclientplayermp;
float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialRenderTick;
float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialRenderTick;
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
ItemStack itemstack = itemRenderer.itemToRender;
int i = Minecraft.getMinecraft().theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_ARM)) {
GL11.glPushMatrix();
GL11.glTranslatef(0.1F, 0.4F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedRightArm.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.LEFT_ARM)) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.1F, 0.4F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedLeftArm.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_LEG)) {
GL11.glPushMatrix();
GL11.glTranslatef(0.025F, 0.6F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.4F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedRightLeg.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.LEFT_LEG)) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.025F, 0.6F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.4F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedLeftLeg.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_ARM) && itemstack != null)
{
float f11, f12;
GL11.glPushMatrix();
if (player.fishEntity != null)
{
itemstack = new ItemStack(Items.stick);
}
float p_78785_1_ = 0.0625F;
GL11.glTranslatef(0.1F, 0.4F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.3F);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(model.bipedRightArm.rotationPointX * p_78785_1_, model.bipedRightArm.rotationPointY * p_78785_1_, model.bipedRightArm.rotationPointZ * p_78785_1_);
GL11.glRotatef((float) Math.toDegrees(model.bipedRightArm.rotateAngleZ), 0, 0, 1);
GL11.glRotatef((float) Math.toDegrees(model.bipedRightArm.rotateAngleY), 0, 1, 0);
GL11.glRotatef((float) Math.toDegrees(model.bipedRightArm.rotateAngleX), 1, 0, 0);
GL11.glTranslatef(-0.1F, 0.6F, 0.0F);
GL11.glRotatef(255, 0, 1, 0);
GL11.glRotatef(45, 1, 0, 0);
GL11.glRotatef(80, 0, 0, 1);
float f6 = 1/1.5F;
GL11.glScalef(f6, f6, f6);
if (itemstack.getItem().requiresMultipleRenderPasses())
{
for (k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
i = itemstack.getItem().getColorFromItemStack(itemstack, k);
f12 = (float)(i >> 16 & 255) / 255.0F;
f3 = (float)(i >> 8 & 255) / 255.0F;
f4 = (float)(i & 255) / 255.0F;
GL11.glColor4f(f12, f3, f4, 1.0F);
mixin_renderItem(player, itemstack, k, EQUIPPED_FIRST_PERSON);
}
}
else
{
k = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f11 = (float)(k >> 16 & 255) / 255.0F;
f12 = (float)(k >> 8 & 255) / 255.0F;
f3 = (float)(k & 255) / 255.0F;
GL11.glColor4f(f11, f12, f3, 1.0F);
mixin_renderItem(player, itemstack, 0, EQUIPPED_FIRST_PERSON);
}
GL11.glPopMatrix();
}
for (int p = 0; p < parts.length; p++) {
ModelRenderer part = parts[p];
EnumAnimationPart enumPart = enumParts[p];
FramePart originalPart = ClientEventHandler.originalValues.get(part);
if (originalPart != null && frame.frameParts.containsKey(enumPart)) {
part.rotationPointX = originalPart.pivot[0];
part.rotationPointY = originalPart.pivot[1];
part.rotationPointZ = originalPart.pivot[2];
part.rotateAngleX = originalPart.rotation[0];
part.rotateAngleY = originalPart.rotation[1];
part.rotateAngleZ = originalPart.rotation[2];
}
}
return true;
}
@Shadow private RenderBlocks renderBlocksIr;
@Shadow private static ResourceLocation RES_ITEM_GLINT;
private void mixin_renderItem(EntityLivingBase p_78443_1_, ItemStack p_78443_2_, int p_78443_3_, IItemRenderer.ItemRenderType type) {
GL11.glPushMatrix();
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
Item item = p_78443_2_.getItem();
Block block = Block.getBlockFromItem(item);
if (p_78443_2_ != null && block != null && block.getRenderBlockPass() != 0) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_CULL_FACE);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
}
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(p_78443_2_, type);
if (customRenderer != null) {
texturemanager.bindTexture(texturemanager.getResourceLocation(p_78443_2_.getItemSpriteNumber()));
ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksIr, p_78443_1_, p_78443_2_);
} else if (p_78443_2_.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.renderItemIn3d(block.getRenderType())) {
texturemanager.bindTexture(texturemanager.getResourceLocation(0));
GL11.glTranslatef(0.0F, 0.2F,-0.2F);
if (p_78443_2_ != null && block != null && block.getRenderBlockPass() != 0) {
GL11.glDepthMask(false);
renderBlocksIr.renderBlockAsItem(block, p_78443_2_.getItemDamage(), 1.0F);
GL11.glDepthMask(true);
} else {
renderBlocksIr.renderBlockAsItem(block, p_78443_2_.getItemDamage(), 1.0F);
}
} else {
IIcon iicon = p_78443_1_.getItemIcon(p_78443_2_, p_78443_3_);
if (iicon == null) {
GL11.glPopMatrix();
return;
}
texturemanager.bindTexture(texturemanager.getResourceLocation(p_78443_2_.getItemSpriteNumber()));
TextureUtil.func_152777_a(false, false, 1.0F);
Tessellator tessellator = Tessellator.instance;
float f = iicon.getMinU();
float f1 = iicon.getMaxU();
float f2 = iicon.getMinV();
float f3 = iicon.getMaxV();
float f4 = 0.0F;
float f5 = 0.3F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-f4, -f5, 0.0F);
float f6 = 1.5F;
GL11.glScalef(f6, f6, f6);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
if (p_78443_2_.hasEffect(p_78443_3_)) {
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
texturemanager.bindTexture(RES_ITEM_GLINT);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(768, 1, 1, 0);
float f7 = 0.76F;
GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f8 = 0.125F;
GL11.glScalef(f8, f8, f8);
float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f9, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f8, f8, f8);
f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f9, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
texturemanager.bindTexture(texturemanager.getResourceLocation(p_78443_2_.getItemSpriteNumber()));
TextureUtil.func_147945_b();
}
GL11.glPopMatrix();
}
}
@@ -9,6 +9,7 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import noppes.npcs.api.AbstractNpcAPI;
import noppes.npcs.api.IPos;
import noppes.npcs.api.IWorld;
import noppes.npcs.api.event.ICustomNPCsEvent;
import noppes.npcs.api.handler.data.INaturalSpawn;
import noppes.npcs.constants.EnumScriptType;
@@ -80,4 +81,56 @@ public class CustomNPCsEvent extends Event implements ICustomNPCsEvent {
return this.airSpawnPassed;
}
}
public static class ScriptedCommandEvent extends CustomNPCsEvent implements ICustomNPCsEvent.ScriptedCommandEvent {
public IWorld world;
public IPos pos;
public String senderName;
public String id;
public String[] args;
public String replyMessage = "";
public ScriptedCommandEvent(IWorld world, IPos pos, String senderName, String id, String[] args){
this.world = world;
this.pos = pos;
this.senderName = senderName;
this.id = id;
this.args = args;
}
public String getHookName() {
return EnumScriptType.SCRIPT_COMMAND.function;
}
@Override
public IWorld getSenderWorld() {
return world;
}
@Override
public IPos getSenderPosition() {
return pos;
}
@Override
public String getSenderName() {
return senderName;
}
@Override
public void setReplyMessage(String message) {
replyMessage = message;
}
@Override
public String getId() {
return id;
}
@Override
public String[] getArgs() {
return args;
}
}
}
@@ -7,4 +7,8 @@ public net.minecraft.client.model.ModelRenderer field_78810_s # baseModel
#Minecraft
public net.minecraft.client.Minecraft field_71428_T # timer
#Entity
public net.minecraft.entity.Entity field_70148_d # firstUpdate
public net.minecraft.entity.Entity field_70148_d # firstUpdate
#RendererLivingEntity
public net.minecraft.client.renderer.entity.RendererLivingEntity field_77045_g # mainModel
#ItemRenderer
public net.minecraft.client.renderer.ItemRenderer field_78453_b # itemToRender