From 28d6850668b5cff41c547c7101f4ed858d1479f7 Mon Sep 17 00:00:00 2001 From: Sen Date: Thu, 10 Jul 2025 00:22:29 +0200 Subject: [PATCH] fixes --- client/src/main/java/client/Client.java | 10 +- .../java/client/network/ClientPlayer.java | 4 +- .../java/client/renderer/EffectRenderer.java | 27 ++-- .../java/client/renderer/EntityRenderer.java | 20 +-- .../client/renderer/entity/RenderPotion.java | 2 +- .../main/java/client/world/WorldClient.java | 4 +- .../src/main/java/common/ai/EntityAIMate.java | 2 +- .../block/artificial/BlockDragonEgg.java | 2 +- .../block/artificial/BlockFloorPortal.java | 2 +- .../common/block/artificial/BlockPortal.java | 2 +- .../common/block/foliage/BlockMycelium.java | 2 +- .../java/common/block/foliage/BlockWart.java | 2 +- .../java/common/block/liquid/BlockLiquid.java | 2 +- .../common/block/natural/BlockBedrock.java | 2 +- .../java/common/block/natural/BlockFire.java | 2 +- .../block/natural/BlockRedstoneOre.java | 2 +- .../common/block/tech/BlockBrewingStand.java | 2 +- .../java/common/block/tech/BlockCauldron.java | 2 +- .../java/common/block/tech/BlockFurnace.java | 2 +- .../block/tech/BlockRedstoneRepeater.java | 2 +- .../common/block/tech/BlockRedstoneTorch.java | 2 +- .../common/block/tech/BlockRedstoneWire.java | 5 +- .../java/common/block/tech/BlockTorch.java | 2 +- .../common/block/tech/BlockWarpChest.java | 2 +- .../src/main/java/common/entity/Entity.java | 2 +- .../common/entity/EntityTrackerEntry.java | 4 +- .../common/entity/animal/EntityDragon.java | 6 +- .../common/entity/animal/EntityHorse.java | 8 +- .../common/entity/animal/EntityMooshroom.java | 2 +- .../common/entity/animal/EntityRabbit.java | 12 +- .../java/common/entity/animal/EntityWolf.java | 2 +- .../java/common/entity/item/EntityBoat.java | 2 +- .../java/common/entity/item/EntityItem.java | 2 +- .../java/common/entity/item/EntityNuke.java | 2 +- .../java/common/entity/item/EntityOrb.java | 2 +- .../java/common/entity/item/EntityTnt.java | 2 +- .../common/entity/item/EntityTntCart.java | 2 +- .../java/common/entity/item/EntityXp.java | 2 +- .../common/entity/npc/EntityArachnoid.java | 14 +- .../common/entity/npc/EntityDarkMage.java | 2 +- .../common/entity/npc/EntityFlyingNPC.java | 6 +- .../common/entity/npc/EntityGargoyle.java | 2 +- .../java/common/entity/npc/EntityMage.java | 20 +-- .../java/common/entity/npc/EntityNPC.java | 62 ++++----- .../java/common/entity/npc/EntitySlime.java | 2 +- .../common/entity/projectile/EntityArrow.java | 2 +- .../common/entity/projectile/EntityBox.java | 6 +- .../entity/projectile/EntityDynamite.java | 2 +- .../common/entity/projectile/EntityEgg.java | 2 +- .../common/entity/projectile/EntityHook.java | 2 +- .../entity/projectile/EntityMissile.java | 2 +- .../entity/projectile/EntityPotion.java | 14 +- .../entity/projectile/EntityProjectile.java | 2 +- .../entity/projectile/EntitySnowball.java | 2 +- .../entity/projectile/FishConstants.java | 2 +- .../common/entity/types/EntityAnimal.java | 2 +- .../common/entity/types/EntityLiving.java | 74 +++++------ .../common/entity/types/EntityTameable.java | 2 +- .../common/entity/types/EntityThrowable.java | 2 +- .../java/common/init/BrewingRegistry.java | 14 ++ .../main/java/common/init/ItemRegistry.java | 37 +++--- common/src/main/java/common/init/Items.java | 2 +- .../inventory/ContainerBrewingStand.java | 6 +- .../src/main/java/common/item/CheatTab.java | 2 +- common/src/main/java/common/item/Item.java | 14 -- .../java/common/item/material/ItemDye.java | 2 +- .../java/common/item/tool/ItemAppleGold.java | 12 +- .../java/common/item/tool/ItemBucket.java | 2 +- .../java/common/item/tool/ItemChargedOrb.java | 2 +- .../java/common/item/tool/ItemFishFood.java | 11 +- .../main/java/common/item/tool/ItemFood.java | 10 +- .../common/item/tool/ItemGlassBottle.java | 6 +- .../java/common/item/tool/ItemPotion.java | 72 +++++++---- .../src/main/java/common/network/IPlayer.java | 8 +- .../common/packet/SPacketEntityEffect.java | 12 +- .../java/common/packet/SPacketParticles.java | 2 +- .../packet/SPacketRemoveEntityEffect.java | 12 +- .../potion/{Potion.java => Effect.java} | 54 +++++--- .../main/java/common/potion/PotionHelper.java | 121 ------------------ .../{PotionEffect.java => StatusEffect.java} | 32 ++--- .../common/tileentity/TileEntityBeacon.java | 20 +-- .../tileentity/TileEntityBrewingStand.java | 18 +-- .../common/{model => util}/ParticleType.java | 4 +- .../main/java/common/world/AWorldServer.java | 2 +- .../src/main/java/common/world/Explosion.java | 2 +- common/src/main/java/common/world/World.java | 2 +- server/src/main/java/server/Server.java | 8 +- .../command/commands/CommandEffect.java | 2 +- .../server/command/commands/CommandGod.java | 4 +- .../server/command/commands/CommandMilk.java | 10 +- .../command/commands/CommandPotion.java | 10 +- .../src/main/java/server/network/Player.java | 22 ++-- .../main/java/server/world/WorldServer.java | 2 +- 93 files changed, 420 insertions(+), 499 deletions(-) create mode 100755 common/src/main/java/common/init/BrewingRegistry.java rename common/src/main/java/common/potion/{Potion.java => Effect.java} (76%) delete mode 100755 common/src/main/java/common/potion/PotionHelper.java rename common/src/main/java/common/potion/{PotionEffect.java => StatusEffect.java} (77%) rename common/src/main/java/common/{model => util}/ParticleType.java (93%) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 2872e701..2f4f8412 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -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(); diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index c17a5149..acb35161 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -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); } diff --git a/client/src/main/java/client/renderer/EffectRenderer.java b/client/src/main/java/client/renderer/EffectRenderer.java index 15ab7bbb..d6a9f1b7 100755 --- a/client/src/main/java/client/renderer/EffectRenderer.java +++ b/client/src/main/java/client/renderer/EffectRenderer.java @@ -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)); diff --git a/client/src/main/java/client/renderer/EntityRenderer.java b/client/src/main/java/client/renderer/EntityRenderer.java index e61373d2..cf4f01d9 100755 --- a/client/src/main/java/client/renderer/EntityRenderer.java +++ b/client/src/main/java/client/renderer/EntityRenderer.java @@ -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) { diff --git a/client/src/main/java/client/renderer/entity/RenderPotion.java b/client/src/main/java/client/renderer/entity/RenderPotion.java index 23dd0996..7c7a18d0 100755 --- a/client/src/main/java/client/renderer/entity/RenderPotion.java +++ b/client/src/main/java/client/renderer/entity/RenderPotion.java @@ -8,7 +8,7 @@ public class RenderPotion extends RenderItemEntity { public RenderPotion(RenderManager renderManagerIn, RenderItem itemRendererIn) { - super(renderManagerIn, Items.potion, itemRendererIn); + super(renderManagerIn, Items.water_bottle, itemRendererIn); } public ItemStack getStack(EntityPotion entityIn) diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index aaad5edb..b2cf45fd 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -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) diff --git a/common/src/main/java/common/ai/EntityAIMate.java b/common/src/main/java/common/ai/EntityAIMate.java index be5d9e86..20b2ee47 100755 --- a/common/src/main/java/common/ai/EntityAIMate.java +++ b/common/src/main/java/common/ai/EntityAIMate.java @@ -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; diff --git a/common/src/main/java/common/block/artificial/BlockDragonEgg.java b/common/src/main/java/common/block/artificial/BlockDragonEgg.java index 9b799f2b..a99ced6a 100755 --- a/common/src/main/java/common/block/artificial/BlockDragonEgg.java +++ b/common/src/main/java/common/block/artificial/BlockDragonEgg.java @@ -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; diff --git a/common/src/main/java/common/block/artificial/BlockFloorPortal.java b/common/src/main/java/common/block/artificial/BlockFloorPortal.java index 7b75a669..3233577a 100755 --- a/common/src/main/java/common/block/artificial/BlockFloorPortal.java +++ b/common/src/main/java/common/block/artificial/BlockFloorPortal.java @@ -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; diff --git a/common/src/main/java/common/block/artificial/BlockPortal.java b/common/src/main/java/common/block/artificial/BlockPortal.java index 4d47b3c8..e5dfc367 100755 --- a/common/src/main/java/common/block/artificial/BlockPortal.java +++ b/common/src/main/java/common/block/artificial/BlockPortal.java @@ -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; diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index 0f5d82f9..27ab2ec3 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -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; diff --git a/common/src/main/java/common/block/foliage/BlockWart.java b/common/src/main/java/common/block/foliage/BlockWart.java index 4471e673..253dd0db 100755 --- a/common/src/main/java/common/block/foliage/BlockWart.java +++ b/common/src/main/java/common/block/foliage/BlockWart.java @@ -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); } } diff --git a/common/src/main/java/common/block/liquid/BlockLiquid.java b/common/src/main/java/common/block/liquid/BlockLiquid.java index ff321d62..4cbf364c 100755 --- a/common/src/main/java/common/block/liquid/BlockLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockLiquid.java @@ -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; diff --git a/common/src/main/java/common/block/natural/BlockBedrock.java b/common/src/main/java/common/block/natural/BlockBedrock.java index 641e0fac..dc0f2bdd 100755 --- a/common/src/main/java/common/block/natural/BlockBedrock.java +++ b/common/src/main/java/common/block/natural/BlockBedrock.java @@ -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; diff --git a/common/src/main/java/common/block/natural/BlockFire.java b/common/src/main/java/common/block/natural/BlockFire.java index e5211e72..be5e567b 100755 --- a/common/src/main/java/common/block/natural/BlockFire.java +++ b/common/src/main/java/common/block/natural/BlockFire.java @@ -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; diff --git a/common/src/main/java/common/block/natural/BlockRedstoneOre.java b/common/src/main/java/common/block/natural/BlockRedstoneOre.java index b6c730d0..6ef6e66a 100755 --- a/common/src/main/java/common/block/natural/BlockRedstoneOre.java +++ b/common/src/main/java/common/block/natural/BlockRedstoneOre.java @@ -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; diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index 6a62092d..2a50e12a 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -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; diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index d384467a..0690f3e0 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -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)) { diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index 0059a38c..548fd017 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -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; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java b/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java index cf86f17a..e98ea304 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java @@ -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; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneTorch.java b/common/src/main/java/common/block/tech/BlockRedstoneTorch.java index a37d7a8d..36769ad1 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneTorch.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneTorch.java @@ -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; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneWire.java b/common/src/main/java/common/block/tech/BlockRedstoneWire.java index 5dba94d8..5cf0e8c2 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneWire.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneWire.java @@ -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() { diff --git a/common/src/main/java/common/block/tech/BlockTorch.java b/common/src/main/java/common/block/tech/BlockTorch.java index 01068769..a20d6184 100755 --- a/common/src/main/java/common/block/tech/BlockTorch.java +++ b/common/src/main/java/common/block/tech/BlockTorch.java @@ -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; diff --git a/common/src/main/java/common/block/tech/BlockWarpChest.java b/common/src/main/java/common/block/tech/BlockWarpChest.java index df01d3b0..ad096529 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -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; diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index a6e148a9..2311c51e 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -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; diff --git a/common/src/main/java/common/entity/EntityTrackerEntry.java b/common/src/main/java/common/entity/EntityTrackerEntry.java index 44294737..2d16680e 100755 --- a/common/src/main/java/common/entity/EntityTrackerEntry.java +++ b/common/src/main/java/common/entity/EntityTrackerEntry.java @@ -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)); } } diff --git a/common/src/main/java/common/entity/animal/EntityDragon.java b/common/src/main/java/common/entity/animal/EntityDragon.java index 04bb3427..d27986cc 100755 --- a/common/src/main/java/common/entity/animal/EntityDragon.java +++ b/common/src/main/java/common/entity/animal/EntityDragon.java @@ -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; } diff --git a/common/src/main/java/common/entity/animal/EntityHorse.java b/common/src/main/java/common/entity/animal/EntityHorse.java index c711a0ba..6065cd7f 100755 --- a/common/src/main/java/common/entity/animal/EntityHorse.java +++ b/common/src/main/java/common/entity/animal/EntityHorse.java @@ -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); diff --git a/common/src/main/java/common/entity/animal/EntityMooshroom.java b/common/src/main/java/common/entity/animal/EntityMooshroom.java index f1e08908..f4af64ee 100755 --- a/common/src/main/java/common/entity/animal/EntityMooshroom.java +++ b/common/src/main/java/common/entity/animal/EntityMooshroom.java @@ -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 diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index d45e4a12..9f208c07 100755 --- a/common/src/main/java/common/entity/animal/EntityRabbit.java +++ b/common/src/main/java/common/entity/animal/EntityRabbit.java @@ -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); } diff --git a/common/src/main/java/common/entity/animal/EntityWolf.java b/common/src/main/java/common/entity/animal/EntityWolf.java index 467077ff..749f2cde 100755 --- a/common/src/main/java/common/entity/animal/EntityWolf.java +++ b/common/src/main/java/common/entity/animal/EntityWolf.java @@ -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; diff --git a/common/src/main/java/common/entity/item/EntityBoat.java b/common/src/main/java/common/entity/item/EntityBoat.java index 352544a6..b2a32453 100755 --- a/common/src/main/java/common/entity/item/EntityBoat.java +++ b/common/src/main/java/common/entity/item/EntityBoat.java @@ -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; diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index bbf7669c..c367c236 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -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; diff --git a/common/src/main/java/common/entity/item/EntityNuke.java b/common/src/main/java/common/entity/item/EntityNuke.java index a94953da..ff4b2d99 100755 --- a/common/src/main/java/common/entity/item/EntityNuke.java +++ b/common/src/main/java/common/entity/item/EntityNuke.java @@ -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 diff --git a/common/src/main/java/common/entity/item/EntityOrb.java b/common/src/main/java/common/entity/item/EntityOrb.java index 6ecf8b61..882413a1 100755 --- a/common/src/main/java/common/entity/item/EntityOrb.java +++ b/common/src/main/java/common/entity/item/EntityOrb.java @@ -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; diff --git a/common/src/main/java/common/entity/item/EntityTnt.java b/common/src/main/java/common/entity/item/EntityTnt.java index a99b24ff..7bd54fa0 100755 --- a/common/src/main/java/common/entity/item/EntityTnt.java +++ b/common/src/main/java/common/entity/item/EntityTnt.java @@ -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 diff --git a/common/src/main/java/common/entity/item/EntityTntCart.java b/common/src/main/java/common/entity/item/EntityTntCart.java index add42d59..4846b6cb 100755 --- a/common/src/main/java/common/entity/item/EntityTntCart.java +++ b/common/src/main/java/common/entity/item/EntityTntCart.java @@ -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; diff --git a/common/src/main/java/common/entity/item/EntityXp.java b/common/src/main/java/common/entity/item/EntityXp.java index 35ac1084..668548c7 100755 --- a/common/src/main/java/common/entity/item/EntityXp.java +++ b/common/src/main/java/common/entity/item/EntityXp.java @@ -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; diff --git a/common/src/main/java/common/entity/npc/EntityArachnoid.java b/common/src/main/java/common/entity/npc/EntityArachnoid.java index 6fa85445..1690f2e0 100755 --- a/common/src/main/java/common/entity/npc/EntityArachnoid.java +++ b/common/src/main/java/common/entity/npc/EntityArachnoid.java @@ -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; diff --git a/common/src/main/java/common/entity/npc/EntityDarkMage.java b/common/src/main/java/common/entity/npc/EntityDarkMage.java index 6f0d473f..609ac341 100755 --- a/common/src/main/java/common/entity/npc/EntityDarkMage.java +++ b/common/src/main/java/common/entity/npc/EntityDarkMage.java @@ -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; diff --git a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java index 0218e906..656852fd 100755 --- a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java +++ b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java @@ -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 diff --git a/common/src/main/java/common/entity/npc/EntityGargoyle.java b/common/src/main/java/common/entity/npc/EntityGargoyle.java index 212304f2..39f9e9c9 100755 --- a/common/src/main/java/common/entity/npc/EntityGargoyle.java +++ b/common/src/main/java/common/entity/npc/EntityGargoyle.java @@ -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; diff --git a/common/src/main/java/common/entity/npc/EntityMage.java b/common/src/main/java/common/entity/npc/EntityMage.java index b9f4d0b8..347a273c 100755 --- a/common/src/main/java/common/entity/npc/EntityMage.java +++ b/common/src/main/java/common/entity/npc/EntityMage.java @@ -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)); } diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index f4b2ec23..7b514f0a 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -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(); diff --git a/common/src/main/java/common/entity/npc/EntitySlime.java b/common/src/main/java/common/entity/npc/EntitySlime.java index c1dd550a..808b3b64 100755 --- a/common/src/main/java/common/entity/npc/EntitySlime.java +++ b/common/src/main/java/common/entity/npc/EntitySlime.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/EntityArrow.java b/common/src/main/java/common/entity/projectile/EntityArrow.java index 3831dd06..c08e3483 100755 --- a/common/src/main/java/common/entity/projectile/EntityArrow.java +++ b/common/src/main/java/common/entity/projectile/EntityArrow.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/EntityBox.java b/common/src/main/java/common/entity/projectile/EntityBox.java index 7fc2740d..764f9630 100755 --- a/common/src/main/java/common/entity/projectile/EntityBox.java +++ b/common/src/main/java/common/entity/projectile/EntityBox.java @@ -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))); // } } } diff --git a/common/src/main/java/common/entity/projectile/EntityDynamite.java b/common/src/main/java/common/entity/projectile/EntityDynamite.java index 8da67200..e993b40b 100755 --- a/common/src/main/java/common/entity/projectile/EntityDynamite.java +++ b/common/src/main/java/common/entity/projectile/EntityDynamite.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/EntityEgg.java b/common/src/main/java/common/entity/projectile/EntityEgg.java index d816fea6..0069abd1 100755 --- a/common/src/main/java/common/entity/projectile/EntityEgg.java +++ b/common/src/main/java/common/entity/projectile/EntityEgg.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/EntityHook.java b/common/src/main/java/common/entity/projectile/EntityHook.java index 84aedbcb..6dfb3186 100755 --- a/common/src/main/java/common/entity/projectile/EntityHook.java +++ b/common/src/main/java/common/entity/projectile/EntityHook.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/EntityMissile.java b/common/src/main/java/common/entity/projectile/EntityMissile.java index fa40ce52..f8753378 100755 --- a/common/src/main/java/common/entity/projectile/EntityMissile.java +++ b/common/src/main/java/common/entity/projectile/EntityMissile.java @@ -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 { diff --git a/common/src/main/java/common/entity/projectile/EntityPotion.java b/common/src/main/java/common/entity/projectile/EntityPotion.java index d2f906d9..37f6480c 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -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 list1 = this.worldObj.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())); } } } diff --git a/common/src/main/java/common/entity/projectile/EntityProjectile.java b/common/src/main/java/common/entity/projectile/EntityProjectile.java index 24b03831..dc9ae5c5 100755 --- a/common/src/main/java/common/entity/projectile/EntityProjectile.java +++ b/common/src/main/java/common/entity/projectile/EntityProjectile.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/EntitySnowball.java b/common/src/main/java/common/entity/projectile/EntitySnowball.java index 90eb22ca..86500c8b 100755 --- a/common/src/main/java/common/entity/projectile/EntitySnowball.java +++ b/common/src/main/java/common/entity/projectile/EntitySnowball.java @@ -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; diff --git a/common/src/main/java/common/entity/projectile/FishConstants.java b/common/src/main/java/common/entity/projectile/FishConstants.java index e43f5017..1710aff0 100644 --- a/common/src/main/java/common/entity/projectile/FishConstants.java +++ b/common/src/main/java/common/entity/projectile/FishConstants.java @@ -7,7 +7,7 @@ import common.rng.WeightedList; public abstract class FishConstants { public static final WeightedList FISHING_JUNK = new WeightedList( (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), diff --git a/common/src/main/java/common/entity/types/EntityAnimal.java b/common/src/main/java/common/entity/types/EntityAnimal.java index 0b627a8e..71e8983c 100755 --- a/common/src/main/java/common/entity/types/EntityAnimal.java +++ b/common/src/main/java/common/entity/types/EntityAnimal.java @@ -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 diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 80388a1b..2bd762a4 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -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 combat = Lists.newArrayList(); - private final Map effects = Maps.newEnumMap(Potion.class); + private final Map effects = Maps.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 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 iterator = this.effects.keySet().iterator(); + Iterator 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 iterator = this.effects.keySet().iterator(); + Iterator 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 getEffects() + public Collection 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() diff --git a/common/src/main/java/common/entity/types/EntityTameable.java b/common/src/main/java/common/entity/types/EntityTameable.java index 5d9c18ed..69e6e393 100755 --- a/common/src/main/java/common/entity/types/EntityTameable.java +++ b/common/src/main/java/common/entity/types/EntityTameable.java @@ -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 diff --git a/common/src/main/java/common/entity/types/EntityThrowable.java b/common/src/main/java/common/entity/types/EntityThrowable.java index 616714c3..6c07aced 100755 --- a/common/src/main/java/common/entity/types/EntityThrowable.java +++ b/common/src/main/java/common/entity/types/EntityThrowable.java @@ -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; diff --git a/common/src/main/java/common/init/BrewingRegistry.java b/common/src/main/java/common/init/BrewingRegistry.java new file mode 100755 index 00000000..0169f607 --- /dev/null +++ b/common/src/main/java/common/init/BrewingRegistry.java @@ -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; + } +} diff --git a/common/src/main/java/common/init/ItemRegistry.java b/common/src/main/java/common/init/ItemRegistry.java index f720740c..21c31a02 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -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 pot : ItemPotion.getBasePotions()) { + for(Pair pot : ItemPotion.getBasePotions()) { register(pot.first(), new ItemPotion(pot.second(), null)); } - for(Pair pot : ItemPotion.getBrewedPotions()) { + for(Pair 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)); diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index bab3c8b0..322a2b5c 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -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"); diff --git a/common/src/main/java/common/inventory/ContainerBrewingStand.java b/common/src/main/java/common/inventory/ContainerBrewingStand.java index fada2687..03098723 100755 --- a/common/src/main/java/common/inventory/ContainerBrewingStand.java +++ b/common/src/main/java/common/inventory/ContainerBrewingStand.java @@ -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); } } } diff --git a/common/src/main/java/common/item/CheatTab.java b/common/src/main/java/common/item/CheatTab.java index 0eb5cd8a..7d460bf7 100755 --- a/common/src/main/java/common/item/CheatTab.java +++ b/common/src/main/java/common/item/CheatTab.java @@ -94,7 +94,7 @@ public enum CheatTab { }, POTIONS("Tränke", false) { protected Item getIconItem() { - return Items.potion; + return Items.water_bottle; } }, ENCHANTMENTS("Verzauberungen", false) { diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index 96c2f159..ed237870 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -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); } diff --git a/common/src/main/java/common/item/material/ItemDye.java b/common/src/main/java/common/item/material/ItemDye.java index dc59930d..3bc8855d 100755 --- a/common/src/main/java/common/item/material/ItemDye.java +++ b/common/src/main/java/common/item/material/ItemDye.java @@ -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; diff --git a/common/src/main/java/common/item/tool/ItemAppleGold.java b/common/src/main/java/common/item/tool/ItemAppleGold.java index abae7448..a7e01695 100755 --- a/common/src/main/java/common/item/tool/ItemAppleGold.java +++ b/common/src/main/java/common/item/tool/ItemAppleGold.java @@ -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 diff --git a/common/src/main/java/common/item/tool/ItemBucket.java b/common/src/main/java/common/item/tool/ItemBucket.java index fa7c58e5..080882f6 100755 --- a/common/src/main/java/common/item/tool/ItemBucket.java +++ b/common/src/main/java/common/item/tool/ItemBucket.java @@ -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; diff --git a/common/src/main/java/common/item/tool/ItemChargedOrb.java b/common/src/main/java/common/item/tool/ItemChargedOrb.java index 77dfb44f..e5aa560d 100755 --- a/common/src/main/java/common/item/tool/ItemChargedOrb.java +++ b/common/src/main/java/common/item/tool/ItemChargedOrb.java @@ -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; diff --git a/common/src/main/java/common/item/tool/ItemFishFood.java b/common/src/main/java/common/item/tool/ItemFishFood.java index 8b0003b2..1714a38f 100755 --- a/common/src/main/java/common/item/tool/ItemFishFood.java +++ b/common/src/main/java/common/item/tool/ItemFishFood.java @@ -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); diff --git a/common/src/main/java/common/item/tool/ItemFood.java b/common/src/main/java/common/item/tool/ItemFood.java index ace52a0f..c012027f 100755 --- a/common/src/main/java/common/item/tool/ItemFood.java +++ b/common/src/main/java/common/item/tool/ItemFood.java @@ -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; diff --git a/common/src/main/java/common/item/tool/ItemGlassBottle.java b/common/src/main/java/common/item/tool/ItemGlassBottle.java index 8aea0084..fb673332 100755 --- a/common/src/main/java/common/item/tool/ItemGlassBottle.java +++ b/common/src/main/java/common/item/tool/ItemGlassBottle.java @@ -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); } } } diff --git a/common/src/main/java/common/item/tool/ItemPotion.java b/common/src/main/java/common/item/tool/ItemPotion.java index 7b687df2..f6d00643 100755 --- a/common/src/main/java/common/item/tool/ItemPotion.java +++ b/common/src/main/java/common/item/tool/ItemPotion.java @@ -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 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 getPotions() { return POTIONS; } - public ItemPotion(Potion type, PotionEffect effect) + public static int mixColors(Collection 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> getBasePotions() { - List> effects = Lists.newArrayList(); - effects.add(new Pair("potion", null)); - for(Potion potion : Potion.values()) { + public static List> getBasePotions() { + List> 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> getBrewedPotions() { - List> effects = Lists.newArrayList(); - for(Potion potion : Potion.values()) { + public static List> getBrewedPotions() { + List> 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; diff --git a/common/src/main/java/common/network/IPlayer.java b/common/src/main/java/common/network/IPlayer.java index 803ce210..ed86f9fa 100644 --- a/common/src/main/java/common/network/IPlayer.java +++ b/common/src/main/java/common/network/IPlayer.java @@ -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); diff --git a/common/src/main/java/common/packet/SPacketEntityEffect.java b/common/src/main/java/common/packet/SPacketEntityEffect.java index 262460ea..36c9f46b 100755 --- a/common/src/main/java/common/packet/SPacketEntityEffect.java +++ b/common/src/main/java/common/packet/SPacketEntityEffect.java @@ -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 { 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 { } - 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 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 return this.entityId; } - public Potion getEffectId() + public Effect getEffectId() { return this.effectId; } diff --git a/common/src/main/java/common/packet/SPacketParticles.java b/common/src/main/java/common/packet/SPacketParticles.java index 1da6682a..8b14576e 100755 --- a/common/src/main/java/common/packet/SPacketParticles.java +++ b/common/src/main/java/common/packet/SPacketParticles.java @@ -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 { diff --git a/common/src/main/java/common/packet/SPacketRemoveEntityEffect.java b/common/src/main/java/common/packet/SPacketRemoveEntityEffect.java index 7a27c9dd..b8c70b77 100755 --- a/common/src/main/java/common/packet/SPacketRemoveEntityEffect.java +++ b/common/src/main/java/common/packet/SPacketRemoveEntityEffect.java @@ -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 { 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 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 return this.entityId; } - public Potion getEffectId() + public Effect getEffectId() { return this.effectId; } diff --git a/common/src/main/java/common/potion/Potion.java b/common/src/main/java/common/potion/Effect.java similarity index 76% rename from common/src/main/java/common/potion/Potion.java rename to common/src/main/java/common/potion/Effect.java index fecd5022..d3ef0dfd 100755 --- a/common/src/main/java/common/potion/Potion.java +++ b/common/src/main/java/common/potion/Effect.java @@ -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 LOOKUP = Maps.newHashMap(); + private static final Map 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) { diff --git a/common/src/main/java/common/potion/PotionHelper.java b/common/src/main/java/common/potion/PotionHelper.java deleted file mode 100755 index c24aea55..00000000 --- a/common/src/main/java/common/potion/PotionHelper.java +++ /dev/null @@ -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 potionRequirements = Maps.newEnumMap(Potion.class); - private static final Map potionAmplifiers = Maps.newEnumMap(Potion.class); - private static final Map DATAVALUE_COLORS = Maps.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 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"); - } -} diff --git a/common/src/main/java/common/potion/PotionEffect.java b/common/src/main/java/common/potion/StatusEffect.java similarity index 77% rename from common/src/main/java/common/potion/PotionEffect.java rename to common/src/main/java/common/potion/StatusEffect.java index cf6134ad..153a94c0 100755 --- a/common/src/main/java/common/potion/PotionEffect.java +++ b/common/src/main/java/common/potion/StatusEffect.java @@ -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")); } } diff --git a/common/src/main/java/common/tileentity/TileEntityBeacon.java b/common/src/main/java/common/tileentity/TileEntityBeacon.java index c6ab3c82..b3a96a83 100755 --- a/common/src/main/java/common/tileentity/TileEntityBeacon.java +++ b/common/src/main/java/common/tileentity/TileEntityBeacon.java @@ -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 // { diff --git a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java index 61bcfa2b..760ab3d4 100755 --- a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java +++ b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java @@ -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() diff --git a/common/src/main/java/common/model/ParticleType.java b/common/src/main/java/common/util/ParticleType.java similarity index 93% rename from common/src/main/java/common/model/ParticleType.java rename to common/src/main/java/common/util/ParticleType.java index a0499d0c..a282d726 100755 --- a/common/src/main/java/common/model/ParticleType.java +++ b/common/src/main/java/common/util/ParticleType.java @@ -1,6 +1,4 @@ -package common.model; - -import common.util.Identifyable; +package common.util; public enum ParticleType implements Identifyable { EXPLOSION_NORMAL("explode", true), diff --git a/common/src/main/java/common/world/AWorldServer.java b/common/src/main/java/common/world/AWorldServer.java index 4bda75dd..e46162b9 100644 --- a/common/src/main/java/common/world/AWorldServer.java +++ b/common/src/main/java/common/world/AWorldServer.java @@ -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; diff --git a/common/src/main/java/common/world/Explosion.java b/common/src/main/java/common/world/Explosion.java index eb69e5d9..ac4908b0 100755 --- a/common/src/main/java/common/world/Explosion.java +++ b/common/src/main/java/common/world/Explosion.java @@ -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; diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 9722cd37..f944216f 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -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 { diff --git a/server/src/main/java/server/Server.java b/server/src/main/java/server/Server.java index 1e81b281..16e31b11 100755 --- a/server/src/main/java/server/Server.java +++ b/server/src/main/java/server/Server.java @@ -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(); diff --git a/server/src/main/java/server/command/commands/CommandEffect.java b/server/src/main/java/server/command/commands/CommandEffect.java index 477e4172..3747ee34 100644 --- a/server/src/main/java/server/command/commands/CommandEffect.java +++ b/server/src/main/java/server/command/commands/CommandEffect.java @@ -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; diff --git a/server/src/main/java/server/command/commands/CommandGod.java b/server/src/main/java/server/command/commands/CommandGod.java index ef5c51f7..b1aaff63 100644 --- a/server/src/main/java/server/command/commands/CommandGod.java +++ b/server/src/main/java/server/command/commands/CommandGod.java @@ -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 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) diff --git a/server/src/main/java/server/command/commands/CommandMilk.java b/server/src/main/java/server/command/commands/CommandMilk.java index 6cc2883d..aa270347 100644 --- a/server/src/main/java/server/command/commands/CommandMilk.java +++ b/server/src/main/java/server/command/commands/CommandMilk.java @@ -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 potions = Lists.newArrayList(); - for(Potion potion : Potion.values()) { + List 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 entities, Potion type, boolean negative) { + public Object exec(CommandEnvironment env, Executor exec, List entities, Effect type, boolean negative) { int done = 0; for(EntityLiving entity : entities) { if(type != null && entity.hasEffect(type)) { diff --git a/server/src/main/java/server/command/commands/CommandPotion.java b/server/src/main/java/server/command/commands/CommandPotion.java index 64f7b5bf..290dbc2f 100644 --- a/server/src/main/java/server/command/commands/CommandPotion.java +++ b/server/src/main/java/server/command/commands/CommandPotion.java @@ -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 entities, Potion type, int duration, int strength, boolean keep) { + public Object exec(CommandEnvironment env, Executor exec, List 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); diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index 2b0db728..2a93a900 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -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; diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index ab85e218..6218307f 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -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;