This commit is contained in:
Sen 2025-07-10 00:22:29 +02:00
parent d404c1743a
commit 28d6850668
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
93 changed files with 420 additions and 499 deletions

View file

@ -160,8 +160,8 @@ import common.packet.CPacketCheat;
import common.packet.CPacketMessage;
import common.packet.HPacketHandshake;
import common.packet.CPacketAction.Action;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.properties.Property;
import common.sound.EventType;
import common.sound.PositionedSound;
@ -622,7 +622,7 @@ public class Client implements IThreadListener {
this.show(null);
this.player.flying = true;
this.player.noclip = true;
this.player.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1));
this.player.addEffect(new StatusEffect(Effect.FLYING, Integer.MAX_VALUE, 1));
this.player.setHeight(2.0f);
world.setGravity(this.gravity = 1.0f);
world.setTimeFactor(this.timeFactor = 1);
@ -1017,8 +1017,8 @@ public class Client implements IThreadListener {
if(!this.drawDebug || this.open != null) {
x = 40;
y = 40;
for(PotionEffect effect : this.player.getEffects()) {
Potion potion = effect.getPotion();
for(StatusEffect effect : this.player.getEffects()) {
Effect potion = effect.getPotion();
int color = potion.getColor();
String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + effect.getEffectName();
String desc = TextColor.NEON + effect.getDurationString();

View file

@ -116,7 +116,7 @@ import common.packet.SPacketTrades;
import common.packet.SPacketUpdateDisplay;
import common.packet.SPacketUpdateHealth;
import common.packet.SPacketWorld;
import common.potion.PotionEffect;
import common.potion.StatusEffect;
import common.rng.Random;
import common.sound.Sound;
import common.tileentity.TileEntity;
@ -1525,7 +1525,7 @@ public class ClientPlayer implements IClientPlayer
if (entity instanceof EntityLiving living)
{
PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier())
StatusEffect potioneffect = new StatusEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier())
.setRemaining(packetIn.getRemaining());
living.addEffect(potioneffect);
}

View file

@ -20,11 +20,11 @@ import common.init.Blocks;
import common.init.ItemRegistry;
import common.item.Item;
import common.item.tool.ItemPotion;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.util.ParticleType;
import common.world.State;
import common.world.World;
@ -631,11 +631,13 @@ public class EffectRenderer {
}
private class Spell extends Particle {
protected Spell(double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_, int color) {
this(xCoordIn, yCoordIn, zCoordIn, p_i1229_8_, p_i1229_10_, p_i1229_12_, color, rng.doublev() * 4.0D, rng.doublev() * Math.PI * 2.0D);
private final boolean effect;
protected Spell(double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_, ItemPotion potion) {
this(xCoordIn, yCoordIn, zCoordIn, p_i1229_8_, p_i1229_10_, p_i1229_12_, potion, rng.doublev() * 4.0D, rng.doublev() * Math.PI * 2.0D);
}
private Spell(double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_, int j1,
private Spell(double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_, ItemPotion potion,
double d22, double d23) {
super(xCoordIn + Math.cos(d23) * d22 * 0.1, yCoordIn + 0.3, zCoordIn + Math.sin(d23) * d22 * 0.1, 0.5 - rng.doublev(),
0.01 + rng.doublev() * 0.5, 0.5 - rng.doublev());
@ -652,11 +654,15 @@ public class EffectRenderer {
float f = 1.0F;
float f1 = 1.0F;
float f2 = 1.0F;
if(j1 != 0xffffffff) {
if(this.effect = potion.getEffect() != null) {
int j1 = potion.getEffect().getPotion().getColor();
f = (float)(j1 >> 16 & 255) / 255.0F;
f1 = (float)(j1 >> 8 & 255) / 255.0F;
f2 = (float)(j1 >> 0 & 255) / 255.0F;
}
else {
this.setUV(1 + rng.zrange(3), 1);
}
this.motionX *= d22;
this.motionY = (this.motionY - 0.10000000149011612D) * d22 + 0.10000000149011612D;
this.motionZ *= d22;
@ -675,8 +681,13 @@ public class EffectRenderer {
return true;
}
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 3);
this.motionY += 0.004D;
if(this.effect) {
this.setUV(Math.max(0, 7 - this.age * 8 / this.lifetime), 3);
this.motionY += 0.004;
}
else {
this.motionY -= 0.004;
}
this.move(this.motionX, this.motionY, this.motionZ);
if(this.posY == this.prevY) {
@ -956,7 +967,7 @@ public class EffectRenderer {
this.register(ParticleType.CRIT, (x, y, z, xSpeed, ySpeed, zSpeed, data) -> new Crit(x, y, z, xSpeed, ySpeed, zSpeed));
this.register(ParticleType.SMOKE, (x, y, z, xSpeed, ySpeed, zSpeed, data) -> new Smoke(x, y, z, xSpeed, ySpeed, zSpeed));
this.register(ParticleType.POTION, (x, y, z, xSpeed, ySpeed, zSpeed, data) -> new Spell(x, y, z, xSpeed, ySpeed, zSpeed,
ItemPotion.getPotionItem(data).getColorFromDamage()));
ItemPotion.getPotionItem(data)));
this.register(ParticleType.GROW, (x, y, z, xSpeed, ySpeed, zSpeed, data) -> new Aura(x, y, z, xSpeed, ySpeed, zSpeed, false, 1));
this.register(ParticleType.SPORE, (x, y, z, xSpeed, ySpeed, zSpeed, data) -> new Aura(x, y, z, xSpeed, ySpeed, zSpeed, false, 0));
this.register(ParticleType.TELEPORT, (x, y, z, xSpeed, ySpeed, zSpeed, data) -> new Teleport(x, y, z, xSpeed, ySpeed, zSpeed));

View file

@ -24,13 +24,13 @@ import common.init.Blocks;
import common.init.Items;
import common.init.SoundEvent;
import common.model.BlockLayer;
import common.model.ParticleType;
import common.potion.Potion;
import common.potion.Effect;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.world.World;
@ -406,7 +406,7 @@ public class EntityRenderer {
GL11.glRotatef(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F);
}
if (f < 0.0F || entitylivingbase.hasEffect(Potion.STABILITY))
if (f < 0.0F || entitylivingbase.hasEffect(Effect.STABILITY))
{
return;
}
@ -786,7 +786,7 @@ public class EntityRenderer {
// f10 = 0.25F + f7 * 0.75F;
// }
if (this.gm.player.hasEffect(Potion.NIGHT_VISION))
if (this.gm.player.hasEffect(Effect.NIGHT_VISION))
{
float vis = this.getNightVisionBrightness(this.gm.player, partialTicks);
float mult = 1.0F / red;
@ -880,7 +880,7 @@ public class EntityRenderer {
private float getNightVisionBrightness(EntityLiving entitylivingbaseIn, float partialTicks)
{
int i = entitylivingbaseIn.getEffect(Potion.NIGHT_VISION).getRemaining();
int i = entitylivingbaseIn.getEffect(Effect.NIGHT_VISION).getRemaining();
return i > 200 ? 1.0F : 0.7F + ExtMath.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F;
}
@ -1402,9 +1402,9 @@ public class EntityRenderer {
this.fogColorBlue *= mult;
double vfog = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial); // * world.dimension.getVoidFogYFactor();
if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Potion.BLINDNESS))
if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Effect.BLINDNESS))
{
int blind = ((EntityLiving)entity).getEffect(Potion.BLINDNESS).getRemaining();
int blind = ((EntityLiving)entity).getEffect(Effect.BLINDNESS).getRemaining();
if (blind < 20)
{
@ -1437,7 +1437,7 @@ public class EntityRenderer {
// this.fogColorBlue = this.fogColorBlue * (1.0F - shift) + this.fogColorBlue * 0.6F * shift;
// }
if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Potion.NIGHT_VISION))
if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Effect.NIGHT_VISION))
{
float vis = this.getNightVisionBrightness((EntityLiving)entity, partial);
float mul = 1.0F / this.fogColorRed;
@ -1497,10 +1497,10 @@ public class EntityRenderer {
if(distance >= 1.0f) {
;
}
else if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Potion.BLINDNESS))
else if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Effect.BLINDNESS))
{
float far = 5.0F;
int effect = ((EntityLiving)entity).getEffect(Potion.BLINDNESS).getRemaining();
int effect = ((EntityLiving)entity).getEffect(Effect.BLINDNESS).getRemaining();
if (effect < 20)
{

View file

@ -8,7 +8,7 @@ public class RenderPotion extends RenderItemEntity<EntityPotion>
{
public RenderPotion(RenderManager renderManagerIn, RenderItem itemRendererIn)
{
super(renderManagerIn, Items.potion, itemRendererIn);
super(renderManagerIn, Items.water_bottle, itemRendererIn);
}
public ItemStack getStack(EntityPotion entityIn)

View file

@ -18,7 +18,6 @@ import common.init.Items;
import common.init.SoundEvent;
import common.item.material.ItemDye;
import common.log.Log;
import common.model.ParticleType;
import common.rng.Random;
import common.sound.MovingSoundMinecart;
import common.sound.PositionedSound;
@ -27,6 +26,7 @@ import common.util.BlockPos;
import common.util.ChunkPos;
import common.util.ExtMath;
import common.util.LongHashMap;
import common.util.ParticleType;
import common.util.Vec3;
import common.util.BlockPos.MutableBlockPos;
import common.world.AWorldClient;
@ -620,7 +620,7 @@ public class WorldClient extends AWorldClient
for (int i1 = 0; i1 < 8; ++i1)
{
this.spawnParticle(ParticleType.ITEM_CRACK, d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, ItemRegistry.getId(Items.potion));
this.spawnParticle(ParticleType.ITEM_CRACK, d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, ItemRegistry.getId(Items.water_bottle));
}
for (int l1 = 0; l1 < 100; ++l1)

View file

@ -6,8 +6,8 @@ import common.entity.item.EntityXp;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityAnimal;
import common.entity.types.EntityLiving;
import common.model.ParticleType;
import common.rng.Random;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -8,10 +8,10 @@ import common.entity.npc.EntityNPC;
import common.init.Blocks;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.State;

View file

@ -11,11 +11,11 @@ import common.entity.Entity;
import common.item.Item;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.ParticleType;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;

View file

@ -11,7 +11,6 @@ import common.item.Item;
import common.model.BlockLayer;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.properties.Property;
import common.properties.PropertyEnum;
import common.properties.PropertyInteger;
@ -19,6 +18,7 @@ import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.ParticleType;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;

View file

@ -7,11 +7,11 @@ import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.AWorldClient;

View file

@ -120,6 +120,6 @@ public class BlockWart extends BlockBush
}
protected Item getItemToRegister() {
return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(StackSize.L);
return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setMaxAmount(StackSize.L);
}
}

View file

@ -11,7 +11,6 @@ import common.init.Blocks;
import common.init.SoundEvent;
import common.item.Item;
import common.model.BlockLayer;
import common.model.ParticleType;
import common.properties.Property;
import common.properties.PropertyInteger;
import common.rng.Random;
@ -20,6 +19,7 @@ import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.Facing;
import common.util.Pair;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.IBlockAccess;

View file

@ -2,9 +2,9 @@ package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;

View file

@ -11,7 +11,6 @@ import common.model.BlockLayer;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.ParticleType;
import common.model.TextureAnimation;
import common.properties.Property;
import common.properties.PropertyBool;
@ -20,6 +19,7 @@ import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.IBlockAccess;
import common.world.IWorldAccess;

View file

@ -10,10 +10,10 @@ import common.item.Item;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;

View file

@ -17,7 +17,6 @@ import common.item.block.ItemSmallBlock;
import common.model.BlockLayer;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
@ -26,6 +25,7 @@ import common.tileentity.TileEntityBrewingStand;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;

View file

@ -510,7 +510,7 @@ public class BlockCauldron extends Block
{
// if (!playerIn.creative)
// {
ItemStack itemstack2 = new ItemStack(Items.potion);
ItemStack itemstack2 = new ItemStack(Items.water_bottle);
if (!playerIn.inventory.addItemStackToInventory(itemstack2))
{

View file

@ -15,13 +15,13 @@ import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.ParticleType;
import common.properties.Property;
import common.rng.Random;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityFurnace;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;

View file

@ -10,13 +10,13 @@ import common.item.block.ItemSmallBlock;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.ParticleType;
import common.properties.Property;
import common.properties.PropertyBool;
import common.properties.PropertyInteger;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;

View file

@ -11,10 +11,10 @@ import common.init.Items;
import common.init.SoundEvent;
import common.item.CheatTab;
import common.item.Item;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;

View file

@ -17,8 +17,6 @@ import common.model.BlockLayer;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.ParticleType;
import common.potion.PotionHelper;
import common.properties.Property;
import common.properties.PropertyEnum;
import common.properties.PropertyInteger;
@ -28,6 +26,7 @@ import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.Facing;
import common.util.Identifyable;
import common.util.ParticleType;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.AWorldClient;
@ -1015,7 +1014,7 @@ public class BlockRedstoneWire extends Block
}
protected Item getItemToRegister() {
return new ItemRedstone(Blocks.redstone).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(StackSize.XL);
return new ItemRedstone(Blocks.redstone).setDisplay("Redstone").setMaxAmount(StackSize.XL);
}
public Property[] getUnsavedProperties() {

View file

@ -12,13 +12,13 @@ import common.model.BlockLayer;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.ParticleType;
import common.properties.Property;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.world.AWorldClient;
import common.world.State;

View file

@ -13,11 +13,11 @@ import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.ParticleType;
import common.properties.Property;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;

View file

@ -26,7 +26,6 @@ import common.init.SoundEvent;
import common.init.UniverseRegistry;
import common.item.Item;
import common.item.ItemStack;
import common.model.ParticleType;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
@ -34,6 +33,7 @@ import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.Facing;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.PortalType;
import common.util.Position;
import common.util.Vec3;

View file

@ -24,7 +24,7 @@ import common.packet.SPacketEntityVelocity;
import common.packet.SPacketSpawnMob;
import common.packet.SPacketSpawnObject;
import common.packet.SPacketSpawnPlayer;
import common.potion.PotionEffect;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.util.ExtMath;
@ -330,7 +330,7 @@ public class EntityTrackerEntry {
if(this.trackedEntity instanceof EntityLiving) {
EntityLiving entitylivingbase = (EntityLiving)this.trackedEntity;
for(PotionEffect potioneffect : entitylivingbase.getEffects()) {
for(StatusEffect potioneffect : entitylivingbase.getEffects()) {
playerMP.connection.sendPacket(new SPacketEntityEffect(this.trackedEntity.getId(), potioneffect));
}
}

View file

@ -11,9 +11,9 @@ import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.entity.types.IEntityMultiPart;
import common.init.SoundEvent;
import common.model.ParticleType;
import common.potion.Potion;
import common.potion.Effect;
import common.util.ExtMath;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.AWorldClient;
@ -57,7 +57,7 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart
return true;
}
public boolean isPotionApplicable(Potion potion, int amplifier) {
public boolean isPotionApplicable(Effect potion, int amplifier) {
return false;
}

View file

@ -27,13 +27,13 @@ import common.inventory.InventoryBasic;
import common.item.Item;
import common.item.ItemStack;
import common.item.spawner.ItemMonsterPlacer;
import common.model.ParticleType;
import common.pathfinding.PathNavigateGround;
import common.potion.Potion;
import common.potion.Effect;
import common.tags.TagObject;
import java.util.List;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;
@ -1330,9 +1330,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
{
this.motionY = this.getHorseJumpStrength() * (double)this.jumpPower;
if (this.hasEffect(Potion.JUMP))
if (this.hasEffect(Effect.JUMP))
{
this.motionY += (double)((float)(this.getEffect(Potion.JUMP).getAmplifier() + 1) * 0.1F);
this.motionY += (double)((float)(this.getEffect(Effect.JUMP).getAmplifier() + 1) * 0.1F);
}
this.setHorseJumping(true);

View file

@ -8,7 +8,7 @@ import common.init.Items;
import common.init.SoundEvent;
import common.item.ItemStack;
import common.item.tool.ItemShears;
import common.model.ParticleType;
import common.util.ParticleType;
import common.world.World;
public class EntityMooshroom extends EntityCow

View file

@ -29,14 +29,14 @@ import common.init.Items;
import common.init.SoundEvent;
import common.item.Item;
import common.item.ItemStack;
import common.model.ParticleType;
import common.pathfinding.PathEntity;
import common.pathfinding.PathNavigateGround;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.State;
@ -81,8 +81,8 @@ public class EntityRabbit extends EntityAnimal {
return this.moveHelper.isUpdating() && this.moveHelper.getY() > this.posY + 0.5D ? 0.5F : this.moveType.getUpwardsMotion();
}
public boolean isPotionApplicable(Potion potion, int amplifier) {
return super.isPotionApplicable(potion, amplifier) || potion == Potion.JUMP;
public boolean isPotionApplicable(Effect potion, int amplifier) {
return super.isPotionApplicable(potion, amplifier) || potion == Effect.JUMP;
}
public void setMoveType(EntityRabbit.EnumMoveType type) {
@ -342,7 +342,7 @@ public class EntityRabbit extends EntityAnimal {
}).isEmpty())
this.setInLove(null);
if(state.getBlock() == Blocks.blue_mushroom)
this.addEffect(new PotionEffect(Potion.SPEED, this.rand.range(400, 2600), this.rand.chance(0, 1, 5)));
this.addEffect(new StatusEffect(Effect.SPEED, this.rand.range(400, 2600), this.rand.chance(0, 1, 5)));
this.worldObj.destroyBlock(pos, false);
this.worldObj.setState(pos, Blocks.air.getState(), 2);
}

View file

@ -29,10 +29,10 @@ import common.item.Item;
import common.item.ItemStack;
import common.item.material.ItemDye;
import common.item.tool.ItemFood;
import common.model.ParticleType;
import common.pathfinding.PathNavigateGround;
import common.tags.TagObject;
import common.util.ExtMath;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -12,11 +12,11 @@ import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.Items;
import common.item.Item;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -14,10 +14,10 @@ import common.init.SoundEvent;
import common.item.Item;
import common.item.ItemStack;
import common.log.Log;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.ParticleType;
import common.util.PortalType;
import common.vars.Vars;
import common.world.World;

View file

@ -2,8 +2,8 @@ package common.entity.item;
import common.entity.Entity;
import common.entity.EntityType;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.ParticleType;
import common.world.World;
public class EntityNuke extends Entity

View file

@ -4,8 +4,8 @@ import common.entity.DamageSource;
import common.entity.Entity;
import common.entity.types.EntityLiving;
import common.entity.types.EntityThrowable;
import common.model.ParticleType;
import common.util.HitPosition;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -4,8 +4,8 @@ import common.entity.Entity;
import common.entity.EntityType;
import common.entity.types.EntityLiving;
import common.entity.types.IObjectData;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.ParticleType;
import common.world.World;
public class EntityTnt extends Entity implements IObjectData

View file

@ -8,9 +8,9 @@ import common.init.Blocks;
import common.init.Items;
import common.init.SoundEvent;
import common.item.ItemStack;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.Explosion;
import common.world.State;

View file

@ -9,10 +9,10 @@ import common.entity.EntityType;
import common.entity.npc.EntityNPC;
import common.entity.types.IObjectData;
import common.init.SoundEvent;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.ParticleType;
import common.util.PortalType;
import common.vars.Vars;
import common.world.World;

View file

@ -6,8 +6,8 @@ import common.entity.Entity;
import common.entity.types.EntityLiving;
import common.pathfinding.PathNavigate;
import common.pathfinding.PathNavigateClimber;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.rng.Random;
import common.util.BlockPos;
import common.world.World;
@ -36,7 +36,7 @@ public class EntityArachnoid extends EntityNPC {
}
public static class GroupData {
public Potion potionEffectId;
public Effect potionEffectId;
public boolean isChild;
public GroupData(boolean isChild) {
@ -44,7 +44,7 @@ public class EntityArachnoid extends EntityNPC {
}
public void pickEffect(Random rand) {
this.potionEffectId = rand.pick(Potion.SPEED, Potion.SPEED, Potion.STRENGTH, Potion.REGENERATION);
this.potionEffectId = rand.pick(Effect.SPEED, Effect.SPEED, Effect.STRENGTH, Effect.REGENERATION);
}
}
@ -98,10 +98,10 @@ public class EntityArachnoid extends EntityNPC {
}
if(livingdata instanceof EntityArachnoid.GroupData) {
Potion i = ((EntityArachnoid.GroupData)livingdata).potionEffectId;
Effect i = ((EntityArachnoid.GroupData)livingdata).potionEffectId;
if(i != null) {
this.addEffect(new PotionEffect(i, Integer.MAX_VALUE, 0));
this.addEffect(new StatusEffect(i, Integer.MAX_VALUE, 0));
}
if(((EntityArachnoid.GroupData)livingdata).isChild)
@ -133,7 +133,7 @@ public class EntityArachnoid extends EntityNPC {
public boolean attackEntityAsMob(Entity entityIn) {
if(super.attackEntityAsMob(entityIn)) {
if(this.isPoisonous() && entityIn instanceof EntityLiving && this.rand.chance(50))
((EntityLiving)entityIn).addEffect(new PotionEffect(Potion.POISON, this.rand.range(14, 35) * 20, 0));
((EntityLiving)entityIn).addEffect(new StatusEffect(Effect.POISON, this.rand.range(14, 35) * 20, 0));
return true;
}
return false;

View file

@ -2,8 +2,8 @@ package common.entity.npc;
import common.ai.AISmallFireballAttack;
import common.init.SoundEvent;
import common.model.ParticleType;
import common.rng.Random;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.World;

View file

@ -4,7 +4,7 @@ import common.ai.EntityAIBase;
import common.ai.EntityMoveHelper;
import common.block.Block;
import common.entity.types.EntityLiving;
import common.potion.Potion;
import common.potion.Effect;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
@ -126,8 +126,8 @@ public abstract class EntityFlyingNPC extends EntityNPC
return false;
}
public boolean isPotionApplicable(Potion potion, int amplifier) {
return (potion != Potion.FLYING || amplifier > 0) && super.isPotionApplicable(potion, amplifier);
public boolean isPotionApplicable(Effect potion, int amplifier) {
return (potion != Effect.FLYING || amplifier > 0) && super.isPotionApplicable(potion, amplifier);
}
static class AILookAround extends EntityAIBase

View file

@ -3,9 +3,9 @@ package common.entity.npc;
import common.ai.AIFlyingBoxAttack;
import common.entity.DamageSource;
import common.item.ItemStack;
import common.model.ParticleType;
import common.rng.Random;
import common.tags.TagObject;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -5,8 +5,8 @@ import common.entity.types.EntityLiving;
import common.init.Items;
import common.item.ItemStack;
import common.item.tool.ItemPotion;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.rng.Random;
import common.util.ExtMath;
import common.world.World;
@ -39,13 +39,13 @@ public class EntityMage extends EntityNPC
if (itemstack != null && itemstack.getItem() instanceof ItemPotion potion)
{
PotionEffect potioneffect = potion.getEffect();
StatusEffect potioneffect = potion.getEffect();
if (potioneffect != null)
{
if(potioneffect.getPotion().isInstant())
potioneffect.getPotion().onImpact(null, null, this, potioneffect.getAmplifier(), 1.0);
else
this.addEffect(new PotionEffect(potioneffect.getPotion(), potioneffect.getDuration(), potioneffect.getAmplifier()));
this.addEffect(new StatusEffect(potioneffect.getPotion(), potioneffect.getDuration(), potioneffect.getAmplifier()));
}
}
@ -61,7 +61,7 @@ public class EntityMage extends EntityNPC
// i = 8237;
// }
// else
if (this.rand.floatv() < 0.15F && this.isBurning() && !this.hasEffect(Potion.FIRE_RESISTANCE))
if (this.rand.floatv() < 0.15F && this.isBurning() && !this.hasEffect(Effect.FIRE_RESISTANCE))
{
i = Items.potion_fire_resistance;
}
@ -69,11 +69,11 @@ public class EntityMage extends EntityNPC
{
i = Items.potion_health;
}
else if (this.rand.floatv() < 0.25F && this.getAttackTarget() != null && !this.hasEffect(Potion.SPEED) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
else if (this.rand.floatv() < 0.25F && this.getAttackTarget() != null && !this.hasEffect(Effect.SPEED) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
{
i = Items.potion_speed;
}
else if (this.rand.floatv() < 0.25F && this.getAttackTarget() != null && !this.hasEffect(Potion.SPEED) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
else if (this.rand.floatv() < 0.25F && this.getAttackTarget() != null && !this.hasEffect(Effect.SPEED) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
{
i = Items.potion_speed;
}
@ -96,15 +96,15 @@ public class EntityMage extends EntityNPC
double d1 = target.posX + target.motionX - this.posX;
double d3 = target.posZ + target.motionZ - this.posZ;
float f = ExtMath.sqrtd(d1 * d1 + d3 * d3);
if (f >= 8.0F && !target.hasEffect(Potion.SLOWNESS))
if (f >= 8.0F && !target.hasEffect(Effect.SLOWNESS))
{
this.setItem(0, new ItemStack(Items.potion_slowness));
}
else if (target.getHealth() >= 8 && !target.hasEffect(Potion.POISON))
else if (target.getHealth() >= 8 && !target.hasEffect(Effect.POISON))
{
this.setItem(0, new ItemStack(Items.potion_poison));
}
else if (f <= 3.0F && !target.hasEffect(Potion.WEAKNESS) && this.rand.floatv() < 0.25F)
else if (f <= 3.0F && !target.hasEffect(Effect.WEAKNESS) && this.rand.floatv() < 0.25F)
{
this.setItem(0, new ItemStack(Items.potion_weakness));
}

View file

@ -68,7 +68,6 @@ import common.item.tool.ItemPotion;
import common.item.tool.ItemShears;
import common.item.tool.ItemSword;
import common.item.tool.ItemTool;
import common.model.ParticleType;
import common.network.IClientPlayer;
import common.network.IPlayer;
import common.packet.CPacketPlayerPosition;
@ -81,8 +80,8 @@ import common.packet.CPacketPlayer;
import common.packet.SPacketEntityEquipment;
import common.packet.SPacketEntityVelocity;
import common.pathfinding.PathNavigateGround;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.rng.Random;
import common.sound.MovingSoundMinecartRiding;
import common.tags.TagObject;
@ -93,6 +92,7 @@ import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.Facing;
import common.util.ParticleType;
import common.util.PortalType;
import common.util.Vec3;
import common.util.WorldPos;
@ -556,7 +556,7 @@ public abstract class EntityNPC extends EntityLiving
return 20;
}
public boolean isPotionApplicable(Potion potion, int amplifier) {
public boolean isPotionApplicable(Effect potion, int amplifier) {
return true;
}
@ -2296,7 +2296,7 @@ public abstract class EntityNPC extends EntityLiving
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ + (double)this.width * 0.35D);
boolean canSprint = true; // (float)this.getFoodStats().getFoodLevel() > 6.0F || this.allowFlying;
if (this.onGround && !flag1 && !flag2 && this.client.getMoveForward() >= f && !this.isSprinting() && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS))
if (this.onGround && !flag1 && !flag2 && this.client.getMoveForward() >= f && !this.isSprinting() && canSprint && !this.isUsingItem() && !this.hasEffect(Effect.BLINDNESS))
{
if (this.sprintToggleTimer <= 0 && !this.client.isSprinting())
{
@ -2308,7 +2308,7 @@ public abstract class EntityNPC extends EntityLiving
}
}
if (!this.isSprinting() && this.client.getMoveForward() >= f && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS) && this.client.isSprinting())
if (!this.isSprinting() && this.client.getMoveForward() >= f && canSprint && !this.isUsingItem() && !this.hasEffect(Effect.BLINDNESS) && this.client.isSprinting())
{
this.setSprinting(true);
}
@ -2318,7 +2318,7 @@ public abstract class EntityNPC extends EntityLiving
this.setSprinting(false);
}
if (this.hasEffect(Potion.FLYING) || this.noclip || this.canNaturallyFly())
if (this.hasEffect(Effect.FLYING) || this.noclip || this.canNaturallyFly())
{
if (this.noclip)
{
@ -2889,21 +2889,21 @@ public abstract class EntityNPC extends EntityLiving
}
}
protected void onNewEffect(PotionEffect id) {
protected void onNewEffect(StatusEffect id) {
super.onNewEffect(id);
if(this.connection != null)
this.connection.onNewEffect(id);
}
protected void onChangedEffect(PotionEffect id, boolean added) {
protected void onChangedEffect(StatusEffect id, boolean added) {
super.onChangedEffect(id, added);
if(this.connection != null)
this.connection.onChangedEffect(id, added);
}
protected void onFinishedEffect(PotionEffect effect) {
protected void onFinishedEffect(StatusEffect effect) {
super.onFinishedEffect(effect);
if(this.isPlayer() && effect.getPotion() == Potion.FLYING && !this.noclip && !this.canNaturallyFly())
if(this.isPlayer() && effect.getPotion() == Effect.FLYING && !this.noclip && !this.canNaturallyFly())
this.flying = false;
// super.onFinishedEffect(effect);
if(this.connection != null)
@ -3245,19 +3245,19 @@ public abstract class EntityNPC extends EntityLiving
}
}
if (this.hasEffect(Potion.HASTE))
if (this.hasEffect(Effect.HASTE))
{
int speed = this.getEffect(Potion.HASTE).getAmplifier();
int speed = this.getEffect(Effect.HASTE).getAmplifier();
if(speed >= 255)
return 1000000.0f;
f *= 1.0F + (float)(speed + 1) * 0.2F;
}
if (this.hasEffect(Potion.FATIGUE))
if (this.hasEffect(Effect.FATIGUE))
{
float f1 = 1.0F;
switch (this.getEffect(Potion.FATIGUE).getAmplifier())
switch (this.getEffect(Effect.FATIGUE).getAmplifier())
{
case 0:
f1 = 0.3F;
@ -3292,7 +3292,7 @@ public abstract class EntityNPC extends EntityLiving
public int getAttackDamage() {
int damage = this.attackDamageBase + (this.getHeldItem() == null ? 0 : this.getHeldItem().getItem().getAttackDamageBonus());
return Math.max(0, damage + (this.hasEffect(Potion.STRENGTH) ? (damage / 2) * (this.getEffect(Potion.STRENGTH).getAmplifier() + 1) : 0) - (this.hasEffect(Potion.WEAKNESS) ? (damage / 5) * (this.getEffect(Potion.WEAKNESS).getAmplifier() + 1) : 0));
return Math.max(0, damage + (this.hasEffect(Effect.STRENGTH) ? (damage / 2) * (this.getEffect(Effect.STRENGTH).getAmplifier() + 1) : 0) - (this.hasEffect(Effect.WEAKNESS) ? (damage / 5) * (this.getEffect(Effect.WEAKNESS).getAmplifier() + 1) : 0));
}
public int getAttackDamageBase() {
@ -3411,7 +3411,7 @@ public abstract class EntityNPC extends EntityLiving
tagCompund.getInt("OriginZ"), dim);
}
this.flying = tagCompund.getBool("flying") && (this.hasEffect(Potion.FLYING) || this.canNaturallyFly());
this.flying = tagCompund.getBool("flying") && (this.hasEffect(Effect.FLYING) || this.canNaturallyFly());
// if(tagCompund.hasKey("speed", 99))
// this.speed = tagCompund.getFloat("speed");
// this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable");
@ -3683,7 +3683,7 @@ public abstract class EntityNPC extends EntityLiving
if (f > 0 || f1 > 0)
{
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInLiquid() && !this.hasEffect(Potion.BLINDNESS) && this.vehicle == null && targetEntity instanceof EntityLiving;
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInLiquid() && !this.hasEffect(Effect.BLINDNESS) && this.vehicle == null && targetEntity instanceof EntityLiving;
if (flag && f > 0)
{
@ -3979,7 +3979,7 @@ public abstract class EntityNPC extends EntityLiving
this.addMoved((int)Math.round((double)distance * 100.0D));
}
if(!this.hasEffect(Potion.FLYING))
if(!this.hasEffect(Effect.FLYING))
super.fall(distance, damageMultiplier);
}
}
@ -4255,7 +4255,7 @@ public abstract class EntityNPC extends EntityLiving
}
public boolean canFlyFullSpeed() {
return this.hasEffect(Potion.FLYING) && this.getEffect(Potion.FLYING).getAmplifier() > 0;
return this.hasEffect(Effect.FLYING) && this.getEffect(Effect.FLYING).getAmplifier() > 0;
}
public int getEnergy(Energy type) { // TODO
@ -4572,22 +4572,22 @@ public abstract class EntityNPC extends EntityLiving
public void setGodMode(boolean god) {
this.fallDistance = 0.0F;
if(!god) {
this.removeEffect(Potion.HASTE);
this.removeEffect(Potion.RESISTANCE);
this.removeEffect(Potion.FIRE_RESISTANCE);
this.removeEffect(Potion.FLYING);
this.removeEffect(Potion.MANA_GENERATION);
this.removeEffect(Effect.HASTE);
this.removeEffect(Effect.RESISTANCE);
this.removeEffect(Effect.FIRE_RESISTANCE);
this.removeEffect(Effect.FLYING);
this.removeEffect(Effect.MANA_GENERATION);
}
else {
this.extinguish();
this.setHealth(this.getMaxHealth());
this.setManaPoints(this.getMaxMana());
this.clearEffects(false);
this.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255));
this.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255));
this.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
this.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1));
this.addEffect(new PotionEffect(Potion.MANA_GENERATION, Integer.MAX_VALUE, 255));
this.addEffect(new StatusEffect(Effect.HASTE, Integer.MAX_VALUE, 255));
this.addEffect(new StatusEffect(Effect.RESISTANCE, Integer.MAX_VALUE, 255));
this.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
this.addEffect(new StatusEffect(Effect.FLYING, Integer.MAX_VALUE, 1));
this.addEffect(new StatusEffect(Effect.MANA_GENERATION, Integer.MAX_VALUE, 255));
}
}
@ -4595,7 +4595,7 @@ public abstract class EntityNPC extends EntityLiving
if(noclip)
this.mountEntity(null);
this.noclip = noclip;
this.flying &= this.hasEffect(Potion.FLYING) || this.noclip || this.canNaturallyFly();
this.flying &= this.hasEffect(Effect.FLYING) || this.noclip || this.canNaturallyFly();
this.fallDistance = 0.0F;
if(this.connection != null)
this.connection.sendPlayerAbilities();

View file

@ -9,12 +9,12 @@ import common.entity.types.EntityLiving;
import common.init.ItemRegistry;
import common.init.Items;
import common.init.SoundEvent;
import common.model.ParticleType;
import common.pathfinding.PathNavigateGround;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;
import common.world.AWorldServer;

View file

@ -16,12 +16,12 @@ import common.init.Blocks;
import common.init.Items;
import common.init.SoundEvent;
import common.item.ItemStack;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.State;

View file

@ -3,8 +3,8 @@ package common.entity.projectile;
import common.entity.DamageSource;
import common.entity.npc.EntityGargoyle;
import common.entity.types.EntityLiving;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.util.HitPosition;
import common.vars.Vars;
import common.world.World;
@ -108,7 +108,7 @@ public class EntityBox extends EntityProjectile
//
// if (i > 0)
// {
((EntityLiving)movingObject.entity).addEffect(new PotionEffect(Potion.SLOWNESS, 20 * this.rand.range(35, 55), this.rand.chance(1, 2, 5)));
((EntityLiving)movingObject.entity).addEffect(new StatusEffect(Effect.SLOWNESS, 20 * this.rand.range(35, 55), this.rand.chance(1, 2, 5)));
// }
}
}

View file

@ -6,9 +6,9 @@ import common.entity.types.EntityLiving;
import common.entity.types.EntityThrowable;
import common.entity.types.IObjectData;
import common.init.ItemRegistry;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.HitPosition;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -6,8 +6,8 @@ import common.entity.types.EntityLiving;
import common.entity.types.EntityThrowable;
import common.init.ItemRegistry;
import common.init.Items;
import common.model.ParticleType;
import common.util.HitPosition;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -16,12 +16,12 @@ import common.init.Blocks;
import common.init.Items;
import common.init.SoundEvent;
import common.item.ItemStack;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.World;

View file

@ -3,9 +3,9 @@ package common.entity.projectile;
import common.entity.Entity;
import common.entity.EntityType;
import common.entity.types.EntityLiving;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ParticleType;
import common.world.World;
public class EntityMissile extends EntityBullet {

View file

@ -9,8 +9,8 @@ import common.init.ItemRegistry;
import common.init.Items;
import common.item.ItemStack;
import common.item.tool.ItemPotion;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
@ -81,10 +81,10 @@ public class EntityPotion extends EntityThrowable implements IObjectData
{
if (this.potionDamage == null)
{
this.potionDamage = new ItemStack(Items.potion);
this.potionDamage = new ItemStack(Items.water_bottle);
}
return this.potionDamage.getItem() instanceof ItemPotion potion ? potion : Items.potion;
return this.potionDamage.getItem() instanceof ItemPotion potion ? potion : Items.water_bottle;
}
/**
@ -94,7 +94,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData
{
if (!this.worldObj.client)
{
PotionEffect potioneffect = this.potionDamage != null && this.potionDamage.getItem() instanceof ItemPotion potion ? potion.getEffect() : null;
StatusEffect potioneffect = this.potionDamage != null && this.potionDamage.getItem() instanceof ItemPotion potion ? potion.getEffect() : null;
BoundingBox axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D);
List<EntityLiving> list1 = this.worldObj.<EntityLiving>getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
@ -116,7 +116,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData
d1 = 1.0D;
}
Potion i = potioneffect.getPotion();
Effect i = potioneffect.getPotion();
if(!entitylivingbase.isPotionApplicable(i, potioneffect.getAmplifier()))
continue;
@ -130,7 +130,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData
if (j > 20)
{
entitylivingbase.addEffect(new PotionEffect(i, j, potioneffect.getAmplifier()));
entitylivingbase.addEffect(new StatusEffect(i, j, potioneffect.getAmplifier()));
}
}
}

View file

@ -8,12 +8,12 @@ import common.entity.Entity;
import common.entity.EntityType;
import common.entity.types.EntityLiving;
import common.init.BlockRegistry;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.world.World;

View file

@ -5,8 +5,8 @@ import common.entity.types.EntityLiving;
import common.entity.types.EntityThrowable;
import common.init.ItemRegistry;
import common.init.Items;
import common.model.ParticleType;
import common.util.HitPosition;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.World;

View file

@ -7,7 +7,7 @@ import common.rng.WeightedList;
public abstract class FishConstants {
public static final WeightedList<RngFishable> FISHING_JUNK = new WeightedList<RngFishable>(
(new RngFishable(new ItemStack(Items.leather_boots), 10)).setMaxDamagePercent(0.9F), new RngFishable(new ItemStack(Items.leather), 10),
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.potion), 10),
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.water_bottle), 10),
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F),
new RngFishable(new ItemStack(Items.bowl), 10), new RngFishable(new ItemStack(Items.stick), 5),
new RngFishable(new ItemStack(Items.ink_sack, 10), 1),

View file

@ -11,10 +11,10 @@ import common.entity.npc.EntityNPC;
import common.init.Blocks;
import common.init.Items;
import common.item.ItemStack;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.ParticleType;
import common.world.World;
public abstract class EntityAnimal extends EntityLiving

View file

@ -42,20 +42,20 @@ import common.item.Item;
import common.item.ItemStack;
import common.item.spawner.ItemMonsterPlacer;
import common.item.tool.ItemArmor;
import common.model.ParticleType;
import common.network.IPlayer;
import common.packet.SPacketEntityAttach;
import common.packet.SPacketAnimation;
import common.packet.SPacketCollectItem;
import common.pathfinding.PathNavigate;
import common.pathfinding.PathNavigateGround;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.State;
@ -68,7 +68,7 @@ public abstract class EntityLiving extends Entity
protected AttributeMap attributes = new AttributeMap();
private final List<CombatEntry> combat = Lists.<CombatEntry>newArrayList();
private final Map<Potion, PotionEffect> effects = Maps.<Potion, PotionEffect>newEnumMap(Potion.class);
private final Map<Effect, StatusEffect> effects = Maps.<Effect, StatusEffect>newEnumMap(Effect.class);
public int soundTimer;
protected int xpValue;
private EntityLookHelper lookHelper;
@ -361,7 +361,7 @@ public abstract class EntityLiving extends Entity
// if(this.isPlayer())
// Log.SERVER.info("rad:" + radiation);
if(radiation >= 0.0f) {
this.addEffect(new PotionEffect(Potion.RADIATION, ExtMath.clampi((int)(radiation * 5.0f), 10, 32766),
this.addEffect(new StatusEffect(Effect.RADIATION, ExtMath.clampi((int)(radiation * 5.0f), 10, 32766),
ExtMath.clampi((int)(radiation / 20.0f), 0, 255)));
}
}
@ -540,7 +540,7 @@ public abstract class EntityLiving extends Entity
{
List<TagObject> nbttaglist = Lists.newArrayList();
for (PotionEffect potioneffect : this.effects.values())
for (StatusEffect potioneffect : this.effects.values())
{
nbttaglist.add(potioneffect.toTags());
}
@ -587,7 +587,7 @@ public abstract class EntityLiving extends Entity
for (int i = 0; i < nbttaglist.size(); ++i)
{
TagObject nbttagcompound = nbttaglist.get(i);
PotionEffect potioneffect = PotionEffect.fromTags(nbttagcompound);
StatusEffect potioneffect = StatusEffect.fromTags(nbttagcompound);
if (potioneffect != null && !potioneffect.getPotion().isInstant())
{
@ -628,12 +628,12 @@ public abstract class EntityLiving extends Entity
protected void updateEffects()
{
Iterator<Potion> iterator = this.effects.keySet().iterator();
Iterator<Effect> iterator = this.effects.keySet().iterator();
while (iterator.hasNext())
{
Potion potion = iterator.next();
PotionEffect potioneffect = this.effects.get(potion);
Effect potion = iterator.next();
StatusEffect potioneffect = this.effects.get(potion);
if (!potioneffect.onUpdate(this))
{
@ -670,12 +670,12 @@ public abstract class EntityLiving extends Entity
public void clearEffects(boolean negative)
{
Iterator<Potion> iterator = this.effects.keySet().iterator();
Iterator<Effect> iterator = this.effects.keySet().iterator();
while (iterator.hasNext())
{
Potion potion = iterator.next();
PotionEffect potioneffect = this.effects.get(potion);
Effect potion = iterator.next();
StatusEffect potioneffect = this.effects.get(potion);
if (!this.worldObj.client && (!negative || potioneffect.getPotion().isBadEffect()))
{
@ -685,7 +685,7 @@ public abstract class EntityLiving extends Entity
}
}
public Collection<PotionEffect> getEffects()
public Collection<StatusEffect> getEffects()
{
return this.effects.values();
}
@ -695,7 +695,7 @@ public abstract class EntityLiving extends Entity
// return this.effects.containsKey(Integer.valueOf(potionId));
// }
public boolean hasEffect(Potion potionIn)
public boolean hasEffect(Effect potionIn)
{
return this.effects.containsKey(potionIn);
}
@ -703,7 +703,7 @@ public abstract class EntityLiving extends Entity
/**
* returns the PotionEffect for the supplied Potion if it is active, null otherwise.
*/
public PotionEffect getEffect(Potion potionIn)
public StatusEffect getEffect(Effect potionIn)
{
return this.effects.get(potionIn);
}
@ -711,7 +711,7 @@ public abstract class EntityLiving extends Entity
/**
* adds a PotionEffect to the entity
*/
public void addEffect(PotionEffect potioneffectIn)
public void addEffect(StatusEffect potioneffectIn)
{
if (!potioneffectIn.getPotion().isInstant() && this.isPotionApplicable(potioneffectIn.getPotion(), potioneffectIn.getAmplifier()))
{
@ -728,8 +728,8 @@ public abstract class EntityLiving extends Entity
}
}
public boolean isPotionApplicable(Potion potion, int amplifier) {
return potion == Potion.SPEED || potion == Potion.SLOWNESS || potion == Potion.HEAL || potion == Potion.DAMAGE || potion == Potion.POISON || potion == Potion.RADIATION;
public boolean isPotionApplicable(Effect potion, int amplifier) {
return potion == Effect.SPEED || potion == Effect.SLOWNESS || potion == Effect.HEAL || potion == Effect.DAMAGE || potion == Effect.POISON || potion == Effect.RADIATION;
}
public boolean arePotionsInverted()
@ -740,7 +740,7 @@ public abstract class EntityLiving extends Entity
/**
* Remove the speified potion effect from this entity.
*/
public void removeEffectClient(Potion potionId)
public void removeEffectClient(Effect potionId)
{
this.effects.remove(potionId);
}
@ -748,9 +748,9 @@ public abstract class EntityLiving extends Entity
/**
* Remove the specified potion effect from this entity.
*/
public void removeEffect(Potion potion)
public void removeEffect(Effect potion)
{
PotionEffect potioneffect = this.effects.remove(potion);
StatusEffect potioneffect = this.effects.remove(potion);
if (potioneffect != null)
{
@ -758,7 +758,7 @@ public abstract class EntityLiving extends Entity
}
}
protected void onNewEffect(PotionEffect id)
protected void onNewEffect(StatusEffect id)
{
this.effectsDirty = true;
@ -768,7 +768,7 @@ public abstract class EntityLiving extends Entity
}
}
protected void onChangedEffect(PotionEffect id, boolean added)
protected void onChangedEffect(StatusEffect id, boolean added)
{
this.effectsDirty = true;
@ -779,7 +779,7 @@ public abstract class EntityLiving extends Entity
}
}
protected void onFinishedEffect(PotionEffect effect)
protected void onFinishedEffect(StatusEffect effect)
{
this.effectsDirty = true;
@ -813,7 +813,7 @@ public abstract class EntityLiving extends Entity
}
public boolean isImmuneToFire() {
return this.hasEffect(Potion.FIRE_RESISTANCE);
return this.hasEffect(Effect.FIRE_RESISTANCE);
}
/**
@ -1037,7 +1037,7 @@ public abstract class EntityLiving extends Entity
*/
public void knockBack(Entity source, float damage, double xfactor, double zfactor)
{
if (!this.hasEffect(Potion.STABILITY) && this.rand.doublev() >= this.getKnockBackResistance())
if (!this.hasEffect(Effect.STABILITY) && this.rand.doublev() >= this.getKnockBackResistance())
{
this.isAirBorne = true;
float div = ExtMath.sqrtd(xfactor * xfactor + zfactor * zfactor);
@ -1114,7 +1114,7 @@ public abstract class EntityLiving extends Entity
{
damageMultiplier = Math.max(0.0f, damageMultiplier - (1.65f - (float)this.worldObj.gravity * 1.65f));
super.fall(distance, damageMultiplier);
PotionEffect potioneffect = this.getEffect(Potion.JUMP);
StatusEffect potioneffect = this.getEffect(Effect.JUMP);
float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
int i = ExtMath.ceilf((distance - 3.0F - f) * damageMultiplier);
@ -1200,9 +1200,9 @@ public abstract class EntityLiving extends Entity
*/
protected int applyPotionDamageCalculations(DamageSource source, int damage)
{
if (this.hasEffect(Potion.RESISTANCE) && source != DamageSource.outOfWorld)
if (this.hasEffect(Effect.RESISTANCE) && source != DamageSource.outOfWorld)
{
int i = (this.getEffect(Potion.RESISTANCE).getAmplifier() + 1) * 5;
int i = (this.getEffect(Effect.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f = (float)damage * (float)j;
damage = (int)(f / 25.0F);
@ -1497,9 +1497,9 @@ public abstract class EntityLiving extends Entity
{
this.motionY = (double)this.getJumpUpwardsMotion();
if (this.hasEffect(Potion.JUMP))
if (this.hasEffect(Effect.JUMP))
{
this.motionY += (double)((float)(this.getEffect(Potion.JUMP).getAmplifier() + 1) * 0.1F);
this.motionY += (double)((float)(this.getEffect(Effect.JUMP).getAmplifier() + 1) * 0.1F);
}
if (this.isSprinting())
@ -1700,10 +1700,10 @@ public abstract class EntityLiving extends Entity
public float getMovementSpeed() {
float speed = this.getSpeedBase() * (this.isSprinting() ? 1.3f : 1.0f);
if(this.hasEffect(Potion.SPEED))
speed *= 1.0f + (float)(this.getEffect(Potion.SPEED).getAmplifier() + 1) * 0.2f;
if(this.hasEffect(Potion.SLOWNESS))
speed *= Math.max(1.0f - (float)(this.getEffect(Potion.SLOWNESS).getAmplifier() + 1) * 0.15f, 0.0f);
if(this.hasEffect(Effect.SPEED))
speed *= 1.0f + (float)(this.getEffect(Effect.SPEED).getAmplifier() + 1) * 0.2f;
if(this.hasEffect(Effect.SLOWNESS))
speed *= Math.max(1.0f - (float)(this.getEffect(Effect.SLOWNESS).getAmplifier() + 1) * 0.15f, 0.0f);
return Math.max(this.modSpeed * speed, 0.0f);
}
@ -2181,7 +2181,7 @@ public abstract class EntityLiving extends Entity
*/
protected void setBeenAttacked()
{
this.veloChanged = !this.hasEffect(Potion.STABILITY) && this.rand.doublev() >= this.getKnockBackResistance();
this.veloChanged = !this.hasEffect(Effect.STABILITY) && this.rand.doublev() >= this.getKnockBackResistance();
}
public float getRotationYawHead()

View file

@ -1,8 +1,8 @@
package common.entity.types;
import common.ai.EntityAISit;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.ParticleType;
import common.world.World;
public abstract class EntityTameable extends EntityAnimal implements IEntityOwnable

View file

@ -8,12 +8,12 @@ import common.entity.Entity;
import common.entity.EntityType;
import common.init.BlockRegistry;
import common.init.Blocks;
import common.model.ParticleType;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.world.State;
import common.world.World;

View file

@ -0,0 +1,14 @@
package common.init;
import common.item.ItemStack;
import common.item.tool.ItemPotion;
public abstract class BrewingRegistry {
public static ItemPotion applyIngredient(ItemPotion potion, ItemStack ingredient) {
return potion; // TODO: add brewing back
}
public static boolean isIngredient(ItemStack stack) {
return false;
}
}

View file

@ -87,9 +87,8 @@ import common.item.tool.ItemSpaceNavigator;
import common.item.tool.ItemSword;
import common.item.tool.ItemWeatherToken;
import common.log.Log;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.PotionHelper;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.util.Pair;
import common.util.Util;
import common.world.Weather;
@ -240,15 +239,15 @@ public abstract class ItemRegistry {
register("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
register("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("bread", (new ItemFood(5, false)).setDisplay("Brot"));
register("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
register("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch"));
register("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
register("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Effect.REGENERATION, 5, 1, 1.0F)
.setDisplay("Goldener Apfel"));
register("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
register("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Effect.REGENERATION, 5, 1, 1.0F)
.setDisplay("Geladener Apfel"));
register("saddle", (new ItemSaddle()).setDisplay("Sattel"));
register("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(StackSize.L));
@ -262,7 +261,7 @@ public abstract class ItemRegistry {
register("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS));
register("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer"));
register("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
register("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
register("glowstone_dust", (new Item()).setDisplay("Glowstonestaub")
.setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) {
register(type.getName(), (new ItemFishFood(false, type)));
@ -277,7 +276,7 @@ public abstract class ItemRegistry {
register(color.getDye(), dye);
}
register("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
register("sugar", (new Item()).setDisplay("Zucker").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(StackSize.L));
register("melon", (new ItemFood(2, false)).setDisplay("Melone"));
register("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch"));
@ -287,24 +286,24 @@ public abstract class ItemRegistry {
register("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.MAGIC));
register("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("tear", (new ItemTiny()).setDisplay("Träne").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(StackSize.XL));
register("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
for(Pair<String, Potion> pot : ItemPotion.getBasePotions()) {
for(Pair<String, Effect> pot : ItemPotion.getBasePotions()) {
register(pot.first(), new ItemPotion(pot.second(), null));
}
for(Pair<String, PotionEffect> pot : ItemPotion.getBrewedPotions()) {
for(Pair<String, StatusEffect> pot : ItemPotion.getBrewedPotions()) {
register(pot.first(), new ItemPotion(pot.second().getPotion(), pot.second()));
}
register("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(StackSize.L));
register("spider_eye", (new ItemFood(2, false)).setPotionEffect(Effect.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
.setMaxAmount(StackSize.L));
register("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge")
.setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(StackSize.L));
register("blazing_powder", (new Item()).setDisplay("Glühender Staub").setPotionEffect(PotionHelper.blazingPowderEffect)
.setTab(CheatTab.MISC).setMaxAmount(StackSize.L));
register("blazing_powder", (new Item()).setDisplay("Glühender Staub")
.setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("magma_cream", (new Item()).setDisplay("Magmacreme").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
register("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect)
register("speckled_melon", (new Item()).setDisplay("Glitzernde Melone")
.setTab(CheatTab.MISC));
register("experience_bottle", (new ItemExpBottle()).setDisplay("Erfahrungsfläschchen"));
register("fireball", (new ItemFireball()).setDisplay("Feuerkugel"));
@ -313,9 +312,9 @@ public abstract class ItemRegistry {
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS);
register("emerald", emerald);
register("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(StackSize.L));
register("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(StackSize.L));
register("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Effect.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(StackSize.L));
register("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
.setPotionEffect(PotionHelper.goldenCarrotEffect));
);
register("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute"));
register("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA));
register("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.FOOD));

View file

@ -965,7 +965,7 @@ public abstract class Items {
public static final ItemEnchantedBook enchanted_book_unbreaking_3 = get("enchanted_book_unbreaking_3");
public static final ItemRocketLauncher rocket_launcher = get("rocket_launcher");
public static final ItemAmmo rocket = get("rocket");
public static final ItemPotion potion = get("potion");
public static final ItemPotion water_bottle = get("water_bottle");
public static final ItemPotion potion_fire_resistance = get("potion_fire_resistance");
public static final ItemPotion potion_health = get("potion_health");
public static final ItemPotion potion_speed = get("potion_speed");

View file

@ -1,8 +1,10 @@
package common.inventory;
import common.entity.npc.EntityNPC;
import common.init.BrewingRegistry;
import common.init.Items;
import common.item.ItemStack;
import common.item.tool.ItemPotion;
import common.network.IPlayer;
public class ContainerBrewingStand extends Container
@ -158,7 +160,7 @@ public class ContainerBrewingStand extends Container
public boolean isItemValid(ItemStack stack)
{
return stack != null ? stack.getItem().isPotionIngredient(stack) : false;
return stack != null ? BrewingRegistry.isIngredient(stack) : false;
}
public int getSlotStackLimit()
@ -203,7 +205,7 @@ public class ContainerBrewingStand extends Container
public static boolean canHoldPotion(ItemStack stack)
{
return stack != null && (stack.getItem() == Items.potion || stack.getItem() == Items.glass_bottle);
return stack != null && (stack.getItem() instanceof ItemPotion || stack.getItem() == Items.glass_bottle);
}
}
}

View file

@ -94,7 +94,7 @@ public enum CheatTab {
},
POTIONS("Tränke", false) {
protected Item getIconItem() {
return Items.potion;
return Items.water_bottle;
}
},
ENCHANTMENTS("Verzauberungen", false) {

View file

@ -26,7 +26,6 @@ public class Item {
private int maxAmount = StackSize.M.getAmount();
private int maxDamage = 0;
private Item containerItem;
private String potionEffect;
private String display;
private CheatTab tab;
private TextColor color = null;
@ -60,11 +59,6 @@ public class Item {
return this;
}
public final Item setPotionEffect(String potionEffect) {
this.potionEffect = potionEffect;
return this;
}
public final Item setTab(CheatTab tab) {
this.tab = tab;
return this;
@ -99,14 +93,6 @@ public class Item {
return this.containerItem != null;
}
public final String getPotionEffect(ItemStack stack) {
return this.potionEffect;
}
public final boolean isPotionIngredient(ItemStack stack) {
return this.getPotionEffect(stack) != null;
}
public final TextColor getColor(ItemStack stack) {
return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE);
}

View file

@ -14,10 +14,10 @@ import common.item.Item;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.util.Vec3;
import common.world.State;
import common.world.World;

View file

@ -3,8 +3,8 @@ package common.item.tool;
import common.color.TextColor;
import common.entity.npc.EntityNPC;
import common.item.ItemStack;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.world.World;
public class ItemAppleGold extends ItemFood
@ -27,16 +27,16 @@ public class ItemAppleGold extends ItemFood
{
if (!worldIn.client)
{
player.addEffect(new PotionEffect(Potion.ABSORPTION, 2400, 0));
player.addEffect(new StatusEffect(Effect.ABSORPTION, 2400, 0));
}
if (this.powered)
{
if (!worldIn.client)
{
player.addEffect(new PotionEffect(Potion.REGENERATION, 600, 4));
player.addEffect(new PotionEffect(Potion.RESISTANCE, 6000, 0));
player.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, 6000, 0));
player.addEffect(new StatusEffect(Effect.REGENERATION, 600, 4));
player.addEffect(new StatusEffect(Effect.RESISTANCE, 6000, 0));
player.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, 6000, 0));
}
}
else

View file

@ -24,12 +24,12 @@ import common.item.Item;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ParticleType;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityDispenser;
import common.util.BlockPos;
import common.util.Facing;
import common.util.HitPosition;
import common.util.ParticleType;
import common.util.Vec3;
import common.util.Vec3i;
import common.world.State;

View file

@ -10,9 +10,9 @@ import common.init.SoundEvent;
import common.item.CheatTab;
import common.item.ItemFragile;
import common.item.ItemStack;
import common.model.ParticleType;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.State;
import common.world.World;

View file

@ -4,9 +4,8 @@ import common.entity.npc.EntityNPC;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.PotionHelper;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.world.World;
public class ItemFishFood extends ItemFood
@ -19,8 +18,6 @@ public class ItemFishFood extends ItemFood
super(0, false);
this.cooked = cooked;
this.type = type;
if(type == FishType.PUFFERFISH)
this.setPotionEffect(PotionHelper.pufferfishEffect);
this.setDisplay((this.type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + this.type.getDisplay());
}
@ -41,8 +38,8 @@ public class ItemFishFood extends ItemFood
{
if (this.type == ItemFishFood.FishType.PUFFERFISH)
{
player.addEffect(new PotionEffect(Potion.POISON, 1200, 3));
player.addEffect(new PotionEffect(Potion.NAUSEA, 300, 1));
player.addEffect(new StatusEffect(Effect.POISON, 1200, 3));
player.addEffect(new StatusEffect(Effect.NAUSEA, 300, 1));
}
super.onFoodEaten(stack, worldIn, player);

View file

@ -6,8 +6,8 @@ import common.item.CheatTab;
import common.item.Item;
import common.item.ItemAction;
import common.item.ItemStack;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.world.World;
public class ItemFood extends Item
@ -15,7 +15,7 @@ public class ItemFood extends Item
public final int itemUseDuration;
private final int healAmount;
private final boolean isWolfsFavoriteMeat;
private Potion potionId;
private Effect potionId;
private int potionDuration;
private int potionAmplifier;
private float potionEffectProbability;
@ -47,7 +47,7 @@ public class ItemFood extends Item
{
if (!worldIn.client && this.potionId != null && worldIn.rand.floatv() < this.potionEffectProbability)
{
player.addEffect(new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier));
player.addEffect(new StatusEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier));
}
}
@ -93,7 +93,7 @@ public class ItemFood extends Item
* sets a potion effect on the item. Args: int potionId, int duration (will be multiplied by 20), int amplifier,
* float probability of effect happening
*/
public ItemFood setPotionEffect(Potion id, int duration, int amplifier, float probability)
public ItemFood setPotionEffect(Effect id, int duration, int amplifier, float probability)
{
this.potionId = id;
this.potionDuration = duration;

View file

@ -52,12 +52,12 @@ public class ItemGlassBottle extends Item
if (itemStackIn.decrSize())
{
return new ItemStack(Items.potion);
return new ItemStack(Items.water_bottle);
}
if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potion)))
if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.water_bottle)))
{
playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potion), false);
playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.water_bottle), false);
}
}
}

View file

@ -1,5 +1,6 @@
package common.item.tool;
import java.util.Collection;
import java.util.List;
import common.collect.Lists;
import common.color.TextColor;
@ -16,9 +17,8 @@ import common.item.ItemStack;
import common.item.StackSize;
import common.model.Model;
import common.model.ModelProvider;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.PotionHelper;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.Facing;
@ -30,19 +30,43 @@ public class ItemPotion extends Item
{
private static final List<ItemPotion> POTIONS = Lists.newArrayList();
private final Potion type;
private final PotionEffect effect;
private final Effect type;
private final StatusEffect effect;
public static ItemPotion getPotionItem(int data) {
Item item = ItemRegistry.byId(data);
return item instanceof ItemPotion potion ? potion : Items.potion;
return item instanceof ItemPotion potion ? potion : Items.water_bottle;
}
public static List<ItemPotion> getPotions() {
return POTIONS;
}
public ItemPotion(Potion type, PotionEffect effect)
public static int mixColors(Collection<StatusEffect> effects) {
if(effects == null || effects.isEmpty())
return Items.water_bottle.getPotionColor();
float r = 0.0F;
float g = 0.0F;
float b = 0.0F;
float amt = 0.0F;
for(StatusEffect effect : effects) {
int color = effect.getPotion().getColor();
for(int z = 0; z <= effect.getAmplifier(); z++) {
r += (float)(color >> 16 & 255) / 255.0F;
g += (float)(color >> 8 & 255) / 255.0F;
b += (float)(color >> 0 & 255) / 255.0F;
++amt;
}
}
if(amt == 0.0F)
return 0;
r = r / amt * 255.0F;
g = g / amt * 255.0F;
b = b / amt * 255.0F;
return (int)r << 16 | (int)g << 8 | (int)b;
}
public ItemPotion(Effect type, StatusEffect effect)
{
this.type = type;
this.effect = effect;
@ -53,12 +77,12 @@ public class ItemPotion extends Item
POTIONS.add(this);
}
public PotionEffect getEffect()
public StatusEffect getEffect()
{
return this.effect;
}
public Potion getType()
public Effect getType()
{
return this.type;
}
@ -81,7 +105,7 @@ public class ItemPotion extends Item
if(this.effect.getPotion().isInstant())
this.effect.getPotion().onImpact(null, null, playerIn, this.effect.getAmplifier(), 1.0);
else
playerIn.addEffect(new PotionEffect(this.effect.getPotion(), this.effect.getDuration(), this.effect.getAmplifier()));
playerIn.addEffect(new StatusEffect(this.effect.getPotion(), this.effect.getDuration(), this.effect.getAmplifier()));
}
}
@ -136,14 +160,14 @@ public class ItemPotion extends Item
return itemStackIn;
}
public int getColorFromDamage()
public int getPotionColor()
{
return this.effect == null ? 0x385dc6 : this.effect.getPotion().getColor();
}
public int getColorFromItemStack(ItemStack stack, int renderPass)
{
return renderPass > 0 ? 16777215 : this.getColorFromDamage();
return renderPass > 0 ? 16777215 : this.getPotionColor();
}
public boolean isEffectInstant()
@ -163,7 +187,7 @@ public class ItemPotion extends Item
}
else
{
return PotionHelper.getPotionPrefix(potion.type) + " Trank";
return potion.type.getPrefix() + " Trank";
}
}
@ -175,7 +199,7 @@ public class ItemPotion extends Item
if (this.effect != null)
{
String s1 = this.effect.getEffectName().trim();
Potion potion = this.effect.getPotion();
Effect potion = this.effect.getPotion();
if (this.effect.getDuration() > 0)
{
@ -204,10 +228,10 @@ public class ItemPotion extends Item
return this.effect != null;
}
public static List<Pair<String, Potion>> getBasePotions() {
List<Pair<String, Potion>> effects = Lists.newArrayList();
effects.add(new Pair("potion", null));
for(Potion potion : Potion.values()) {
public static List<Pair<String, Effect>> getBasePotions() {
List<Pair<String, Effect>> effects = Lists.newArrayList();
effects.add(new Pair("water_bottle", null));
for(Effect potion : Effect.values()) {
if(potion.getMaxStrength() > 0) {
effects.add(new Pair("potion_" + potion + "_base", potion));
}
@ -215,15 +239,15 @@ public class ItemPotion extends Item
return effects;
}
public static List<Pair<String, PotionEffect>> getBrewedPotions() {
List<Pair<String, PotionEffect>> effects = Lists.newArrayList();
for(Potion potion : Potion.values()) {
public static List<Pair<String, StatusEffect>> getBrewedPotions() {
List<Pair<String, StatusEffect>> effects = Lists.newArrayList();
for(Effect potion : Effect.values()) {
int maxStrength = potion.getMaxStrength();
int baseDuration = potion.getBaseDuration();
int baseDuration = potion.getBaseDuration() * 20;
for(int z = 0; z < maxStrength; z++) {
effects.add(new Pair("potion_" + potion + (z == 0 ? "" : "_" + (z + 1)), new PotionEffect(potion, baseDuration / (z + 1), z)));
effects.add(new Pair("potion_" + potion + (z == 0 ? "" : "_" + (z + 1)), new StatusEffect(potion, baseDuration / (z + 1), z)));
if(z == 0 && !potion.isInstant())
effects.add(new Pair("potion_" + potion + "_extended", new PotionEffect(potion, (baseDuration * 8) / 3, z)));
effects.add(new Pair("potion_" + potion + "_extended", new StatusEffect(potion, (baseDuration * 8) / 3, z)));
}
}
return effects;

View file

@ -23,7 +23,7 @@ import common.packet.CPacketPlace;
import common.packet.CPacketPlayer;
import common.packet.CPacketSign;
import common.packet.CPacketSkin;
import common.potion.PotionEffect;
import common.potion.StatusEffect;
import common.tileentity.IInteractionObject;
import common.tileentity.TileEntitySign;
import common.util.BlockPos;
@ -87,9 +87,9 @@ public interface IPlayer extends NetHandler {
void displayEntityGui(Entity entity, IInventory inventory);
void closeScreen();
void onItemUseFinish();
void onNewEffect(PotionEffect id);
void onChangedEffect(PotionEffect id, boolean added);
void onFinishedEffect(PotionEffect effect);
void onNewEffect(StatusEffect id);
void onChangedEffect(StatusEffect id, boolean added);
void onFinishedEffect(StatusEffect effect);
void setPositionAndUpdate(double x, double y, double z);
void onCriticalHit(Entity entity);
void onEnchantmentCritical(Entity entity);

View file

@ -5,13 +5,13 @@ import java.io.IOException;
import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
public class SPacketEntityEffect implements Packet<IClientPlayer>
{
private int entityId;
private Potion effectId;
private Effect effectId;
private int amplifier;
private int duration;
private int remaining;
@ -20,7 +20,7 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
{
}
public SPacketEntityEffect(int entityIdIn, PotionEffect effect)
public SPacketEntityEffect(int entityIdIn, StatusEffect effect)
{
this.entityId = entityIdIn;
this.effectId = effect.getPotion();
@ -43,7 +43,7 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarInt();
this.effectId = buf.readEnumValue(Potion.class);
this.effectId = buf.readEnumValue(Effect.class);
this.amplifier = buf.readVarInt();
this.duration = buf.readVarInt();
this.remaining = buf.readVarInt();
@ -74,7 +74,7 @@ public class SPacketEntityEffect implements Packet<IClientPlayer>
return this.entityId;
}
public Potion getEffectId()
public Effect getEffectId()
{
return this.effectId;
}

View file

@ -2,10 +2,10 @@ package common.packet;
import java.io.IOException;
import common.model.ParticleType;
import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.util.ParticleType;
public class SPacketParticles implements Packet<IClientPlayer>
{

View file

@ -5,19 +5,19 @@ import java.io.IOException;
import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
public class SPacketRemoveEntityEffect implements Packet<IClientPlayer>
{
private int entityId;
private Potion effectId;
private Effect effectId;
public SPacketRemoveEntityEffect()
{
}
public SPacketRemoveEntityEffect(int entityIdIn, PotionEffect effect)
public SPacketRemoveEntityEffect(int entityIdIn, StatusEffect effect)
{
this.entityId = entityIdIn;
this.effectId = effect.getPotion();
@ -29,7 +29,7 @@ public class SPacketRemoveEntityEffect implements Packet<IClientPlayer>
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarInt();
this.effectId = buf.readEnumValue(Potion.class);
this.effectId = buf.readEnumValue(Effect.class);
}
/**
@ -54,7 +54,7 @@ public class SPacketRemoveEntityEffect implements Packet<IClientPlayer>
return this.entityId;
}
public Potion getEffectId()
public Effect getEffectId()
{
return this.effectId;
}

View file

@ -9,13 +9,13 @@ import common.entity.projectile.EntityPotion;
import common.entity.types.EntityLiving;
import common.vars.Vars;
public enum Potion {
SPEED("speed", 2, 3600, "Schnelligkeit", "Trank der Schnelligkeit", false, 8171462) {
public enum Effect {
SPEED("speed", 2, 180, "Schnelligkeit", "Trank der Schnelligkeit", false, 8171462) {
public String getTooltip(int amp) {
return String.format(TextColor.BLUE + "+%d%% Geschwindigkeit", 20 * (amp + 1));
}
},
SLOWNESS("slowness", 1, 1800, "Langsamkeit", "Trank der Langsamkeit", true, 5926017) {
SLOWNESS("slowness", 1, 90, "Langsamkeit", "Trank der Langsamkeit", true, 5926017) {
public String getTooltip(int amp) {
return String.format(TextColor.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1));
}
@ -26,7 +26,7 @@ public enum Potion {
}
},
FATIGUE("mining_fatigue", "Abbaulähmung", "Trank der Trägheit", true, 4866583),
STRENGTH("strength", 2, 3600, "Stärke", "Trank der Stärke", false, 9643043) {
STRENGTH("strength", 2, 180, "Stärke", "Trank der Stärke", false, 9643043) {
public String getTooltip(int amp) {
return String.format(TextColor.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1));
}
@ -69,7 +69,7 @@ public enum Potion {
return 0.25;
}
},
REGENERATION("regeneration", 2, 900, "Regeneration", "Trank der Regeneration", false, 13458603) {
REGENERATION("regeneration", 2, 45, "Regeneration", "Trank der Regeneration", false, 13458603) {
public void onUpdate(EntityLiving entity, int duration, int amp) {
int k = 50 >> amp;
if((k <= 0 || duration % k == 0) && entity.getHealth() < entity.getMaxHealth())
@ -81,7 +81,7 @@ public enum Potion {
}
},
RESISTANCE("resistance", "Resistenz", "Trank des Widerstandes", false, 10044730),
FIRE_RESISTANCE("fire_resistance", 1, 3600, "Feuerschutz", "Trank der Feuerresistenz", false, 14981690),
FIRE_RESISTANCE("fire_resistance", 1, 180, "Feuerschutz", "Trank der Feuerresistenz", false, 14981690),
MANA_GENERATION("mana_generation", "Manaschub", "Trank des Manaschubes", false, 3035801) {
public void onUpdate(EntityLiving entity, int duration, int amp) {
if(!(entity instanceof EntityNPC npc))
@ -105,14 +105,14 @@ public enum Potion {
return 0.25;
}
},
NIGHT_VISION("night_vision", 1, 3600, "Nachtsicht", "Trank der Nachtsicht", false, 2039713),
STABILITY("stability", 1, 3600, "Stabilität", "Trank der Standfestigkeit", false, 5797459),
WEAKNESS("weakness", 1, 1800, "Schwäche", "Trank der Schwäche", true, 4738376) {
NIGHT_VISION("night_vision", 1, 180, "Nachtsicht", "Trank der Nachtsicht", false, 2039713),
STABILITY("stability", 1, 180, "Stabilität", "Trank der Standfestigkeit", false, 5797459),
WEAKNESS("weakness", 1, 90, "Schwäche", "Trank der Schwäche", true, 4738376) {
public String getTooltip(int amp) {
return String.format(TextColor.RED + "-%d%% Angriffsschaden", 20 * (amp + 1));
}
},
POISON("poison", 2, 900, "Vergiftung", "Trank der Vergiftung", true, 5149489) {
POISON("poison", 2, 45, "Vergiftung", "Trank der Vergiftung", true, 5149489) {
public void onUpdate(EntityLiving entity, int duration, int amp) {
int j = 25 >> amp;
if((j <= 0 || duration % j == 0) && (entity.worldObj.client || Vars.damagePoison) && entity.getHealth() > 1)
@ -145,7 +145,17 @@ public enum Potion {
}
};
private static final Map<String, Potion> LOOKUP = Maps.newHashMap();
private static final Map<String, Effect> LOOKUP = Maps.newHashMap();
private static final String[] POTENCIES = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};
private static final String[] PREFIXES = new String[] {
"Gewöhnlicher", "Langweiliger", "Fader", "Klarer", "Milchiger",
"Trüber", "Schlichter", "Dünnflüssiger", "Seltsamer", "Flauer",
"Wuchtiger", "Verpfuschter", "Cremiger", "Milder", "Sanfter",
"Gefälliger", "Dickflüssiger", "Vornehmer", "Raffinierter", "Lieblicher",
"Flinker", "Verfeinerter", "Belebender", "Prickelnder", "Starker",
"Fauler", "Geruchloser", "Ranziger", "Rauer", "Beißender",
"Widerlicher", "Stinkender"
};
private final String name;
private final String effectDisplay;
@ -157,28 +167,28 @@ public enum Potion {
private final int baseDuration;
static {
for(Potion potion : values()) {
for(Effect potion : values()) {
LOOKUP.put(potion.name, potion);
}
}
public static Potion getByName(String name) {
public static Effect getByName(String name) {
return LOOKUP.get(name);
}
private Potion(String name, String effectDisplay, String potionDisplay, boolean bad, int color) {
private Effect(String name, String effectDisplay, String potionDisplay, boolean bad, int color) {
this(name, 0, 0, effectDisplay, potionDisplay, bad, color, false);
}
private Potion(String name, int maxStrength, String effectDisplay, String potionDisplay, boolean bad, int color) {
private Effect(String name, int maxStrength, String effectDisplay, String potionDisplay, boolean bad, int color) {
this(name, maxStrength, 0, effectDisplay, potionDisplay, bad, color, true);
}
private Potion(String name, int maxStrength, int baseDuration, String effectDisplay, String potionDisplay, boolean bad, int color) {
private Effect(String name, int maxStrength, int baseDuration, String effectDisplay, String potionDisplay, boolean bad, int color) {
this(name, maxStrength, baseDuration, effectDisplay, potionDisplay, bad, color, false);
}
private Potion(String name, int maxStrength, int baseDuration, String effectDisplay, String potionDisplay, boolean bad, int color, boolean instant) {
private Effect(String name, int maxStrength, int baseDuration, String effectDisplay, String potionDisplay, boolean bad, int color, boolean instant) {
this.name = name;
this.bad = bad;
this.instant = instant;
@ -197,8 +207,16 @@ public enum Potion {
return this.name;
}
public String getPrefix() {
return PREFIXES[this.ordinal() % PREFIXES.length];
}
public String getPotency(int amplifier) {
return amplifier >= 1 && amplifier <= 9 ? " " + POTENCIES[amplifier - 1] : (amplifier == 0 ? "" : (" " + (amplifier + 1)));
}
public String getDisplay(int amplifier) {
return this.effectDisplay + PotionHelper.getPotionPotency(amplifier);
return this.effectDisplay + this.getPotency(amplifier);
}
public String getPotionDisplay(int amplifier) {

View file

@ -1,121 +0,0 @@
package common.potion;
import java.util.Collection;
import java.util.Map;
import common.collect.Maps;
import common.init.Items;
import common.item.tool.ItemPotion;
public class PotionHelper
{
private static final String[] POTENCIES = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};
public static final String sugarEffect = "-0+1-2-3&4-4+13";
public static final String tearEffect = "+0-1-2-3&4-4+13";
public static final String spiderEyeEffect = "-0-1+2-3&4-4+13";
public static final String fermentedSpiderEyeEffect = "-0+3-4+13";
public static final String speckledMelonEffect = "+0-1+2-3&4-4+13";
public static final String blazingPowderEffect = "+0-1-2+3&4-4+13";
public static final String magmaCreamEffect = "+0+1-2-3&4-4+13";
public static final String redstoneEffect = "-5+6-7";
public static final String glowstoneEffect = "+5-6-7";
public static final String gunpowderEffect = "+14&13-13";
public static final String goldenCarrotEffect = "-0+1+2-3+13&4-4";
public static final String pufferfishEffect = "+0-1+2+3+13&4-4";
private static final Map<Potion, String> potionRequirements = Maps.<Potion, String>newEnumMap(Potion.class);
private static final Map<Potion, String> potionAmplifiers = Maps.<Potion, String>newEnumMap(Potion.class);
private static final Map<Integer, Integer> DATAVALUE_COLORS = Maps.<Integer, Integer>newHashMap();
private static final String[] potionPrefixes = new String[] {
"Gewöhnlicher", "Langweiliger", "Fader", "Klarer", "Milchiger",
"Trüber", "Schlichter", "Dünnflüssiger", "Seltsamer", "Flauer",
"Wuchtiger", "Verpfuschter", "Cremiger", "Milder", "Sanfter",
"Gefälliger", "Dickflüssiger", "Vornehmer", "Raffinierter", "Lieblicher",
"Flinker", "Verfeinerter", "Belebender", "Prickelnder", "Starker",
"Fauler", "Geruchloser", "Ranziger", "Rauer", "Beißender",
"Widerlicher", "Stinkender"
};
public static int calcPotionLiquidColor(Collection<PotionEffect> effects)
{
int i = Items.potion.getColorFromDamage();
if (effects != null && !effects.isEmpty())
{
float f = 0.0F;
float f1 = 0.0F;
float f2 = 0.0F;
float f3 = 0.0F;
for (PotionEffect potioneffect : effects)
{
int j = potioneffect.getPotion().getColor();
for (int k = 0; k <= potioneffect.getAmplifier(); ++k)
{
f += (float)(j >> 16 & 255) / 255.0F;
f1 += (float)(j >> 8 & 255) / 255.0F;
f2 += (float)(j >> 0 & 255) / 255.0F;
++f3;
}
}
if (f3 == 0.0F)
{
return 0;
}
else
{
f = f / f3 * 255.0F;
f1 = f1 / f3 * 255.0F;
f2 = f2 / f3 * 255.0F;
return (int)f << 16 | (int)f1 << 8 | (int)f2;
}
}
else
{
return i;
}
}
public static String getPotionPrefix(Potion potion)
{
return potionPrefixes[potion.ordinal() % potionPrefixes.length];
}
public static String getPotionPotency(int value)
{
return value >= 1 && value <= 9 ? " " + POTENCIES[value - 1] : (value == 0 ? "" : (" " + (value + 1)));
}
public static ItemPotion applyIngredient(ItemPotion potion, String effect)
{
return potion; // TODO: add brewing back
}
static
{
potionRequirements.put(Potion.REGENERATION, "0 & !1 & !2 & !3 & 0+6");
potionRequirements.put(Potion.SPEED, "!0 & 1 & !2 & !3 & 1+6");
potionRequirements.put(Potion.FIRE_RESISTANCE, "0 & 1 & !2 & !3 & 0+6");
potionRequirements.put(Potion.HEAL, "0 & !1 & 2 & !3");
potionRequirements.put(Potion.POISON, "!0 & !1 & 2 & !3 & 2+6");
potionRequirements.put(Potion.WEAKNESS, "!0 & !1 & !2 & 3 & 3+6");
potionRequirements.put(Potion.DAMAGE, "!0 & !1 & 2 & 3");
potionRequirements.put(Potion.SLOWNESS, "!0 & 1 & !2 & 3 & 3+6");
potionRequirements.put(Potion.STRENGTH, "0 & !1 & !2 & 3 & 3+6");
potionRequirements.put(Potion.NIGHT_VISION, "!0 & 1 & 2 & !3 & 2+6");
potionRequirements.put(Potion.STABILITY, "!0 & 1 & 2 & 3 & 2+6");
potionAmplifiers.put(Potion.SPEED, "5");
potionAmplifiers.put(Potion.HASTE, "5");
potionAmplifiers.put(Potion.STRENGTH, "5");
potionAmplifiers.put(Potion.REGENERATION, "5");
potionAmplifiers.put(Potion.DAMAGE, "5");
potionAmplifiers.put(Potion.HEAL, "5");
potionAmplifiers.put(Potion.RESISTANCE, "5");
potionAmplifiers.put(Potion.POISON, "5");
}
}

View file

@ -4,21 +4,20 @@ import common.entity.types.EntityLiving;
import common.log.Log;
import common.tags.TagObject;
public class PotionEffect {
private final Potion potion;
public class StatusEffect {
private final Effect potion;
private final int duration;
private final int amplifier;
private int remaining;
private boolean thrown;
public PotionEffect(Potion id, int duration, int amplifier) {
public StatusEffect(Effect id, int duration, int amplifier) {
this.potion = id;
this.duration = this.remaining = duration;
this.amplifier = amplifier;
}
public PotionEffect combine(PotionEffect other) {
public StatusEffect combine(StatusEffect other) {
if(this.potion != other.potion)
Log.TICK.warn("PotionEffect.combine(): Diese Methode sollte nur für gleiche Effekte aufgerufen werden!");
int duration = this.duration;
@ -33,10 +32,10 @@ public class PotionEffect {
duration = other.duration;
remaining = other.remaining;
}
return new PotionEffect(this.potion, duration, amplifier).setRemaining(remaining);
return new StatusEffect(this.potion, duration, amplifier).setRemaining(remaining);
}
public Potion getPotion() {
public Effect getPotion() {
return this.potion;
}
@ -56,12 +55,7 @@ public class PotionEffect {
return this.amplifier;
}
public PotionEffect setThrown(boolean thrown) {
this.thrown = thrown;
return this;
}
public PotionEffect setRemaining(int remaining) {
public StatusEffect setRemaining(int remaining) {
this.remaining = remaining;
return this;
}
@ -100,11 +94,11 @@ public class PotionEffect {
}
public boolean equals(Object obj) {
if(!(obj instanceof PotionEffect))
if(!(obj instanceof StatusEffect))
return false;
PotionEffect other = (PotionEffect)obj;
StatusEffect other = (StatusEffect)obj;
return this.potion == other.potion && this.amplifier == other.amplifier && this.duration == other.duration
&& this.thrown == other.thrown && this.remaining == other.remaining;
&& this.remaining == other.remaining;
}
public TagObject toTags() {
@ -116,9 +110,9 @@ public class PotionEffect {
return tag;
}
public static PotionEffect fromTags(TagObject tag) {
Potion potion = Potion.getByName(tag.getString("Type"));
return potion == null ? null : new PotionEffect(potion, tag.getInt("Duration"), (int)(tag.getByte("Amplifier") & 255))
public static StatusEffect fromTags(TagObject tag) {
Effect potion = Effect.getByName(tag.getString("Type"));
return potion == null ? null : new StatusEffect(potion, tag.getInt("Duration"), (int)(tag.getByte("Amplifier") & 255))
.setRemaining(tag.getInt("Remaining"));
}
}

View file

@ -7,8 +7,8 @@ import common.block.artificial.BlockStainedGlass;
import common.block.artificial.BlockStainedGlassPane;
import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.BoundingBox;
@ -18,12 +18,12 @@ import common.world.AWorldServer;
public class TileEntityBeacon extends TileEntity implements ITickable
{
private static final Potion[][] effectsList = new Potion[][] {{Potion.SPEED, Potion.HASTE}, {Potion.RESISTANCE, Potion.JUMP}, {Potion.STRENGTH}, {Potion.REGENERATION}};
private static final Effect[][] effectsList = new Effect[][] {{Effect.SPEED, Effect.HASTE}, {Effect.RESISTANCE, Effect.JUMP}, {Effect.STRENGTH}, {Effect.REGENERATION}};
private boolean isComplete;
private int levels = -1;
private Potion primaryEffect;
private Potion secondaryEffect;
private Effect primaryEffect;
private Effect secondaryEffect;
/**
* Like the old updateEntity(), except more generic.
@ -68,14 +68,14 @@ public class TileEntityBeacon extends TileEntity implements ITickable
for (EntityLiving entityplayer : list)
{
entityplayer.addEffect(new PotionEffect(this.primaryEffect, 180, i));
entityplayer.addEffect(new StatusEffect(this.primaryEffect, 180, i));
}
if (this.levels >= 4 && this.primaryEffect != this.secondaryEffect && this.secondaryEffect != null)
{
for (EntityLiving entityplayer1 : list)
{
entityplayer1.addEffect(new PotionEffect(this.secondaryEffect, 180, 0));
entityplayer1.addEffect(new StatusEffect(this.secondaryEffect, 180, 0));
}
}
}
@ -259,12 +259,12 @@ public class TileEntityBeacon extends TileEntity implements ITickable
// }
// }
private Potion getEffect(String id)
private Effect getEffect(String id)
{
Potion potion = Potion.getByName(id);
Effect potion = Effect.getByName(id);
// if (potion != null)
// {
return potion != Potion.SPEED && potion != Potion.HASTE && potion != Potion.RESISTANCE && potion != Potion.JUMP && potion != Potion.STRENGTH && potion != Potion.REGENERATION ? null : potion;
return potion != Effect.SPEED && potion != Effect.HASTE && potion != Effect.RESISTANCE && potion != Effect.JUMP && potion != Effect.STRENGTH && potion != Effect.REGENERATION ? null : potion;
// }
// else
// {

View file

@ -6,6 +6,7 @@ import java.util.List;
import common.block.tech.BlockBrewingStand;
import common.collect.Lists;
import common.entity.npc.EntityNPC;
import common.init.BrewingRegistry;
import common.init.Items;
import common.inventory.Container;
import common.inventory.ContainerBrewingStand;
@ -14,8 +15,7 @@ import common.inventory.InventoryPlayer;
import common.item.Item;
import common.item.ItemStack;
import common.item.tool.ItemPotion;
import common.potion.PotionEffect;
import common.potion.PotionHelper;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.util.Facing;
import common.world.State;
@ -133,7 +133,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
{
ItemStack itemstack = this.brewingItemStacks[3];
if (!itemstack.getItem().isPotionIngredient(itemstack))
if (!BrewingRegistry.isIngredient(itemstack))
{
return false;
}
@ -147,8 +147,8 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
{
ItemPotion result = this.getPotionResult(potion, itemstack);
PotionEffect list = potion.getEffect();
PotionEffect list1 = result.getEffect();
StatusEffect list = potion.getEffect();
StatusEffect list1 = result.getEffect();
if ((potion.getType() == null || list != list1) && (list == null || !list.equals(list1) && list1 != null) && potion != result)
{
@ -178,8 +178,8 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion)
{
ItemPotion result = this.getPotionResult(potion, itemstack);
PotionEffect list = potion.getEffect();
PotionEffect list1 = result.getEffect();
StatusEffect list = potion.getEffect();
StatusEffect list1 = result.getEffect();
if (potion.getType() != null && list == list1 || list != null && (list.equals(list1) || list1 == null))
{
@ -207,7 +207,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
private ItemPotion getPotionResult(ItemPotion potion, ItemStack stack)
{
return stack == null ? potion : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(potion, stack.getItem().getPotionEffect(stack)) : potion);
return stack == null ? potion : (BrewingRegistry.isIngredient(stack) ? BrewingRegistry.applyIngredient(potion, stack) : potion);
}
public void readTags(TagObject compound)
@ -342,7 +342,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
*/
public boolean isItemValidForSlot(int index, ItemStack stack)
{
return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potion || stack.getItem() == Items.glass_bottle;
return index == 3 ? BrewingRegistry.isIngredient(stack) : stack.getItem() instanceof ItemPotion || stack.getItem() == Items.glass_bottle;
}
public boolean[] func_174902_m()

View file

@ -1,6 +1,4 @@
package common.model;
import common.util.Identifyable;
package common.util;
public enum ParticleType implements Identifyable {
EXPLOSION_NORMAL("explode", true),

View file

@ -8,11 +8,11 @@ import common.dimension.Dimension;
import common.entity.Entity;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.model.ParticleType;
import common.network.IPlayer;
import common.network.Packet;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ParticleType;
import common.util.PortalType;
import common.village.Village;

View file

@ -16,11 +16,11 @@ import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.SoundEvent;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;

View file

@ -26,7 +26,6 @@ import common.init.BlockRegistry;
import common.init.Blocks;
import common.init.SoundEvent;
import common.item.ItemStack;
import common.model.ParticleType;
import common.rng.Random;
import common.tileentity.ITickable;
import common.tileentity.TileEntity;
@ -37,6 +36,7 @@ import common.util.ExtMath;
import common.util.Facing;
import common.util.HitPosition;
import common.util.IntHashMap;
import common.util.ParticleType;
import common.util.Vec3;
public abstract class World implements IWorldAccess {

View file

@ -80,7 +80,7 @@ import common.packet.SPacketSetExperience;
import common.packet.SPacketSkin;
import common.packet.SPacketTimeUpdate;
import common.packet.SPacketWorld;
import common.potion.PotionEffect;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.EncryptUtil;
@ -755,7 +755,7 @@ public final class Server implements IThreadListener, Executor {
conn.sendPacket(new SPacketSkin(player.getId(), player.getSkin())); // , player.getModel()));
conn.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotYaw, player.rotPitch);
this.updateTimeAndWeatherForPlayer(conn, world);
for(PotionEffect effect : player.getEffects()) {
for(StatusEffect effect : player.getEffects()) {
conn.sendPacket(new SPacketEntityEffect(player.getId(), effect));
}
conn.sendPacket(new SPacketPlayerAbilities(player));
@ -926,7 +926,7 @@ public final class Server implements IThreadListener, Executor {
nplayer.setHealth(nplayer.getHealth());
this.updateTimeAndWeatherForPlayer(conn, world);
this.syncPlayerInventory(nplayer);
for(PotionEffect effect : nplayer.getEffects()) {
for(StatusEffect effect : nplayer.getEffects()) {
conn.sendPacket(new SPacketEntityEffect(nplayer.getId(), effect));
}
conn.sendPlayerAbilities();
@ -951,7 +951,7 @@ public final class Server implements IThreadListener, Executor {
player.setRotationYawHead(yaw);
this.updateTimeAndWeatherForPlayer((Player)player.connection, newWorld);
this.syncPlayerInventory(player);
for(PotionEffect effect : player.getEffects()) {
for(StatusEffect effect : player.getEffects()) {
player.connection.sendPacket(new SPacketEntityEffect(player.getId(), effect));
}
player.connection.sendPlayerAbilities();

View file

@ -2,8 +2,8 @@ package server.command.commands;
import java.util.List;
import common.model.ParticleType;
import common.packet.SPacketParticles;
import common.util.ParticleType;
import common.util.Vec3;
import server.command.Command;
import server.command.CommandEnvironment;

View file

@ -4,7 +4,7 @@ import java.util.List;
import common.color.TextColor;
import common.entity.npc.EntityNPC;
import common.potion.Potion;
import common.potion.Effect;
import server.command.Command;
import server.command.CommandEnvironment;
import server.command.Executor;
@ -21,7 +21,7 @@ public class CommandGod extends Command {
}
public void exec(CommandEnvironment env, Executor exec, List<EntityNPC> players, boolean remove, boolean quiet) {
remove = !remove && exec.isPlayer() && players.size() == 1 && players.get(0).connection == exec ? players.get(0).hasEffect(Potion.HASTE) && players.get(0).getEffect(Potion.HASTE).getAmplifier() == 255 : remove;
remove = !remove && exec.isPlayer() && players.size() == 1 && players.get(0).connection == exec ? players.get(0).hasEffect(Effect.HASTE) && players.get(0).getEffect(Effect.HASTE).getAmplifier() == 255 : remove;
for(EntityNPC player : players) {
player.setGodMode(!remove);
if(!quiet)

View file

@ -4,7 +4,7 @@ import java.util.List;
import common.collect.Lists;
import common.entity.types.EntityLiving;
import common.potion.Potion;
import common.potion.Effect;
import server.command.Command;
import server.command.CommandEnvironment;
import server.command.Executor;
@ -16,17 +16,17 @@ public class CommandMilk extends Command {
this.addLivingEntityList("entities", true, UserPolicy.NON_ADMINS_OR_SELF);
this.setParamsOptional();
List<Potion> potions = Lists.newArrayList();
for(Potion potion : Potion.values()) {
List<Effect> potions = Lists.newArrayList();
for(Effect potion : Effect.values()) {
if(!potion.isInstant())
potions.add(potion);
}
this.addEnum("type", Potion.class, potions);
this.addEnum("type", Effect.class, potions);
this.addFlag("negative", 'n');
}
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Potion type, boolean negative) {
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Effect type, boolean negative) {
int done = 0;
for(EntityLiving entity : entities) {
if(type != null && entity.hasEffect(type)) {

View file

@ -3,8 +3,8 @@ package server.command.commands;
import java.util.List;
import common.entity.types.EntityLiving;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import server.command.Command;
import server.command.CommandEnvironment;
import server.command.Executor;
@ -15,7 +15,7 @@ public class CommandPotion extends Command {
super("potion");
this.addLivingEntityList("entities", true, UserPolicy.NON_ADMINS_OR_SELF);
this.addEnum("type", Potion.class, Potion.values());
this.addEnum("type", Effect.class, Effect.values());
this.setParamsOptional();
this.addInt("duration", 0, 1000000, 1000000);
this.addInt("strength", 1, 256, 1);
@ -23,7 +23,7 @@ public class CommandPotion extends Command {
this.addFlag("keep", 'k');
}
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Potion type, int duration, int strength, boolean keep) {
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Effect type, int duration, int strength, boolean keep) {
int done = 0;
for(EntityLiving entity : entities) {
if(entity.isPotionApplicable(type, strength - 1)) {
@ -31,7 +31,7 @@ public class CommandPotion extends Command {
type.onImpact(null, null, entity, strength - 1, 1.0);
}
else {
PotionEffect effect = new PotionEffect(type, duration == 0 ? Integer.MAX_VALUE : (duration * 20), strength - 1);
StatusEffect effect = new StatusEffect(type, duration == 0 ? Integer.MAX_VALUE : (duration * 20), strength - 1);
if(!keep && entity.hasEffect(type))
entity.removeEffect(type);
entity.addEffect(effect);

View file

@ -97,8 +97,8 @@ import common.packet.SPacketTrades;
import common.packet.SPacketUpdateHealth;
import common.packet.CPacketAction.Action;
import common.packet.SPacketMessage.Type;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.potion.Effect;
import common.potion.StatusEffect;
import common.tags.TagObject;
import common.tileentity.IInteractionObject;
import common.tileentity.ILockableContainer;
@ -786,17 +786,17 @@ public class Player extends User implements Executor, IPlayer
// }
// }
public void onNewEffect(PotionEffect id)
public void onNewEffect(StatusEffect id)
{
this.sendPacket(new SPacketEntityEffect(this.entity.getId(), id));
}
public void onChangedEffect(PotionEffect id, boolean added)
public void onChangedEffect(StatusEffect id, boolean added)
{
this.sendPacket(new SPacketEntityEffect(this.entity.getId(), id));
}
public void onFinishedEffect(PotionEffect effect)
public void onFinishedEffect(StatusEffect effect)
{
this.sendPacket(new SPacketRemoveEntityEffect(this.entity.getId(), effect));
}
@ -1715,7 +1715,7 @@ public class Player extends User implements Executor, IPlayer
super.setAdmin(admin);
if(!this.isAdmin() && this.entity != null && this.entity.noclip) {
this.entity.noclip = false;
this.entity.flying &= this.entity.hasEffect(Potion.FLYING) || this.entity.canNaturallyFly();
this.entity.flying &= this.entity.hasEffect(Effect.FLYING) || this.entity.canNaturallyFly();
this.entity.fallDistance = 0.0F;
this.sendPlayerAbilities();
this.addFeed(TextColor.RED + "NoClip wurde deaktiviert");
@ -2553,7 +2553,7 @@ public class Player extends User implements Executor, IPlayer
break;
case START_FLYING:
this.entity.flying = this.entity.hasEffect(Potion.FLYING) || this.entity.noclip || this.entity.canNaturallyFly();
this.entity.flying = this.entity.hasEffect(Effect.FLYING) || this.entity.noclip || this.entity.canNaturallyFly();
break;
case STOP_FLYING:
@ -2678,7 +2678,7 @@ public class Player extends User implements Executor, IPlayer
case GOD:
if(this.isAdmin()) {
boolean god = !this.entity.hasEffect(Potion.HASTE) || this.entity.getEffect(Potion.HASTE).getAmplifier() != 255;
boolean god = !this.entity.hasEffect(Effect.HASTE) || this.entity.getEffect(Effect.HASTE).getAmplifier() != 255;
this.entity.setGodMode(god);
this.addFeed(god ? (TextColor.GREEN + "Statuseffekte wurden hinzugefügt") : (TextColor.RED + "Statuseffekte wurden entfernt"));
}
@ -2693,10 +2693,10 @@ public class Player extends User implements Executor, IPlayer
case SPEED:
if(this.isAdmin()) {
if(this.entity.hasEffect(Potion.SPEED))
this.entity.removeEffect(Potion.SPEED);
if(this.entity.hasEffect(Effect.SPEED))
this.entity.removeEffect(Effect.SPEED);
else
this.entity.addEffect(new PotionEffect(Potion.SPEED, Integer.MAX_VALUE, 19));
this.entity.addEffect(new StatusEffect(Effect.SPEED, Integer.MAX_VALUE, 19));
this.addFeed(TextColor.GREEN + "Deine Geschwindigkeit wurde auf %dx geändert", (int)(this.entity.getAIMoveSpeed() * 10.0f));
// int speed = this.playerEntity.speed != 1.0f ? 1 : 5;
// this.playerEntity.speed = (float)speed;

View file

@ -39,7 +39,6 @@ import common.init.SoundEvent;
import common.init.UniverseRegistry;
import common.item.block.ItemDoor;
import common.log.Log;
import common.model.ParticleType;
import common.network.IPlayer;
import common.network.Packet;
import common.packet.SPacketEntityStatus;
@ -64,6 +63,7 @@ import common.util.ChunkPos;
import common.util.ExtMath;
import common.util.IntHashMap;
import common.util.LongHashMap;
import common.util.ParticleType;
import common.util.PortalType;
import common.util.Position;
import common.util.Vec3;