Skip to content

Commit

Permalink
Fixed #1.11.20 and some AI cleanup too
Browse files Browse the repository at this point in the history
  • Loading branch information
Heltrato committed Jul 17, 2017
1 parent fee531a commit 57ee869
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 19 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Monster Hunter Frontier Craft mod created by the Guild Hall team authored by : H
* [ ] Add Frontier AI ~ Heltrato
* [ ] Akura, Kirin, Brachydios, Popo ~ Heltrato
* [ ] Test a larger Quest world size ~ Heltrato
* [ ] Rerelease Beta for Server..

# TBD #
* [ ] Party System
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mhfc/net/common/ai/entity/AIAngleWhip.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public void onUpdate() {
target = this.entity.getAttackTarget();
if (target != null) {
if (getCurrentFrame() == this.damageFrame) {
hitAreaEntities();
entity.playSound(sound, 2.0F, 1.0F);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/mhfc/net/common/ai/entity/AIBite.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@
/**
* @author WorldSEnder ** dang so complex men ~Heltrato
*/
@SuppressWarnings("rawtypes")
public class AIBite extends DamagingAction<EntityMHFCBase> implements IHasAttackProvider {
public class AIBite extends DamagingAction<EntityMHFCBase<?>> implements IHasAttackProvider {

protected float damage;
protected float weight;
protected String animationLocation;
protected int animationLength;
protected int damageFrame;
protected SoundEvent sound;
protected EntityMHFCBase entity = this.getEntity();
protected EntityMHFCBase<?> entity = this.getEntity();

public AIBite(
EntityMHFCBase entity,
EntityMHFCBase<?> entity,
String animationLocation,
int animationLength,
int damageFrame,
Expand Down Expand Up @@ -59,6 +58,7 @@ public void onUpdate() {
target = this.entity.getAttackTarget();
if (target != null) {
if (getCurrentFrame() == this.damageFrame) {
damageCollidingEntities();
entity.playSound(sound, 2.0F, 1.0F);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/mhfc/net/common/ai/entity/AIBreathe.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
import mhfc.net.common.ai.general.provider.impl.IHasAnimationProvider;
import mhfc.net.common.entity.type.EntityMHFCBase;

@SuppressWarnings("rawtypes")
public class AIBreathe extends BreatheAction<EntityMHFCBase<?>> implements IHasAnimationProvider {

protected EntityMHFCBase entity;
protected EntityMHFCBase<?> entity;
protected String animationLocation;
protected int animationLength;
protected float weight;

public AIBreathe(EntityMHFCBase entity, String animationLocation, int animationLength, float weight) {
public AIBreathe(EntityMHFCBase<?> entity, String animationLocation, int animationLength, float weight) {
this.entity = entity;
this.animationLocation = animationLocation;
this.animationLength = animationLength;
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/mhfc/net/common/ai/entity/AIDeath.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
import mhfc.net.common.entity.type.EntityMHFCBase;
import net.minecraft.util.SoundEvent;

@SuppressWarnings("rawtypes")
public class AIDeath extends DeathAction<EntityMHFCBase> implements IHasAnimationProvider {
public class AIDeath extends DeathAction<EntityMHFCBase<?>> implements IHasAnimationProvider {

protected EntityMHFCBase entity;
protected EntityMHFCBase<?> entity;
protected String animationLocation;
protected SoundEvent sound;

public AIDeath(EntityMHFCBase entity, String animationLocation, SoundEvent sound) {
public AIDeath(EntityMHFCBase<?> entity, String animationLocation, SoundEvent sound) {
this.entity = entity;
this.animationLocation = animationLocation;
this.sound = sound;
Expand All @@ -25,6 +24,11 @@ public IAnimationProvider getAnimProvider() {
return new AnimationAdapter(this, animationLocation, 0);
}

@Override
protected void beginExecution() {
super.beginExecution();
}

@Override
public SoundEvent provideDeathSound() {
return this.sound;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ protected void onUpdate() {
super.onUpdate();

if (target != null) {
getEntity().getTurnHelper().updateTurnSpeed(14.0f);
getEntity().getTurnHelper().updateTurnSpeed(30F);
getEntity().getTurnHelper().updateTargetPoint(targetPoint);
hitAreaEntities();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ protected void damageCollidingEntities() {
AIUtils.damageCollidingEntities(this.getEntity(), dmgHelper.getCalculator());
}

@SuppressWarnings("rawtypes")
@Override
protected void onUpdate() {
if (target != null) {
((EntityMHFCBase) getEntity()).getTurnHelper().updateTurnSpeed(12.0f);
((EntityMHFCBase) getEntity()).getTurnHelper().updateTargetPoint(targetPoint);
damageCollidingEntities();
((EntityMHFCBase<?>) getEntity()).getTurnHelper().updateTurnSpeed(30F);
((EntityMHFCBase<?>) getEntity()).getTurnHelper().updateTargetPoint(targetPoint);
}

}
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/mhfc/net/common/entity/type/EntityMHFCBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public void onUpdate() {
}
}


protected abstract IActionManager<YC> constructActionManager();

/**
Expand Down Expand Up @@ -194,7 +195,6 @@ protected void applyEntityAttributes() {

getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(1.3D);
getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(30D);
getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3D);
getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(17D);
}

Expand Down Expand Up @@ -419,7 +419,9 @@ protected void setAIActionManager(AIActionManager<YC> newManager) {
@Override
protected void updateAITasks() {
super.updateAITasks();
if (!this.isDead) {
turnHelper.onUpdateTurn();
}
}

@SideOnly(Side.CLIENT)
Expand Down Expand Up @@ -487,6 +489,14 @@ public boolean canBePushed() {
return false;
}

@Override
public boolean canBeCollidedWith() {
if (this.isDead) {
return false;
}
return true;
}

public TargetTurnHelper getTurnHelper() {
return turnHelper;
}
Expand Down

0 comments on commit 57ee869

Please sign in to comment.