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)