From 9688d1d8028cf061589111aed63cc9e6cf99f070 Mon Sep 17 00:00:00 2001 From: Sen Date: Wed, 23 Jul 2025 14:23:06 +0200 Subject: [PATCH] code cleanup --- client/src/main/java/client/Client.java | 107 ++++++------------ .../java/client/network/ClientPlayer.java | 2 +- .../java/client/renderer/EffectRenderer.java | 6 +- .../java/client/renderer/EntityRenderer.java | 4 +- .../java/client/util/PlayerController.java | 2 +- .../main/java/common/ai/AIFireballAttack.java | 4 +- .../java/common/ai/AIFlyingBoxAttack.java | 2 +- .../java/common/ai/AISmallFireballAttack.java | 2 +- .../main/java/common/ai/EntityAIEatGrass.java | 2 +- .../src/main/java/common/ai/EntityAIMate.java | 2 +- common/src/main/java/common/block/Block.java | 28 ++++- .../main/java/common/block/BlockFalling.java | 2 +- .../common/block/artificial/BlockDoor.java | 4 +- .../block/artificial/BlockDragonEgg.java | 4 +- .../block/artificial/BlockFenceGate.java | 2 +- .../block/artificial/BlockFloorPortal.java | 2 +- .../common/block/artificial/BlockPortal.java | 2 +- .../common/block/artificial/BlockSlab.java | 2 +- .../block/artificial/BlockTrapDoor.java | 2 +- .../common/block/foliage/BlockMycelium.java | 2 +- .../java/common/block/liquid/BlockLiquid.java | 12 +- .../common/block/natural/BlockBedrock.java | 2 +- .../java/common/block/natural/BlockFire.java | 14 +-- .../java/common/block/natural/BlockSnow.java | 2 +- .../java/common/block/tech/BlockAnvil.java | 2 +- .../block/tech/BlockBasePressurePlate.java | 4 +- .../common/block/tech/BlockBrewingStand.java | 5 +- .../java/common/block/tech/BlockButton.java | 8 +- .../java/common/block/tech/BlockChest.java | 3 +- .../common/block/tech/BlockDispenser.java | 5 +- .../java/common/block/tech/BlockFurnace.java | 19 ++-- .../java/common/block/tech/BlockHopper.java | 3 +- .../java/common/block/tech/BlockLever.java | 2 +- .../java/common/block/tech/BlockLitTorch.java | 12 +- .../java/common/block/tech/BlockMachine.java | 3 +- .../common/block/tech/BlockPistonBase.java | 4 +- .../main/java/common/block/tech/BlockTNT.java | 3 +- .../block/tech/BlockToggleableLight.java | 2 +- .../common/block/tech/BlockTripWireHook.java | 8 +- .../common/block/tech/BlockUnlitTorch.java | 2 +- .../common/block/tech/BlockWarpChest.java | 2 +- .../src/main/java/common/entity/Entity.java | 8 +- .../java/common/entity/animal/EntityBat.java | 4 +- .../common/entity/animal/EntityDragon.java | 4 +- .../common/entity/animal/EntityHorse.java | 2 +- .../common/entity/animal/EntityRabbit.java | 2 +- .../java/common/entity/animal/EntityWolf.java | 2 +- .../common/entity/effect/EntityLightning.java | 4 +- .../java/common/entity/item/EntityBoat.java | 4 +- .../java/common/entity/item/EntityItem.java | 2 +- .../java/common/entity/item/EntityNuke.java | 2 +- .../java/common/entity/item/EntityOrb.java | 8 +- .../java/common/entity/item/EntityTnt.java | 2 +- .../common/entity/item/EntityTntCart.java | 2 +- .../java/common/entity/item/EntityXp.java | 2 +- .../common/entity/item/EntityXpBottle.java | 2 +- .../common/entity/npc/EntityCultivator.java | 2 +- .../common/entity/npc/EntityDarkMage.java | 4 +- .../common/entity/npc/EntityGargoyle.java | 4 +- .../java/common/entity/npc/EntityHaunter.java | 2 +- .../java/common/entity/npc/EntityNPC.java | 8 +- .../java/common/entity/npc/EntitySlime.java | 2 +- .../java/common/entity/npc/EntityZombie.java | 4 +- .../common/entity/projectile/EntityArrow.java | 4 +- .../entity/projectile/EntityDynamite.java | 2 +- .../common/entity/projectile/EntityEgg.java | 2 +- .../entity/projectile/EntityMissile.java | 2 +- .../entity/projectile/EntityPotion.java | 2 +- .../entity/projectile/EntityProjectile.java | 4 +- .../entity/projectile/EntitySnowball.java | 2 +- .../common/entity/types/EntityAnimal.java | 4 +- .../common/entity/types/EntityLiving.java | 12 +- .../common/entity/types/EntityTameable.java | 2 +- .../common/entity/types/EntityThrowable.java | 2 +- .../common/inventory/ContainerRepair.java | 6 +- .../common/inventory/InventoryHelper.java | 64 ----------- common/src/main/java/common/item/Item.java | 7 +- .../common/item/consumable/ItemPotion.java | 3 +- .../java/common/item/material/ItemArmor.java | 3 +- .../java/common/item/material/ItemBucket.java | 6 +- .../java/common/item/material/ItemDye.java | 12 +- .../item/projectile/ItemChargedOrb.java | 2 +- .../java/common/item/projectile/ItemDie.java | 3 +- .../common/item/projectile/ItemDynamite.java | 3 +- .../java/common/item/projectile/ItemEgg.java | 3 +- .../common/item/projectile/ItemExpBottle.java | 3 +- .../common/item/projectile/ItemFireball.java | 5 +- .../common/item/projectile/ItemSnowball.java | 3 +- .../java/common/item/spawner/ItemBoat.java | 3 +- .../common/item/spawner/ItemMinecart.java | 3 +- .../java/common/item/tool/ItemCamera.java | 2 +- .../main/java/common/item/tool/ItemFire.java | 11 +- .../main/java/common/item/tool/ItemHoe.java | 2 +- .../java/common/item/weapon/ItemArrow.java | 4 +- .../common/tileentity/TileEntityChest.java | 6 +- .../tileentity/TileEntityDispenser.java | 12 +- .../common/tileentity/TileEntityDropper.java | 10 +- common/src/main/java/common/world/Chunk.java | 6 +- .../src/main/java/common/world/Explosion.java | 12 +- common/src/main/java/common/world/World.java | 32 +++--- .../src/main/java/server/network/Player.java | 2 +- .../main/java/server/world/WorldServer.java | 4 +- 102 files changed, 290 insertions(+), 356 deletions(-) delete mode 100755 common/src/main/java/common/inventory/InventoryHelper.java diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 1110af9b..1c6f8292 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -290,30 +290,25 @@ public class Client implements IThreadListener { this.updatePhysics(); } - public boolean spawnEntityInWorld(Entity entityIn) { - boolean flag = super.spawnEntityInWorld(entityIn); - Client.this.spawnEntityInWorld(flag, entityIn); - return flag; - } - - public void removeEntity(Entity entityIn) { - super.removeEntity(entityIn); - Client.this.removeEntity(entityIn); - } - protected void onEntityAdded(Entity entityIn) { - Client.this.onEntityAdded(entityIn); + if(Client.this.spawnQueue.contains(entityIn)) + Client.this.spawnQueue.remove(entityIn); } protected void onEntityRemoved(Entity entityIn) { - Client.this.onEntityRemoved(entityIn); + if(Client.this.entityList.contains(entityIn)) { + if(entityIn.isEntityAlive()) + Client.this.spawnQueue.add(entityIn); + else + Client.this.entityList.remove(entityIn); + } } public Entity getEntityByID(int id) { return id == Client.this.player.getId() ? Client.this.player : super.getEntityByID(id); } - public void playSound(double x, double y, double z, SoundEvent sound, float volume) { + public void clientSound(SoundEvent sound, double x, double y, double z, float volume) { Client.this.getSoundManager().playSound(new PositionedSound(sound, volume, (float)x, (float)y, (float)z)); } @@ -336,11 +331,11 @@ public class Client implements IThreadListener { return allowEmpty || !Client.this.getChunk(x, z).isDummy(); } - public void spawnParticle(ParticleType particle, double xCoord, double yCoord, double zCoord, int data) { + public void clientParticle(ParticleType particle, double xCoord, double yCoord, double zCoord, int data) { Client.this.effectRenderer.spawnParticle(Client.this.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, data); } - public void playAuxSFX(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) { + public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) { if(Client.this.getNetHandler() != null) Client.this.getNetHandler().playAuxSFX(sfxType, blockPosIn, data); } @@ -352,14 +347,14 @@ public class Client implements IThreadListener { Client.this.renderGlobal.markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); } - public void notifyLightSet(BlockPos pos) { + public void clientNotifyLight(BlockPos pos) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); Client.this.renderGlobal.markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); } - public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { + public void clientRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { Client.this.renderGlobal.markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1); } @@ -1629,7 +1624,7 @@ public class Client implements IThreadListener { } this.player.preparePlayerToSpawn(); - world.spawnEntityInWorld(this.player); + this.spawnEntity(this.player); this.viewEntity = this.player; System.gc(); @@ -1645,6 +1640,7 @@ public class Client implements IThreadListener { { i = this.player.getId(); this.world.removeEntity(this.player); + this.entityList.remove(this.player); } this.viewEntity = null; @@ -1653,7 +1649,7 @@ public class Client implements IThreadListener { this.player.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched()); this.viewEntity = this.player; this.player.preparePlayerToSpawn(); - this.world.spawnEntityInWorld(this.player); + this.spawnEntity(this.player); this.player.rotYaw = -180.0F; this.player.setId(i); } @@ -3340,7 +3336,7 @@ public class Client implements IThreadListener { float y = (posY < -32 ? (float)posY - 32.0f : -64.0f) + rand.floatv() * 65.0f; float z = ((float)posZ) + (rand.floatv() - rand.floatv() - 0.5f) * 32.0f; if(y < -64.0f || rand.floatv() >= (64.0f + y) / 64.0f) - this.world.spawnParticle(ParticleType.DEPTH, (double)x, (double)y, (double)z); + this.world.clientParticle(ParticleType.DEPTH, (double)x, (double)y, (double)z); } } } @@ -3519,15 +3515,13 @@ public class Client implements IThreadListener { if (entity != null) { this.world.removeEntity(entity); + this.entityList.remove(entity); } this.entityList.add(entityToSpawn); entityToSpawn.setId(entityID); - if (!this.world.spawnEntityInWorld(entityToSpawn)) - { - this.spawnQueue.add(entityToSpawn); - } + this.spawnEntity(entityToSpawn); this.entityIds.addKey(entityID, entityToSpawn); } @@ -3540,6 +3534,7 @@ public class Client implements IThreadListener { { this.entityList.remove(entity); this.world.removeEntity(entity); + this.entityList.remove(entity); } return entity; @@ -3563,7 +3558,13 @@ public class Client implements IThreadListener { for (int l = 0; l < this.unloaded.size(); ++l) { - this.onEntityRemoved(this.unloaded.get(l)); + Entity entity2 = this.unloaded.get(l); + if(this.entityList.contains(entity2)) { + if(entity2.isEntityAlive()) + this.spawnQueue.add(entity2); + else + this.entityList.remove(entity2); + } } this.unloaded.clear(); @@ -3594,54 +3595,20 @@ public class Client implements IThreadListener { } this.entities.remove(i1--); - this.onEntityRemoved(entity1); + if(this.entityList.contains(entity1)) + Client.this.entityList.remove(entity1); } } } - - private void spawnEntityInWorld(boolean flag, Entity entityIn) - { - this.entityList.add(entityIn); - if (!flag) - { - this.spawnQueue.add(entityIn); - } - else if (entityIn instanceof EntityCart) - { - this.soundManager.playSound(new MovingSoundMinecart((EntityCart)entityIn)); - } - } - - private void removeEntity(Entity entityIn) - { - this.entityList.remove(entityIn); - } - private void onEntityAdded(Entity entityIn) - { - if (this.spawnQueue.contains(entityIn)) - { - this.spawnQueue.remove(entityIn); - } - } - - private void onEntityRemoved(Entity entityIn) - { - boolean flag = false; - - if (this.entityList.contains(entityIn)) - { - if (entityIn.isEntityAlive()) - { - this.spawnQueue.add(entityIn); - flag = true; - } - else - { - this.entityList.remove(entityIn); - } - } - } + private void spawnEntity(Entity entityIn) { + boolean flag = this.world.spawnEntityInWorld(entityIn); + this.entityList.add(entityIn); + if(!flag) + this.spawnQueue.add(entityIn); + else if(entityIn instanceof EntityCart) + this.soundManager.playSound(new MovingSoundMinecart((EntityCart)entityIn)); + } private void ensureAreaLoaded(Entity entity) { int x = ExtMath.floord(entity.posX / 16.0D); diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index 8a25a0e5..3d1f1985 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -1998,7 +1998,7 @@ public class ClientPlayer implements IClientPlayer try { - this.world.spawnParticle(packetIn.getParticleType(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), packetIn.getParticleArg()); + this.world.clientParticle(packetIn.getParticleType(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), packetIn.getParticleArg()); } catch (Throwable var17) { diff --git a/client/src/main/java/client/renderer/EffectRenderer.java b/client/src/main/java/client/renderer/EffectRenderer.java index 06f0cfd9..332de632 100755 --- a/client/src/main/java/client/renderer/EffectRenderer.java +++ b/client/src/main/java/client/renderer/EffectRenderer.java @@ -495,7 +495,7 @@ public class EffectRenderer { float f = (float)this.age / (float)this.lifetime; if(rng.floatv() > f) { - world.spawnParticle(ParticleType.SMOKE, this.posX, this.posY, this.posZ); + world.clientParticle(ParticleType.SMOKE, this.posX, this.posY, this.posZ); } this.motionY -= 0.03D; @@ -888,7 +888,7 @@ public class EffectRenderer { double y = (double)(rng.floatv() * 2.0F - 1.0F); double z = (double)(rng.floatv() * 2.0F - 1.0F); if(x * x + y * y + z * z <= 1.0D) - world.spawnParticle(ParticleType.CRIT, this.entity.posX + x * (double)this.entity.width / 4.0D, + world.clientParticle(ParticleType.CRIT, this.entity.posX + x * (double)this.entity.width / 4.0D, this.entity.getEntityBoundingBox().minY + (double)(this.entity.height / 2.0F) + y * (double)this.entity.height / 4.0D, this.entity.posZ + z * (double)this.entity.width / 4.0D); } @@ -910,7 +910,7 @@ public class EffectRenderer { double x = this.posX + (rng.doublev() - rng.doublev()) * 4.0D; double y = this.posY + (rng.doublev() - rng.doublev()) * 4.0D; double z = this.posZ + (rng.doublev() - rng.doublev()) * 4.0D; - world.spawnParticle(ParticleType.EXPLOSION_LARGE, x, y, z, (int)(100.0f * (float)this.age / (float)this.lifetime)); + world.clientParticle(ParticleType.EXPLOSION_LARGE, x, y, z, (int)(100.0f * (float)this.age / (float)this.lifetime)); } } diff --git a/client/src/main/java/client/renderer/EntityRenderer.java b/client/src/main/java/client/renderer/EntityRenderer.java index 65422715..9b05d830 100755 --- a/client/src/main/java/client/renderer/EntityRenderer.java +++ b/client/src/main/java/client/renderer/EntityRenderer.java @@ -1354,7 +1354,7 @@ public class EntityRenderer { } } if(temp < 194.0f || this.random.chance(8)) - this.gm.world.spawnParticle(temp >= 194.0f && this.random.chance(20) ? ParticleType.LAVA : ParticleType.SMOKE, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4); + this.gm.world.clientParticle(temp >= 194.0f && this.random.chance(20) ? ParticleType.LAVA : ParticleType.SMOKE, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4); } else if (block != Blocks.air) { @@ -1368,7 +1368,7 @@ public class EntityRenderer { d2 = (double)blockpos2.getZ() + d4; } - this.gm.world.spawnParticle(temp <= 5.0f ? ParticleType.HAIL_CORN : ParticleType.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4); + this.gm.world.clientParticle(temp <= 5.0f ? ParticleType.HAIL_CORN : ParticleType.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4); } } } diff --git a/client/src/main/java/client/util/PlayerController.java b/client/src/main/java/client/util/PlayerController.java index 485023ca..2e7639f9 100755 --- a/client/src/main/java/client/util/PlayerController.java +++ b/client/src/main/java/client/util/PlayerController.java @@ -54,7 +54,7 @@ public class PlayerController { return false; } else { - world.playAuxSFX(2001, pos, BlockRegistry.getId(state)); + world.playEffect(2001, pos, BlockRegistry.getId(state)); boolean flag = world.setBlockToAir(pos); if(flag) { diff --git a/common/src/main/java/common/ai/AIFireballAttack.java b/common/src/main/java/common/ai/AIFireballAttack.java index 87a3b8d1..7b17102c 100755 --- a/common/src/main/java/common/ai/AIFireballAttack.java +++ b/common/src/main/java/common/ai/AIFireballAttack.java @@ -55,7 +55,7 @@ public class AIFireballAttack extends EntityAIBase if (this.attackTimer == this.delay) { - world.playAuxSFX(1007, new BlockPos(this.parentEntity), 0); + world.playEffect(1007, new BlockPos(this.parentEntity), 0); this.parentEntity.setItemNoUpdate(0, new ItemStack(Items.orb)); } @@ -68,7 +68,7 @@ public class AIFireballAttack extends EntityAIBase double d2 = target.posX - (this.parentEntity.posX + vec3.xCoord * d1); double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight()); double d4 = target.posZ - (this.parentEntity.posZ + vec3.zCoord * d1); - world.playAuxSFX(1008, new BlockPos(this.parentEntity), 0); + world.playEffect(1008, new BlockPos(this.parentEntity), 0); EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity); // 0.0, 0.0, 0.0); // fireball.setAcceleration(d2 + this.parentEntity.getRNG().gaussian() * 0.1D, diff --git a/common/src/main/java/common/ai/AIFlyingBoxAttack.java b/common/src/main/java/common/ai/AIFlyingBoxAttack.java index 444a1dd8..27e30c73 100755 --- a/common/src/main/java/common/ai/AIFlyingBoxAttack.java +++ b/common/src/main/java/common/ai/AIFlyingBoxAttack.java @@ -75,7 +75,7 @@ public class AIFlyingBoxAttack extends EntityAIBase private void launchBoxToCoords(double x, double y, double z, boolean invulnerable) { this.entity.swingItem(); - this.entity.worldObj.playAuxSFX(1014, new BlockPos(this.entity), 0); + this.entity.worldObj.playEffect(1014, new BlockPos(this.entity), 0); double d0 = this.entity.posX; double d1 = this.entity.posY + this.entity.height + 0.8; double d2 = this.entity.posZ; diff --git a/common/src/main/java/common/ai/AISmallFireballAttack.java b/common/src/main/java/common/ai/AISmallFireballAttack.java index ed9c9b21..e3b1171b 100755 --- a/common/src/main/java/common/ai/AISmallFireballAttack.java +++ b/common/src/main/java/common/ai/AISmallFireballAttack.java @@ -81,7 +81,7 @@ public class AISmallFireballAttack extends EntityAIBase { this.entity.swingItem(); // float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F; - this.entity.worldObj.playAuxSFX(1009, new BlockPos((int)this.entity.posX, (int)this.entity.posY, (int)this.entity.posZ), 0); + this.entity.worldObj.playEffect(1009, new BlockPos((int)this.entity.posX, (int)this.entity.posY, (int)this.entity.posZ), 0); for (int i = 0; i < 1; ++i) { diff --git a/common/src/main/java/common/ai/EntityAIEatGrass.java b/common/src/main/java/common/ai/EntityAIEatGrass.java index bc252230..d773f9de 100755 --- a/common/src/main/java/common/ai/EntityAIEatGrass.java +++ b/common/src/main/java/common/ai/EntityAIEatGrass.java @@ -102,7 +102,7 @@ public class EntityAIEatGrass extends EntityAIBase { if (Vars.mobGrief) { - this.entityWorld.playAuxSFX(2001, blockpos1, BlockRegistry.getId(Blocks.grass.getState())); + this.entityWorld.playEffect(2001, blockpos1, BlockRegistry.getId(Blocks.grass.getState())); this.entityWorld.setState(blockpos1, Blocks.dirt.getState(), 2); } diff --git a/common/src/main/java/common/ai/EntityAIMate.java b/common/src/main/java/common/ai/EntityAIMate.java index 142eb18d..ffc387b9 100755 --- a/common/src/main/java/common/ai/EntityAIMate.java +++ b/common/src/main/java/common/ai/EntityAIMate.java @@ -152,7 +152,7 @@ public class EntityAIMate extends EntityAIBase double d3 = random.doublev() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width; double d4 = 0.5D + random.doublev() * (double)this.theAnimal.height; double d5 = random.doublev() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width; - this.theWorld.spawnParticle(ParticleType.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5); + this.theWorld.clientParticle(ParticleType.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5); } if (entityplayer != null && Vars.breedingXP) // FIX xp diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index 3ef4a3d2..d0206803 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -32,6 +32,7 @@ import common.entity.item.EntityXp; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.Blocks; +import common.inventory.IInventory; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; @@ -334,6 +335,29 @@ public class Block { } } + public static void dropItems(AWorldServer world, BlockPos pos, IInventory inventory) { + for(int n = 0; n < inventory.getSizeInventory(); n++) { + ItemStack stack = inventory.getStackInSlot(n); + if(stack == null) + continue; + double x = (double)pos.getX() + (double)world.rand.floatv() * 0.8F + 0.1F; + double y = (double)pos.getY() + (double)world.rand.floatv() * 0.8F + 0.1F; + double z = (double)pos.getZ() + (double)world.rand.floatv() * 0.8F + 0.1F; + while(!stack.isEmpty()) { + int amount = stack.getSize() > 64 ? stack.getSize() : (world.rand.zrange(21) + 10); + if(amount > stack.getSize()) + amount = stack.getSize(); + stack.decrSize(amount); + EntityItem entity = new EntityItem(world, x, y, z, new ItemStack(stack.getItem(), amount)); + entity.getEntityItem().copyData(stack); + entity.motionX = world.rand.gaussian() * 0.05; + entity.motionY = world.rand.gaussian() * 0.05 + 0.2; + entity.motionZ = world.rand.gaussian() * 0.05; + world.spawnEntityInWorld(entity); + } + } + } + public Block(Material material) { this.miningLevel = (material == Material.SOLID || material == Material.HEAVY) ? 0 : -1; this.axeHarvest = material == Material.WOOD || material == Material.PLANT || material == Material.BUSH || material == Material.SOFT; @@ -972,7 +996,7 @@ public class Block { this.onPlace(world, pos, iblockstate1, player); } - world.playSound(this.getSound().getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F); + world.sendSound(this.getSound().getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F); stack.decrSize(); } @@ -990,7 +1014,7 @@ public class Block { public void onPlace(World world, BlockPos pos, State state, EntityLiving placer) { } - public boolean dispense(World world, TileEntity source, Vec3 position, BlockPos pos, Facing side, ItemStack stack) { + public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos pos, Facing side, ItemStack stack) { return false; } diff --git a/common/src/main/java/common/block/BlockFalling.java b/common/src/main/java/common/block/BlockFalling.java index 15e28c28..acf2897f 100755 --- a/common/src/main/java/common/block/BlockFalling.java +++ b/common/src/main/java/common/block/BlockFalling.java @@ -35,7 +35,7 @@ public class BlockFalling extends Block { this.checkFallable(world, pos); } - private void checkFallable(World world, BlockPos pos) { + private void checkFallable(AWorldServer world, BlockPos pos) { if(canFallInto(world, pos.down()) && pos.getY() >= 0) { int range = 32; if(!fallInstantly && world.isAreaLoaded(pos.add(-range, -range, -range), pos.add(range, range, range))) { diff --git a/common/src/main/java/common/block/artificial/BlockDoor.java b/common/src/main/java/common/block/artificial/BlockDoor.java index d389ed56..0140c2e0 100755 --- a/common/src/main/java/common/block/artificial/BlockDoor.java +++ b/common/src/main/java/common/block/artificial/BlockDoor.java @@ -173,7 +173,7 @@ public class BlockDoor extends Block implements Rotatable { world.setState(lower, bottom.withProperty(OPEN, open), 2); world.setState(upper, top.withProperty(OPEN, open), 2); world.markBlockRangeForRenderUpdate(lower, upper); - world.playAuxSFX(player, open ? 1003 : 1006, pos, 0); + world.playEffect(player, open ? 1003 : 1006, pos, 0); return true; } @@ -188,7 +188,7 @@ public class BlockDoor extends Block implements Rotatable { world.setState(lower, bottom.withProperty(OPEN, open), 2); world.setState(upper, top.withProperty(OPEN, open), 2); world.markBlockRangeForRenderUpdate(lower, upper); - world.playAuxSFX(open ? 1003 : 1006, pos, 0); + world.playEffect(open ? 1003 : 1006, pos, 0); } } } diff --git a/common/src/main/java/common/block/artificial/BlockDragonEgg.java b/common/src/main/java/common/block/artificial/BlockDragonEgg.java index 3ee1842f..6f9af33c 100755 --- a/common/src/main/java/common/block/artificial/BlockDragonEgg.java +++ b/common/src/main/java/common/block/artificial/BlockDragonEgg.java @@ -104,7 +104,7 @@ public class BlockDragonEgg extends Block this.checkFall(worldIn, pos); } - private void checkFall(World worldIn, BlockPos pos) + private void checkFall(AWorldServer worldIn, BlockPos pos) { if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0) { @@ -159,7 +159,7 @@ public class BlockDragonEgg extends Block double d1 = (double)blockpos.getX() + (double)(pos.getX() - blockpos.getX()) * d0 + (worldIn.rand.doublev() - 0.5D) * 1.0D + 0.5D; double d2 = (double)blockpos.getY() + (double)(pos.getY() - blockpos.getY()) * d0 + worldIn.rand.doublev() * 1.0D - 0.5D; double d3 = (double)blockpos.getZ() + (double)(pos.getZ() - blockpos.getZ()) * d0 + (worldIn.rand.doublev() - 0.5D) * 1.0D + 0.5D; - worldIn.spawnParticle(ParticleType.TELEPORT, d1, d2, d3); + worldIn.clientParticle(ParticleType.TELEPORT, d1, d2, d3); } } else diff --git a/common/src/main/java/common/block/artificial/BlockFenceGate.java b/common/src/main/java/common/block/artificial/BlockFenceGate.java index 111ea13b..4b74eb34 100755 --- a/common/src/main/java/common/block/artificial/BlockFenceGate.java +++ b/common/src/main/java/common/block/artificial/BlockFenceGate.java @@ -132,7 +132,7 @@ public class BlockFenceGate extends Block implements Rotatable worldIn.setState(pos, state, 2); } - worldIn.playAuxSFX(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); + worldIn.playEffect(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); return true; } diff --git a/common/src/main/java/common/block/artificial/BlockFloorPortal.java b/common/src/main/java/common/block/artificial/BlockFloorPortal.java index ad0729a1..52c35b81 100755 --- a/common/src/main/java/common/block/artificial/BlockFloorPortal.java +++ b/common/src/main/java/common/block/artificial/BlockFloorPortal.java @@ -96,7 +96,7 @@ public class BlockFloorPortal extends Block double d0 = (double)((float)pos.getX() + rand.floatv()); double d1 = (double)((float)pos.getY() + 0.8F); double d2 = (double)((float)pos.getZ() + rand.floatv()); - worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2); + worldIn.clientParticle(ParticleType.SMOKE, d0, d1, d2); } // /** diff --git a/common/src/main/java/common/block/artificial/BlockPortal.java b/common/src/main/java/common/block/artificial/BlockPortal.java index 1311db00..4e091d25 100755 --- a/common/src/main/java/common/block/artificial/BlockPortal.java +++ b/common/src/main/java/common/block/artificial/BlockPortal.java @@ -247,7 +247,7 @@ public class BlockPortal extends Block d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j; } - worldIn.spawnParticle(ParticleType.TELEPORT, d0, d1, d2); + worldIn.clientParticle(ParticleType.TELEPORT, d0, d1, d2); } } diff --git a/common/src/main/java/common/block/artificial/BlockSlab.java b/common/src/main/java/common/block/artificial/BlockSlab.java index 85bd812e..7119642a 100755 --- a/common/src/main/java/common/block/artificial/BlockSlab.java +++ b/common/src/main/java/common/block/artificial/BlockSlab.java @@ -165,7 +165,7 @@ public class BlockSlab extends Block implements Directional { if(worldIn.canBlockBePlaced(this, pos, false, side, null, stack)) { State place = this.getState().withProperty(BlockSlab.FACING, playerIn.getHorizontalFacing()); if(worldIn.setState(pos, place, 3)) { - worldIn.playSound(this.getSound().getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), + worldIn.sendSound(this.getSound().getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F); stack.decrSize(); } diff --git a/common/src/main/java/common/block/artificial/BlockTrapDoor.java b/common/src/main/java/common/block/artificial/BlockTrapDoor.java index 8b87b5b4..86f5db85 100755 --- a/common/src/main/java/common/block/artificial/BlockTrapDoor.java +++ b/common/src/main/java/common/block/artificial/BlockTrapDoor.java @@ -135,7 +135,7 @@ public class BlockTrapDoor extends Block implements Rotatable return true; state = state.cycleProperty(OPEN); worldIn.setState(pos, state, 2); - worldIn.playAuxSFX(player, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); + worldIn.playEffect(player, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); return true; } diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index 404b9b42..cf5824a6 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -76,7 +76,7 @@ public class BlockMycelium extends Block if (rand.chance(10)) { - worldIn.spawnParticle(ParticleType.SPORE, (double)((float)pos.getX() + rand.floatv()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.floatv())); + worldIn.clientParticle(ParticleType.SPORE, (double)((float)pos.getX() + rand.floatv()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.floatv())); } } diff --git a/common/src/main/java/common/block/liquid/BlockLiquid.java b/common/src/main/java/common/block/liquid/BlockLiquid.java index 0c37deba..fbeb7aa7 100755 --- a/common/src/main/java/common/block/liquid/BlockLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockLiquid.java @@ -250,7 +250,7 @@ public abstract class BlockLiquid extends Block { if (rand.chance(64)) { - worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, SoundEvent.WATER, rand.floatv() * 0.25F + 0.75F); + worldIn.clientSound(SoundEvent.WATER, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, rand.floatv() * 0.25F + 0.75F); } } } @@ -262,13 +262,13 @@ public abstract class BlockLiquid extends Block double d8 = d0 + (double)rand.floatv(); double d4 = d1 + this.maxY; double d6 = d2 + (double)rand.floatv(); - worldIn.spawnParticle(ParticleType.LAVA, d8, d4, d6); - worldIn.playSound(d8, d4, d6, SoundEvent.LAVA_POP, 0.2F + rand.floatv() * 0.2F); + worldIn.clientParticle(ParticleType.LAVA, d8, d4, d6); + worldIn.clientSound(SoundEvent.LAVA_POP, d8, d4, d6, 0.2F + rand.floatv() * 0.2F); } if (rand.chance(200)) { - worldIn.playSound(d0, d1, d2, SoundEvent.LAVA, 0.2F + rand.floatv() * 0.2F); + worldIn.clientSound(SoundEvent.LAVA, d0, d1, d2, 0.2F + rand.floatv() * 0.2F); } } } @@ -337,11 +337,11 @@ public abstract class BlockLiquid extends Block double d0 = (double)pos.getX(); double d1 = (double)pos.getY(); double d2 = (double)pos.getZ(); - worldIn.playSound(SoundEvent.FIZZ, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, 0.5F); + worldIn.sendSound(SoundEvent.FIZZ, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, 0.5F); for (int i = 0; i < 8; ++i) { - worldIn.spawnParticle(ParticleType.SMOKE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random()); + worldIn.clientParticle(ParticleType.SMOKE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random()); } } diff --git a/common/src/main/java/common/block/natural/BlockBedrock.java b/common/src/main/java/common/block/natural/BlockBedrock.java index 6460c1b4..86d2b9f9 100755 --- a/common/src/main/java/common/block/natural/BlockBedrock.java +++ b/common/src/main/java/common/block/natural/BlockBedrock.java @@ -16,7 +16,7 @@ public class BlockBedrock extends Block { public void displayTick(World worldIn, BlockPos pos, State state, Random rand) { if(/* worldIn.canShowVoidParticles() && */ pos.getY() <= 5 && rand.chance(8)) { - worldIn.spawnParticle(ParticleType.DEPTH, (double)pos.getX() + rand.floatv(), (double)(pos.getY()+1) + (rand.floatv() * 0.5f), + worldIn.clientParticle(ParticleType.DEPTH, (double)pos.getX() + rand.floatv(), (double)(pos.getY()+1) + (rand.floatv() * 0.5f), (double)pos.getZ() + rand.floatv()); } } diff --git a/common/src/main/java/common/block/natural/BlockFire.java b/common/src/main/java/common/block/natural/BlockFire.java index 38bbde70..2a558c59 100755 --- a/common/src/main/java/common/block/natural/BlockFire.java +++ b/common/src/main/java/common/block/natural/BlockFire.java @@ -349,7 +349,7 @@ public class BlockFire extends Block { if (rand.chance(24)) { - worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), SoundEvent.FIRE, 1.0F + rand.floatv()); + worldIn.clientSound(SoundEvent.FIRE, (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F + rand.floatv()); } if (!worldIn.isBlockSolid(pos.down()) && !this.canCatchFire(worldIn, pos.down())) @@ -361,7 +361,7 @@ public class BlockFire extends Block double d3 = (double)pos.getX() + rand.doublev() * 0.10000000149011612D; double d8 = (double)pos.getY() + rand.doublev(); double d13 = (double)pos.getZ() + rand.doublev(); - worldIn.spawnParticle(ParticleType.SMOKE, d3, d8, d13); + worldIn.clientParticle(ParticleType.SMOKE, d3, d8, d13); } } @@ -372,7 +372,7 @@ public class BlockFire extends Block double d4 = (double)(pos.getX() + 1) - rand.doublev() * 0.10000000149011612D; double d9 = (double)pos.getY() + rand.doublev(); double d14 = (double)pos.getZ() + rand.doublev(); - worldIn.spawnParticle(ParticleType.SMOKE, d4, d9, d14); + worldIn.clientParticle(ParticleType.SMOKE, d4, d9, d14); } } @@ -383,7 +383,7 @@ public class BlockFire extends Block double d5 = (double)pos.getX() + rand.doublev(); double d10 = (double)pos.getY() + rand.doublev(); double d15 = (double)pos.getZ() + rand.doublev() * 0.10000000149011612D; - worldIn.spawnParticle(ParticleType.SMOKE, d5, d10, d15); + worldIn.clientParticle(ParticleType.SMOKE, d5, d10, d15); } } @@ -394,7 +394,7 @@ public class BlockFire extends Block double d6 = (double)pos.getX() + rand.doublev(); double d11 = (double)pos.getY() + rand.doublev(); double d16 = (double)(pos.getZ() + 1) - rand.doublev() * 0.10000000149011612D; - worldIn.spawnParticle(ParticleType.SMOKE, d6, d11, d16); + worldIn.clientParticle(ParticleType.SMOKE, d6, d11, d16); } } @@ -405,7 +405,7 @@ public class BlockFire extends Block double d7 = (double)pos.getX() + rand.doublev(); double d12 = (double)(pos.getY() + 1) - rand.doublev() * 0.10000000149011612D; double d17 = (double)pos.getZ() + rand.doublev(); - worldIn.spawnParticle(ParticleType.SMOKE, d7, d12, d17); + worldIn.clientParticle(ParticleType.SMOKE, d7, d12, d17); } } } @@ -416,7 +416,7 @@ public class BlockFire extends Block double d0 = (double)pos.getX() + rand.doublev(); double d1 = (double)pos.getY() + rand.doublev() * 0.5D + 0.5D; double d2 = (double)pos.getZ() + rand.doublev(); - worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2); + worldIn.clientParticle(ParticleType.SMOKE, d0, d1, d2); } } } diff --git a/common/src/main/java/common/block/natural/BlockSnow.java b/common/src/main/java/common/block/natural/BlockSnow.java index fa92899d..2b9f6553 100755 --- a/common/src/main/java/common/block/natural/BlockSnow.java +++ b/common/src/main/java/common/block/natural/BlockSnow.java @@ -197,7 +197,7 @@ public class BlockSnow extends Block if (axisalignedbb != null && worldIn.checkNoEntityCollision(axisalignedbb) && worldIn.setState(blockpos, iblockstate1, 2)) { - worldIn.playSound(this.getSound().getPlaceSound(), (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), 1.0F); + worldIn.sendSound(this.getSound().getPlaceSound(), (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), 1.0F); stack.decrSize(); return true; } diff --git a/common/src/main/java/common/block/tech/BlockAnvil.java b/common/src/main/java/common/block/tech/BlockAnvil.java index 44e50ff1..b8e9b679 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -105,7 +105,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable public void onEndFalling(World worldIn, BlockPos pos) { - worldIn.playAuxSFX(1022, pos, 0); + worldIn.playEffect(1022, pos, 0); } public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) diff --git a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java index c2b71bc4..3ba4c0dc 100755 --- a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java @@ -156,11 +156,11 @@ public abstract class BlockBasePressurePlate extends Block if (!flag1 && flag) { - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.3F); } else if (flag1 && !flag) { - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.3F); } if (flag1) diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index 64a408e8..2d2b6001 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -7,7 +7,6 @@ import common.block.ITileEntityProvider; import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; -import common.inventory.InventoryHelper; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; @@ -419,7 +418,7 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider double d0 = (double)((float)pos.getX() + 0.4F + rand.floatv() * 0.2F); double d1 = (double)((float)pos.getY() + 0.7F + rand.floatv() * 0.3F); double d2 = (double)((float)pos.getZ() + 0.4F + rand.floatv() * 0.2F); - worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2); + worldIn.clientParticle(ParticleType.SMOKE, d0, d1, d2); } public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) @@ -428,7 +427,7 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider if (tileentity instanceof TileEntityBrewingStand) { - InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand)tileentity); + dropItems(worldIn, pos, (TileEntityBrewingStand)tileentity); } super.onRemoved(worldIn, pos, state); diff --git a/common/src/main/java/common/block/tech/BlockButton.java b/common/src/main/java/common/block/tech/BlockButton.java index e90ff3d0..e06d27e8 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -188,7 +188,7 @@ public class BlockButton extends Block implements Directional { worldIn.setState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3); worldIn.markBlockRangeForRenderUpdate(pos, pos); - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); if(!worldIn.client) { this.notifyNeighbors((AWorldServer)worldIn, pos, (Facing)state.getValue(FACING)); ((AWorldServer)worldIn).scheduleUpdate(pos, this, this.tickRate(worldIn, null)); @@ -233,7 +233,7 @@ public class BlockButton extends Block implements Directional { worldIn.setState(pos, state.withProperty(POWERED, Boolean.valueOf(false))); this.notifyNeighbors(worldIn, pos, (Facing)state.getValue(FACING)); - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); worldIn.markBlockRangeForRenderUpdate(pos, pos); } } @@ -269,7 +269,7 @@ public class BlockButton extends Block implements Directional worldIn.setState(pos, state.withProperty(POWERED, Boolean.valueOf(true))); this.notifyNeighbors(worldIn, pos, (Facing)state.getValue(FACING)); worldIn.markBlockRangeForRenderUpdate(pos, pos); - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); } if (!flag && flag1) @@ -277,7 +277,7 @@ public class BlockButton extends Block implements Directional worldIn.setState(pos, state.withProperty(POWERED, Boolean.valueOf(false))); this.notifyNeighbors(worldIn, pos, (Facing)state.getValue(FACING)); worldIn.markBlockRangeForRenderUpdate(pos, pos); - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); } if (flag) diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index 6edc3c64..6dc62b96 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -16,7 +16,6 @@ import common.entity.types.EntityLiving; import common.init.Items; import common.init.SoundEvent; import common.inventory.IInventory; -import common.inventory.InventoryHelper; import common.item.CheatTab; import common.item.ItemStack; import common.item.tool.ItemKey; @@ -143,7 +142,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable if (tileentity instanceof IInventory) { - InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity); + dropItems(worldIn, pos, (IInventory)tileentity); } super.onRemoved(worldIn, pos, state); diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index eb6c2c45..0672dfdd 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -7,7 +7,6 @@ import common.block.Material; import common.entity.item.EntityItem; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.inventory.InventoryHelper; import common.item.CheatTab; import common.item.ItemStack; import common.model.Model; @@ -28,7 +27,7 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct { protected Random rand = new Random(); - public static void dispense(World world, double speed, Facing facing, Vec3 position, ItemStack stack) + public static void dispense(AWorldServer world, double speed, Facing facing, Vec3 position, ItemStack stack) { EntityItem entity = new EntityItem(world, position.xCoord, position.yCoord - (facing.getAxis() == Facing.Axis.Y ? 0.125 : 0.15625), position.zCoord, stack); double velo = world.rand.doublev() * 0.1 + 0.2; @@ -145,7 +144,7 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct if (tileentity instanceof TileEntityDispenser) { - InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityDispenser)tileentity); + dropItems(worldIn, pos, (TileEntityDispenser)tileentity); } super.onRemoved(worldIn, pos, state); diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index 6cea0ab8..fab2667e 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -8,7 +8,6 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.Blocks; import common.init.Items; -import common.inventory.InventoryHelper; import common.item.Item; import common.model.Model; import common.model.ModelProvider; @@ -87,23 +86,23 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl switch (enumfacing) { case WEST: - worldIn.spawnParticle(ParticleType.SMOKE, d0 - d3, d1, d2 + d4); - worldIn.spawnParticle(ParticleType.FLAME, d0 - d3, d1, d2 + d4); + worldIn.clientParticle(ParticleType.SMOKE, d0 - d3, d1, d2 + d4); + worldIn.clientParticle(ParticleType.FLAME, d0 - d3, d1, d2 + d4); break; case EAST: - worldIn.spawnParticle(ParticleType.SMOKE, d0 + d3, d1, d2 + d4); - worldIn.spawnParticle(ParticleType.FLAME, d0 + d3, d1, d2 + d4); + worldIn.clientParticle(ParticleType.SMOKE, d0 + d3, d1, d2 + d4); + worldIn.clientParticle(ParticleType.FLAME, d0 + d3, d1, d2 + d4); break; case NORTH: - worldIn.spawnParticle(ParticleType.SMOKE, d0 + d4, d1, d2 - d3); - worldIn.spawnParticle(ParticleType.FLAME, d0 + d4, d1, d2 - d3); + worldIn.clientParticle(ParticleType.SMOKE, d0 + d4, d1, d2 - d3); + worldIn.clientParticle(ParticleType.FLAME, d0 + d4, d1, d2 - d3); break; case SOUTH: - worldIn.spawnParticle(ParticleType.SMOKE, d0 + d4, d1, d2 + d3); - worldIn.spawnParticle(ParticleType.FLAME, d0 + d4, d1, d2 + d3); + worldIn.clientParticle(ParticleType.SMOKE, d0 + d4, d1, d2 + d3); + worldIn.clientParticle(ParticleType.FLAME, d0 + d4, d1, d2 + d3); } } } @@ -179,7 +178,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl if (tileentity instanceof TileEntityFurnace) { - InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityFurnace)tileentity); + dropItems(worldIn, pos, (TileEntityFurnace)tileentity); } } diff --git a/common/src/main/java/common/block/tech/BlockHopper.java b/common/src/main/java/common/block/tech/BlockHopper.java index dacdabde..cd9e6bb7 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -9,7 +9,6 @@ import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.inventory.InventoryHelper; import common.item.CheatTab; import common.model.BlockLayer; import common.model.Model; @@ -156,7 +155,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction if (tileentity instanceof TileEntityHopper) { - InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityHopper)tileentity); + dropItems(worldIn, pos, (TileEntityHopper)tileentity); } super.onRemoved(worldIn, pos, state); diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index 6be4702d..89d5dba4 100755 --- a/common/src/main/java/common/block/tech/BlockLever.java +++ b/common/src/main/java/common/block/tech/BlockLever.java @@ -211,7 +211,7 @@ public class BlockLever extends Block { state = state.cycleProperty(POWERED); worldIn.setState(pos, state, 3); - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F); ((AWorldServer)worldIn).notifyNeighborsOfStateChange(pos, this); Facing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); ((AWorldServer)worldIn).notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this); diff --git a/common/src/main/java/common/block/tech/BlockLitTorch.java b/common/src/main/java/common/block/tech/BlockLitTorch.java index f00dc5e6..bd7ec816 100755 --- a/common/src/main/java/common/block/tech/BlockLitTorch.java +++ b/common/src/main/java/common/block/tech/BlockLitTorch.java @@ -31,7 +31,7 @@ public class BlockLitTorch extends BlockTorch { public void extinguish(AWorldServer worldIn, BlockPos pos, State state, Random rand) { worldIn.setState(pos, this.unlit.getState().withProperty(FACING, state.getValue(FACING)), 3); - worldIn.playSound(SoundEvent.FIZZ, (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), + worldIn.sendSound(SoundEvent.FIZZ, (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 0.5F); for(int i = 0; i < 5; ++i) { double d0 = (double)pos.getX() + rand.doublev() * 0.6D + 0.2D; @@ -65,13 +65,13 @@ public class BlockLitTorch extends BlockTorch { if (enumfacing.getAxis().isHorizontal()) { Facing enumfacing1 = enumfacing.getOpposite(); - worldIn.spawnParticle(ParticleType.SMOKE, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ()); - worldIn.spawnParticle(ParticleType.FLAME, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ()); + worldIn.clientParticle(ParticleType.SMOKE, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ()); + worldIn.clientParticle(ParticleType.FLAME, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ()); } else { - worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2); - worldIn.spawnParticle(ParticleType.FLAME, d0, d1, d2); + worldIn.clientParticle(ParticleType.SMOKE, d0, d1, d2); + worldIn.clientParticle(ParticleType.FLAME, d0, d1, d2); } } else { @@ -88,7 +88,7 @@ public class BlockLitTorch extends BlockTorch { d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ(); } - worldIn.spawnParticle(ParticleType.DUST, d0, d1, d2, this.unlit.getParticleColor()); + worldIn.clientParticle(ParticleType.DUST, d0, d1, d2, this.unlit.getParticleColor()); } } diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index 39146acf..0d917043 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -6,7 +6,6 @@ import common.block.ITileEntityProvider; import common.block.Material; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.inventory.InventoryHelper; import common.item.CheatTab; import common.properties.Property; import common.tileentity.TileEntity; @@ -54,7 +53,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); if(tileentity instanceof Device) { - InventoryHelper.dropInventoryItems(worldIn, pos, (Device)tileentity); + dropItems(worldIn, pos, (Device)tileentity); } super.onRemoved(worldIn, pos, state); } diff --git a/common/src/main/java/common/block/tech/BlockPistonBase.java b/common/src/main/java/common/block/tech/BlockPistonBase.java index 38899e2c..7f8bc918 100755 --- a/common/src/main/java/common/block/tech/BlockPistonBase.java +++ b/common/src/main/java/common/block/tech/BlockPistonBase.java @@ -324,7 +324,7 @@ public class BlockPistonBase extends Block implements Directional } worldIn.setState(pos, state.withProperty(EXTENDED, Boolean.valueOf(true)), 2); - worldIn.playSound(SoundEvent.PISTON_OUT, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F); + worldIn.sendSound(SoundEvent.PISTON_OUT, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F); } } else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue()) @@ -345,7 +345,7 @@ public class BlockPistonBase extends Block implements Directional worldIn.setBlockToAir(pos.offset(enumfacing)); } - worldIn.playSound(SoundEvent.PISTON_IN, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F); + worldIn.sendSound(SoundEvent.PISTON_IN, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.5F); } } diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index 9c9a64bf..636e0fcf 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -23,6 +23,7 @@ import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.Explosion; import common.world.State; import common.world.World; @@ -165,7 +166,7 @@ public class BlockTNT extends Block return TextColor.RED; } - public boolean dispense(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { blockpos = blockpos.offset(facing); EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, this.power); world.spawnEntityInWorld(entitytntprimed); diff --git a/common/src/main/java/common/block/tech/BlockToggleableLight.java b/common/src/main/java/common/block/tech/BlockToggleableLight.java index 7cda9d7a..27c6e865 100755 --- a/common/src/main/java/common/block/tech/BlockToggleableLight.java +++ b/common/src/main/java/common/block/tech/BlockToggleableLight.java @@ -40,7 +40,7 @@ public class BlockToggleableLight extends Block { player.getCurrentEquippedItem().decrSize(); } this.toggle(worldIn, pos); - worldIn.playAuxSFX(player, this.isOn ? 1004 : 1007, pos, 0); + worldIn.playEffect(player, this.isOn ? 1004 : 1007, pos, 0); return true; } diff --git a/common/src/main/java/common/block/tech/BlockTripWireHook.java b/common/src/main/java/common/block/tech/BlockTripWireHook.java index 8c81faf0..3f4775ba 100755 --- a/common/src/main/java/common/block/tech/BlockTripWireHook.java +++ b/common/src/main/java/common/block/tech/BlockTripWireHook.java @@ -232,19 +232,19 @@ public class BlockTripWireHook extends Block implements Rotatable { if (powered && !wasPowered) { - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); } else if (!powered && wasPowered) { - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); } else if (attached && !wasAttached) { - worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); + worldIn.sendSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); } else if (!attached && wasAttached) { - worldIn.playSound(SoundEvent.BOWHIT, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); + worldIn.sendSound(SoundEvent.BOWHIT, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, 0.4F); } } diff --git a/common/src/main/java/common/block/tech/BlockUnlitTorch.java b/common/src/main/java/common/block/tech/BlockUnlitTorch.java index 70ed1736..05f12d50 100644 --- a/common/src/main/java/common/block/tech/BlockUnlitTorch.java +++ b/common/src/main/java/common/block/tech/BlockUnlitTorch.java @@ -33,7 +33,7 @@ public class BlockUnlitTorch extends BlockTorch { if(item == Items.lighter || item == Items.fireball) { worldIn.setState(pos, this.lit.getState().withProperty(FACING, state.getValue(FACING)).withProperty(BlockLitTorch.FUEL, 7), 3); - worldIn.playAuxSFX(playerIn, 1007, pos, 0); + worldIn.playEffect(playerIn, 1007, pos, 0); if(item == Items.lighter) { playerIn.getCurrentEquippedItem().damage(1, playerIn); diff --git a/common/src/main/java/common/block/tech/BlockWarpChest.java b/common/src/main/java/common/block/tech/BlockWarpChest.java index 63dc4e69..52827f4e 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -114,7 +114,7 @@ public class BlockWarpChest extends Block implements Rotatable double d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j; double d1 = (double)((float)pos.getY() + rand.floatv()); double d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k; - worldIn.spawnParticle(ParticleType.TELEPORT, d0, d1, d2); + worldIn.clientParticle(ParticleType.TELEPORT, d0, d1, d2); } } diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index 48d6fe84..771ccb81 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -1007,7 +1007,7 @@ public abstract class Entity { float f2 = (this.rand.floatv() * 2.0F - 1.0F) * this.width; float f3 = (this.rand.floatv() * 2.0F - 1.0F) * this.width; - this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3); + this.worldObj.clientParticle(ParticleType.SPLASH, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3); } if(this.worldObj.getState(new BlockPos(this.posX, this.posY, this.posZ)).getBlock().getMaterial() == Material.WATER) { @@ -1015,7 +1015,7 @@ public abstract class Entity { float f4 = (this.rand.floatv() * 2.0F - 1.0F) * this.width; float f5 = (this.rand.floatv() * 2.0F - 1.0F) * this.width; - this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX + (double)f4, (double)(f1 + 1.0F), this.posZ + (double)f5); + this.worldObj.clientParticle(ParticleType.SPLASH, this.posX + (double)f4, (double)(f1 + 1.0F), this.posZ + (double)f5); } } } @@ -1042,7 +1042,7 @@ public abstract class Entity if (block.getRenderType() != -1) { - this.worldObj.spawnParticle(ParticleType.BLOCK_CRACK, this.posX + ((double)this.rand.floatv() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.floatv() - 0.5D) * (double)this.width, BlockRegistry.getId(iblockstate)); + this.worldObj.clientParticle(ParticleType.BLOCK_CRACK, this.posX + ((double)this.rand.floatv() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.floatv() - 0.5D) * (double)this.width, BlockRegistry.getId(iblockstate)); } } @@ -1639,7 +1639,7 @@ public abstract class Entity */ public EntityItem entityDropItem(ItemStack itemStackIn, float offsetY) { - if (!itemStackIn.isEmpty() && itemStackIn.getItem() != null) + if (!this.worldObj.client && !itemStackIn.isEmpty() && itemStackIn.getItem() != null) { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); entityitem.setDefaultPickupDelay(); diff --git a/common/src/main/java/common/entity/animal/EntityBat.java b/common/src/main/java/common/entity/animal/EntityBat.java index 01c744fc..b061a5b9 100755 --- a/common/src/main/java/common/entity/animal/EntityBat.java +++ b/common/src/main/java/common/entity/animal/EntityBat.java @@ -154,7 +154,7 @@ public class EntityBat extends EntityLiving if (!this.worldObj.getState(blockpos1).getBlock().isNormalCube()) { this.setIsBatHanging(false); - this.worldObj.playAuxSFX(1015, blockpos, 0); + this.worldObj.playEffect(1015, blockpos, 0); } else { @@ -166,7 +166,7 @@ public class EntityBat extends EntityLiving if (this.worldObj.getClosestPlayerToEntity(this, 4.0D) != null) { this.setIsBatHanging(false); - this.worldObj.playAuxSFX(1015, blockpos, 0); + this.worldObj.playEffect(1015, blockpos, 0); } } } diff --git a/common/src/main/java/common/entity/animal/EntityDragon.java b/common/src/main/java/common/entity/animal/EntityDragon.java index 1f0b17cd..51dda853 100755 --- a/common/src/main/java/common/entity/animal/EntityDragon.java +++ b/common/src/main/java/common/entity/animal/EntityDragon.java @@ -109,7 +109,7 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart if (f1 <= -0.3F && f >= -0.3F) // && !this.isSilent()) { - this.worldObj.playSound(this.posX, this.posY, this.posZ, SoundEvent.DRAGON_WINGS, 5.0F); + this.worldObj.clientSound(SoundEvent.DRAGON_WINGS, this.posX, this.posY, this.posZ, 5.0F); } } @@ -120,7 +120,7 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart float f11 = (this.rand.floatv() - 0.5F) * 8.0F; float f13 = (this.rand.floatv() - 0.5F) * 4.0F; float f14 = (this.rand.floatv() - 0.5F) * 8.0F; - this.worldObj.spawnParticle(ParticleType.EXPLOSION_LARGE, this.posX + (double)f11, this.posY + 2.0D + (double)f13, this.posZ + (double)f14, 100); + this.worldObj.clientParticle(ParticleType.EXPLOSION_LARGE, this.posX + (double)f11, this.posY + 2.0D + (double)f13, this.posZ + (double)f14, 100); } else { diff --git a/common/src/main/java/common/entity/animal/EntityHorse.java b/common/src/main/java/common/entity/animal/EntityHorse.java index 2648f7cf..80122bba 100755 --- a/common/src/main/java/common/entity/animal/EntityHorse.java +++ b/common/src/main/java/common/entity/animal/EntityHorse.java @@ -1637,7 +1637,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic for (int i = 0; i < 7; ++i) { - this.worldObj.spawnParticle(enumparticletypes, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(enumparticletypes, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index f55445f6..ba761f01 100755 --- a/common/src/main/java/common/entity/animal/EntityRabbit.java +++ b/common/src/main/java/common/entity/animal/EntityRabbit.java @@ -329,7 +329,7 @@ public class EntityRabbit extends EntityAnimal { } protected void consumeBlock(BlockPos pos, State state) { - this.worldObj.playAuxSFX(2001, pos, BlockRegistry.getId(state)); + this.worldObj.playEffect(2001, pos, BlockRegistry.getId(state)); this.foodCooldown = this.rand.excl(10, this.isChild() ? 20 : 50); if(this.isChild()) this.grow(this.rand.range(250, 350)); diff --git a/common/src/main/java/common/entity/animal/EntityWolf.java b/common/src/main/java/common/entity/animal/EntityWolf.java index e6e709e2..e4eeed04 100755 --- a/common/src/main/java/common/entity/animal/EntityWolf.java +++ b/common/src/main/java/common/entity/animal/EntityWolf.java @@ -249,7 +249,7 @@ public class EntityWolf extends EntityTameable { float f1 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F; float f2 = (this.rand.floatv() * 2.0F - 1.0F) * this.width * 0.5F; - this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2); + this.worldObj.clientParticle(ParticleType.SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2); } } } diff --git a/common/src/main/java/common/entity/effect/EntityLightning.java b/common/src/main/java/common/entity/effect/EntityLightning.java index 0e52f398..04d51878 100755 --- a/common/src/main/java/common/entity/effect/EntityLightning.java +++ b/common/src/main/java/common/entity/effect/EntityLightning.java @@ -45,8 +45,8 @@ public class EntityLightning extends EntityWeatherEffect if (this.lightningState == 2) { - this.worldObj.playSound(SoundEvent.THUNDER, this.posX, this.posY, this.posZ, 10000.0F); - this.worldObj.playSound(SoundEvent.EXPLODE, this.posX, this.posY, this.posZ, 2.0F); + this.worldObj.sendSound(SoundEvent.THUNDER, this.posX, this.posY, this.posZ, 10000.0F); + this.worldObj.sendSound(SoundEvent.EXPLODE, this.posX, this.posY, this.posZ, 2.0F); } --this.lightningState; diff --git a/common/src/main/java/common/entity/item/EntityBoat.java b/common/src/main/java/common/entity/item/EntityBoat.java index 37c0b3fc..8a8d8264 100755 --- a/common/src/main/java/common/entity/item/EntityBoat.java +++ b/common/src/main/java/common/entity/item/EntityBoat.java @@ -279,13 +279,13 @@ public class EntityBoat extends Entity { double d7 = this.posX - d2 * d5 * 0.8D + d4 * d6; double d8 = this.posZ - d4 * d5 * 0.8D - d2 * d6; - this.worldObj.spawnParticle(ParticleType.SPLASH, d7, this.posY - 0.125D, d8); + this.worldObj.clientParticle(ParticleType.SPLASH, d7, this.posY - 0.125D, d8); } else { double d24 = this.posX + d2 + d4 * d5 * 0.7D; double d25 = this.posZ + d4 - d2 * d5 * 0.7D; - this.worldObj.spawnParticle(ParticleType.SPLASH, d24, this.posY - 0.125D, d25); + this.worldObj.clientParticle(ParticleType.SPLASH, d24, this.posY - 0.125D, d25); } } } diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index 0e7b393f..5ca062d6 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -70,7 +70,7 @@ public class EntityItem extends Entity ((AWorldServer)this.worldObj).spawnParticles(ParticleType.ITEM_CRACK, this.posX + this.rand.drange(-0.15, 0.15), this.posY + 0.15, this.posZ + this.rand.drange(-0.15, 0.15), ItemRegistry.getId(this.getEntityItem().getItem())); } - this.worldObj.playAuxSFX(1023, this.getPosition(), 0); + this.worldObj.playEffect(1023, this.getPosition(), 0); this.setDead(); } } diff --git a/common/src/main/java/common/entity/item/EntityNuke.java b/common/src/main/java/common/entity/item/EntityNuke.java index 8ca8bd87..85bd5bf5 100755 --- a/common/src/main/java/common/entity/item/EntityNuke.java +++ b/common/src/main/java/common/entity/item/EntityNuke.java @@ -82,7 +82,7 @@ public class EntityNuke extends Entity { this.handleWaterMovement(); // if(!this.isInvisible()) { - this.worldObj.spawnParticle(ParticleType.FLAME, this.posX, this.posY + 1.1D, this.posZ); + this.worldObj.clientParticle(ParticleType.FLAME, this.posX, this.posY + 1.1D, this.posZ); // } } } diff --git a/common/src/main/java/common/entity/item/EntityOrb.java b/common/src/main/java/common/entity/item/EntityOrb.java index d9f2d561..54945d3a 100755 --- a/common/src/main/java/common/entity/item/EntityOrb.java +++ b/common/src/main/java/common/entity/item/EntityOrb.java @@ -64,7 +64,7 @@ public class EntityOrb extends EntityThrowable for (int i = 0; i < 32; ++i) { - this.worldObj.spawnParticle(ParticleType.TELEPORT, this.posX - 0.25 + this.rand.doublev() * 0.5, this.posY + this.rand.doublev() * 2.0D, this.posZ - 0.25 + this.rand.doublev() * 0.5); + this.worldObj.clientParticle(ParticleType.TELEPORT, this.posX - 0.25 + this.rand.doublev() * 0.5, this.posY + this.rand.doublev() * 2.0D, this.posZ - 0.25 + this.rand.doublev() * 0.5); } if (!this.worldObj.client) @@ -72,7 +72,7 @@ public class EntityOrb extends EntityThrowable // if(entitylivingbase != null) if (entitylivingbase != null) // && entitylivingbase.isPlayer()) { - this.worldObj.playAuxSFX(1013, entitylivingbase.getPosition(), 0); + this.worldObj.playEffect(1013, entitylivingbase.getPosition(), 0); // EntityNPCMP entityplayermp = (EntityNPCMP)entitylivingbase; if (/* entityplayermp.netHandler.connection.isChannelOpen() && */ entitylivingbase.worldObj == this.worldObj) // && !entityplayermp.isPlayerSleeping()) @@ -104,7 +104,7 @@ public class EntityOrb extends EntityThrowable this.setDead(); if(entitylivingbase != null) - this.worldObj.playAuxSFX(1005, entitylivingbase.getPosition(), 0); + this.worldObj.playEffect(1005, entitylivingbase.getPosition(), 0); } if (pos.entity != null) @@ -112,7 +112,7 @@ public class EntityOrb extends EntityThrowable if(Vars.telefrag) { pos.entity.attackEntityFrom(DamageSource.causeTeleFragDamage(this, entitylivingbase), 10000); if(!this.worldObj.client) - this.worldObj.playAuxSFX(1017, pos.entity.getPosition(), 0); + this.worldObj.playEffect(1017, pos.entity.getPosition(), 0); } else if(Vars.knockOrb) { pos.entity.attackEntityFrom(DamageSource.causeThrownDamage(this, entitylivingbase), Vars.orbDamageOther); diff --git a/common/src/main/java/common/entity/item/EntityTnt.java b/common/src/main/java/common/entity/item/EntityTnt.java index 4d3be91f..655d0718 100755 --- a/common/src/main/java/common/entity/item/EntityTnt.java +++ b/common/src/main/java/common/entity/item/EntityTnt.java @@ -96,7 +96,7 @@ public class EntityTnt extends Entity implements IObjectData else { this.handleWaterMovement(); - this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX, this.posY + 0.5D, this.posZ); + this.worldObj.clientParticle(ParticleType.SMOKE, this.posX, this.posY + 0.5D, this.posZ); } } diff --git a/common/src/main/java/common/entity/item/EntityTntCart.java b/common/src/main/java/common/entity/item/EntityTntCart.java index 5c956ae1..dc99ded6 100755 --- a/common/src/main/java/common/entity/item/EntityTntCart.java +++ b/common/src/main/java/common/entity/item/EntityTntCart.java @@ -52,7 +52,7 @@ public class EntityTntCart extends EntityCart if (this.minecartTNTFuse > 0) { --this.minecartTNTFuse; - this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX, this.posY + 0.5D, this.posZ); + this.worldObj.clientParticle(ParticleType.SMOKE, this.posX, this.posY + 0.5D, this.posZ); } else if (this.minecartTNTFuse == 0) { diff --git a/common/src/main/java/common/entity/item/EntityXp.java b/common/src/main/java/common/entity/item/EntityXp.java index 6ceeb0fa..b4cb1d26 100755 --- a/common/src/main/java/common/entity/item/EntityXp.java +++ b/common/src/main/java/common/entity/item/EntityXp.java @@ -337,7 +337,7 @@ public class EntityXp extends Entity implements IObjectData this.xpValue = id; for (int i = 0; i < 2; i++) { - this.worldObj.spawnParticle(ParticleType.GROW, + this.worldObj.clientParticle(ParticleType.GROW, this.posX + (double)(this.rand.floatv() * this.width) - (double)this.width * 0.5, this.posY + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width) - (double)this.width * 0.5); diff --git a/common/src/main/java/common/entity/item/EntityXpBottle.java b/common/src/main/java/common/entity/item/EntityXpBottle.java index fdef911e..14ccf806 100755 --- a/common/src/main/java/common/entity/item/EntityXpBottle.java +++ b/common/src/main/java/common/entity/item/EntityXpBottle.java @@ -48,7 +48,7 @@ public class EntityXpBottle extends EntityThrowable { if (!this.worldObj.client) { - this.worldObj.playAuxSFX(2002, new BlockPos(this), 0); + this.worldObj.playEffect(2002, new BlockPos(this), 0); int i = this.worldObj.rand.rangeBonus(3, 7, 4); while (i > 0) diff --git a/common/src/main/java/common/entity/npc/EntityCultivator.java b/common/src/main/java/common/entity/npc/EntityCultivator.java index 2376c0a5..5d2e0707 100755 --- a/common/src/main/java/common/entity/npc/EntityCultivator.java +++ b/common/src/main/java/common/entity/npc/EntityCultivator.java @@ -32,7 +32,7 @@ public class EntityCultivator extends EntityNPC { if(EntityCultivator.this.rand.chance(100) && EntityCultivator.this.getHeldItem() != null && EntityCultivator.this.getHeldItem().getItem() == Items.camera) { EntityCultivator.this.swingItem(); - EntityCultivator.this.worldObj.playAuxSFX(1024, new BlockPos(EntityCultivator.this.posX, + EntityCultivator.this.worldObj.playEffect(1024, new BlockPos(EntityCultivator.this.posX, EntityCultivator.this.posY + EntityCultivator.this.getEyeHeight(), EntityCultivator.this.posZ), 0); } } diff --git a/common/src/main/java/common/entity/npc/EntityDarkMage.java b/common/src/main/java/common/entity/npc/EntityDarkMage.java index 1e6ffbc5..16eb7e2b 100755 --- a/common/src/main/java/common/entity/npc/EntityDarkMage.java +++ b/common/src/main/java/common/entity/npc/EntityDarkMage.java @@ -84,11 +84,11 @@ public class EntityDarkMage extends EntityHoveringNPC { { if(this.worldObj.client && this.isAttacking()) { if(this.rand.chance(24)) { // && !this.isSilent()) { - this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, SoundEvent.FIRE, + this.worldObj.clientSound(SoundEvent.FIRE, this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, 1.0F + this.rand.floatv()); } for(int i = 0; i < 2; ++i) { - this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX + (this.rand.doublev() - 0.5D) * (double)this.width, + this.worldObj.clientParticle(ParticleType.SMOKE, this.posX + (this.rand.doublev() - 0.5D) * (double)this.width, this.posY + this.rand.doublev() * (double)this.height, this.posZ + (this.rand.doublev() - 0.5D) * (double)this.width); } diff --git a/common/src/main/java/common/entity/npc/EntityGargoyle.java b/common/src/main/java/common/entity/npc/EntityGargoyle.java index adfd2f88..a72eb1cd 100755 --- a/common/src/main/java/common/entity/npc/EntityGargoyle.java +++ b/common/src/main/java/common/entity/npc/EntityGargoyle.java @@ -88,14 +88,14 @@ public class EntityGargoyle extends EntityFlyingNPC for (int l = 0; l < 5; ++l) { - this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX + this.rand.gaussian() * 0.30000001192092896D, this.posY + this.height + this.rand.gaussian() * 0.30000001192092896D, this.posZ + this.rand.gaussian() * 0.30000001192092896D); + this.worldObj.clientParticle(ParticleType.SMOKE, this.posX + this.rand.gaussian() * 0.30000001192092896D, this.posY + this.height + this.rand.gaussian() * 0.30000001192092896D, this.posZ + this.rand.gaussian() * 0.30000001192092896D); } if (this.getInvulTime() > 0) { for (int i1 = 0; i1 < 3; ++i1) { - this.worldObj.spawnParticle(ParticleType.CRIT, this.posX + this.rand.gaussian() * 1.0D, this.posY + (double)(this.rand.floatv() * 3.3F), this.posZ + this.rand.gaussian() * 1.0D); + this.worldObj.clientParticle(ParticleType.CRIT, this.posX + this.rand.gaussian() * 1.0D, this.posY + (double)(this.rand.floatv() * 3.3F), this.posZ + this.rand.gaussian() * 1.0D); } } } diff --git a/common/src/main/java/common/entity/npc/EntityHaunter.java b/common/src/main/java/common/entity/npc/EntityHaunter.java index f3a50e0a..afb1304b 100755 --- a/common/src/main/java/common/entity/npc/EntityHaunter.java +++ b/common/src/main/java/common/entity/npc/EntityHaunter.java @@ -231,7 +231,7 @@ public class EntityHaunter extends EntityNPC { if (itemstack != null && itemstack.getItem() == Items.lighter) { - this.worldObj.playSound(SoundEvent.IGNITE, this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, 1.0F); + this.worldObj.sendSound(SoundEvent.IGNITE, this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, 1.0F); player.swingItem(); if (!this.worldObj.client) diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index f6d076c1..b7a5265c 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -617,7 +617,7 @@ public abstract class EntityNPC extends EntityLiving if (this.inLove == 10) { this.inLove = 0; - this.worldObj.spawnParticle(ParticleType.HEART, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(ParticleType.HEART, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } else { @@ -1227,14 +1227,14 @@ public abstract class EntityNPC extends EntityLiving return false; } else { - this.worldObj.playAuxSFX(1013, new BlockPos(ox, oy, oz), 0); + this.worldObj.playEffect(1013, new BlockPos(ox, oy, oz), 0); for(int n = 0; n < 8; n++) { ((AWorldServer)this.worldObj).spawnParticles(ParticleType.TELEPORT, ox + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, oy + this.rand.doublev() * (double)this.height, oz + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D); } - this.worldObj.playAuxSFX(1005, this.getPosition(), 0); + this.worldObj.playEffect(1005, this.getPosition(), 0); for(int n = 0; n < 8; n++) { ((AWorldServer)this.worldObj).spawnParticles(ParticleType.TELEPORT, this.posX + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, @@ -2074,7 +2074,7 @@ public abstract class EntityNPC extends EntityLiving if(this.connection != null) this.connection.playSound(name, volume); else if(this.client != null) - this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume); + this.worldObj.clientSound(name, this.posX, this.posY, this.posZ, volume); else if(!this.slave) super.playSound(name, volume); } diff --git a/common/src/main/java/common/entity/npc/EntitySlime.java b/common/src/main/java/common/entity/npc/EntitySlime.java index 7cee9f60..997ce449 100755 --- a/common/src/main/java/common/entity/npc/EntitySlime.java +++ b/common/src/main/java/common/entity/npc/EntitySlime.java @@ -180,7 +180,7 @@ public class EntitySlime extends EntityNPC World world = this.worldObj; double d0 = this.posX + (double)f2; double d1 = this.posZ + (double)f3; - world.spawnParticle(ParticleType.ITEM_CRACK, d0, this.getEntityBoundingBox().minY, d1, ItemRegistry.getId(Items.slime_ball)); + world.clientParticle(ParticleType.ITEM_CRACK, d0, this.getEntityBoundingBox().minY, d1, ItemRegistry.getId(Items.slime_ball)); } // if (!this.isChild()) diff --git a/common/src/main/java/common/entity/npc/EntityZombie.java b/common/src/main/java/common/entity/npc/EntityZombie.java index 35801ea7..896a5012 100755 --- a/common/src/main/java/common/entity/npc/EntityZombie.java +++ b/common/src/main/java/common/entity/npc/EntityZombie.java @@ -53,7 +53,7 @@ public class EntityZombie extends EntityNPC entitylivingbase = (EntityLiving)source.getEntity(); } - if (entitylivingbase != null && Vars.mobs && Vars.spawnMoreZombie > 0 && this.rand.chance(Vars.spawnMoreZombie)) + if (!this.worldObj.client && entitylivingbase != null && Vars.mobs && Vars.spawnMoreZombie > 0 && this.rand.chance(Vars.spawnMoreZombie)) { int i = ExtMath.floord(this.posX); int j = ExtMath.floord(this.posY); @@ -169,7 +169,7 @@ public class EntityZombie extends EntityNPC } this.worldObj.spawnEntityInWorld(entityzombie); - this.worldObj.playAuxSFX(1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0); + this.worldObj.playEffect(1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0); } } diff --git a/common/src/main/java/common/entity/projectile/EntityArrow.java b/common/src/main/java/common/entity/projectile/EntityArrow.java index 64f8554b..2db98436 100755 --- a/common/src/main/java/common/entity/projectile/EntityArrow.java +++ b/common/src/main/java/common/entity/projectile/EntityArrow.java @@ -404,7 +404,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData { for (int k = 0; k < 4; ++k) { - this.worldObj.spawnParticle(ParticleType.CRIT, this.posX + this.motionX * (double)k / 4.0D, this.posY + this.motionY * (double)k / 4.0D, this.posZ + this.motionZ * (double)k / 4.0D); + this.worldObj.clientParticle(ParticleType.CRIT, this.posX + this.motionX * (double)k / 4.0D, this.posY + this.motionY * (double)k / 4.0D, this.posZ + this.motionZ * (double)k / 4.0D); } } @@ -444,7 +444,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData for (int i1 = 0; i1 < 4; ++i1) { float f8 = 0.25F; - this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f8, this.posY - this.motionY * (double)f8, this.posZ - this.motionZ * (double)f8); + this.worldObj.clientParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f8, this.posY - this.motionY * (double)f8, this.posZ - this.motionZ * (double)f8); } f4 = 0.6F; diff --git a/common/src/main/java/common/entity/projectile/EntityDynamite.java b/common/src/main/java/common/entity/projectile/EntityDynamite.java index 7fe42119..05a2b841 100755 --- a/common/src/main/java/common/entity/projectile/EntityDynamite.java +++ b/common/src/main/java/common/entity/projectile/EntityDynamite.java @@ -49,7 +49,7 @@ public class EntityDynamite extends EntityThrowable implements IObjectData for (int k = 0; k < 8; ++k) { - this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ItemRegistry.getId(ItemRegistry.byName("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize)))); + this.worldObj.clientParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ItemRegistry.getId(ItemRegistry.byName("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize)))); } if (!this.worldObj.client) diff --git a/common/src/main/java/common/entity/projectile/EntityEgg.java b/common/src/main/java/common/entity/projectile/EntityEgg.java index 9b5f3d27..1ed0ee24 100755 --- a/common/src/main/java/common/entity/projectile/EntityEgg.java +++ b/common/src/main/java/common/entity/projectile/EntityEgg.java @@ -60,7 +60,7 @@ public class EntityEgg extends EntityThrowable for (int k = 0; k < 8; ++k) { - this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ItemRegistry.getId(Items.egg)); + this.worldObj.clientParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ItemRegistry.getId(Items.egg)); } if (!this.worldObj.client) diff --git a/common/src/main/java/common/entity/projectile/EntityMissile.java b/common/src/main/java/common/entity/projectile/EntityMissile.java index 95423105..72810bf0 100755 --- a/common/src/main/java/common/entity/projectile/EntityMissile.java +++ b/common/src/main/java/common/entity/projectile/EntityMissile.java @@ -39,7 +39,7 @@ public class EntityMissile extends EntityBullet { public void onUpdate() { super.onUpdate(); if(this.worldObj.client && this.age % 2 < 2) - this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX, this.posY, this.posZ); + this.worldObj.clientParticle(ParticleType.SMOKE, this.posX, this.posY, this.posZ); if(!this.worldObj.client && this.age > this.fuse) this.explode(); } diff --git a/common/src/main/java/common/entity/projectile/EntityPotion.java b/common/src/main/java/common/entity/projectile/EntityPotion.java index 5ab29306..f2f1e035 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -141,7 +141,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData } } - this.worldObj.playAuxSFX(2002, new BlockPos(this), ItemRegistry.getId(this.getPotionDamage())); + this.worldObj.playEffect(2002, new BlockPos(this), ItemRegistry.getId(this.getPotionDamage())); this.setDead(); } } diff --git a/common/src/main/java/common/entity/projectile/EntityProjectile.java b/common/src/main/java/common/entity/projectile/EntityProjectile.java index 35abdcbe..84d40812 100755 --- a/common/src/main/java/common/entity/projectile/EntityProjectile.java +++ b/common/src/main/java/common/entity/projectile/EntityProjectile.java @@ -214,7 +214,7 @@ public abstract class EntityProjectile extends Entity for (int j = 0; j < 4; ++j) { float f3 = 0.25F; - this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3); + this.worldObj.clientParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3); } f2 = 0.8F; @@ -226,7 +226,7 @@ public abstract class EntityProjectile extends Entity this.motionX *= (double)f2; this.motionY *= (double)f2; this.motionZ *= (double)f2; - this.worldObj.spawnParticle(ParticleType.SMOKE, this.posX, this.posY + 0.5D, this.posZ); + this.worldObj.clientParticle(ParticleType.SMOKE, this.posX, this.posY + 0.5D, this.posZ); this.setPosition(this.posX, this.posY, this.posZ); } else diff --git a/common/src/main/java/common/entity/projectile/EntitySnowball.java b/common/src/main/java/common/entity/projectile/EntitySnowball.java index ea808860..73adc9b1 100755 --- a/common/src/main/java/common/entity/projectile/EntitySnowball.java +++ b/common/src/main/java/common/entity/projectile/EntitySnowball.java @@ -47,7 +47,7 @@ public class EntitySnowball extends EntityThrowable for (int j = 0; j < 8; ++j) { - this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ItemRegistry.getId(Items.snowball)); + this.worldObj.clientParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ItemRegistry.getId(Items.snowball)); } if (!this.worldObj.client) diff --git a/common/src/main/java/common/entity/types/EntityAnimal.java b/common/src/main/java/common/entity/types/EntityAnimal.java index 515979e3..a0b5beed 100755 --- a/common/src/main/java/common/entity/types/EntityAnimal.java +++ b/common/src/main/java/common/entity/types/EntityAnimal.java @@ -67,7 +67,7 @@ public abstract class EntityAnimal extends EntityLiving if (this.inLove == 10) { this.inLove = 0; - this.worldObj.spawnParticle(ParticleType.HEART, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(ParticleType.HEART, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } } @@ -239,7 +239,7 @@ public abstract class EntityAnimal extends EntityLiving { for (int i = 0; i < 7; ++i) { - this.worldObj.spawnParticle(ParticleType.HEART, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(ParticleType.HEART, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } else diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 83f50957..c8b15c5e 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -434,7 +434,7 @@ public abstract class EntityLiving extends Entity for (int k = 0; k < 20; ++k) { - this.worldObj.spawnParticle(ParticleType.EXPLOSION_NORMAL, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(ParticleType.EXPLOSION_NORMAL, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } } @@ -969,7 +969,7 @@ public abstract class EntityLiving extends Entity vec31 = vec31.rotatePitch(-this.rotPitch * (float)Math.PI / 180.0F); vec31 = vec31.rotateYaw(-this.rotYaw * (float)Math.PI / 180.0F); vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); - this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, ItemRegistry.getId(stack.getItem())); + this.worldObj.clientParticle(ParticleType.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, ItemRegistry.getId(stack.getItem())); } } @@ -985,7 +985,7 @@ public abstract class EntityLiving extends Entity } Entity entity = cause.getEntity(); - if (entity != null) + if (entity != null && !this.worldObj.client) { entity.onKillEntity(this); } @@ -1971,7 +1971,7 @@ public abstract class EntityLiving extends Entity { if (this.particleTimer % 4 == 0) { - this.worldObj.spawnParticle(ParticleType.GROW, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(ParticleType.GROW, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } --this.particleTimer; @@ -2476,7 +2476,7 @@ public abstract class EntityLiving extends Entity double d1 = this.rand.gaussian() * 0.02D; double d2 = this.rand.gaussian() * 0.02D; double d3 = 10.0D; - this.worldObj.spawnParticle(ParticleType.EXPLOSION_NORMAL, + this.worldObj.clientParticle(ParticleType.EXPLOSION_NORMAL, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width - d0 * d3, this.posY + (double)(this.rand.floatv() * this.height) - d1 * d3, this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width - d2 * d3); @@ -3033,7 +3033,7 @@ public abstract class EntityLiving extends Entity { for (int i = 0; i < 5; ++i) { - this.worldObj.spawnParticle(particleType, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 1.0D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(particleType, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 1.0D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } diff --git a/common/src/main/java/common/entity/types/EntityTameable.java b/common/src/main/java/common/entity/types/EntityTameable.java index 0aa1eb69..7e81eedc 100755 --- a/common/src/main/java/common/entity/types/EntityTameable.java +++ b/common/src/main/java/common/entity/types/EntityTameable.java @@ -74,7 +74,7 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna for (int i = 0; i < 7; ++i) { - this.worldObj.spawnParticle(enumparticletypes, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); + this.worldObj.clientParticle(enumparticletypes, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width); } } diff --git a/common/src/main/java/common/entity/types/EntityThrowable.java b/common/src/main/java/common/entity/types/EntityThrowable.java index a2ae3133..1f226dd2 100755 --- a/common/src/main/java/common/entity/types/EntityThrowable.java +++ b/common/src/main/java/common/entity/types/EntityThrowable.java @@ -275,7 +275,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile for (int i = 0; i < 4; ++i) { float f4 = 0.25F; - this.worldObj.spawnParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4); + this.worldObj.clientParticle(ParticleType.SPLASH, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4); } f2 = 0.8F; diff --git a/common/src/main/java/common/inventory/ContainerRepair.java b/common/src/main/java/common/inventory/ContainerRepair.java index 923313d9..6a3c61d7 100755 --- a/common/src/main/java/common/inventory/ContainerRepair.java +++ b/common/src/main/java/common/inventory/ContainerRepair.java @@ -102,17 +102,17 @@ public class ContainerRepair extends Container if (l >= BlockAnvil.ANVILS.length) { worldIn.setBlockToAir(blockPosIn); - worldIn.playAuxSFX(1020, blockPosIn, 0); + worldIn.playEffect(1020, blockPosIn, 0); } else { worldIn.setState(blockPosIn, BlockAnvil.getByDamage(l).getState().withProperty(BlockAnvil.FACING, iblockstate.getValue(BlockAnvil.FACING)), 2); - worldIn.playAuxSFX(1021, blockPosIn, 0); + worldIn.playEffect(1021, blockPosIn, 0); } } else if (!worldIn.client) { - worldIn.playAuxSFX(1021, blockPosIn, 0); + worldIn.playEffect(1021, blockPosIn, 0); } } diff --git a/common/src/main/java/common/inventory/InventoryHelper.java b/common/src/main/java/common/inventory/InventoryHelper.java deleted file mode 100755 index 0d2d1f04..00000000 --- a/common/src/main/java/common/inventory/InventoryHelper.java +++ /dev/null @@ -1,64 +0,0 @@ -package common.inventory; - -import common.entity.Entity; -import common.entity.item.EntityItem; -import common.item.ItemStack; -import common.rng.Random; -import common.util.BlockPos; -import common.world.World; - -public class InventoryHelper -{ - private static final Random RANDOM = new Random(); - - public static void dropInventoryItems(World worldIn, BlockPos pos, IInventory inventory) - { - dropInventoryItems(worldIn, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), inventory); - } - - public static void dropInventoryItems(World worldIn, Entity entityAt, IInventory inventory) - { - dropInventoryItems(worldIn, entityAt.posX, entityAt.posY, entityAt.posZ, inventory); - } - - private static void dropInventoryItems(World worldIn, double x, double y, double z, IInventory inventory) - { - for (int i = 0; i < inventory.getSizeInventory(); ++i) - { - ItemStack itemstack = inventory.getStackInSlot(i); - - if (itemstack != null) - { - spawnItemStack(worldIn, x, y, z, itemstack); - } - } - } - - private static void spawnItemStack(World worldIn, double x, double y, double z, ItemStack stack) // fixed: large sizes - { - float f = RANDOM.floatv() * 0.8F + 0.1F; - float f1 = RANDOM.floatv() * 0.8F + 0.1F; - float f2 = RANDOM.floatv() * 0.8F + 0.1F; - - while (!stack.isEmpty()) - { - int i = stack.getSize() > 64 ? stack.getSize() : (RANDOM.zrange(21) + 10); - - if (i > stack.getSize()) - { - i = stack.getSize(); - } - - stack.decrSize(i); - EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i)); - - entityitem.getEntityItem().copyData(stack); - - float f3 = 0.05F; - entityitem.motionX = RANDOM.gaussian() * (double)f3; - entityitem.motionY = RANDOM.gaussian() * (double)f3 + 0.20000000298023224D; - entityitem.motionZ = RANDOM.gaussian() * (double)f3; - worldIn.spawnEntityInWorld(entityitem); - } - } -} diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index 5e5a0ed3..0b44741b 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -20,6 +20,7 @@ import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class Item { @@ -171,11 +172,11 @@ public class Item { return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } - protected final ItemStack dispenseProjectile(World world, Facing facing, ItemStack stack, IProjectile entity) { + protected final ItemStack dispenseProjectile(AWorldServer world, Facing facing, ItemStack stack, IProjectile entity) { return this.dispenseProjectile(world, facing, stack, entity, 1.1f, 6.0f); } - protected final ItemStack dispenseProjectile(World world, Facing facing, ItemStack stack, IProjectile entity, float velocity, float inaccuracy) { + protected final ItemStack dispenseProjectile(AWorldServer world, Facing facing, ItemStack stack, IProjectile entity, float velocity, float inaccuracy) { entity.setThrowableHeading((double)facing.getFrontOffsetX(), (double)((float)facing.getFrontOffsetY() + 0.1F), (double)facing.getFrontOffsetZ(), velocity, inaccuracy); world.spawnEntityInWorld((Entity)entity); @@ -317,7 +318,7 @@ public class Item { return null; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { if(this.block == null || !this.block.dispense(world, source, position, blockpos, facing, stack)) BlockDispenser.dispense(world, 6.0, facing, position, stack.split(1)); return stack; diff --git a/common/src/main/java/common/item/consumable/ItemPotion.java b/common/src/main/java/common/item/consumable/ItemPotion.java index 821a8589..23740fe2 100755 --- a/common/src/main/java/common/item/consumable/ItemPotion.java +++ b/common/src/main/java/common/item/consumable/ItemPotion.java @@ -24,6 +24,7 @@ import common.util.BlockPos; import common.util.Facing; import common.util.Pair; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemPotion extends Item @@ -254,7 +255,7 @@ public class ItemPotion extends Item return new String[] {"potion_overlay", "bottle"}; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { return this.dispenseProjectile(world, facing, stack, new EntityPotion(world, position.xCoord, position.yCoord, position.zCoord, stack.copy()), 1.375f, 3.0f); } diff --git a/common/src/main/java/common/item/material/ItemArmor.java b/common/src/main/java/common/item/material/ItemArmor.java index b0219659..78a10f00 100755 --- a/common/src/main/java/common/item/material/ItemArmor.java +++ b/common/src/main/java/common/item/material/ItemArmor.java @@ -19,6 +19,7 @@ import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemArmor extends Item @@ -131,7 +132,7 @@ public class ItemArmor extends Item // } } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { BlockPos pos = blockpos.offset(facing); int i = pos.getX(); int j = pos.getY(); diff --git a/common/src/main/java/common/item/material/ItemBucket.java b/common/src/main/java/common/item/material/ItemBucket.java index 79aff7af..625bc855 100755 --- a/common/src/main/java/common/item/material/ItemBucket.java +++ b/common/src/main/java/common/item/material/ItemBucket.java @@ -274,11 +274,11 @@ public class ItemBucket extends Item int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); - worldIn.playSound(SoundEvent.FIZZ, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.5F); + worldIn.sendSound(SoundEvent.FIZZ, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.5F); for (int l = 0; l < 8; ++l) { - worldIn.spawnParticle(ParticleType.SMOKE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random()); + worldIn.clientParticle(ParticleType.SMOKE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random()); } } else @@ -323,7 +323,7 @@ public class ItemBucket extends Item return super.getTextures(this.recursive ? name.substring("recursive_".length()) : name); } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { if(this.recursive) return super.dispenseStack(world, source, position, blockpos, facing, stack); if(this.liquid == null) { diff --git a/common/src/main/java/common/item/material/ItemDye.java b/common/src/main/java/common/item/material/ItemDye.java index 2829ef95..7cbc6c92 100755 --- a/common/src/main/java/common/item/material/ItemDye.java +++ b/common/src/main/java/common/item/material/ItemDye.java @@ -61,7 +61,7 @@ public class ItemDye extends Item { { if (!worldIn.client) { - worldIn.playAuxSFX(2005, pos, 0); + worldIn.playEffect(2005, pos, 0); } return true; @@ -144,7 +144,7 @@ public class ItemDye extends Item { for (int i = 0; i < amount; ++i) { - worldIn.spawnParticle(ParticleType.GROW, (double)((float)pos.getX() + worldIn.rand.floatv()), (double)pos.getY() + (double)worldIn.rand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + worldIn.rand.floatv())); + worldIn.clientParticle(ParticleType.GROW, (double)((float)pos.getX() + worldIn.rand.floatv()), (double)pos.getY() + (double)worldIn.rand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + worldIn.rand.floatv())); } } } @@ -172,7 +172,7 @@ public class ItemDye extends Item { } } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { if(this.color != DyeColor.WHITE) return super.dispenseStack(world, source, position, blockpos, facing, stack); BlockPos pos = blockpos = blockpos.offset(facing); @@ -181,13 +181,13 @@ public class ItemDye extends Item { { if (!world.client) { - world.playAuxSFX(2005, pos, 0); + world.playEffect(2005, pos, 0); } - world.playAuxSFX(1000, blockpos, 0); + world.playEffect(1000, blockpos, 0); } else { - world.playAuxSFX(1001, blockpos, 0); + world.playEffect(1001, blockpos, 0); } return stack; diff --git a/common/src/main/java/common/item/projectile/ItemChargedOrb.java b/common/src/main/java/common/item/projectile/ItemChargedOrb.java index c73dc41e..7942946c 100755 --- a/common/src/main/java/common/item/projectile/ItemChargedOrb.java +++ b/common/src/main/java/common/item/projectile/ItemChargedOrb.java @@ -66,7 +66,7 @@ public class ItemChargedOrb extends Item double d0 = (double)((float)pos.getX() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F); double d1 = (double)((float)pos.getY() + 0.8125F); double d2 = (double)((float)pos.getZ() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F); - worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2); + worldIn.clientParticle(ParticleType.SMOKE, d0, d1, d2); } Facing enumfacing = (Facing)iblockstate.getValue(BlockPortalFrame.FACING); diff --git a/common/src/main/java/common/item/projectile/ItemDie.java b/common/src/main/java/common/item/projectile/ItemDie.java index fe873459..e8988d76 100755 --- a/common/src/main/java/common/item/projectile/ItemDie.java +++ b/common/src/main/java/common/item/projectile/ItemDie.java @@ -19,6 +19,7 @@ import common.util.BlockPos; import common.util.Facing; import common.util.Pair; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemDie extends Item @@ -89,7 +90,7 @@ public class ItemDie extends Item return GuiPosition.DICE; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { return this.dispenseProjectile(world, facing, stack, new EntityDie(world, position.xCoord, position.yCoord, position.zCoord, this.sides), 0.275f, 30.0f); } diff --git a/common/src/main/java/common/item/projectile/ItemDynamite.java b/common/src/main/java/common/item/projectile/ItemDynamite.java index b4b5a924..5ea6f19b 100755 --- a/common/src/main/java/common/item/projectile/ItemDynamite.java +++ b/common/src/main/java/common/item/projectile/ItemDynamite.java @@ -11,6 +11,7 @@ import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemDynamite extends Item { @@ -40,7 +41,7 @@ public class ItemDynamite extends Item { return stack; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { return this.dispenseProjectile(world, facing, stack, new EntityDynamite(world, position.xCoord, position.yCoord, position.zCoord, this.power)); } diff --git a/common/src/main/java/common/item/projectile/ItemEgg.java b/common/src/main/java/common/item/projectile/ItemEgg.java index a8750067..1bda1797 100755 --- a/common/src/main/java/common/item/projectile/ItemEgg.java +++ b/common/src/main/java/common/item/projectile/ItemEgg.java @@ -10,6 +10,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemEgg extends Item @@ -40,7 +41,7 @@ public class ItemEgg extends Item return itemStackIn; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { return this.dispenseProjectile(world, facing, stack, new EntityEgg(world, position.xCoord, position.yCoord, position.zCoord)); } diff --git a/common/src/main/java/common/item/projectile/ItemExpBottle.java b/common/src/main/java/common/item/projectile/ItemExpBottle.java index 411c7690..021c6f6c 100755 --- a/common/src/main/java/common/item/projectile/ItemExpBottle.java +++ b/common/src/main/java/common/item/projectile/ItemExpBottle.java @@ -10,6 +10,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemExpBottle extends Item @@ -41,7 +42,7 @@ public class ItemExpBottle extends Item return itemStackIn; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { return this.dispenseProjectile(world, facing, stack, new EntityXpBottle(world, position.xCoord, position.yCoord, position.zCoord), 1.375f, 3.0f); } diff --git a/common/src/main/java/common/item/projectile/ItemFireball.java b/common/src/main/java/common/item/projectile/ItemFireball.java index 1cddb116..7da51593 100755 --- a/common/src/main/java/common/item/projectile/ItemFireball.java +++ b/common/src/main/java/common/item/projectile/ItemFireball.java @@ -11,6 +11,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemFireball extends Item @@ -41,7 +42,7 @@ public class ItemFireball extends Item { if (worldIn.getState(pos).getBlock() == Blocks.air) { - worldIn.playSound(SoundEvent.FIREBALL, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 1.0F); + worldIn.sendSound(SoundEvent.FIREBALL, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 1.0F); worldIn.setState(pos, Blocks.fire.getState()); } @@ -55,7 +56,7 @@ public class ItemFireball extends Item } } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { double d0 = position.xCoord + (double)((float)facing.getFrontOffsetX() * 0.3F); double d1 = position.yCoord + (double)((float)facing.getFrontOffsetY() * 0.3F); double d2 = position.zCoord + (double)((float)facing.getFrontOffsetZ() * 0.3F); diff --git a/common/src/main/java/common/item/projectile/ItemSnowball.java b/common/src/main/java/common/item/projectile/ItemSnowball.java index 38e99d48..c15732bd 100755 --- a/common/src/main/java/common/item/projectile/ItemSnowball.java +++ b/common/src/main/java/common/item/projectile/ItemSnowball.java @@ -10,6 +10,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemSnowball extends Item @@ -40,7 +41,7 @@ public class ItemSnowball extends Item return itemStackIn; } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { return this.dispenseProjectile(world, facing, stack, new EntitySnowball(world, position.xCoord, position.yCoord, position.zCoord)); } diff --git a/common/src/main/java/common/item/spawner/ItemBoat.java b/common/src/main/java/common/item/spawner/ItemBoat.java index a1b1961f..0b33c15e 100755 --- a/common/src/main/java/common/item/spawner/ItemBoat.java +++ b/common/src/main/java/common/item/spawner/ItemBoat.java @@ -17,6 +17,7 @@ import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemBoat extends Item @@ -117,7 +118,7 @@ public class ItemBoat extends Item } } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { double d0 = blockpos.getX() + 0.5 + (double)((float)facing.getFrontOffsetX() * 1.125F); double d1 = blockpos.getY() + 0.5 + (double)((float)facing.getFrontOffsetY() * 1.125F); double d2 = blockpos.getZ() + 0.5 + (double)((float)facing.getFrontOffsetZ() * 1.125F); diff --git a/common/src/main/java/common/item/spawner/ItemMinecart.java b/common/src/main/java/common/item/spawner/ItemMinecart.java index 5256313c..37b3152f 100755 --- a/common/src/main/java/common/item/spawner/ItemMinecart.java +++ b/common/src/main/java/common/item/spawner/ItemMinecart.java @@ -13,6 +13,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.State; import common.world.World; @@ -82,7 +83,7 @@ public class ItemMinecart extends Item } } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { double d0 = blockpos.getX() + 0.5 + (double)facing.getFrontOffsetX() * 1.125D; double d1 = Math.floor(blockpos.getY() + 0.5) + (double)facing.getFrontOffsetY(); double d2 = blockpos.getZ() + 0.5 + (double)facing.getFrontOffsetZ() * 1.125D; diff --git a/common/src/main/java/common/item/tool/ItemCamera.java b/common/src/main/java/common/item/tool/ItemCamera.java index 715408cc..75047962 100755 --- a/common/src/main/java/common/item/tool/ItemCamera.java +++ b/common/src/main/java/common/item/tool/ItemCamera.java @@ -16,7 +16,7 @@ public class ItemCamera extends Item { public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { if(control == ItemControl.SECONDARY) { if(!world.client) - world.playAuxSFX(1024, new BlockPos(player.posX, player.posY + player.getEyeHeight(), player.posZ), 0); + world.playEffect(1024, new BlockPos(player.posX, player.posY + player.getEyeHeight(), player.posZ), 0); return true; } return false; diff --git a/common/src/main/java/common/item/tool/ItemFire.java b/common/src/main/java/common/item/tool/ItemFire.java index eeac54fc..fe25615b 100755 --- a/common/src/main/java/common/item/tool/ItemFire.java +++ b/common/src/main/java/common/item/tool/ItemFire.java @@ -12,6 +12,7 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; +import common.world.AWorldServer; import common.world.World; public class ItemFire extends Item @@ -41,7 +42,7 @@ public class ItemFire extends Item { if (worldIn.getState(pos).getBlock() == Blocks.air) { - worldIn.playSound(SoundEvent.IGNITE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 1.0F); + worldIn.sendSound(SoundEvent.IGNITE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 1.0F); worldIn.setState(pos, this.fireBlock.getState()); } @@ -50,7 +51,7 @@ public class ItemFire extends Item } } - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { BlockPos pos = blockpos = blockpos.offset(facing); if (world.isAirBlock(pos)) @@ -58,17 +59,17 @@ public class ItemFire extends Item world.setState(pos, this.fireBlock.getState()); stack.damage(1, null, world.rand); - world.playAuxSFX(1000, blockpos, 0); + world.playEffect(1000, blockpos, 0); } else if (world.getState(pos).getBlock() instanceof BlockTNT tnt) { tnt.onBroken(world, pos, tnt.getState().withProperty(BlockTNT.EXPLODE, true)); world.setBlockToAir(pos); - world.playAuxSFX(1000, blockpos, 0); + world.playEffect(1000, blockpos, 0); } else { - world.playAuxSFX(1001, blockpos, 0); + world.playEffect(1001, blockpos, 0); } return stack; diff --git a/common/src/main/java/common/item/tool/ItemHoe.java b/common/src/main/java/common/item/tool/ItemHoe.java index 518c6ecd..19daf218 100755 --- a/common/src/main/java/common/item/tool/ItemHoe.java +++ b/common/src/main/java/common/item/tool/ItemHoe.java @@ -68,7 +68,7 @@ public class ItemHoe extends Item protected boolean useHoe(ItemStack stack, EntityNPC player, World worldIn, BlockPos target, State newState) { if(newState.getBlock().getSound().getStepSound() != null) - worldIn.playSound(newState.getBlock().getSound().getStepSound(), (double)((float)target.getX() + 0.5F), (double)((float)target.getY() + 0.5F), (double)((float)target.getZ() + 0.5F), 1.0F); + worldIn.sendSound(newState.getBlock().getSound().getStepSound(), (double)((float)target.getX() + 0.5F), (double)((float)target.getY() + 0.5F), (double)((float)target.getZ() + 0.5F), 1.0F); if (worldIn.client) { diff --git a/common/src/main/java/common/item/weapon/ItemArrow.java b/common/src/main/java/common/item/weapon/ItemArrow.java index 6cca79f4..3b13f39e 100644 --- a/common/src/main/java/common/item/weapon/ItemArrow.java +++ b/common/src/main/java/common/item/weapon/ItemArrow.java @@ -7,10 +7,10 @@ import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; -import common.world.World; +import common.world.AWorldServer; public class ItemArrow extends Item { - public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { EntityArrow arrow = new EntityArrow(world, position.xCoord, position.yCoord, position.zCoord); arrow.canBePickedUp = 1; return this.dispenseProjectile(world, facing, stack, arrow); diff --git a/common/src/main/java/common/tileentity/TileEntityChest.java b/common/src/main/java/common/tileentity/TileEntityChest.java index bd08f8a2..f3b8bd0a 100755 --- a/common/src/main/java/common/tileentity/TileEntityChest.java +++ b/common/src/main/java/common/tileentity/TileEntityChest.java @@ -220,7 +220,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory { double d3 = (double)i + 0.5D; double d0 = (double)k + 0.5D; - this.worldObj.playSound((this.wasOpen = this.numPlayersUsing > 0) ? SoundEvent.CHESTOPEN : SoundEvent.CHESTCLOSED, d3, (double)j + 0.5D, d0, 0.5F); + this.worldObj.sendSound((this.wasOpen = this.numPlayersUsing > 0) ? SoundEvent.CHESTOPEN : SoundEvent.CHESTCLOSED, d3, (double)j + 0.5D, d0, 0.5F); } } @@ -239,7 +239,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory } ++this.numPlayersUsing; - this.worldObj.playAuxSFX(2016, this.pos, this.numPlayersUsing); + this.worldObj.playEffect(2016, this.pos, this.numPlayersUsing); if(!this.worldObj.client) { ((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos, this.getBlockType()); ((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType()); @@ -252,7 +252,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory if (/* !player.isSpectator() && */ this.getBlockType() instanceof BlockChest) { --this.numPlayersUsing; - this.worldObj.playAuxSFX(2016, this.pos, this.numPlayersUsing); + this.worldObj.playEffect(2016, this.pos, this.numPlayersUsing); if(!this.worldObj.client) { ((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos, this.getBlockType()); ((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType()); diff --git a/common/src/main/java/common/tileentity/TileEntityDispenser.java b/common/src/main/java/common/tileentity/TileEntityDispenser.java index efce439a..a2a48f9c 100755 --- a/common/src/main/java/common/tileentity/TileEntityDispenser.java +++ b/common/src/main/java/common/tileentity/TileEntityDispenser.java @@ -12,8 +12,8 @@ import common.tags.TagObject; import common.util.BlockPos; import common.util.Facing; import common.vars.Vars; +import common.world.AWorldServer; import common.world.State; -import common.world.World; import java.util.List; @@ -240,18 +240,18 @@ public class TileEntityDispenser extends TileEntityInventory implements ITickabl return 0xffbf00; } - protected ItemStack dispenseStack(ItemStack stack, World world, BlockPos pos) + protected ItemStack dispenseStack(ItemStack stack, AWorldServer world, BlockPos pos) { Facing facing = world.getState(pos).getValue(BlockDispenser.FACING); ItemStack nstack = stack.getItem().dispenseStack(world, world.getTileEntity(pos), BlockDispenser.getDispensePosition(pos, facing), pos, facing, stack); int id = stack.getItem().getDispenseSoundId(); if(id != 0) - world.playAuxSFX(id, pos, 0); - world.playAuxSFX(2000, pos, facing.getFrontOffsetX() + 1 + (facing.getFrontOffsetZ() + 1) * 3); + world.playEffect(id, pos, 0); + world.playEffect(2000, pos, facing.getFrontOffsetX() + 1 + (facing.getFrontOffsetZ() + 1) * 3); return nstack; } - protected void dispense(World worldIn, BlockPos pos) + protected void dispense(AWorldServer worldIn, BlockPos pos) { TileEntity te = worldIn.getTileEntity(pos); @@ -281,7 +281,7 @@ public class TileEntityDispenser extends TileEntityInventory implements ITickabl State state = this.getBlockState(); if(!(state.getBlock() instanceof BlockDispenser) || !this.decrPower()) return; - this.dispense(this.worldObj, this.pos); + this.dispense((AWorldServer)this.worldObj, this.pos); this.cooldown = Vars.dispenserDelay; } else { diff --git a/common/src/main/java/common/tileentity/TileEntityDropper.java b/common/src/main/java/common/tileentity/TileEntityDropper.java index b3b55902..3bb01dc0 100755 --- a/common/src/main/java/common/tileentity/TileEntityDropper.java +++ b/common/src/main/java/common/tileentity/TileEntityDropper.java @@ -5,20 +5,20 @@ import common.inventory.IInventory; import common.item.ItemStack; import common.util.BlockPos; import common.util.Facing; -import common.world.World; +import common.world.AWorldServer; public class TileEntityDropper extends TileEntityDispenser { - protected ItemStack dispenseStack(ItemStack stack, World world, BlockPos pos) + protected ItemStack dispenseStack(ItemStack stack, AWorldServer world, BlockPos pos) { Facing facing = world.getState(pos).getValue(BlockDispenser.FACING); BlockDispenser.dispense(world, 6.0, facing, BlockDispenser.getDispensePosition(pos, facing), stack.split(1)); - world.playAuxSFX(1000, pos, 0); - world.playAuxSFX(2000, pos, facing.getFrontOffsetX() + 1 + (facing.getFrontOffsetZ() + 1) * 3); + world.playEffect(1000, pos, 0); + world.playEffect(2000, pos, facing.getFrontOffsetX() + 1 + (facing.getFrontOffsetZ() + 1) * 3); return stack; } - protected void dispense(World worldIn, BlockPos pos) + protected void dispense(AWorldServer worldIn, BlockPos pos) { TileEntity te = worldIn.getTileEntity(pos); diff --git a/common/src/main/java/common/world/Chunk.java b/common/src/main/java/common/world/Chunk.java index 69d92f24..51ca31c5 100755 --- a/common/src/main/java/common/world/Chunk.java +++ b/common/src/main/java/common/world/Chunk.java @@ -119,7 +119,7 @@ public abstract class Chunk { if(stor != null) { stor.setSky(x, y & 15, z, l); - this.world.notifyLightSet(new BlockPos((this.xPos << 4) + x, y, (this.zPos << 4) + z)); + this.world.clientNotifyLight(new BlockPos((this.xPos << 4) + x, y, (this.zPos << 4) + z)); } } @@ -221,7 +221,7 @@ public abstract class Chunk { if(stor != null) { stor.setSky(x, n & 15, z, 15); - this.world.notifyLightSet(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); + this.world.clientNotifyLight(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); } } } @@ -231,7 +231,7 @@ public abstract class Chunk { if(stor != null) { stor.setSky(x, n & 15, z, 0); - this.world.notifyLightSet(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); + this.world.clientNotifyLight(new BlockPos((this.xPos << 4) + x, n, (this.zPos << 4) + z)); } } } diff --git a/common/src/main/java/common/world/Explosion.java b/common/src/main/java/common/world/Explosion.java index 5e99a990..f177e202 100755 --- a/common/src/main/java/common/world/Explosion.java +++ b/common/src/main/java/common/world/Explosion.java @@ -202,7 +202,7 @@ public class Explosion if(iblockstate.getBlock() != Blocks.air && iblockstate.getBlock().getResistance(null) < 60000.0f) { worldObj.setState(blockpos, Blocks.air.getState(), 3); if(rand.chance(1000)) { - worldObj.playSound(SoundEvent.EXPLODE, explosionX + x, explosionY + y, explosionZ + z, 4.0F); + worldObj.sendSound(SoundEvent.EXPLODE, explosionX + x, explosionY + y, explosionZ + z, 4.0F); ((AWorldServer)worldObj).spawnParticles(ParticleType.EXPLOSION_HUGE, explosionX + x, explosionY + y, explosionZ + z); } } @@ -299,15 +299,15 @@ public class Explosion */ public void doExplosionB(boolean spawnParticles, boolean altSound) { - this.worldObj.playSound(altSound ? SoundEvent.EXPLODE_ALT : SoundEvent.EXPLODE, this.explosionX, this.explosionY, this.explosionZ, 4.0F); + this.worldObj.sendSound(altSound ? SoundEvent.EXPLODE_ALT : SoundEvent.EXPLODE, this.explosionX, this.explosionY, this.explosionZ, 4.0F); if (this.explosionSize >= 2.0F && this.isSmoking) { - this.worldObj.spawnParticle(ParticleType.EXPLOSION_HUGE, this.explosionX, this.explosionY, this.explosionZ); + this.worldObj.clientParticle(ParticleType.EXPLOSION_HUGE, this.explosionX, this.explosionY, this.explosionZ); } else { - this.worldObj.spawnParticle(ParticleType.EXPLOSION_LARGE, this.explosionX, this.explosionY, this.explosionZ, 100); + this.worldObj.clientParticle(ParticleType.EXPLOSION_LARGE, this.explosionX, this.explosionY, this.explosionZ, 100); } if (this.isSmoking) @@ -322,8 +322,8 @@ public class Explosion double d0 = (double)((float)blockpos.getX() + this.worldObj.rand.floatv()); double d1 = (double)((float)blockpos.getY() + this.worldObj.rand.floatv()); double d2 = (double)((float)blockpos.getZ() + this.worldObj.rand.floatv()); - this.worldObj.spawnParticle(ParticleType.EXPLOSION_NORMAL, (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D); - this.worldObj.spawnParticle(ParticleType.SMOKE, d0, d1, d2); + this.worldObj.clientParticle(ParticleType.EXPLOSION_NORMAL, (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D); + this.worldObj.clientParticle(ParticleType.SMOKE, d0, d1, d2); } if (block != Blocks.air) diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 897bdbd1..ab8a4e35 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -278,7 +278,7 @@ public abstract class World implements IWorldAccess { return false; } else { - this.playAuxSFX(2001, pos, BlockRegistry.getId(iblockstate)); + this.playEffect(2001, pos, BlockRegistry.getId(iblockstate)); if(dropBlock) { block.drop(this, pos, iblockstate, 0); @@ -301,11 +301,11 @@ public abstract class World implements IWorldAccess { } } - this.markBlockRangeForRenderUpdate(x1, x2, z1, x1, z2, z1); + this.clientRenderUpdate(x1, x2, z1, x1, z2, z1); } public void markBlockRangeForRenderUpdate(BlockPos rangeMin, BlockPos rangeMax) { - this.markBlockRangeForRenderUpdate(rangeMin.getX(), rangeMin.getY(), rangeMin.getZ(), rangeMax.getX(), rangeMax.getY(), rangeMax.getZ()); + this.clientRenderUpdate(rangeMin.getX(), rangeMin.getY(), rangeMin.getZ(), rangeMax.getX(), rangeMax.getY(), rangeMax.getZ()); } public boolean canSeeSky(BlockPos pos) { @@ -475,7 +475,7 @@ public abstract class World implements IWorldAccess { if(this.isBlockLoaded(pos)) { Chunk chunk = this.getChunk(pos); chunk.setLight(type, pos, lightValue); - this.notifyLightSet(pos); + this.clientNotifyLight(pos); } } } @@ -701,7 +701,7 @@ public abstract class World implements IWorldAccess { } public void playSoundAtEntity(Entity entityIn, SoundEvent name, float volume) { - this.playSound(name, entityIn.posX, entityIn.posY, entityIn.posZ, volume); + this.sendSound(name, entityIn.posX, entityIn.posY, entityIn.posZ, volume); } public boolean spawnEntityInWorld(Entity entityIn) { @@ -1376,7 +1376,7 @@ public abstract class World implements IWorldAccess { pos = pos.offset(side); if(this.getState(pos).getBlock().canExtinguish()) { - this.playAuxSFX(player, 1004, pos, 0); + this.playEffect(player, 1004, pos, 0); this.setBlockToAir(pos); return true; } @@ -1962,32 +1962,32 @@ public abstract class World implements IWorldAccess { return Math.abs(gravity) < 0.075 ? 0.0 : gravity; } - public final void playAuxSFX(int type, BlockPos pos, int data) { - this.playAuxSFX(null, type, pos, data); + public final void playEffect(int type, BlockPos pos, int data) { + this.playEffect(null, type, pos, data); } - public final void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord) { - this.spawnParticle(particleType, xCoord, yCoord, zCoord, 0); + public final void clientParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord) { + this.clientParticle(particleType, xCoord, yCoord, zCoord, 0); } - public void playSound(SoundEvent sound, double x, double y, double z, float volume) { + public void sendSound(SoundEvent sound, double x, double y, double z, float volume) { } - public void playSound(double x, double y, double z, SoundEvent sound, float volume) { + public void clientSound(SoundEvent sound, double x, double y, double z, float volume) { } public void setLastLightning(int last, int color) { } - public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int data) { + public void clientParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int data) { } - public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { + public void clientRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { } - protected void notifyLightSet(BlockPos pos) { + protected void clientNotifyLight(BlockPos pos) { } protected abstract float getTemperature(BlockPos pos); @@ -1996,5 +1996,5 @@ public abstract class World implements IWorldAccess { public abstract void markBlockForUpdate(BlockPos pos); protected abstract void onEntityAdded(Entity entityIn); protected abstract void onEntityRemoved(Entity entityIn); - public abstract void playAuxSFX(EntityNPC player, int sfxType, BlockPos blockPosIn, int data); + public abstract void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data); } diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index da3d7c76..9bd161e8 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -1206,7 +1206,7 @@ public class Player extends User implements Executor, IPlayer State iblockstate = this.entity.worldObj.getState(pos); TileEntity tileentity = this.entity.worldObj.getTileEntity(pos); - this.entity.worldObj.playAuxSFX(this.entity, 2001, pos, BlockRegistry.getId(iblockstate)); + this.entity.worldObj.playEffect(this.entity, 2001, pos, BlockRegistry.getId(iblockstate)); boolean flag1 = this.removeBlock(pos); // if (this.creative) diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index e5a52800..99991153 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -1673,12 +1673,12 @@ public final class WorldServer extends AWorldServer { return this.seaLevel; } - public void playSound(SoundEvent sound, double x, double y, double z, float volume) + public void sendSound(SoundEvent sound, double x, double y, double z, float volume) { this.sendNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, new SPacketSoundEffect(sound, x, y, z, volume)); } - public void playAuxSFX(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) + public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) { this.sendNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, new SPacketEffect(sfxType, blockPosIn, data)); }