forked from BLOCKFANTASY/LOOHP-Limbo
Minecraft 1.21.7
This commit is contained in:
parent
57473e5f57
commit
077595f0c2
|
|
@ -1,6 +1,6 @@
|
|||
# Limbo
|
||||
[](http://ci.loohpjames.com/job/Limbo/)
|
||||
## Standalone Limbo Minecraft Server (Currently 1.21.6)
|
||||
## Standalone Limbo Minecraft Server (Currently 1.21.7)
|
||||
|
||||
https://www.spigotmc.org/resources/82468/
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ IP: mc.loohpjames.com
|
|||
```
|
||||

|
||||
***
|
||||
### Downloads (1.17.1-1.21.6)
|
||||
### Downloads (1.17.1-1.21.7)
|
||||
- [Jenkins](http://ci.loohpjames.com/job/Limbo/)
|
||||
***
|
||||
### Offical Plugins
|
||||
|
|
|
|||
4
pom.xml
4
pom.xml
|
|
@ -24,7 +24,7 @@
|
|||
<groupId>com.loohp</groupId>
|
||||
<artifactId>Limbo</artifactId>
|
||||
<name>Limbo</name>
|
||||
<version>0.7.14-ALPHA</version>
|
||||
<version>0.7.15-ALPHA</version>
|
||||
|
||||
<description>Standalone Limbo Minecraft Server.</description>
|
||||
<url>https://github.com/LOOHP/Limbo</url>
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}-${project.version}-1.21.6</finalName>
|
||||
<finalName>${project.artifactId}-${project.version}-1.21.7</finalName>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public final class Limbo {
|
|||
private static Limbo instance;
|
||||
public static boolean noGui = false;
|
||||
|
||||
public static void main(String args[]) throws IOException, ParseException, NumberFormatException, ClassNotFoundException, InterruptedException {
|
||||
public static void main(String[] args) throws IOException, ParseException, NumberFormatException, ClassNotFoundException, InterruptedException {
|
||||
for (String flag : args) {
|
||||
if (flag.equals("--nogui") || flag.equals("nogui")) {
|
||||
noGui = true;
|
||||
|
|
@ -132,8 +132,8 @@ public final class Limbo {
|
|||
|
||||
//===========================
|
||||
|
||||
public final String SERVER_IMPLEMENTATION_VERSION = "1.21.6";
|
||||
public final int SERVER_IMPLEMENTATION_PROTOCOL = 771;
|
||||
public final String SERVER_IMPLEMENTATION_VERSION = "1.21.7";
|
||||
public final int SERVER_IMPLEMENTATION_PROTOCOL = 772;
|
||||
public final String LIMBO_IMPLEMENTATION_VERSION;
|
||||
|
||||
private final AtomicBoolean isRunning;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package com.loohp.limbo.inventory;
|
||||
|
||||
import com.loohp.limbo.location.Location;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class CustomInventory extends AbstractInventory implements TitledInventory {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This file is part of Limbo.
|
||||
*
|
||||
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com>
|
||||
* Copyright (C) 2022. Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.loohp.limbo.inventory;
|
||||
|
||||
public class EmptyInventory extends AbstractInventory {
|
||||
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
@Deprecated
|
||||
public static EmptyInventory create(InventoryHolder inventoryHolder) {
|
||||
return new EmptyInventory(inventoryHolder);
|
||||
}
|
||||
|
||||
private EmptyInventory(InventoryHolder inventoryHolder) {
|
||||
super(0, inventoryHolder, InventoryType.CHEST, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,29 +27,39 @@ public class MovingObjectPositionBlock extends MovingObjectPosition {
|
|||
private final BlockPosition blockPos;
|
||||
private final boolean miss;
|
||||
private final boolean inside;
|
||||
private final boolean worldBorderHit;
|
||||
|
||||
public static MovingObjectPositionBlock miss(Vector vec3d, BlockFace direction, BlockPosition blockposition) {
|
||||
return new MovingObjectPositionBlock(true, vec3d, direction, blockposition, false);
|
||||
return new MovingObjectPositionBlock(true, vec3d, direction, blockposition, false, false);
|
||||
}
|
||||
|
||||
public MovingObjectPositionBlock(Vector vec3d, BlockFace direction, BlockPosition blockposition, boolean flag) {
|
||||
this(false, vec3d, direction, blockposition, flag);
|
||||
this(false, vec3d, direction, blockposition, flag, false);
|
||||
}
|
||||
|
||||
private MovingObjectPositionBlock(boolean flag, Vector vec3d, BlockFace direction, BlockPosition blockposition, boolean flag1) {
|
||||
public MovingObjectPositionBlock(Vector vec3d, BlockFace direction, BlockPosition blockposition, boolean flag, boolean flag1) {
|
||||
this(false, vec3d, direction, blockposition, flag, flag1);
|
||||
}
|
||||
|
||||
private MovingObjectPositionBlock(boolean flag, Vector vec3d, BlockFace direction, BlockPosition blockposition, boolean flag1, boolean flag2) {
|
||||
super(vec3d);
|
||||
this.miss = flag;
|
||||
this.direction = direction;
|
||||
this.blockPos = blockposition;
|
||||
this.inside = flag1;
|
||||
this.worldBorderHit = flag2;
|
||||
}
|
||||
|
||||
public MovingObjectPositionBlock withDirection(BlockFace direction) {
|
||||
return new MovingObjectPositionBlock(this.miss, this.location, direction, this.blockPos, this.inside);
|
||||
return new MovingObjectPositionBlock(this.miss, this.location, direction, this.blockPos, this.inside, this.worldBorderHit);
|
||||
}
|
||||
|
||||
public MovingObjectPositionBlock withPosition(BlockPosition blockposition) {
|
||||
return new MovingObjectPositionBlock(this.miss, this.location, this.direction, blockposition, this.inside);
|
||||
return new MovingObjectPositionBlock(this.miss, this.location, this.direction, blockposition, this.inside, this.worldBorderHit);
|
||||
}
|
||||
|
||||
public MovingObjectPositionBlock hitBorder() {
|
||||
return new MovingObjectPositionBlock(this.miss, this.location, this.direction, this.blockPos, this.inside, true);
|
||||
}
|
||||
|
||||
public BlockPosition getBlockPos() {
|
||||
|
|
@ -68,4 +78,8 @@ public class MovingObjectPositionBlock extends MovingObjectPosition {
|
|||
public boolean isInside() {
|
||||
return this.inside;
|
||||
}
|
||||
|
||||
public boolean isWorldBorderHit() {
|
||||
return worldBorderHit;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class Channel implements AutoCloseable {
|
|||
ensureOpen();
|
||||
size = size < 0 ? DataTypeIO.readVarInt(input) : size;
|
||||
int packetId = DataTypeIO.readVarInt(input);
|
||||
System.out.println(packetId);
|
||||
ChannelPacketRead read = new ChannelPacketRead(size, packetId, input);
|
||||
for (Pair<Key, ChannelPacketHandler> pair : handlers) {
|
||||
read = pair.getSecond().read(read);
|
||||
|
|
|
|||
|
|
@ -29,14 +29,18 @@ public class PacketPlayInBlockPlace extends PacketIn {
|
|||
|
||||
private final EquipmentSlot hand;
|
||||
private final int sequence;
|
||||
private final float yRot;
|
||||
private final float xRot;
|
||||
|
||||
public PacketPlayInBlockPlace(EquipmentSlot hand, int sequence) {
|
||||
public PacketPlayInBlockPlace(EquipmentSlot hand, int sequence, float yRot, float xRot) {
|
||||
this.hand = hand;
|
||||
this.sequence = sequence;
|
||||
}
|
||||
this.yRot = yRot;
|
||||
this.xRot = xRot;
|
||||
}
|
||||
|
||||
public PacketPlayInBlockPlace(DataInputStream in) throws IOException {
|
||||
this(EquipmentSlot.values()[DataTypeIO.readVarInt(in)], DataTypeIO.readVarInt(in));
|
||||
public PacketPlayInBlockPlace(DataInputStream in, float yRot, float xRot) throws IOException {
|
||||
this(EquipmentSlot.values()[DataTypeIO.readVarInt(in)], DataTypeIO.readVarInt(in), in.readFloat(), in.readFloat());
|
||||
}
|
||||
|
||||
public EquipmentSlot getHand() {
|
||||
|
|
@ -46,4 +50,12 @@ public class PacketPlayInBlockPlace extends PacketIn {
|
|||
public int getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public float getYRot() {
|
||||
return yRot;
|
||||
}
|
||||
|
||||
public float getXRot() {
|
||||
return xRot;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class PacketPlayInSetCreativeSlot extends PacketIn {
|
|||
}
|
||||
|
||||
public PacketPlayInSetCreativeSlot(DataInputStream in) throws IOException {
|
||||
this(in.readShort(), DataTypeIO.readItemStack(in));
|
||||
this(in.readShort(), DataTypeIO.readUntrustedItemStack(in));
|
||||
}
|
||||
|
||||
public int getSlotNumber() {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,13 @@
|
|||
package com.loohp.limbo.network.protocol.packets;
|
||||
|
||||
import com.loohp.limbo.inventory.InventoryClickType;
|
||||
import com.loohp.limbo.inventory.ItemStack;
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class PacketPlayInWindowClick extends PacketIn {
|
||||
|
||||
|
|
@ -36,34 +35,32 @@ public class PacketPlayInWindowClick extends PacketIn {
|
|||
private final int slotNum;
|
||||
private final int buttonNum;
|
||||
private final InventoryClickType clickType;
|
||||
private final Map<Integer, ItemStack> changedSlots;
|
||||
private final ItemStack carriedItem;
|
||||
private final Set<Integer> changedSlots;
|
||||
|
||||
public PacketPlayInWindowClick(int containerId, int stateId, int slotNum, int buttonNum, InventoryClickType clickType, Map<Integer, ItemStack> changedSlots, ItemStack carriedItem) {
|
||||
public PacketPlayInWindowClick(int containerId, int stateId, int slotNum, int buttonNum, InventoryClickType clickType, Set<Integer> changedSlots) {
|
||||
this.containerId = containerId;
|
||||
this.stateId = stateId;
|
||||
this.slotNum = slotNum;
|
||||
this.buttonNum = buttonNum;
|
||||
this.clickType = clickType;
|
||||
this.changedSlots = changedSlots;
|
||||
this.carriedItem = carriedItem;
|
||||
}
|
||||
|
||||
public PacketPlayInWindowClick(DataInputStream in) throws IOException {
|
||||
this.containerId = in.readByte();
|
||||
this.containerId = DataTypeIO.readVarInt(in);
|
||||
this.stateId = DataTypeIO.readVarInt(in);
|
||||
this.slotNum = in.readShort();
|
||||
this.buttonNum = in.readByte();
|
||||
this.clickType = InventoryClickType.values()[DataTypeIO.readVarInt(in)];
|
||||
Map<Integer, ItemStack> changedSlots = new HashMap<>();
|
||||
Set<Integer> changedSlots = new HashSet<>();
|
||||
int size = DataTypeIO.readVarInt(in);
|
||||
for (int i = 0; i < size; i++) {
|
||||
int slot = in.readShort();
|
||||
ItemStack itemStack = DataTypeIO.readItemStack(in);
|
||||
changedSlots.put(slot, itemStack);
|
||||
DataTypeIO.consumeHashedStack(in);
|
||||
changedSlots.add(slot);
|
||||
}
|
||||
this.changedSlots = Collections.unmodifiableMap(changedSlots);
|
||||
this.carriedItem = DataTypeIO.readItemStack(in);
|
||||
this.changedSlots = Collections.unmodifiableSet(changedSlots);
|
||||
DataTypeIO.consumeHashedStack(in);
|
||||
}
|
||||
|
||||
public int getContainerId() {
|
||||
|
|
@ -86,11 +83,11 @@ public class PacketPlayInWindowClick extends PacketIn {
|
|||
return clickType;
|
||||
}
|
||||
|
||||
public Map<Integer, ItemStack> getChangedSlots() {
|
||||
public Set<Integer> getChangedSlots() {
|
||||
return changedSlots;
|
||||
}
|
||||
|
||||
public ItemStack getCarriedItem() {
|
||||
return carriedItem;
|
||||
}
|
||||
// public ItemStack getCarriedItem() {
|
||||
// return carriedItem;
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class PacketPlayOutSetSlot extends PacketOut {
|
|||
DataOutputStream output = new DataOutputStream(buffer);
|
||||
output.writeByte(PacketRegistry.getPacketId(getClass()));
|
||||
|
||||
output.writeByte(containerId);
|
||||
DataTypeIO.writeVarInt(output, containerId);
|
||||
DataTypeIO.writeVarInt(output, stateId);
|
||||
output.writeShort(slot);
|
||||
DataTypeIO.writeItemStack(output, itemStack);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class PacketPlayOutWindowItems extends PacketOut {
|
|||
DataOutputStream output = new DataOutputStream(buffer);
|
||||
output.writeByte(PacketRegistry.getPacketId(getClass()));
|
||||
|
||||
output.writeByte(containerId);
|
||||
DataTypeIO.writeVarInt(output, containerId);
|
||||
DataTypeIO.writeVarInt(output, stateId);
|
||||
DataTypeIO.writeVarInt(output, items.size());
|
||||
for (ItemStack itemStack : items) {
|
||||
|
|
|
|||
|
|
@ -31,10 +31,7 @@ import com.loohp.limbo.events.inventory.InventoryCloseEvent;
|
|||
import com.loohp.limbo.events.inventory.InventoryOpenEvent;
|
||||
import com.loohp.limbo.events.player.PlayerChatEvent;
|
||||
import com.loohp.limbo.events.player.PlayerTeleportEvent;
|
||||
import com.loohp.limbo.inventory.Inventory;
|
||||
import com.loohp.limbo.inventory.InventoryHolder;
|
||||
import com.loohp.limbo.inventory.InventoryView;
|
||||
import com.loohp.limbo.inventory.TitledInventory;
|
||||
import com.loohp.limbo.inventory.*;
|
||||
import com.loohp.limbo.location.Location;
|
||||
import com.loohp.limbo.network.ClientConnection;
|
||||
import com.loohp.limbo.network.protocol.packets.ClientboundClearTitlesPacket;
|
||||
|
|
@ -116,7 +113,7 @@ public class Player extends LivingEntity implements CommandSender, InventoryHold
|
|||
this.entityId = entityId;
|
||||
this.containerIdCounter = new AtomicInteger(1);
|
||||
this.playerInventory = new PlayerInventory(this);
|
||||
this.inventoryView = new InventoryView(this, null, null, playerInventory);
|
||||
this.inventoryView = new InventoryView(this, null, EmptyInventory.create(this), playerInventory);
|
||||
this.playerInteractManager = playerInteractManager;
|
||||
this.playerInteractManager.setPlayer(this);
|
||||
this.watcher = new DataWatcher(this);
|
||||
|
|
|
|||
|
|
@ -76,6 +76,30 @@ public class DataTypeIO {
|
|||
}
|
||||
}
|
||||
|
||||
public static ItemStack readUntrustedItemStack(DataInputStream in) throws IOException {
|
||||
int amount = DataTypeIO.readVarInt(in);
|
||||
if (amount <= 0) {
|
||||
return ItemStack.AIR;
|
||||
} else {
|
||||
Key key = BuiltInRegistries.ITEM_REGISTRY.fromId(readVarInt(in));
|
||||
int size = DataTypeIO.readVarInt(in);
|
||||
int removeSize = DataTypeIO.readVarInt(in);
|
||||
Map<Key, Tag<?>> components = new HashMap<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Key componentKey = BuiltInRegistries.DATA_COMPONENT_TYPE.fromId(DataTypeIO.readVarInt(in));
|
||||
DataTypeIO.readVarInt(in);
|
||||
Tag<?> component = readTag(in, Tag.class);
|
||||
if (componentKey != null && DataComponentType.isKnownType(componentKey)) {
|
||||
components.put(componentKey, component);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < removeSize; i++) {
|
||||
DataTypeIO.readVarInt(in);
|
||||
}
|
||||
return new ItemStack(key, amount, components);
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack readItemStack(DataInputStream in) throws IOException {
|
||||
int amount = DataTypeIO.readVarInt(in);
|
||||
if (amount <= 0) {
|
||||
|
|
@ -83,7 +107,7 @@ public class DataTypeIO {
|
|||
} else {
|
||||
Key key = BuiltInRegistries.ITEM_REGISTRY.fromId(readVarInt(in));
|
||||
int size = DataTypeIO.readVarInt(in);
|
||||
DataTypeIO.readVarInt(in);
|
||||
int removeSize = DataTypeIO.readVarInt(in);
|
||||
Map<Key, Tag<?>> components = new HashMap<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Key componentKey = BuiltInRegistries.DATA_COMPONENT_TYPE.fromId(DataTypeIO.readVarInt(in));
|
||||
|
|
@ -92,6 +116,9 @@ public class DataTypeIO {
|
|||
components.put(componentKey, component);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < removeSize; i++) {
|
||||
DataTypeIO.readVarInt(in);
|
||||
}
|
||||
return new ItemStack(key, amount, components);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,6 +134,7 @@ public class DataTypeIO {
|
|||
out.writeFloat((float) (vector.getY() - (double) blockposition.getY()));
|
||||
out.writeFloat((float) (vector.getZ() - (double) blockposition.getZ()));
|
||||
out.writeBoolean(movingobjectpositionblock.isInside());
|
||||
out.writeBoolean(movingobjectpositionblock.isWorldBorderHit());
|
||||
}
|
||||
|
||||
public static MovingObjectPositionBlock readBlockHitResult(DataInputStream in) throws IOException {
|
||||
|
|
@ -116,8 +144,9 @@ public class DataTypeIO {
|
|||
float f1 = in.readFloat();
|
||||
float f2 = in.readFloat();
|
||||
boolean flag = in.readBoolean();
|
||||
boolean flag1 = in.readBoolean();
|
||||
|
||||
return new MovingObjectPositionBlock(new Vector((double) blockposition.getX() + (double) f, (double) blockposition.getY() + (double) f1, (double) blockposition.getZ() + (double) f2), direction, blockposition, flag);
|
||||
return new MovingObjectPositionBlock(new Vector((double) blockposition.getX() + (double) f, (double) blockposition.getY() + (double) f1, (double) blockposition.getZ() + (double) f2), direction, blockposition, flag, flag1);
|
||||
}
|
||||
|
||||
public static <E extends Enum<E>> void writeEnumSet(DataOutputStream out, EnumSet<E> enumset, Class<E> oclass) throws IOException {
|
||||
|
|
@ -306,4 +335,20 @@ public class DataTypeIO {
|
|||
out.writeLong(l);
|
||||
}
|
||||
|
||||
public static void consumeHashedStack(DataInputStream in) throws IOException {
|
||||
if (in.readBoolean()) {
|
||||
DataTypeIO.readVarInt(in);
|
||||
DataTypeIO.readVarInt(in);
|
||||
int addedSize = DataTypeIO.readVarInt(in);
|
||||
for (int i = 0; i < addedSize; i++) {
|
||||
DataTypeIO.readVarInt(in);
|
||||
in.readInt();
|
||||
}
|
||||
int removedSize = DataTypeIO.readVarInt(in);
|
||||
for (int i = 0; i < removedSize; i++) {
|
||||
DataTypeIO.readVarInt(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"asset_id": "minecraft:dennis",
|
||||
"author": {
|
||||
"color": "gray",
|
||||
"translate": "painting.minecraft.dennis.author"
|
||||
},
|
||||
"height": 3,
|
||||
"title": {
|
||||
"color": "yellow",
|
||||
"translate": "painting.minecraft.dennis.title"
|
||||
},
|
||||
"width": 3
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "minecraft:jungle"
|
||||
"biomes": "#minecraft:is_jungle"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "minecraft:savanna"
|
||||
"biomes": "#minecraft:is_savanna"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "minecraft:badlands"
|
||||
"biomes": "#minecraft:is_badlands"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue