mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 20:05:02 -04:00
Remove FallingDustParticleData, PacketEntitySoundEffect, adjust log messages (sound effect)
This commit is contained in:
parent
da79690b9d
commit
985c4b31a8
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.game.datatypes.objectLoader.particle.data;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.Particle;
|
||||
|
||||
public class FallingDustParticleData extends ParticleData {
|
||||
final Block block;
|
||||
|
||||
public FallingDustParticleData(Block block, Particle type) {
|
||||
super(type);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return block.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.SoundCategories;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.PacketHandler;
|
||||
|
||||
|
||||
public class PacketEntitySoundEffect implements ClientboundPacket {
|
||||
int soundId;
|
||||
SoundCategories category;
|
||||
int entityId;
|
||||
float volume;
|
||||
float pitch;
|
||||
|
||||
@Override
|
||||
public boolean read(InByteBuffer buffer) {
|
||||
soundId = buffer.readVarInt();
|
||||
category = SoundCategories.byId(buffer.readVarInt());
|
||||
entityId = buffer.readVarInt();
|
||||
volume = buffer.readFloat();
|
||||
pitch = buffer.readFloat();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log() {
|
||||
Log.protocol(String.format("Play sound entity effect (soundId=%d, category=%s, entityId=%d, volume=%s, pitch=%s)", soundId, category, entityId, volume, pitch));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketHandler h) {
|
||||
h.handle(this);
|
||||
}
|
||||
|
||||
public int getSoundId() {
|
||||
return soundId;
|
||||
}
|
||||
|
||||
public SoundCategories getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
}
|
@ -58,7 +58,7 @@ public class PacketNamedSoundEffect implements ClientboundPacket {
|
||||
|
||||
@Override
|
||||
public void log() {
|
||||
Log.protocol(String.format("Play named sound effect %s with volume=%s and pitch=%s at %s", sound, volume, pitch, location));
|
||||
Log.protocol(String.format("Play sound effect (sound=%s, category=%s, volume=%s, pitch=%s, location=%s)", sound, category, volume, pitch, location));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,7 +69,6 @@ public class PacketNamedSoundEffect implements ClientboundPacket {
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Pitch in Percent
|
||||
*/
|
||||
@ -84,4 +83,8 @@ public class PacketNamedSoundEffect implements ClientboundPacket {
|
||||
public float getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public SoundCategories getCategory() {
|
||||
return category;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class PacketSoundEffect implements ClientboundPacket {
|
||||
static final float pitchCalc = 100.0F / 63.0F;
|
||||
Location location;
|
||||
SoundCategories category;
|
||||
int sound;
|
||||
int soundId;
|
||||
float volume;
|
||||
float pitch;
|
||||
|
||||
@ -33,14 +33,14 @@ public class PacketSoundEffect implements ClientboundPacket {
|
||||
public boolean read(InByteBuffer buffer) {
|
||||
switch (buffer.getVersion()) {
|
||||
case VERSION_1_9_4:
|
||||
sound = buffer.readVarInt();
|
||||
soundId = buffer.readVarInt();
|
||||
category = SoundCategories.byId(buffer.readVarInt());
|
||||
location = new Location(buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4);
|
||||
volume = buffer.readFloat();
|
||||
pitch = (buffer.readByte() * pitchCalc) / 100F;
|
||||
return true;
|
||||
default:
|
||||
sound = buffer.readVarInt();
|
||||
soundId = buffer.readVarInt();
|
||||
category = SoundCategories.byId(buffer.readVarInt());
|
||||
location = new Location(buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4, buffer.readFixedPointNumberInteger() * 4);
|
||||
volume = buffer.readFloat();
|
||||
@ -51,7 +51,7 @@ public class PacketSoundEffect implements ClientboundPacket {
|
||||
|
||||
@Override
|
||||
public void log() {
|
||||
Log.protocol(String.format("Play sound effect %d with volume=%s and pitch=%s at %s", sound, volume, pitch, location));
|
||||
Log.protocol(String.format("Play sound effect (soundId=%d, category=%s, volume=%s, pitch=%s, location=%s)", soundId, category, volume, pitch, location));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,8 +70,8 @@ public class PacketSoundEffect implements ClientboundPacket {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public int getSound() {
|
||||
return sound;
|
||||
public int getSoundId() {
|
||||
return soundId;
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
|
@ -25,7 +25,10 @@ import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Blocks;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.items.Items;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.Particle;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.Particles;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.data.*;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.data.BlockParticleData;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.data.DustParticleData;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.data.ItemParticleData;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.particle.data.ParticleData;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.recipes.Ingredient;
|
||||
import de.bixilon.minosoft.game.datatypes.world.BlockPosition;
|
||||
import de.bixilon.minosoft.nbt.tag.CompoundTag;
|
||||
@ -235,20 +238,18 @@ public class InByteBuffer {
|
||||
return new ItemParticleData(new Slot(Items.getItemByLegacy(readVarInt(), readVarInt())), type);
|
||||
case "blockcrack":
|
||||
case "blockdust":
|
||||
return new BlockParticleData(Blocks.getBlockByLegacy(readVarInt() << 4), type);
|
||||
case "falling_dust":
|
||||
return new FallingDustParticleData(Blocks.getBlockByLegacy(readVarInt() << 4), type);
|
||||
return new BlockParticleData(Blocks.getBlockByLegacy(readVarInt() << 4), type);
|
||||
default:
|
||||
return new ParticleData(type);
|
||||
}
|
||||
}
|
||||
switch (type.getIdentifier()) {
|
||||
case "block":
|
||||
case "falling_dust":
|
||||
return new BlockParticleData(Blocks.getBlock(readVarInt(), version), type);
|
||||
case "dust":
|
||||
return new DustParticleData(readFloat(), readFloat(), readFloat(), readFloat(), type);
|
||||
case "falling_dust":
|
||||
return new FallingDustParticleData(Blocks.getBlock(readVarInt(), version), type);
|
||||
case "item":
|
||||
return new ItemParticleData(readSlot(), type);
|
||||
default:
|
||||
|
@ -632,4 +632,7 @@ public class PacketHandler {
|
||||
public void handle(PacketLoginPluginRequest pkg) {
|
||||
connection.getPluginChannelHandler().handle(pkg.getMessageId(), pkg.getChannel(), pkg.getData());
|
||||
}
|
||||
|
||||
public void handle(PacketEntitySoundEffect pkg) {
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ public abstract class Protocol implements ProtocolInterface {
|
||||
packetClassMapping.put(Packets.Clientbound.PLAY_TRADE_LIST, PacketTradeList.class);
|
||||
packetClassMapping.put(Packets.Clientbound.PLAY_OPEN_BOOK, PacketOpenBook.class);
|
||||
packetClassMapping.put(Packets.Clientbound.PLAY_ACKNOWLEDGE_PLAYER_DIGGING, PacketAcknowledgePlayerDigging.class);
|
||||
packetClassMapping.put(Packets.Clientbound.PLAY_ENTITY_SOUND_EFFECT, PacketEntitySoundEffect.class);
|
||||
}
|
||||
|
||||
protected final HashMap<ConnectionState, HashBiMap<Packets.Serverbound, Integer>> serverboundPacketMapping;
|
||||
|
Loading…
x
Reference in New Issue
Block a user