mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-22 16:57:40 +01:00
(Custom) enchant remap fixes, non full block light fix (#124)
* Fix 1.13 enchant conversion + custom enchants * Remove redundant check * More enchant remap fixes, add config option for custom enchant display * Fix non full blocks "saving" block light
This commit is contained in:
parent
e6059845aa
commit
fdcab0d5a8
@ -16,7 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
|
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
this.init();
|
this.init(getDataFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +17,7 @@ public class BungeePlugin extends Plugin implements ViaBackwardsPlatform {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
this.init();
|
this.init(getDataFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Why is this not a thing in Bungee? O_o
|
// Why is this not a thing in Bungee? O_o
|
||||||
|
@ -11,17 +11,26 @@
|
|||||||
package nl.matsv.viabackwards;
|
package nl.matsv.viabackwards;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import lombok.Getter;
|
import nl.matsv.viabackwards.api.ViaBackwardsConfig;
|
||||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||||
|
|
||||||
public class ViaBackwards {
|
public class ViaBackwards {
|
||||||
@Getter
|
|
||||||
private static ViaBackwardsPlatform platform;
|
|
||||||
|
|
||||||
public static void init(ViaBackwardsPlatform platform) {
|
private static ViaBackwardsPlatform platform;
|
||||||
|
private static ViaBackwardsConfig config;
|
||||||
|
|
||||||
|
public static void init(ViaBackwardsPlatform platform, ViaBackwardsConfig config) {
|
||||||
Preconditions.checkArgument(platform != null, "ViaBackwards is already initialized");
|
Preconditions.checkArgument(platform != null, "ViaBackwards is already initialized");
|
||||||
|
|
||||||
ViaBackwards.platform = platform;
|
ViaBackwards.platform = platform;
|
||||||
|
ViaBackwards.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ViaBackwardsPlatform getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ViaBackwardsConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package nl.matsv.viabackwards;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.util.Config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public final class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.api.ViaBackwardsConfig {
|
||||||
|
|
||||||
|
public ViaBackwardsConfig(File configFile) {
|
||||||
|
super(configFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addCustomEnchantsToLore() {
|
||||||
|
return getBoolean("add-custom-enchants-into-lore", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public URL getDefaultConfigURL() {
|
||||||
|
return getClass().getClassLoader().getResource("assets/viabackwards/config.yml");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleConfig(Map<String, Object> map) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getUnsupportedOptions() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package nl.matsv.viabackwards.api;
|
||||||
|
|
||||||
|
public interface ViaBackwardsConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mimics name and level of a custom enchant through the item's lore.
|
||||||
|
*
|
||||||
|
* @return true if enabled
|
||||||
|
*/
|
||||||
|
boolean addCustomEnchantsToLore();
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
package nl.matsv.viabackwards.api;
|
package nl.matsv.viabackwards.api;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.ViaBackwards;
|
import nl.matsv.viabackwards.ViaBackwards;
|
||||||
|
import nl.matsv.viabackwards.ViaBackwardsConfig;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
|
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.Protocol1_11_1To1_12;
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.Protocol1_11_1To1_12;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.Protocol1_11To1_11_1;
|
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.Protocol1_11To1_11_1;
|
||||||
@ -29,17 +30,23 @@ import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
|||||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||||
import us.myles.ViaVersion.update.Version;
|
import us.myles.ViaVersion.update.Version;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public interface ViaBackwardsPlatform {
|
public interface ViaBackwardsPlatform {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize ViaBackwards
|
* Initialize ViaBackwards
|
||||||
*/
|
*/
|
||||||
default void init() {
|
default void init(File dataFolder) {
|
||||||
ViaBackwards.init(this);
|
ViaBackwardsConfig config = new ViaBackwardsConfig(new File(dataFolder, "config.yml"));
|
||||||
|
config.reloadConfig();
|
||||||
|
|
||||||
|
ViaBackwards.init(this, config);
|
||||||
|
|
||||||
|
if (isOutdated()) return;
|
||||||
|
|
||||||
if (!isOutdated()) {
|
|
||||||
ProtocolRegistry.registerProtocol(new Protocol1_9_4To1_10(), Collections.singletonList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_10.getId());
|
ProtocolRegistry.registerProtocol(new Protocol1_9_4To1_10(), Collections.singletonList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_10.getId());
|
||||||
ProtocolRegistry.registerProtocol(new Protocol1_10To1_11(), Collections.singletonList(ProtocolVersion.v1_10.getId()), ProtocolVersion.v1_11.getId());
|
ProtocolRegistry.registerProtocol(new Protocol1_10To1_11(), Collections.singletonList(ProtocolVersion.v1_10.getId()), ProtocolVersion.v1_11.getId());
|
||||||
ProtocolRegistry.registerProtocol(new Protocol1_11To1_11_1(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_11_1.getId());
|
ProtocolRegistry.registerProtocol(new Protocol1_11To1_11_1(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_11_1.getId());
|
||||||
@ -55,7 +62,6 @@ public interface ViaBackwardsPlatform {
|
|||||||
ProtocolRegistry.registerProtocol(new Protocol1_14_2To1_14_3(), Collections.singletonList(ProtocolVersion.v1_14_2.getId()), ProtocolVersion.v1_14_3.getId());
|
ProtocolRegistry.registerProtocol(new Protocol1_14_2To1_14_3(), Collections.singletonList(ProtocolVersion.v1_14_2.getId()), ProtocolVersion.v1_14_3.getId());
|
||||||
ProtocolRegistry.registerProtocol(new Protocol1_14_3To1_14_4(), Collections.singletonList(ProtocolVersion.v1_14_3.getId()), ProtocolVersion.v1_14_4.getId());
|
ProtocolRegistry.registerProtocol(new Protocol1_14_3To1_14_4(), Collections.singletonList(ProtocolVersion.v1_14_3.getId()), ProtocolVersion.v1_14_4.getId());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger provided by the platform
|
* Logger provided by the platform
|
||||||
|
@ -605,10 +605,10 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
rewrite(205).repItem(new Item((short) 90, (byte) 1, (short) -1, getNamedTag("1.13 Mushroom Stem")));
|
rewrite(205).repItem(new Item((short) 90, (byte) 1, (short) -1, getNamedTag("1.13 Mushroom Stem")));
|
||||||
|
|
||||||
|
|
||||||
enchantmentMappings.put("minecraft:loyalty", "§r§7Loyalty");
|
enchantmentMappings.put("minecraft:loyalty", "§7Loyalty");
|
||||||
enchantmentMappings.put("minecraft:impaling", "§r§7Impaling");
|
enchantmentMappings.put("minecraft:impaling", "§7Impaling");
|
||||||
enchantmentMappings.put("minecraft:riptide", "§r§7Riptide");
|
enchantmentMappings.put("minecraft:riptide", "§7Riptide");
|
||||||
enchantmentMappings.put("minecraft:channeling", "§r§7Channeling");
|
enchantmentMappings.put("minecraft:channeling", "§7Channeling");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -798,9 +798,30 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
noMapped.add(enchantmentEntry);
|
noMapped.add(enchantmentEntry);
|
||||||
} else if (!newId.isEmpty()) {
|
} else if (!newId.isEmpty()) {
|
||||||
Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId);
|
Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId);
|
||||||
if (oldId == null && newId.startsWith("viaversion:legacy/")) {
|
if (oldId == null) {
|
||||||
|
if (!newId.startsWith("viaversion:legacy/")) {
|
||||||
|
// Custom enchant (?)
|
||||||
|
noMapped.add(enchantmentEntry);
|
||||||
|
|
||||||
|
// Some custom-enchant plugins write it into the lore manually, which would double its entry
|
||||||
|
if (ViaBackwards.getConfig().addCustomEnchantsToLore()) {
|
||||||
|
String name = newId;
|
||||||
|
if (name.contains(":"))
|
||||||
|
name = name.split(":")[1];
|
||||||
|
name = "§7" + Character.toUpperCase(name.charAt(0)) + name.substring(1).toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
|
lore.add(new StringTag("", name + " "
|
||||||
|
+ getRomanNumber((Short) ((CompoundTag) enchantmentEntry).get("lvl").getValue())));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Via.getManager().isDebug())
|
||||||
|
ViaBackwards.getPlatform().getLogger().warning("Found unknown enchant: " + newId);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
oldId = Short.valueOf(newId.substring(18));
|
oldId = Short.valueOf(newId.substring(18));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Short level = (Short) ((CompoundTag) enchantmentEntry).get("lvl").getValue();
|
Short level = (Short) ((CompoundTag) enchantmentEntry).get("lvl").getValue();
|
||||||
if (level != 0)
|
if (level != 0)
|
||||||
hasValidEnchants = true;
|
hasValidEnchants = true;
|
||||||
@ -815,6 +836,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
IntTag hideFlags = tag.get("HideFlags");
|
IntTag hideFlags = tag.get("HideFlags");
|
||||||
if (hideFlags == null) {
|
if (hideFlags == null) {
|
||||||
hideFlags = new IntTag("HideFlags");
|
hideFlags = new IntTag("HideFlags");
|
||||||
|
tag.put(new ByteTag(NBT_TAG_NAME + "|DummyEnchant"));
|
||||||
} else {
|
} else {
|
||||||
tag.put(new IntTag(NBT_TAG_NAME + "|OldHideFlags", hideFlags.getValue()));
|
tag.put(new IntTag(NBT_TAG_NAME + "|OldHideFlags", hideFlags.getValue()));
|
||||||
}
|
}
|
||||||
@ -831,27 +853,32 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
tag.put(hideFlags);
|
tag.put(hideFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lore.isEmpty()) {
|
if (noMapped.size() != 0) {
|
||||||
tag.put(noMapped);
|
tag.put(noMapped);
|
||||||
|
|
||||||
|
if (!lore.isEmpty()) {
|
||||||
CompoundTag display = tag.get("display");
|
CompoundTag display = tag.get("display");
|
||||||
if (display == null) {
|
if (display == null) {
|
||||||
tag.put(display = new CompoundTag("display"));
|
tag.put(display = new CompoundTag("display"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTag loreTag = display.get("Lore");
|
ListTag loreTag = display.get("Lore");
|
||||||
if (loreTag == null) {
|
if (loreTag == null) {
|
||||||
display.put(loreTag = new ListTag("Lore", StringTag.class));
|
display.put(loreTag = new ListTag("Lore", StringTag.class));
|
||||||
}
|
tag.put(new ByteTag(NBT_TAG_NAME + "|DummyLore"));
|
||||||
|
} else if (loreTag.size() != 0) {
|
||||||
ListTag oldLore = new ListTag(NBT_TAG_NAME + "|OldLore", StringTag.class);
|
ListTag oldLore = new ListTag(NBT_TAG_NAME + "|OldLore", StringTag.class);
|
||||||
for (Tag value : lore) {
|
for (Tag value : loreTag) {
|
||||||
oldLore.add(value.clone());
|
oldLore.add(value.clone());
|
||||||
}
|
}
|
||||||
display.put(oldLore);
|
tag.put(oldLore);
|
||||||
|
|
||||||
lore.addAll(loreTag.getValue());
|
lore.addAll(loreTag.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
loreTag.setValue(lore);
|
loreTag.setValue(lore);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tag.remove("Enchantments");
|
tag.remove("Enchantments");
|
||||||
tag.put(newEnchantments);
|
tag.put(newEnchantments);
|
||||||
@ -898,35 +925,20 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Display Name now uses JSON
|
// Display Name now uses JSON
|
||||||
if (tag.get("display") instanceof CompoundTag) {
|
Tag display = tag.get("display");
|
||||||
CompoundTag display = tag.get("display");
|
if (display instanceof CompoundTag) {
|
||||||
if (tag.get(NBT_TAG_NAME + "|noDisplay") instanceof ByteTag) {
|
CompoundTag displayTag = (CompoundTag) display;
|
||||||
tag.remove("display");
|
StringTag name = displayTag.get("Name");
|
||||||
tag.remove(NBT_TAG_NAME + "|noDisplay");
|
if (name instanceof StringTag) {
|
||||||
} else {
|
displayTag.put(new StringTag(NBT_TAG_NAME + "|Name", name.getValue()));
|
||||||
if (display.get("Name") instanceof StringTag) {
|
|
||||||
StringTag name = display.get("Name");
|
|
||||||
display.put(new StringTag(NBT_TAG_NAME + "|Name", name.getValue()));
|
|
||||||
name.setValue(
|
name.setValue(
|
||||||
ChatRewriter.legacyTextToJson(
|
ChatRewriter.legacyTextToJson(
|
||||||
name.getValue()
|
name.getValue()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (display.get(NBT_TAG_NAME + "|OldLore") instanceof ListTag) {
|
}
|
||||||
ListTag loreTag = new ListTag("Lore", StringTag.class);
|
|
||||||
ListTag oldLore = display.get(NBT_TAG_NAME + "|OldLore");
|
|
||||||
Iterator<Tag> iterator = oldLore.iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
loreTag.add(iterator.next());
|
|
||||||
}
|
|
||||||
display.remove("Lore");
|
|
||||||
display.put(loreTag);
|
|
||||||
display.remove(NBT_TAG_NAME + "|OldLore");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ench is now Enchantments and now uses identifiers
|
// ench is now Enchantments and now uses identifiers
|
||||||
if (tag.get("ench") instanceof ListTag) {
|
if (tag.get("ench") instanceof ListTag) {
|
||||||
rewriteEnchantmentsToServer(tag, false);
|
rewriteEnchantmentsToServer(tag, false);
|
||||||
@ -1002,18 +1014,22 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
boolean dummyEnchant = false;
|
boolean dummyEnchant = false;
|
||||||
if (!storedEnch) {
|
if (!storedEnch) {
|
||||||
IntTag hideFlags = tag.get(NBT_TAG_NAME + "|OldHideFlags");
|
IntTag hideFlags = tag.get(NBT_TAG_NAME + "|OldHideFlags");
|
||||||
dummyEnchant = hideFlags != null;
|
if (hideFlags != null) {
|
||||||
if (dummyEnchant) {
|
|
||||||
tag.put(new IntTag("HideFlags", hideFlags.getValue()));
|
tag.put(new IntTag("HideFlags", hideFlags.getValue()));
|
||||||
} else {
|
dummyEnchant = true;
|
||||||
|
tag.remove(NBT_TAG_NAME + "|OldHideFlags");
|
||||||
|
} else if (tag.contains(NBT_TAG_NAME + "|DummyEnchant")) {
|
||||||
tag.remove("HideFlags");
|
tag.remove("HideFlags");
|
||||||
|
dummyEnchant = true;
|
||||||
|
tag.remove(NBT_TAG_NAME + "|DummyEnchant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Tag enchEntry : enchantments) {
|
for (Tag enchEntry : enchantments) {
|
||||||
CompoundTag enchantmentEntry = new CompoundTag("");
|
CompoundTag enchantmentEntry = new CompoundTag("");
|
||||||
short oldId = ((Number) ((CompoundTag) enchEntry).get("id").getValue()).shortValue();
|
short oldId = ((Number) ((CompoundTag) enchEntry).get("id").getValue()).shortValue();
|
||||||
if (dummyEnchant && oldId == 0) {
|
short level = ((Number) ((CompoundTag) enchEntry).get("lvl").getValue()).shortValue();
|
||||||
|
if (dummyEnchant && oldId == 0 && level == 0) {
|
||||||
continue; //Skip dummy enchatment
|
continue; //Skip dummy enchatment
|
||||||
}
|
}
|
||||||
String newId = MappingData.oldEnchantmentsIds.get(oldId);
|
String newId = MappingData.oldEnchantmentsIds.get(oldId);
|
||||||
@ -1021,9 +1037,11 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
newId = "viaversion:legacy/" + oldId;
|
newId = "viaversion:legacy/" + oldId;
|
||||||
}
|
}
|
||||||
enchantmentEntry.put(new StringTag("id", newId));
|
enchantmentEntry.put(new StringTag("id", newId));
|
||||||
enchantmentEntry.put(new ShortTag("lvl", ((Number) ((CompoundTag) enchEntry).get("lvl").getValue()).shortValue()));
|
|
||||||
|
enchantmentEntry.put(new ShortTag("lvl", level));
|
||||||
newEnchantments.add(enchantmentEntry);
|
newEnchantments.add(enchantmentEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTag noMapped = tag.get(NBT_TAG_NAME + "|Enchantments");
|
ListTag noMapped = tag.get(NBT_TAG_NAME + "|Enchantments");
|
||||||
if (noMapped != null) {
|
if (noMapped != null) {
|
||||||
for (Tag value : noMapped) {
|
for (Tag value : noMapped) {
|
||||||
@ -1045,10 +1063,11 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
lore.setValue(oldLore.getValue());
|
lore.setValue(oldLore.getValue());
|
||||||
tag.remove(NBT_TAG_NAME + "|OldLore");
|
tag.remove(NBT_TAG_NAME + "|OldLore");
|
||||||
} else {
|
} else if (tag.contains(NBT_TAG_NAME + "|DummyLore")) {
|
||||||
tag.remove("Lore");
|
display.remove("Lore");
|
||||||
if (display.isEmpty())
|
if (display.isEmpty())
|
||||||
tag.remove("display");
|
tag.remove("display");
|
||||||
|
tag.remove(NBT_TAG_NAME + "|DummyLore");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!storedEnch)
|
if (!storedEnch)
|
||||||
|
@ -537,6 +537,19 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (section.getNonAirBlocksCount() != 0 && section.hasBlockLight()) {
|
||||||
|
for (int x = 0; x < 16; x++) {
|
||||||
|
for (int y = 0; y < 16; y++) {
|
||||||
|
for (int z = 0; z < 16; z++) {
|
||||||
|
int id = section.getFlatBlock(x, y, z);
|
||||||
|
if (MappingData.nonFullBlocks.contains(id)) {
|
||||||
|
section.getBlockLightNibbleArray().set(x, y, z, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < section.getPaletteSize(); j++) {
|
for (int j = 0; j < section.getPaletteSize(); j++) {
|
||||||
int old = section.getPaletteEntry(j);
|
int old = section.getPaletteEntry(j);
|
||||||
int newId = Protocol1_13_2To1_14.getNewBlockStateId(old);
|
int newId = Protocol1_13_2To1_14.getNewBlockStateId(old);
|
||||||
|
5
core/src/main/resources/assets/viabackwards/config.yml
Normal file
5
core/src/main/resources/assets/viabackwards/config.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# If you need help, you can join our Discord - https://viaversion.com/discord
|
||||||
|
#
|
||||||
|
# Writes name and level of custom enchantments into the item's lore.
|
||||||
|
# Set this to false if you see the entries doubled/if the custom-enchant plugin already writes these into the lore manually.
|
||||||
|
add-custom-enchants-into-lore: true
|
@ -20,11 +20,11 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
|
public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
|
||||||
@Getter
|
@Getter
|
||||||
private final Logger logger = new LoggerWrapper(LogManager.getLogger("ViaRewind"));
|
private final Logger logger = new LoggerWrapper(LogManager.getLogger("ViaBackwards"));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
this.init();
|
this.init(FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ViaBackwards").resolve("config.yml").toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
2
pom.xml
2
pom.xml
@ -61,7 +61,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion</artifactId>
|
<artifactId>viaversion</artifactId>
|
||||||
<version>2.1.3</version>
|
<version>2.1.4-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -14,6 +14,7 @@ import com.google.inject.Inject;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||||
import nl.matsv.viabackwards.sponge.VersionInfo;
|
import nl.matsv.viabackwards.sponge.VersionInfo;
|
||||||
|
import org.spongepowered.api.config.ConfigDir;
|
||||||
import org.spongepowered.api.event.Listener;
|
import org.spongepowered.api.event.Listener;
|
||||||
import org.spongepowered.api.event.Order;
|
import org.spongepowered.api.event.Order;
|
||||||
import org.spongepowered.api.event.game.state.GameInitializationEvent;
|
import org.spongepowered.api.event.game.state.GameInitializationEvent;
|
||||||
@ -21,6 +22,7 @@ import org.spongepowered.api.plugin.Dependency;
|
|||||||
import org.spongepowered.api.plugin.Plugin;
|
import org.spongepowered.api.plugin.Plugin;
|
||||||
import us.myles.ViaVersion.sponge.util.LoggerWrapper;
|
import us.myles.ViaVersion.sponge.util.LoggerWrapper;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@Plugin(id = "viabackwards",
|
@Plugin(id = "viabackwards",
|
||||||
@ -35,13 +37,16 @@ public class SpongePlugin implements ViaBackwardsPlatform {
|
|||||||
private Logger logger;
|
private Logger logger;
|
||||||
@Inject
|
@Inject
|
||||||
private org.slf4j.Logger loggerSlf4j;
|
private org.slf4j.Logger loggerSlf4j;
|
||||||
|
@Inject
|
||||||
|
@ConfigDir(sharedRoot = false)
|
||||||
|
private Path configPath;
|
||||||
|
|
||||||
@Listener(order = Order.LATE)
|
@Listener(order = Order.LATE)
|
||||||
public void onGameStart(GameInitializationEvent e) {
|
public void onGameStart(GameInitializationEvent e) {
|
||||||
// Setup Logger
|
// Setup Logger
|
||||||
this.logger = new LoggerWrapper(loggerSlf4j);
|
this.logger = new LoggerWrapper(loggerSlf4j);
|
||||||
// Init!
|
// Init!
|
||||||
this.init();
|
this.init(configPath.resolve("config.yml").toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,11 +16,13 @@ import com.velocitypowered.api.event.Subscribe;
|
|||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||||
import com.velocitypowered.api.plugin.Dependency;
|
import com.velocitypowered.api.plugin.Dependency;
|
||||||
import com.velocitypowered.api.plugin.Plugin;
|
import com.velocitypowered.api.plugin.Plugin;
|
||||||
|
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||||
import nl.matsv.viabackwards.velocity.VersionInfo;
|
import nl.matsv.viabackwards.velocity.VersionInfo;
|
||||||
import us.myles.ViaVersion.sponge.util.LoggerWrapper;
|
import us.myles.ViaVersion.sponge.util.LoggerWrapper;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@Plugin(id = "viabackwards",
|
@Plugin(id = "viabackwards",
|
||||||
@ -35,13 +37,16 @@ public class VelocityPlugin implements ViaBackwardsPlatform {
|
|||||||
private Logger logger;
|
private Logger logger;
|
||||||
@Inject
|
@Inject
|
||||||
private org.slf4j.Logger loggerSlf4j;
|
private org.slf4j.Logger loggerSlf4j;
|
||||||
|
@Inject
|
||||||
|
@DataDirectory
|
||||||
|
private Path configPath;
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.LATE)
|
@Subscribe(order = PostOrder.LATE)
|
||||||
public void onProxyStart(ProxyInitializeEvent e) {
|
public void onProxyStart(ProxyInitializeEvent e) {
|
||||||
// Setup Logger
|
// Setup Logger
|
||||||
this.logger = new LoggerWrapper(loggerSlf4j);
|
this.logger = new LoggerWrapper(loggerSlf4j);
|
||||||
// Init!
|
// Init!
|
||||||
this.init();
|
this.init(configPath.resolve("config.yml").toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user