mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 01:16:46 -04:00
remove some old unused/deprecated stuff
This commit is contained in:
parent
a060c46982
commit
61a72961f5
@ -10,18 +10,20 @@
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
package de.bixilon.minosoft.data
|
||||
|
||||
package de.bixilon.minosoft.data;
|
||||
import de.bixilon.minosoft.util.KUtil
|
||||
import de.bixilon.minosoft.util.enum.ValuesEnum
|
||||
|
||||
public enum Difficulties {
|
||||
enum class Difficulties {
|
||||
PEACEFUL,
|
||||
EASY,
|
||||
NORMAL,
|
||||
HARD;
|
||||
HARD,
|
||||
;
|
||||
|
||||
private static final Difficulties[] DIFFICULTIES = values();
|
||||
|
||||
public static Difficulties byId(int id) {
|
||||
return DIFFICULTIES[id];
|
||||
companion object : ValuesEnum<Difficulties> {
|
||||
override val VALUES: Array<Difficulties> = values()
|
||||
override val NAME_MAP: Map<String, Difficulties> = KUtil.getEnumValues(VALUES)
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.data;
|
||||
|
||||
public enum LevelTypes {
|
||||
DEFAULT("default"),
|
||||
FLAT("flat"),
|
||||
LARGE_BIOMES("largeBiomes"),
|
||||
AMPLIFIED("amplified"),
|
||||
DEFAULT_1_1("default_1_1"),
|
||||
CUSTOMIZED("customized"),
|
||||
BUFFET("buffet"),
|
||||
UNKNOWN("unknown");
|
||||
private final String type;
|
||||
|
||||
LevelTypes(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static LevelTypes byType(String type) {
|
||||
for (LevelTypes levelType : values()) {
|
||||
if (levelType.getId().equals(type)) {
|
||||
return levelType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.type;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.data.inventory;
|
||||
|
||||
import de.bixilon.minosoft.data.text.ChatComponent;
|
||||
|
||||
public class InventoryProperties {
|
||||
private final int windowId;
|
||||
private final InventoryTypes type;
|
||||
private final ChatComponent title;
|
||||
private final byte slotCount;
|
||||
|
||||
public InventoryProperties(int windowId, InventoryTypes type, ChatComponent title, byte slotCount) {
|
||||
this.windowId = windowId;
|
||||
this.type = type;
|
||||
this.title = title;
|
||||
this.slotCount = slotCount;
|
||||
}
|
||||
|
||||
public int getWindowId() {
|
||||
return this.windowId;
|
||||
}
|
||||
|
||||
public InventoryTypes getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public ChatComponent getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public byte getSlotCount() {
|
||||
return this.slotCount;
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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.data.inventory;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation;
|
||||
|
||||
@Deprecated
|
||||
public enum InventoryTypes {
|
||||
CHEST(new ResourceLocation("minecraft:chest")),
|
||||
WORKBENCH(new ResourceLocation("minecraft:crafting_table")),
|
||||
FURNACE(new ResourceLocation("minecraft:furnace")),
|
||||
DISPENSER(new ResourceLocation("minecraft:dispenser")),
|
||||
ENCHANTMENT_TABLE(new ResourceLocation("minecraft:enchanting_table")),
|
||||
BREWING_STAND(new ResourceLocation("minecraft:brewing_stand")),
|
||||
NPC_TRACE(new ResourceLocation("minecraft:villager")),
|
||||
BEACON(new ResourceLocation("minecraft:beacon")),
|
||||
ANVIL(new ResourceLocation("minecraft:anvil")),
|
||||
HOPPER(new ResourceLocation("minecraft:hopper")),
|
||||
DROPPER(new ResourceLocation("minecraft:dropper")),
|
||||
HORSE(new ResourceLocation("EntityHorse"));
|
||||
|
||||
private static final InventoryTypes[] INVENTORY_TYPES = values();
|
||||
private static final HashBiMap<ResourceLocation, InventoryTypes> RESOURCE_LOCATION_TYPE_MAP = HashBiMap.create();
|
||||
|
||||
static {
|
||||
for (InventoryTypes type : INVENTORY_TYPES) {
|
||||
RESOURCE_LOCATION_TYPE_MAP.put(type.getResourceLocation(), type);
|
||||
}
|
||||
}
|
||||
|
||||
private final ResourceLocation resourceLocation;
|
||||
|
||||
InventoryTypes(ResourceLocation resourceLocation) {
|
||||
this.resourceLocation = resourceLocation;
|
||||
}
|
||||
|
||||
public static InventoryTypes byId(int id) {
|
||||
return INVENTORY_TYPES[id];
|
||||
}
|
||||
|
||||
public static InventoryTypes byResourceLocation(ResourceLocation resourceLocation) {
|
||||
return RESOURCE_LOCATION_TYPE_MAP.get(resourceLocation);
|
||||
}
|
||||
|
||||
public ResourceLocation getResourceLocation() {
|
||||
return this.resourceLocation;
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ package de.bixilon.minosoft.modding.event.events;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import de.bixilon.minosoft.data.Difficulties;
|
||||
import de.bixilon.minosoft.data.LevelTypes;
|
||||
import de.bixilon.minosoft.data.abilities.Gamemodes;
|
||||
import de.bixilon.minosoft.data.mappings.Dimension;
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation;
|
||||
@ -30,13 +29,12 @@ public class JoinGameEvent extends CancelableEvent {
|
||||
private final Difficulties difficulty;
|
||||
private final int viewDistance;
|
||||
private final int maxPlayers;
|
||||
private final LevelTypes levelType;
|
||||
private final boolean reducedDebugScreen;
|
||||
private final boolean enableRespawnScreen;
|
||||
private final long hashedSeed;
|
||||
private final HashBiMap<ResourceLocation, Dimension> dimensions;
|
||||
|
||||
public JoinGameEvent(PlayConnection connection, int entityId, boolean hardcore, Gamemodes gamemode, Dimension dimension, Difficulties difficulty, int viewDistance, int maxPlayers, LevelTypes levelType, boolean reducedDebugScreen, boolean enableRespawnScreen, long hashedSeed, HashBiMap<ResourceLocation, Dimension> dimensions) {
|
||||
public JoinGameEvent(PlayConnection connection, int entityId, boolean hardcore, Gamemodes gamemode, Dimension dimension, Difficulties difficulty, int viewDistance, int maxPlayers, boolean reducedDebugScreen, boolean enableRespawnScreen, long hashedSeed, HashBiMap<ResourceLocation, Dimension> dimensions) {
|
||||
super(connection);
|
||||
this.entityId = entityId;
|
||||
this.hardcore = hardcore;
|
||||
@ -45,7 +43,6 @@ public class JoinGameEvent extends CancelableEvent {
|
||||
this.difficulty = difficulty;
|
||||
this.viewDistance = viewDistance;
|
||||
this.maxPlayers = maxPlayers;
|
||||
this.levelType = levelType;
|
||||
this.reducedDebugScreen = reducedDebugScreen;
|
||||
this.enableRespawnScreen = enableRespawnScreen;
|
||||
this.hashedSeed = hashedSeed;
|
||||
@ -61,7 +58,6 @@ public class JoinGameEvent extends CancelableEvent {
|
||||
this.difficulty = pkg.getDifficulty();
|
||||
this.viewDistance = pkg.getViewDistance();
|
||||
this.maxPlayers = pkg.getMaxPlayers();
|
||||
this.levelType = pkg.getLevelType();
|
||||
this.reducedDebugScreen = pkg.isReducedDebugScreen();
|
||||
this.enableRespawnScreen = pkg.isEnableRespawnScreen();
|
||||
this.hashedSeed = pkg.getHashedSeed();
|
||||
@ -96,10 +92,6 @@ public class JoinGameEvent extends CancelableEvent {
|
||||
return this.maxPlayers;
|
||||
}
|
||||
|
||||
public LevelTypes getLevelType() {
|
||||
return this.levelType;
|
||||
}
|
||||
|
||||
public boolean isReducedDebugScreen() {
|
||||
return this.reducedDebugScreen;
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
package de.bixilon.minosoft.modding.event.events;
|
||||
|
||||
import de.bixilon.minosoft.data.Difficulties;
|
||||
import de.bixilon.minosoft.data.LevelTypes;
|
||||
import de.bixilon.minosoft.data.abilities.Gamemodes;
|
||||
import de.bixilon.minosoft.data.mappings.Dimension;
|
||||
import de.bixilon.minosoft.protocol.network.connection.PlayConnection;
|
||||
@ -24,14 +23,12 @@ public class RespawnEvent extends PlayConnectionEvent {
|
||||
private final Gamemodes gamemode;
|
||||
private final Dimension dimension;
|
||||
private final Difficulties difficulty;
|
||||
private final LevelTypes levelType;
|
||||
|
||||
public RespawnEvent(PlayConnection connection, Gamemodes gamemode, Dimension dimension, Difficulties difficulty, LevelTypes levelType) {
|
||||
public RespawnEvent(PlayConnection connection, Gamemodes gamemode, Dimension dimension, Difficulties difficulty) {
|
||||
super(connection);
|
||||
this.gamemode = gamemode;
|
||||
this.dimension = dimension;
|
||||
this.difficulty = difficulty;
|
||||
this.levelType = levelType;
|
||||
}
|
||||
|
||||
public RespawnEvent(PlayConnection connection, RespawnS2CP pkg) {
|
||||
@ -39,7 +36,6 @@ public class RespawnEvent extends PlayConnectionEvent {
|
||||
this.gamemode = pkg.getGamemode();
|
||||
this.dimension = pkg.getDimension();
|
||||
this.difficulty = pkg.getDifficulty();
|
||||
this.levelType = pkg.getLevelType();
|
||||
}
|
||||
|
||||
public Gamemodes getGamemode() {
|
||||
@ -53,8 +49,4 @@ public class RespawnEvent extends PlayConnectionEvent {
|
||||
public Difficulties getDifficulty() {
|
||||
return this.difficulty;
|
||||
}
|
||||
|
||||
public LevelTypes getLevelType() {
|
||||
return this.levelType;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ package de.bixilon.minosoft.protocol.packets.s2c.play
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.minosoft.data.Difficulties
|
||||
import de.bixilon.minosoft.data.LevelTypes
|
||||
import de.bixilon.minosoft.data.abilities.Gamemodes
|
||||
import de.bixilon.minosoft.data.mappings.Dimension
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation
|
||||
@ -48,7 +47,7 @@ class JoinGameS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
private set
|
||||
var maxPlayers = 0
|
||||
private set
|
||||
var levelType: LevelTypes = LevelTypes.UNKNOWN
|
||||
var levelType: String? = null
|
||||
private set
|
||||
var isReducedDebugScreen = false
|
||||
private set
|
||||
@ -74,10 +73,10 @@ class JoinGameS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
|
||||
if (buffer.versionId < ProtocolVersions.V_1_9_1) {
|
||||
dimension = buffer.connection.registries.dimensionRegistry[buffer.readByte().toInt()]
|
||||
difficulty = Difficulties.byId(buffer.readUnsignedByte().toInt())
|
||||
difficulty = Difficulties[buffer.readUnsignedByte()]
|
||||
maxPlayers = buffer.readByte().toInt()
|
||||
if (buffer.versionId >= ProtocolVersions.V_13W42B) {
|
||||
levelType = LevelTypes.byType(buffer.readString())
|
||||
levelType = buffer.readString()
|
||||
}
|
||||
if (buffer.versionId >= ProtocolVersions.V_14W29A) {
|
||||
isReducedDebugScreen = buffer.readBoolean()
|
||||
@ -107,7 +106,7 @@ class JoinGameS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
hashedSeed = buffer.readLong()
|
||||
}
|
||||
if (buffer.versionId < ProtocolVersions.V_19W11A) {
|
||||
difficulty = Difficulties.byId(buffer.readUnsignedByte())
|
||||
difficulty = Difficulties[buffer.readUnsignedByte()]
|
||||
}
|
||||
maxPlayers = if (buffer.versionId < ProtocolVersions.V_1_16_2_RC1) {
|
||||
buffer.readByte().toInt()
|
||||
@ -115,7 +114,7 @@ class JoinGameS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
buffer.readVarInt()
|
||||
}
|
||||
if (buffer.versionId < ProtocolVersions.V_20W20A) {
|
||||
levelType = LevelTypes.byType(buffer.readString())
|
||||
levelType = buffer.readString()
|
||||
}
|
||||
if (buffer.versionId >= ProtocolVersions.V_19W13A) {
|
||||
viewDistance = buffer.readVarInt()
|
||||
@ -123,7 +122,7 @@ class JoinGameS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
if (buffer.versionId >= ProtocolVersions.V_20W20A) {
|
||||
buffer.readBoolean() // isDebug
|
||||
if (buffer.readBoolean()) {
|
||||
levelType = LevelTypes.FLAT
|
||||
levelType = "flat"
|
||||
}
|
||||
}
|
||||
isReducedDebugScreen = buffer.readBoolean()
|
||||
|
@ -13,7 +13,6 @@
|
||||
package de.bixilon.minosoft.protocol.packets.s2c.play
|
||||
|
||||
import de.bixilon.minosoft.data.Difficulties
|
||||
import de.bixilon.minosoft.data.LevelTypes
|
||||
import de.bixilon.minosoft.data.abilities.Gamemodes
|
||||
import de.bixilon.minosoft.data.mappings.Dimension
|
||||
import de.bixilon.minosoft.modding.event.events.RespawnEvent
|
||||
@ -33,7 +32,7 @@ class RespawnS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
var difficulty: Difficulties = Difficulties.NORMAL
|
||||
private set
|
||||
val gamemode: Gamemodes
|
||||
var levelType: LevelTypes = LevelTypes.UNKNOWN
|
||||
var levelType: String? = null
|
||||
private set
|
||||
var hashedSeed = 0L
|
||||
private set
|
||||
@ -61,7 +60,7 @@ class RespawnS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
}
|
||||
}
|
||||
if (buffer.versionId < ProtocolVersions.V_19W11A) {
|
||||
difficulty = Difficulties.byId(buffer.readUnsignedByte())
|
||||
difficulty = Difficulties[buffer.readUnsignedByte()]
|
||||
}
|
||||
if (buffer.versionId >= ProtocolVersions.V_20W22A) {
|
||||
dimension = buffer.connection.registries.dimensionRegistry[buffer.readResourceLocation()]!!
|
||||
@ -74,7 +73,7 @@ class RespawnS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
buffer.readByte() // previous game mode
|
||||
}
|
||||
if (buffer.versionId >= ProtocolVersions.V_13W42B && buffer.versionId < ProtocolVersions.V_20W20A) {
|
||||
levelType = LevelTypes.byType(buffer.readString())
|
||||
levelType = buffer.readString()
|
||||
}
|
||||
if (buffer.versionId >= ProtocolVersions.V_20W20A) {
|
||||
isDebug = buffer.readBoolean()
|
||||
|
@ -22,7 +22,7 @@ import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
|
||||
class ServerDifficultyS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||
val difficulty: Difficulties = Difficulties.byId(buffer.readUnsignedByte())
|
||||
val difficulty: Difficulties = Difficulties[buffer.readUnsignedByte()]
|
||||
var locked = false
|
||||
private set
|
||||
|
||||
|
@ -10,10 +10,12 @@
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
package de.bixilon.minosoft.protocol.protocol
|
||||
|
||||
package de.bixilon.minosoft.protocol.protocol;
|
||||
import de.bixilon.minosoft.util.KUtil
|
||||
import de.bixilon.minosoft.util.enum.ValuesEnum
|
||||
|
||||
public enum ConnectionStates {
|
||||
enum class ConnectionStates {
|
||||
HANDSHAKING,
|
||||
STATUS,
|
||||
LOGIN,
|
||||
@ -22,11 +24,11 @@ public enum ConnectionStates {
|
||||
DISCONNECTING,
|
||||
DISCONNECTED,
|
||||
FAILED,
|
||||
FAILED_NO_RETRY;
|
||||
FAILED_NO_RETRY,
|
||||
;
|
||||
|
||||
private static final ConnectionStates[] CONNECTION_STATES = values();
|
||||
|
||||
public static ConnectionStates byId(int id) {
|
||||
return CONNECTION_STATES[id];
|
||||
companion object : ValuesEnum<ConnectionStates> {
|
||||
override val VALUES: Array<ConnectionStates> = values()
|
||||
override val NAME_MAP: Map<String, ConnectionStates> = KUtil.getEnumValues(VALUES)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user