Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a0686685c | ||
|
|
ccc63966c6 | ||
|
|
18d8ab068d | ||
|
|
227396d08a | ||
|
|
dbc92572fd | ||
|
|
ea2f603cf7 | ||
|
|
a5aa9e7281 | ||
|
|
0e5ee7063f |
No files matched your search
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class EntityTracker extends StoredObject {
|
||||
@@ -51,12 +52,12 @@ public class EntityTracker extends StoredObject {
|
||||
|
||||
public AbstractEntityType getEntityType(int id) {
|
||||
if (containsEntity(id))
|
||||
return getEntity(id).getType();
|
||||
return getEntity(id).get().getType();
|
||||
return null;
|
||||
}
|
||||
|
||||
public StoredEntity getEntity(int id) {
|
||||
return entityMap.get(id);
|
||||
public Optional<StoredEntity> getEntity(int id) {
|
||||
return Optional.ofNullable(entityMap.get(id));
|
||||
}
|
||||
|
||||
public boolean containsEntity(int id) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.blockitem.BlockItemSettings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.data.BlockColors;
|
||||
@@ -52,8 +53,15 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
|
||||
|
||||
if (i.getTag() == null)
|
||||
i.setTag(new CompoundTag(""));
|
||||
|
||||
// Backup data for toServer
|
||||
i.getTag().put(createViaNBT(original));
|
||||
|
||||
// Keep original data
|
||||
if (original.getTag() != null)
|
||||
for (Tag ai : original.getTag())
|
||||
i.getTag().put(ai);
|
||||
|
||||
// Handle colors
|
||||
if (i.getTag().contains("display")) {
|
||||
CompoundTag tag = i.getTag().get("display");
|
||||
@@ -146,8 +154,10 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int block = section.getBlock(x, y, z);
|
||||
int btype = block >> 4;
|
||||
int meta = block & 15;
|
||||
|
||||
if (containsBlock(btype)) {
|
||||
Block b = handleBlock(btype, block & 15); // Type / data
|
||||
Block b = handleBlock(btype, meta); // Type / data
|
||||
section.setBlock(x, y, z, b.getId(), b.getData());
|
||||
}
|
||||
// Entity Tags
|
||||
@@ -198,7 +208,7 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
|
||||
protected CompoundTag getNamedTag(String text) {
|
||||
CompoundTag tag = new CompoundTag("");
|
||||
tag.put(new CompoundTag("display"));
|
||||
((CompoundTag) tag.get("display")).put(new StringTag("Name", text));
|
||||
((CompoundTag) tag.get("display")).put(new StringTag("Name", ChatColor.RESET + text));
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -98,7 +99,14 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
}
|
||||
|
||||
protected MetaStorage handleMeta(UserConnection user, int entityId, MetaStorage storage) throws Exception {
|
||||
EntityTracker.StoredEntity entity = getEntityTracker(user).getEntity(entityId);
|
||||
Optional<EntityTracker.StoredEntity> optEntity = getEntityTracker(user).getEntity(entityId);
|
||||
if (!optEntity.isPresent()) {
|
||||
if (!Via.getConfig().isSuppressMetadataErrors())
|
||||
ViaBackwards.getPlatform().getLogger().warning("Metadata for entity id: " + entityId + " not sent because the entity doesn't exist. " + storage);
|
||||
throw new CancelException();
|
||||
}
|
||||
|
||||
EntityTracker.StoredEntity entity = optEntity.get();
|
||||
AbstractEntityType type = entity.getType();
|
||||
|
||||
List<Metadata> newList = new CopyOnWriteArrayList<>();
|
||||
|
||||
+6
-4
@@ -394,7 +394,7 @@ public class BlockItemPackets1_11 extends BlockItemRewriter<Protocol1_10To1_11>
|
||||
for (int i = 219; i < 235; i++)
|
||||
rewrite(i)
|
||||
.repItem(new Item((short) 130, (byte) 1, (short) 0, getNamedTag("1.11 " + BlockColors.get(i - 219) + " Shulker Box")))
|
||||
.repBlock(new Block(130, 1))
|
||||
.repBlock(new Block(130, 4)) // TODO investigate this
|
||||
.blockEntityHandler((block, tag) -> {
|
||||
tag.remove("id");
|
||||
tag.put(new StringTag("id", "minecraft:chest"));
|
||||
@@ -428,7 +428,8 @@ public class BlockItemPackets1_11 extends BlockItemRewriter<Protocol1_10To1_11>
|
||||
WindowTracker tracker = user.get(WindowTracker.class);
|
||||
if (tracker.getInventory() != null && tracker.getInventory().equals("EntityHorse")) {
|
||||
EntityTracker.ProtocolEntityTracker entTracker = user.get(EntityTracker.class).get(getProtocol());
|
||||
if (tracker.getEntityId() != -1 && entTracker.getEntity(tracker.getEntityId()).getType().is(EntityType1_11.EntityType.LIAMA))
|
||||
Optional<EntityTracker.StoredEntity> optEntity = entTracker.getEntity(tracker.getEntityId());
|
||||
if (optEntity.isPresent() && optEntity.get().getType().is(EntityType1_11.EntityType.LIAMA))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -438,8 +439,9 @@ public class BlockItemPackets1_11 extends BlockItemRewriter<Protocol1_10To1_11>
|
||||
WindowTracker tracker = user.get(WindowTracker.class);
|
||||
if (tracker.getInventory() != null && tracker.getInventory().equals("EntityHorse")) {
|
||||
EntityTracker.ProtocolEntityTracker entTracker = user.get(EntityTracker.class).get(getProtocol());
|
||||
if (tracker.getEntityId() != -1)
|
||||
return Optional.of(entTracker.getEntity(tracker.getEntityId()).get(ChestedHorseStorage.class));
|
||||
Optional<EntityTracker.StoredEntity> optEntity = entTracker.getEntity(tracker.getEntityId());
|
||||
if (optEntity.isPresent())
|
||||
return Optional.of(optEntity.get().get(ChestedHorseStorage.class));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,6 +45,6 @@ public class BlockColors {
|
||||
}
|
||||
|
||||
public static String get(Integer key) {
|
||||
return colors.get(key);
|
||||
return colors.getOrDefault(key, "Unknown color");
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<groupId>nl.matsv</groupId>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.1.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>Allow newer clients to join older server versions.</description>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Reference in new issue
Block a user