Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2025-01-12 07:56:15 +01:00
Ursprung
922afc12a5
Commit
46c7cab3a4
@ -13,6 +13,7 @@ public class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.
|
||||
private boolean addCustomEnchantsToLore;
|
||||
private boolean addTeamColorToPrefix;
|
||||
private boolean fix1_13FacePlayer;
|
||||
private boolean alwaysShowOriginalMobName;
|
||||
|
||||
public ViaBackwardsConfig(File configFile) {
|
||||
super(configFile);
|
||||
@ -28,6 +29,7 @@ public class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.
|
||||
addCustomEnchantsToLore = getBoolean("add-custom-enchants-into-lore", true);
|
||||
addTeamColorToPrefix = getBoolean("add-teamcolor-to-prefix", true);
|
||||
fix1_13FacePlayer = getBoolean("fix-1_13-face-player", false);
|
||||
alwaysShowOriginalMobName = getBoolean("always-show-original-mob-name", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,6 +47,11 @@ public class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.
|
||||
return fix1_13FacePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysShowOriginalMobName() {
|
||||
return alwaysShowOriginalMobName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viabackwards/config.yml");
|
||||
|
@ -22,4 +22,11 @@ public interface ViaBackwardsConfig {
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean isFix1_13FacePlayer();
|
||||
|
||||
/**
|
||||
* Always shows the original mob's name instead of only when hovering over them with the cursor.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean alwaysShowOriginalMobName();
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ import java.util.List;
|
||||
public abstract class EntityRewriter<T extends BackwardsProtocol> extends EntityRewriterBase<T> {
|
||||
|
||||
protected EntityRewriter(T protocol) {
|
||||
super(protocol, MetaType1_14.OptChat, 2);
|
||||
this(protocol, MetaType1_14.OptChat, MetaType1_14.Boolean);
|
||||
}
|
||||
|
||||
protected EntityRewriter(T protocol, MetaType displayType) {
|
||||
super(protocol, displayType, 2);
|
||||
protected EntityRewriter(T protocol, MetaType displayType, MetaType displayVisibilityType) {
|
||||
super(protocol, displayType, 2, displayVisibilityType, 3);
|
||||
}
|
||||
|
||||
public void registerSpawnTrackerWithData(ClientboundPacketType packetType, EntityType fallingBlockType) {
|
||||
|
@ -17,7 +17,6 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.entities.EntityType;
|
||||
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.api.protocol.ClientboundPacketType;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
@ -46,17 +45,18 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
||||
private final Map<EntityType, EntityData> entityTypes = new HashMap<>();
|
||||
private final List<MetaHandlerSettings> metaHandlers = new ArrayList<>();
|
||||
private final MetaType displayNameMetaType;
|
||||
private final MetaType displayVisibilityMetaType;
|
||||
private final int displayNameIndex;
|
||||
private final int displayVisibilityIndex;
|
||||
protected Int2IntMap typeMapping;
|
||||
|
||||
EntityRewriterBase(T protocol) {
|
||||
this(protocol, MetaType1_9.String, 2);
|
||||
}
|
||||
|
||||
EntityRewriterBase(T protocol, MetaType displayNameMetaType, int displayNameIndex) {
|
||||
EntityRewriterBase(T protocol, MetaType displayNameMetaType, int displayNameIndex,
|
||||
MetaType displayVisibilityMetaType, int displayVisibilityIndex) {
|
||||
super(protocol);
|
||||
this.displayNameMetaType = displayNameMetaType;
|
||||
this.displayNameIndex = displayNameIndex;
|
||||
this.displayVisibilityMetaType = displayVisibilityMetaType;
|
||||
this.displayVisibilityIndex = displayVisibilityIndex;
|
||||
}
|
||||
|
||||
protected EntityType getEntityType(UserConnection connection, int id) {
|
||||
@ -194,10 +194,15 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
||||
Metadata data = storage.get(displayNameIndex);
|
||||
if (data != null) {
|
||||
EntityData entityData = getEntityData(type);
|
||||
// Set the name if there is no custom name set already
|
||||
if (entityData != null && entityData.getMobName() != null
|
||||
&& (data.getValue() == null || data.getValue().toString().isEmpty())
|
||||
&& data.getMetaType().getTypeID() == displayNameMetaType.getTypeID()) {
|
||||
data.setValue(entityData.getMobName());
|
||||
if (ViaBackwards.getConfig().alwaysShowOriginalMobName()) {
|
||||
storage.delete(displayVisibilityIndex);
|
||||
storage.add(new Metadata(displayVisibilityIndex, displayVisibilityMetaType, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.entities.EntityType;
|
||||
import us.myles.ViaVersion.api.entities.ObjectType;
|
||||
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.api.protocol.ClientboundPacketType;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
@ -25,11 +26,11 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
||||
private final Map<ObjectType, EntityData> objectTypes = new HashMap<>();
|
||||
|
||||
protected LegacyEntityRewriter(T protocol) {
|
||||
super(protocol);
|
||||
this(protocol, MetaType1_9.String, MetaType1_9.Boolean);
|
||||
}
|
||||
|
||||
protected LegacyEntityRewriter(T protocol, MetaType displayType) {
|
||||
super(protocol, displayType, 2);
|
||||
protected LegacyEntityRewriter(T protocol, MetaType displayType, MetaType displayVisibilityType) {
|
||||
super(protocol, displayType, 2, displayVisibilityType, 3);
|
||||
}
|
||||
|
||||
protected EntityObjectData mapObjectType(ObjectType oldObjectType, ObjectType replacement, int data) {
|
||||
|
@ -34,7 +34,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
private EntityPositionHandler positionHandler;
|
||||
|
||||
public EntityPackets1_14(Protocol1_13_2To1_14 protocol) {
|
||||
super(protocol, MetaType1_13_2.OptChat);
|
||||
super(protocol, MetaType1_13_2.OptChat, MetaType1_13_2.Boolean);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,8 @@
|
||||
# If you need help, you can join our Discord - https://viaversion.com/discord
|
||||
#
|
||||
# Always shows a mapped mob's original name, and not only when hovering over it with the cursor.
|
||||
always-show-original-mob-name: true
|
||||
#
|
||||
# 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
|
||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren