add flying types
This commit is contained in:
parent
b317139c97
commit
414dc668ff
11 changed files with 29 additions and 22 deletions
|
@ -157,7 +157,6 @@ import common.packet.HPacketHandshake;
|
||||||
import common.packet.CPacketAction.Action;
|
import common.packet.CPacketAction.Action;
|
||||||
import common.potion.Potion;
|
import common.potion.Potion;
|
||||||
import common.potion.PotionEffect;
|
import common.potion.PotionEffect;
|
||||||
import common.potion.PotionHelper;
|
|
||||||
import common.properties.IProperty;
|
import common.properties.IProperty;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.sound.EventType;
|
import common.sound.EventType;
|
||||||
|
@ -937,7 +936,7 @@ public class Client implements IThreadListener {
|
||||||
for(PotionEffect effect : this.player.getEffects()) {
|
for(PotionEffect effect : this.player.getEffects()) {
|
||||||
Potion potion = effect.getPotion();
|
Potion potion = effect.getPotion();
|
||||||
int color = potion.getColor();
|
int color = potion.getColor();
|
||||||
String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + potion.getDisplay() + PotionHelper.getPotionPotency(effect.getAmplifier());
|
String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + effect.getEffectName();
|
||||||
String desc = TextColor.NEON + effect.getDurationString();
|
String desc = TextColor.NEON + effect.getDurationString();
|
||||||
// Drawing.drawRectColor(x, y, 250, Font.DEFAULT.yglyph + 2, color | 0xff000000);
|
// Drawing.drawRectColor(x, y, 250, Font.DEFAULT.yglyph + 2, color | 0xff000000);
|
||||||
Drawing.drawRectBorder(x, y, 250, Font.YGLYPH + 4, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f);
|
Drawing.drawRectBorder(x, y, 250, Font.YGLYPH + 4, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f);
|
||||||
|
|
|
@ -129,9 +129,9 @@ public abstract class EntityFlyingNPC extends EntityNPC
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPotionApplicable(Potion potion)
|
public boolean isPotionApplicable(Potion potion, int amplifier)
|
||||||
{
|
{
|
||||||
return potion != Potion.FLYING && super.isPotionApplicable(potion);
|
return (potion != Potion.FLYING || amplifier > 0) && super.isPotionApplicable(potion, amplifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class AILookAround extends EntityAIBase
|
static class AILookAround extends EntityAIBase
|
||||||
|
|
|
@ -3960,7 +3960,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
{
|
{
|
||||||
double d3 = this.motionY;
|
double d3 = this.motionY;
|
||||||
float f = this.jumpMovement;
|
float f = this.jumpMovement;
|
||||||
this.jumpMovement = this.landMovement * (this.canFlyFullSpeed() ? 0.5f : 0.2f) * (float)(this.isSprinting() ? 2 : 1);
|
this.jumpMovement = this.landMovement * (this.canFlyFullSpeed() ? 0.5f : 0.2f) * (this.isSprinting() ? (this.canFlyFullSpeed() ? 2.0f : 1.3f) : 1.0f);
|
||||||
super.moveEntityWithHeading(strafe, forward);
|
super.moveEntityWithHeading(strafe, forward);
|
||||||
this.motionY = d3 * 0.6D;
|
this.motionY = d3 * 0.6D;
|
||||||
this.jumpMovement = f;
|
this.jumpMovement = f;
|
||||||
|
@ -4369,7 +4369,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canFlyFullSpeed() {
|
public boolean canFlyFullSpeed() {
|
||||||
return this.flying;
|
return this.hasEffect(Potion.FLYING) && this.getEffect(Potion.FLYING).getAmplifier() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnergy(Energy type) { // TODO
|
public int getEnergy(Energy type) { // TODO
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData
|
||||||
for (PotionEffect potioneffect : list)
|
for (PotionEffect potioneffect : list)
|
||||||
{
|
{
|
||||||
Potion i = potioneffect.getPotion();
|
Potion i = potioneffect.getPotion();
|
||||||
if(!entitylivingbase.isPotionApplicable(i))
|
if(!entitylivingbase.isPotionApplicable(i, potioneffect.getAmplifier()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i.isInstant())
|
if (i.isInstant())
|
||||||
|
|
|
@ -813,7 +813,7 @@ public abstract class EntityLiving extends Entity
|
||||||
*/
|
*/
|
||||||
public void addEffect(PotionEffect potioneffectIn)
|
public void addEffect(PotionEffect potioneffectIn)
|
||||||
{
|
{
|
||||||
if (!potioneffectIn.getPotion().isInstant() && this.isPotionApplicable(potioneffectIn.getPotion()))
|
if (!potioneffectIn.getPotion().isInstant() && this.isPotionApplicable(potioneffectIn.getPotion(), potioneffectIn.getAmplifier()))
|
||||||
{
|
{
|
||||||
if (this.effects.containsKey(potioneffectIn.getPotion()))
|
if (this.effects.containsKey(potioneffectIn.getPotion()))
|
||||||
{
|
{
|
||||||
|
@ -828,7 +828,7 @@ public abstract class EntityLiving extends Entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPotionApplicable(Potion potion)
|
public boolean isPotionApplicable(Potion potion, int amplifier)
|
||||||
{
|
{
|
||||||
// if (this.getCreatureType() == CreatureType.UNDEAD)
|
// if (this.getCreatureType() == CreatureType.UNDEAD)
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -228,7 +228,7 @@ public class ItemPotion extends Item
|
||||||
|
|
||||||
if (list != null && !list.isEmpty())
|
if (list != null && !list.isEmpty())
|
||||||
{
|
{
|
||||||
String s2 = ((PotionEffect)list.get(0)).getPotionName();
|
String s2 = list.get(0).getPotionName();
|
||||||
// s2 = s2 + ".postfix";
|
// s2 = s2 + ".postfix";
|
||||||
return s + s2.trim();
|
return s + s2.trim();
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,6 @@ public class ItemPotion extends Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s1 = s1 + PotionHelper.getPotionPotency(potioneffect.getAmplifier());
|
|
||||||
// if (potioneffect.getAmplifier() >= 1 && potioneffect.getAmplifier() <= 9)
|
// if (potioneffect.getAmplifier() >= 1 && potioneffect.getAmplifier() <= 9)
|
||||||
// {
|
// {
|
||||||
// s1 = s1 + " " + Strs.get("potion.potency." + potioneffect.getAmplifier()).trim();
|
// s1 = s1 + " " + Strs.get("potion.potency." + potioneffect.getAmplifier()).trim();
|
||||||
|
|
|
@ -94,7 +94,15 @@ public enum Potion {
|
||||||
entity.healMana(1);
|
entity.healMana(1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FLYING("flying", "Schweben", "Trank des Schwebens", false, 8356754),
|
FLYING("flying", null, null, false, 8356754) {
|
||||||
|
public String getDisplay(int amplifier) {
|
||||||
|
return amplifier <= 0 ? "Schweben" : "Flugkraft";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPotionDisplay(int amplifier) {
|
||||||
|
return amplifier <= 0 ? "Trank des Schwebens" : "Trank der Flugkraft";
|
||||||
|
}
|
||||||
|
},
|
||||||
BLINDNESS("blindness", "Blindheit", "Trank der Blindheit", true, 2039587) {
|
BLINDNESS("blindness", "Blindheit", "Trank der Blindheit", true, 2039587) {
|
||||||
public double getEffectiveness() {
|
public double getEffectiveness() {
|
||||||
return 0.25;
|
return 0.25;
|
||||||
|
@ -195,11 +203,11 @@ public enum Potion {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplay() {
|
public String getDisplay(int amplifier) {
|
||||||
return this.effectDisplay;
|
return this.effectDisplay + PotionHelper.getPotionPotency(amplifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPotionDisplay() {
|
public String getPotionDisplay(int amplifier) {
|
||||||
return this.potionDisplay;
|
return this.potionDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,11 +105,11 @@ public class PotionEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEffectName() {
|
public String getEffectName() {
|
||||||
return this.potion.getDisplay();
|
return this.potion.getDisplay(this.amplifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPotionName() {
|
public String getPotionName() {
|
||||||
return this.potion.getPotionDisplay();
|
return this.potion.getPotionDisplay(this.amplifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDurationString() {
|
public String getDurationString() {
|
||||||
|
|
|
@ -29,8 +29,9 @@ public class CommandMilk extends Command {
|
||||||
int done = 0;
|
int done = 0;
|
||||||
for(EntityLiving entity : entities) {
|
for(EntityLiving entity : entities) {
|
||||||
if(type != null && entity.hasEffect(type)) {
|
if(type != null && entity.hasEffect(type)) {
|
||||||
|
int amplifier = entity.getEffect(type).getAmplifier();
|
||||||
entity.removeEffect(type);
|
entity.removeEffect(type);
|
||||||
exec.logConsole("%s von %s entfernt", type.getDisplay(), entity.getCommandName());
|
exec.logConsole("%s von %s entfernt", type.getDisplay(amplifier), entity.getCommandName());
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
else if(type == null && !entity.getEffects().isEmpty()) {
|
else if(type == null && !entity.getEffects().isEmpty()) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CommandPotion extends Command {
|
||||||
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Potion type, int duration, int strength, boolean particles, boolean ambient, boolean keep) {
|
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Potion type, int duration, int strength, boolean particles, boolean ambient, boolean keep) {
|
||||||
int done = 0;
|
int done = 0;
|
||||||
for(EntityLiving entity : entities) {
|
for(EntityLiving entity : entities) {
|
||||||
if(entity.isPotionApplicable(type)) {
|
if(entity.isPotionApplicable(type, strength - 1)) {
|
||||||
if(type.isInstant()) {
|
if(type.isInstant()) {
|
||||||
type.onImpact(null, null, entity, strength - 1, 1.0);
|
type.onImpact(null, null, entity, strength - 1, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ public class CommandPotion extends Command {
|
||||||
entity.addEffect(effect);
|
entity.addEffect(effect);
|
||||||
}
|
}
|
||||||
if(type.isInstant() || duration == 0)
|
if(type.isInstant() || duration == 0)
|
||||||
exec.logConsole("%d * %s an %s gegeben", strength, type.getDisplay(), entity.getCommandName());
|
exec.logConsole("%s an %s gegeben", type.getDisplay(strength - 1), entity.getCommandName());
|
||||||
else
|
else
|
||||||
exec.logConsole("%d * %s für %d Sekunden an %s gegeben", strength, type.getDisplay(), duration, entity.getCommandName());
|
exec.logConsole("%s für %d Sekunden an %s gegeben", type.getDisplay(strength - 1), duration, entity.getCommandName());
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2763,7 +2763,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
||||||
this.entity.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255, false, false));
|
this.entity.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255, false, false));
|
||||||
this.entity.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255, false, false));
|
this.entity.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255, false, false));
|
||||||
this.entity.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false));
|
this.entity.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false));
|
||||||
this.entity.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 0, false, false));
|
this.entity.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1, false, false));
|
||||||
this.entity.addEffect(new PotionEffect(Potion.MANA, Integer.MAX_VALUE, 255, false, false));
|
this.entity.addEffect(new PotionEffect(Potion.MANA, Integer.MAX_VALUE, 255, false, false));
|
||||||
this.addFeed(TextColor.GREEN + "Statuseffekte wurden hinzugefügt");
|
this.addFeed(TextColor.GREEN + "Statuseffekte wurden hinzugefügt");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue