3d shareware

This commit is contained in:
creeper123123321 2022-02-27 11:07:58 -03:00
parent 8972a03749
commit 599538898b
7 changed files with 311 additions and 6 deletions

View File

@ -0,0 +1,143 @@
/*
* Copyright (c) RK_01 2021.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ===================================
*
* Copyright (c) VIAaaS contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.viaversion.aas.protocol.sharewareto1_14;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
public enum ClientboundPacketsShareware implements ClientboundPacketType {
SPAWN_ENTITY, // 0x00
SPAWN_EXPERIENCE_ORB, // 0x01
SPAWN_GLOBAL_ENTITY, // 0x02
SPAWN_MOB, // 0x03
SPAWN_PAINTING, // 0x04
SPAWN_PLAYER, // 0x05
ENTITY_ANIMATION, // 0x06
STATISTICS, // 0x07
BLOCK_BREAK_ANIMATION, // 0x08
BLOCK_ENTITY_DATA, // 0x09
BLOCK_ACTION, // 0x0A
BLOCK_CHANGE, // 0x0B
BOSSBAR, // 0x0C
SERVER_DIFFICULTY, // 0x0D
CHAT_MESSAGE, // 0x0E
MULTI_BLOCK_CHANGE, // 0x0F
TAB_COMPLETE, // 0x10
DECLARE_COMMANDS, // 0x11
WINDOW_CONFIRMATION, // 0x12
CLOSE_WINDOW, // 0x13
OPEN_HORSE_WINDOW, // 0x14
WINDOW_ITEMS, // 0x15
WINDOW_PROPERTY, // 0x16
SET_SLOT, // 0x17
COOLDOWN, // 0x18
PLUGIN_MESSAGE, // 0x19
NAMED_SOUND, // 0x1A
DISCONNECT, // 0x1B
ENTITY_STATUS, // 0x1C
NBT_QUERY, // 0x1D
EXPLOSION, // 0x1E
UNLOAD_CHUNK, // 0x1F
GAME_EVENT, // 0x20
KEEP_ALIVE, // 0x21
CHUNK_DATA, // 0x22
EFFECT, // 0x23
SPAWN_PARTICLE, // 0x24
JOIN_GAME, // 0x25
MAP_DATA, // 0x26
ENTITY_MOVEMENT, // 0x27
ENTITY_POSITION, // 0x28
ENTITY_POSITION_AND_ROTATION, // 0x29
ENTITY_ROTATION, // 0x2A
VEHICLE_MOVE, // 0x2B
OPEN_BOOK, // 0x2C
OPEN_SIGN_EDITOR, // 0x2D
CRAFT_RECIPE_RESPONSE, // 0x2E
PLAYER_ABILITIES, // 0x2F
COMBAT_EVENT, // 0x30
PLAYER_INFO, // 0x31
FACE_PLAYER, // 0x32
PLAYER_POSITION, // 0x33
UNLOCK_RECIPES, // 0x34
DESTROY_ENTITIES, // 0x35
REMOVE_ENTITY_EFFECT, // 0x36
RESOURCE_PACK, // 0x37
RESPAWN, // 0x38
ENTITY_HEAD_LOOK, // 0x39
SELECT_ADVANCEMENTS_TAB, // 0x3A
WORLD_BORDER, // 0x3B
CAMERA, // 0x3C
HELD_ITEM_CHANGE, // 0x3D
DISPLAY_SCOREBOARD, // 0x3E
ENTITY_METADATA, // 0x3F
ATTACH_ENTITY, // 0x40
ENTITY_VELOCITY, // 0x41
ENTITY_EQUIPMENT, // 0x42
SET_EXPERIENCE, // 0x43
UPDATE_HEALTH, // 0x44
SCOREBOARD_OBJECTIVE, // 0x45
SET_PASSENGERS, // 0x46
TEAMS, // 0x47
UPDATE_SCORE, // 0x48
SPAWN_POSITION, // 0x49
TIME_UPDATE, // 0x4A
TITLE, // 0x4B
STOP_SOUND, // 0x4C
SOUND, // 0x4D
ENTITY_SOUND, // 0x4E
TAB_LIST, // 0x4F
COLLECT_ITEM, // 0x50
ENTITY_TELEPORT, // 0x51
ADVANCEMENTS, // 0x52
ENTITY_PROPERTIES, // 0x53
ENTITY_EFFECT, // 0x54
DECLARE_RECIPES, // 0x55
TAGS, // 0x56
UPDATE_LIGHT, // 0x57
OPEN_WINDOW, // 0x58
TRADE_LIST, // 0x59
UPDATE_VIEW_DISTANCE; // 0x5A
@Override
public int getId() {
return this.ordinal();
}
@Override
public String getName() {
return this.name();
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) RK_01 2021.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ===================================
*
* Copyright (c) VIAaaS contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.viaversion.aas.protocol.sharewareto1_14;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
// https://github.com/RaphiMC/ViaAprilFools/
public class ProtocolSharewareto1_14 extends AbstractProtocol<ClientboundPackets1_14, ClientboundPacketsShareware, ServerboundPackets1_14, ServerboundPacketsShareware> {
public ProtocolSharewareto1_14() {
super(ClientboundPackets1_14.class, ClientboundPacketsShareware.class, ServerboundPackets1_14.class, ServerboundPacketsShareware.class);
}
@Override
protected void registerPackets() {
this.cancelClientbound(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
this.cancelClientbound(ClientboundPackets1_14.ACKNOWLEDGE_PLAYER_DIGGING);
}
@Override
public void init(UserConnection userConnection) {
}
}

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) RK_01 2021.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ===================================
*
* Copyright (c) VIAaaS contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.viaversion.aas.protocol.sharewareto1_14;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
public enum ServerboundPacketsShareware implements ServerboundPacketType {
TELEPORT_CONFIRM, // 0x00
QUERY_BLOCK_NBT, // 0x01
SET_DIFFICULTY, // 0x02
CHAT_MESSAGE, // 0x03
CLIENT_STATUS, // 0x04
CLIENT_SETTINGS, // 0x05
TAB_COMPLETE, // 0x06
WINDOW_CONFIRMATION, // 0x07
CLICK_WINDOW_BUTTON, // 0x08
CLICK_WINDOW, // 0x09
CLOSE_WINDOW, // 0x0A
PLUGIN_MESSAGE, // 0x0B
EDIT_BOOK, // 0x0C
ENTITY_NBT_REQUEST, // 0x0D
INTERACT_ENTITY, // 0x0E
LOCK_DIFFICULTY, // 0x0F
KEEP_ALIVE, // 0x10
PLAYER_MOVEMENT, // 0x11
PLAYER_POSITION, // 0x12
PLAYER_POSITION_AND_ROTATION, // 0x13
PLAYER_ROTATION, // 0x14
VEHICLE_MOVE, // 0x15
STEER_BOAT, // 0x16
PICK_ITEM, // 0x17
CRAFT_RECIPE_REQUEST, // 0x18
PLAYER_ABILITIES, // 0x19
PLAYER_DIGGING, // 0x1A
ENTITY_ACTION, // 0x1B
STEER_VEHICLE, // 0x1C
RECIPE_BOOK_DATA, // 0x1D
RENAME_ITEM, // 0x1E
RESOURCE_PACK_STATUS, // 0x1F
ADVANCEMENT_TAB, // 0x20
SELECT_TRADE, // 0x21
SET_BEACON_EFFECT, // 0x22
HELD_ITEM_CHANGE, // 0x23
UPDATE_COMMAND_BLOCK, // 0x24
UPDATE_COMMAND_BLOCK_MINECART, // 0x25
CREATIVE_INVENTORY_ACTION, // 0x26
UPDATE_JIGSAW_BLOCK, // 0x27
UPDATE_STRUCTURE_BLOCK, // 0x28
UPDATE_SIGN, // 0x29
ANIMATION, // 0x2A
SPECTATE, // 0x2B
PLAYER_BLOCK_PLACEMENT, // 0x2C
USE_ITEM; // 0x2D
@Override
public int getId() {
return ordinal();
}
@Override
public String getName() {
return name();
}
}

View File

@ -16,7 +16,7 @@ class CryptoRequest : Packet {
override fun decode(byteBuf: ByteBuf, protocolVersion: Int) {
serverId = Type.STRING.read(byteBuf)
if (protocolVersion >= ProtocolVersion.v1_8.version) {
if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1) {
publicKey = KeyFactory.getInstance("RSA")
.generatePublic(X509EncodedKeySpec(Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)))
token = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
@ -29,7 +29,7 @@ class CryptoRequest : Packet {
override fun encode(byteBuf: ByteBuf, protocolVersion: Int) {
Type.STRING.write(byteBuf, serverId)
if (protocolVersion >= ProtocolVersion.v1_8.version) {
if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1) {
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, publicKey.encoded)
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, token)
} else {

View File

@ -11,7 +11,7 @@ class CryptoResponse : Packet {
lateinit var encryptedToken: ByteArray
override fun decode(byteBuf: ByteBuf, protocolVersion: Int) {
if (protocolVersion >= ProtocolVersion.v1_8.version) {
if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1) {
encryptedKey = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
encryptedToken = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
} else {
@ -21,7 +21,7 @@ class CryptoResponse : Packet {
}
override fun encode(byteBuf: ByteBuf, protocolVersion: Int) {
if (protocolVersion >= ProtocolVersion.v1_8.version) {
if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1) {
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedKey)
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedToken)
} else {

View File

@ -16,7 +16,7 @@ class LoginSuccess : Packet {
protocolVersion >= ProtocolVersion.v1_16.version -> {
Type.UUID_INT_ARRAY.read(byteBuf)
}
protocolVersion >= ProtocolVersion.v1_7_6.version -> {
protocolVersion >= ProtocolVersion.v1_7_6.version || protocolVersion == 1 -> {
UUID.fromString(Type.STRING.read(byteBuf))
}
else -> parseUndashedId(Type.STRING.read(byteBuf))
@ -29,7 +29,7 @@ class LoginSuccess : Packet {
protocolVersion >= ProtocolVersion.v1_16.version -> {
Type.UUID_INT_ARRAY.write(byteBuf, id)
}
protocolVersion >= ProtocolVersion.v1_7_6.version -> {
protocolVersion >= ProtocolVersion.v1_7_6.version || protocolVersion == 1 -> {
Type.STRING.write(byteBuf, id.toString())
}
else -> Type.STRING.write(byteBuf, id.toString().replace("-", ""))

View File

@ -1,6 +1,7 @@
package com.viaversion.aas.protocol
import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
import com.viaversion.aas.protocol.sharewareto1_14.ProtocolSharewareto1_14
import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
@ -8,4 +9,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
// + https://github.com/creeper123123321/ViaRewind/tree/17to18
fun registerAspirinProtocols() {
Via.getManager().protocolManager.registerProtocol(Protocol1_8To1_7_6, ProtocolVersion.v1_8, ProtocolVersion.v1_7_6)
// todo fix version checks
val shareware = ProtocolVersion.register(1, "3D Shareware v1.34")
Via.getManager().protocolManager.registerProtocol(ProtocolSharewareto1_14(), shareware, ProtocolVersion.v1_14)
}