mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-19 14:59:21 +00:00
feat: remove 1.20.1 support
This commit is contained in:
11
README.md
11
README.md
@@ -48,15 +48,16 @@ HuskSync supports the following [compatible versions](https://william278.net/doc
|
|||||||
|
|
||||||
| Minecraft | Latest HuskSync | Java Version | Platforms | Support Status |
|
| Minecraft | Latest HuskSync | Java Version | Platforms | Support Status |
|
||||||
|:---------------:|:---------------:|:------------:|:--------------|:------------------------------|
|
|:---------------:|:---------------:|:------------:|:--------------|:------------------------------|
|
||||||
| 1.21.7/8 | _latest_ | 21 | Paper | ✅ **Active Release** |
|
| 1.21.10 | _latest_ | 21 | Paper | ✅ **Active Release** |
|
||||||
|
| 1.21.7/8 | _latest_ | 21 | Paper | ✅ **August 2026** |
|
||||||
| 1.21.6 | 3.8.5 | 21 | Paper | 🗃️ Archived (July 2025) |
|
| 1.21.6 | 3.8.5 | 21 | Paper | 🗃️ Archived (July 2025) |
|
||||||
| 1.21.5 | _latest_ | 21 | Paper | ✅ **January 2026** (Non-LTS) |
|
| 1.21.5 | _latest_ | 21 | Paper | ✅ **February 2026** (Non-LTS) |
|
||||||
| 1.21.4 | _latest_ | 21 | Paper, Fabric | ✅ **November 2025** (Non-LTS) |
|
| 1.21.4 | _latest_ | 21 | Paper, Fabric | ✅ **February 2026** (Non-LTS) |
|
||||||
| 1.21.3 | 3.7.1 | 21 | Paper, Fabric | 🗃️ Archived (December 2024) |
|
| 1.21.3 | 3.7.1 | 21 | Paper, Fabric | 🗃️ Archived (December 2024) |
|
||||||
| 1.21.1 | _latest_ | 21 | Paper, Fabric | ✅ **November 2025** (LTS) |
|
| 1.21.1 | _latest_ | 21 | Paper, Fabric | ✅ **May 2026** (LTS) |
|
||||||
| 1.20.6 | 3.6.8 | 17 | Paper | 🗃️ Archived (October 2024) |
|
| 1.20.6 | 3.6.8 | 17 | Paper | 🗃️ Archived (October 2024) |
|
||||||
| 1.20.4 | 3.6.8 | 17 | Paper | 🗃️ Archived (July 2024) |
|
| 1.20.4 | 3.6.8 | 17 | Paper | 🗃️ Archived (July 2024) |
|
||||||
| 1.20.1 | _latest_ | 17 | Paper, Fabric | ✅ **November 2025** (LTS) |
|
| 1.20.1 | 3.8.7 | 17 | Paper, Fabric | 🗃️ Archived (November 2024) |
|
||||||
| 1.17.1 - 1.19.4 | 3.6.8 | 17 | Paper | 🗃️ Archived |
|
| 1.17.1 - 1.19.4 | 3.6.8 | 17 | Paper | 🗃️ Archived |
|
||||||
| 1.16.5 | 3.2.1 | 16 | Paper | 🗃️ Archived |
|
| 1.16.5 | 3.2.1 | 16 | Paper | 🗃️ Archived |
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
minecraft_version_range=1.20.1
|
|
||||||
minecraft_version_numeric=12001
|
|
||||||
minecraft_api_version=1.20
|
|
||||||
paper_api_version=1.20.1-R0.1-SNAPSHOT
|
|
||||||
@@ -38,11 +38,7 @@ import org.bukkit.attribute.AttributeModifier;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
//#if MC==12001
|
|
||||||
//$$ import org.bukkit.inventory.EquipmentSlot;
|
|
||||||
//#else
|
|
||||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
//#endif
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@@ -620,33 +616,19 @@ public abstract class BukkitData implements Data {
|
|||||||
instance.getBaseValue(),
|
instance.getBaseValue(),
|
||||||
instance.getModifiers().stream()
|
instance.getModifiers().stream()
|
||||||
.filter(modifier -> !settings.isIgnoredModifier(modifier.getName()))
|
.filter(modifier -> !settings.isIgnoredModifier(modifier.getName()))
|
||||||
//#if MC==12001
|
|
||||||
//$$ .filter(modifier -> modifier.getSlot() == null)
|
|
||||||
//#else
|
|
||||||
.filter(modifier -> modifier.getSlotGroup() != EquipmentSlotGroup.ANY)
|
.filter(modifier -> modifier.getSlotGroup() != EquipmentSlotGroup.ANY)
|
||||||
//#endif
|
|
||||||
.map(BukkitData.Attributes::adapt).collect(Collectors.toSet())
|
.map(BukkitData.Attributes::adapt).collect(Collectors.toSet())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static Modifier adapt(@NotNull AttributeModifier modifier) {
|
private static Modifier adapt(@NotNull AttributeModifier modifier) {
|
||||||
//#if MC==12001
|
|
||||||
//$$ return new Modifier(
|
|
||||||
//$$ modifier.getUniqueId(),
|
|
||||||
//$$ modifier.getName(),
|
|
||||||
//$$ modifier.getAmount(),
|
|
||||||
//$$ modifier.getOperation().ordinal(),
|
|
||||||
//$$ modifier.getSlot() != null ? modifier.getSlot().ordinal() : -1
|
|
||||||
//$$ );
|
|
||||||
//#else
|
|
||||||
return new Modifier(
|
return new Modifier(
|
||||||
modifier.getKey().toString(),
|
modifier.getKey().toString(),
|
||||||
modifier.getAmount(),
|
modifier.getAmount(),
|
||||||
modifier.getOperation().ordinal(),
|
modifier.getOperation().ordinal(),
|
||||||
modifier.getSlotGroup().toString()
|
modifier.getSlotGroup().toString()
|
||||||
);
|
);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyAttribute(@Nullable AttributeInstance instance, @Nullable Attribute attribute) {
|
private static void applyAttribute(@Nullable AttributeInstance instance, @Nullable Attribute attribute) {
|
||||||
@@ -666,22 +648,12 @@ public abstract class BukkitData implements Data {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static AttributeModifier adapt(@NotNull Modifier modifier) {
|
private static AttributeModifier adapt(@NotNull Modifier modifier) {
|
||||||
//#if MC==12001
|
|
||||||
//$$ return new AttributeModifier(
|
|
||||||
//$$ modifier.uuid(),
|
|
||||||
//$$ modifier.name(),
|
|
||||||
//$$ modifier.amount(),
|
|
||||||
//$$ AttributeModifier.Operation.values()[modifier.operation()],
|
|
||||||
//$$ modifier.equipmentSlot() != -1 ? EquipmentSlot.values()[modifier.equipmentSlot()] : null
|
|
||||||
//$$ );
|
|
||||||
//#else
|
|
||||||
return new AttributeModifier(
|
return new AttributeModifier(
|
||||||
Objects.requireNonNull(NamespacedKey.fromString(modifier.name())),
|
Objects.requireNonNull(NamespacedKey.fromString(modifier.name())),
|
||||||
modifier.amount(),
|
modifier.amount(),
|
||||||
AttributeModifier.Operation.values()[modifier.operation()],
|
AttributeModifier.Operation.values()[modifier.operation()],
|
||||||
Optional.ofNullable(EquipmentSlotGroup.getByName(modifier.slotGroup())).orElse(EquipmentSlotGroup.ANY)
|
Optional.ofNullable(EquipmentSlotGroup.getByName(modifier.slotGroup())).orElse(EquipmentSlotGroup.ANY)
|
||||||
);
|
);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -597,11 +597,7 @@ public interface BukkitMapHandler {
|
|||||||
final List<MapBanner> banners = Lists.newArrayList();
|
final List<MapBanner> banners = Lists.newArrayList();
|
||||||
for (int i = 0; i < getCursors().size(); i++) {
|
for (int i = 0; i < getCursors().size(); i++) {
|
||||||
final MapCursor cursor = getCursors().getCursor(i);
|
final MapCursor cursor = getCursors().getCursor(i);
|
||||||
//#if MC==12001
|
|
||||||
//$$ final String type = cursor.getType().name().toLowerCase(Locale.ENGLISH);
|
|
||||||
//#else
|
|
||||||
final String type = cursor.getType().getKey().getKey();
|
final String type = cursor.getType().getKey().getKey();
|
||||||
//#endif
|
|
||||||
if (type.startsWith(BANNER_PREFIX)) {
|
if (type.startsWith(BANNER_PREFIX)) {
|
||||||
banners.add(new MapBanner(
|
banners.add(new MapBanner(
|
||||||
type.replaceAll(BANNER_PREFIX, ""),
|
type.replaceAll(BANNER_PREFIX, ""),
|
||||||
|
|||||||
@@ -51,11 +51,7 @@ public final class BukkitKeyedAdapter {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PotionEffectType matchEffectType(@NotNull String key) {
|
public static PotionEffectType matchEffectType(@NotNull String key) {
|
||||||
//#if MC==12001
|
|
||||||
//$$ return PotionEffectType.getByName(key);
|
|
||||||
//#else
|
|
||||||
return getRegistryValue(Registry.EFFECT, key);
|
return getRegistryValue(Registry.EFFECT, key);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Keyed> T getRegistryValue(@NotNull Registry<T> registry, @NotNull String keyString) {
|
private static <T extends Keyed> T getRegistryValue(@NotNull Registry<T> registry, @NotNull String keyString) {
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
essential.defaults.loom.mappings=net.fabricmc:yarn:1.20.1+build.10:v2
|
|
||||||
|
|
||||||
minecraft_version_range='1.20.1'
|
|
||||||
|
|
||||||
fabric_loader_version=0.15.11
|
|
||||||
fabric_api_version=0.92.2+1.20.1
|
|
||||||
fabric_permissions_api_version=0.2-SNAPSHOT
|
|
||||||
fabric_adventure_platform_version=5.9.0
|
|
||||||
fabric_sgui_version=1.2.2+1.20
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.8",
|
|
||||||
"package": "net.william278.husksync.mixins",
|
|
||||||
"compatibilityLevel": "JAVA_17",
|
|
||||||
"server": [
|
|
||||||
"ItemEntityMixin",
|
|
||||||
"PlayerEntityMixin",
|
|
||||||
"ServerPlayerEntityMixin",
|
|
||||||
"ServerPlayNetworkHandlerMixin",
|
|
||||||
"ServerWorldMixin"
|
|
||||||
],
|
|
||||||
"client": [],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,11 +7,9 @@ preprocess {
|
|||||||
def fabric12105 = createNode("1.21.5", 12105, "yarn")
|
def fabric12105 = createNode("1.21.5", 12105, "yarn")
|
||||||
def fabric12104 = createNode("1.21.4", 12104, "yarn")
|
def fabric12104 = createNode("1.21.4", 12104, "yarn")
|
||||||
def fabric12101 = createNode("1.21.1", 12101, "yarn")
|
def fabric12101 = createNode("1.21.1", 12101, "yarn")
|
||||||
def fabric12001 = createNode("1.20.1", 12001, "yarn")
|
|
||||||
|
|
||||||
strictExtraMappings.set(true)
|
strictExtraMappings.set(true)
|
||||||
fabric12105.link(fabric12108, null)
|
fabric12105.link(fabric12108, null)
|
||||||
fabric12104.link(fabric12108, null)
|
fabric12104.link(fabric12108, null)
|
||||||
fabric12101.link(fabric12108, null)
|
fabric12101.link(fabric12108, null)
|
||||||
fabric12001.link(fabric12108, null)
|
|
||||||
}
|
}
|
||||||
@@ -26,12 +26,7 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
import net.minecraft.advancement.AdvancementProgress;
|
import net.minecraft.advancement.AdvancementProgress;
|
||||||
import net.minecraft.advancement.PlayerAdvancementTracker;
|
import net.minecraft.advancement.PlayerAdvancementTracker;
|
||||||
//#if MC==12001
|
|
||||||
//$$ import net.minecraft.enchantment.EnchantmentHelper;
|
|
||||||
//$$ import net.minecraft.nbt.NbtCompound;
|
|
||||||
//#else
|
|
||||||
import net.minecraft.component.DataComponentTypes;
|
import net.minecraft.component.DataComponentTypes;
|
||||||
//#endif
|
|
||||||
import net.minecraft.entity.attribute.EntityAttribute;
|
import net.minecraft.entity.attribute.EntityAttribute;
|
||||||
import net.minecraft.entity.attribute.EntityAttributeInstance;
|
import net.minecraft.entity.attribute.EntityAttributeInstance;
|
||||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||||
@@ -95,16 +90,6 @@ public abstract class FabricData implements Data {
|
|||||||
stack.getItem().toString(),
|
stack.getItem().toString(),
|
||||||
stack.getCount(),
|
stack.getCount(),
|
||||||
stack.getName().getString(),
|
stack.getName().getString(),
|
||||||
//#if MC==12001
|
|
||||||
//$$ Optional.ofNullable(stack.getSubNbt(ItemStack.DISPLAY_KEY))
|
|
||||||
//$$ .flatMap(display -> Optional.ofNullable(display.get(ItemStack.LORE_KEY))
|
|
||||||
//$$ .map(lore -> ((List<String>) lore).stream().toList()))
|
|
||||||
//$$ .orElse(null),
|
|
||||||
//$$ stack.getEnchantments().stream()
|
|
||||||
//$$ .map(element -> EnchantmentHelper.getIdFromNbt((NbtCompound) element))
|
|
||||||
//$$ .filter(Objects::nonNull).map(Identifier::toString)
|
|
||||||
//$$ .toList()
|
|
||||||
//#else
|
|
||||||
stack.getComponents().get(DataComponentTypes.LORE).lines().stream()
|
stack.getComponents().get(DataComponentTypes.LORE).lines().stream()
|
||||||
.map(Text::getString)
|
.map(Text::getString)
|
||||||
.toList(),
|
.toList(),
|
||||||
@@ -112,7 +97,6 @@ public abstract class FabricData implements Data {
|
|||||||
.map(RegistryEntry::getIdAsString)
|
.map(RegistryEntry::getIdAsString)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.toList()
|
.toList()
|
||||||
//#endif
|
|
||||||
) : null)
|
) : null)
|
||||||
.toArray(Stack[]::new);
|
.toArray(Stack[]::new);
|
||||||
}
|
}
|
||||||
@@ -274,11 +258,7 @@ public abstract class FabricData implements Data {
|
|||||||
.map(effect -> {
|
.map(effect -> {
|
||||||
final StatusEffect type = matchEffectType(effect.type());
|
final StatusEffect type = matchEffectType(effect.type());
|
||||||
return type != null ? new StatusEffectInstance(
|
return type != null ? new StatusEffectInstance(
|
||||||
//#if MC==12001
|
|
||||||
//$$ type,
|
|
||||||
//#else
|
|
||||||
RegistryEntry.of(type),
|
RegistryEntry.of(type),
|
||||||
//#endif
|
|
||||||
effect.duration(),
|
effect.duration(),
|
||||||
effect.amplifier(),
|
effect.amplifier(),
|
||||||
effect.isAmbient(),
|
effect.isAmbient(),
|
||||||
@@ -300,16 +280,10 @@ public abstract class FabricData implements Data {
|
|||||||
@Override
|
@Override
|
||||||
public void apply(@NotNull FabricUser user, @NotNull FabricHuskSync plugin) throws IllegalStateException {
|
public void apply(@NotNull FabricUser user, @NotNull FabricHuskSync plugin) throws IllegalStateException {
|
||||||
final ServerPlayerEntity player = user.getPlayer();
|
final ServerPlayerEntity player = user.getPlayer();
|
||||||
//#if MC==12001
|
|
||||||
//$$ final List<StatusEffect> effectsToRemove = player.getActiveStatusEffects().entrySet().stream()
|
|
||||||
//$$ .filter(e -> !e.getValue().isAmbient()).map(Map.Entry::getKey).toList();
|
|
||||||
//$$ effectsToRemove.forEach(player::removeStatusEffect);
|
|
||||||
//#else
|
|
||||||
//todo ambient check
|
//todo ambient check
|
||||||
final List<StatusEffect> effectsToRemove = new ArrayList<>(player.getActiveStatusEffects().keySet().stream()
|
final List<StatusEffect> effectsToRemove = new ArrayList<>(player.getActiveStatusEffects().keySet().stream()
|
||||||
.map(RegistryEntry::value).toList());
|
.map(RegistryEntry::value).toList());
|
||||||
effectsToRemove.forEach(effect -> player.removeStatusEffect(RegistryEntry.of(effect)));
|
effectsToRemove.forEach(effect -> player.removeStatusEffect(RegistryEntry.of(effect)));
|
||||||
//#endif
|
|
||||||
getEffects().forEach(player::addStatusEffect);
|
getEffects().forEach(player::addStatusEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,11 +293,7 @@ public abstract class FabricData implements Data {
|
|||||||
public List<Effect> getActiveEffects() {
|
public List<Effect> getActiveEffects() {
|
||||||
return effects.stream()
|
return effects.stream()
|
||||||
.map(potionEffect -> {
|
.map(potionEffect -> {
|
||||||
//#if MC==12001
|
|
||||||
//$$ final String key = getEffectId(potionEffect.getEffectType());
|
|
||||||
//#else
|
|
||||||
final String key = getEffectId(potionEffect.getEffectType().value());
|
final String key = getEffectId(potionEffect.getEffectType().value());
|
||||||
//#endif
|
|
||||||
return key != null ? new Effect(
|
return key != null ? new Effect(
|
||||||
key,
|
key,
|
||||||
potionEffect.getAmplifier(),
|
potionEffect.getAmplifier(),
|
||||||
@@ -357,21 +327,13 @@ public abstract class FabricData implements Data {
|
|||||||
|
|
||||||
advancementProgress.getObtainedCriteria().forEach((criteria) -> awardedCriteria.put(
|
advancementProgress.getObtainedCriteria().forEach((criteria) -> awardedCriteria.put(
|
||||||
criteria,
|
criteria,
|
||||||
//#if MC==12001
|
|
||||||
//$$ advancementProgress.getEarliestProgressObtainDate()
|
|
||||||
//#else
|
|
||||||
Date.from(advancementProgress.getEarliestProgressObtainDate())
|
Date.from(advancementProgress.getEarliestProgressObtainDate())
|
||||||
//#endif
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Only save the advancement if criteria has been completed
|
// Only save the advancement if criteria has been completed
|
||||||
if (!awardedCriteria.isEmpty()) {
|
if (!awardedCriteria.isEmpty()) {
|
||||||
advancements.add(Advancement.adapt(
|
advancements.add(Advancement.adapt(
|
||||||
//#if MC==12001
|
|
||||||
//$$ advancementEntry.getId().toString(),
|
|
||||||
//#else
|
|
||||||
advancementEntry.id().asString(),
|
advancementEntry.id().asString(),
|
||||||
//#endif
|
|
||||||
awardedCriteria
|
awardedCriteria
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -392,11 +354,7 @@ public abstract class FabricData implements Data {
|
|||||||
final AdvancementProgress progress = player.getAdvancementTracker().getProgress(advancementEntry);
|
final AdvancementProgress progress = player.getAdvancementTracker().getProgress(advancementEntry);
|
||||||
final Optional<Advancement> record = completed.stream()
|
final Optional<Advancement> record = completed.stream()
|
||||||
.filter(r -> r.getKey().equals(
|
.filter(r -> r.getKey().equals(
|
||||||
//#if MC==12001
|
|
||||||
//$$ advancementEntry.getId().toString()
|
|
||||||
//#else
|
|
||||||
advancementEntry.id().asString()
|
advancementEntry.id().asString()
|
||||||
//#endif
|
|
||||||
))
|
))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (record.isEmpty()) {
|
if (record.isEmpty()) {
|
||||||
@@ -414,11 +372,7 @@ public abstract class FabricData implements Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setAdvancement(@NotNull FabricHuskSync plugin,
|
private void setAdvancement(@NotNull FabricHuskSync plugin,
|
||||||
//#if MC==12001
|
|
||||||
//$$ @NotNull net.minecraft.advancement.Advancement advancementEntry,
|
|
||||||
//#else
|
|
||||||
@NotNull net.minecraft.advancement.AdvancementEntry advancementEntry,
|
@NotNull net.minecraft.advancement.AdvancementEntry advancementEntry,
|
||||||
//#endif
|
|
||||||
@NotNull ServerPlayerEntity player,
|
@NotNull ServerPlayerEntity player,
|
||||||
@NotNull FabricUser user,
|
@NotNull FabricUser user,
|
||||||
@NotNull List<String> toAward,
|
@NotNull List<String> toAward,
|
||||||
@@ -445,11 +399,7 @@ public abstract class FabricData implements Data {
|
|||||||
// Performs a consuming function for every advancement entry registered on the server
|
// Performs a consuming function for every advancement entry registered on the server
|
||||||
private static void forEachAdvancementEntry(
|
private static void forEachAdvancementEntry(
|
||||||
@NotNull MinecraftServer server,
|
@NotNull MinecraftServer server,
|
||||||
//#if MC==12001
|
|
||||||
//$$ @NotNull ThrowingConsumer<net.minecraft.advancement.Advancement> con
|
|
||||||
//#else
|
|
||||||
@NotNull ThrowingConsumer<net.minecraft.advancement.AdvancementEntry> con
|
@NotNull ThrowingConsumer<net.minecraft.advancement.AdvancementEntry> con
|
||||||
//#endif
|
|
||||||
) {
|
) {
|
||||||
server.getAdvancementLoader().getAdvancements().forEach(con);
|
server.getAdvancementLoader().getAdvancements().forEach(con);
|
||||||
}
|
}
|
||||||
@@ -482,11 +432,7 @@ public abstract class FabricData implements Data {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static FabricData.Location adapt(@NotNull ServerPlayerEntity player) {
|
public static FabricData.Location adapt(@NotNull ServerPlayerEntity player) {
|
||||||
//#if MC==12001
|
|
||||||
//$$ final String worldName = player.getWorld().getDimensionKey().getValue().toString();
|
|
||||||
//#else
|
|
||||||
final String worldName = player.getWorld().getDimensionEntry().getIdAsString();
|
final String worldName = player.getWorld().getDimensionEntry().getIdAsString();
|
||||||
//#endif
|
|
||||||
return from(
|
return from(
|
||||||
player.getX(),
|
player.getX(),
|
||||||
player.getY(),
|
player.getY(),
|
||||||
@@ -659,21 +605,6 @@ public abstract class FabricData implements Data {
|
|||||||
final List<Attribute> attributes = Lists.newArrayList();
|
final List<Attribute> attributes = Lists.newArrayList();
|
||||||
final AttributeSettings settings = plugin.getSettings().getSynchronization().getAttributes();
|
final AttributeSettings settings = plugin.getSettings().getSynchronization().getAttributes();
|
||||||
Registries.ATTRIBUTE.forEach(id -> {
|
Registries.ATTRIBUTE.forEach(id -> {
|
||||||
//#if MC==12001
|
|
||||||
//$$ final EntityAttributeInstance instance = player.getAttributeInstance(id);
|
|
||||||
//$$ final Identifier key = Registries.ATTRIBUTE.getId(id);
|
|
||||||
//$$ if (instance == null || key == null || settings.isIgnoredAttribute(key.asString())) {
|
|
||||||
//$$ return;
|
|
||||||
//$$ }
|
|
||||||
//$$ final Set<Modifier> modifiers = Sets.newHashSet();
|
|
||||||
//$$ instance.getModifiers().forEach(modifier -> modifiers.add(new Modifier(
|
|
||||||
//$$ modifier.getId(),
|
|
||||||
//$$ modifier.getName(),
|
|
||||||
//$$ modifier.getValue(),
|
|
||||||
//$$ modifier.getOperation().getId(),
|
|
||||||
//$$ -1
|
|
||||||
//$$ )));
|
|
||||||
//#else
|
|
||||||
final EntityAttributeInstance instance = player.getAttributeInstance(RegistryEntry.of(id));
|
final EntityAttributeInstance instance = player.getAttributeInstance(RegistryEntry.of(id));
|
||||||
final Identifier key = Registries.ATTRIBUTE.getId(id);
|
final Identifier key = Registries.ATTRIBUTE.getId(id);
|
||||||
if (instance == null || key == null || settings.isIgnoredAttribute(key.asString())) {
|
if (instance == null || key == null || settings.isIgnoredAttribute(key.asString())) {
|
||||||
@@ -686,7 +617,6 @@ public abstract class FabricData implements Data {
|
|||||||
modifier.operation().getId(),
|
modifier.operation().getId(),
|
||||||
Modifier.ANY_EQUIPMENT_SLOT_GROUP
|
Modifier.ANY_EQUIPMENT_SLOT_GROUP
|
||||||
)));
|
)));
|
||||||
//#endif
|
|
||||||
attributes.add(new Attribute(
|
attributes.add(new Attribute(
|
||||||
key.toString(),
|
key.toString(),
|
||||||
instance.getBaseValue(),
|
instance.getBaseValue(),
|
||||||
@@ -719,11 +649,7 @@ public abstract class FabricData implements Data {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
applyAttribute(
|
applyAttribute(
|
||||||
//#if MC==12001
|
|
||||||
//$$ user.getPlayer().getAttributeInstance(id),
|
|
||||||
//#else
|
|
||||||
user.getPlayer().getAttributeInstance(RegistryEntry.of(id)),
|
user.getPlayer().getAttributeInstance(RegistryEntry.of(id)),
|
||||||
//#endif
|
|
||||||
getAttribute(id).orElse(null)
|
getAttribute(id).orElse(null)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ import lombok.AccessLevel;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.minecraft.datafixer.TypeReferences;
|
import net.minecraft.datafixer.TypeReferences;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
//#if MC==12001
|
|
||||||
//$$ import net.minecraft.nbt.NbtCompound;
|
|
||||||
//#endif
|
|
||||||
import net.minecraft.nbt.*;
|
import net.minecraft.nbt.*;
|
||||||
import net.minecraft.registry.DynamicRegistryManager;
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
import net.william278.desertwell.util.Version;
|
import net.william278.desertwell.util.Version;
|
||||||
@@ -280,10 +277,6 @@ public abstract class FabricSerializer {
|
|||||||
//$$ return (NbtCompound) item.toNbt(reg);
|
//$$ return (NbtCompound) item.toNbt(reg);
|
||||||
//#elseif MC==12101
|
//#elseif MC==12101
|
||||||
//$$ return (NbtCompound) item.encode(reg);
|
//$$ return (NbtCompound) item.encode(reg);
|
||||||
//#elseif MC==12001
|
|
||||||
//$$ final NbtCompound compound = new NbtCompound();
|
|
||||||
//$$ item.writeNbt(compound);
|
|
||||||
//$$ return compound;
|
|
||||||
//#endif
|
//#endif
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
return null;
|
return null;
|
||||||
@@ -294,10 +287,8 @@ public abstract class FabricSerializer {
|
|||||||
private ItemStack decodeNbt(@NotNull NbtElement item, @NotNull DynamicRegistryManager reg) {
|
private ItemStack decodeNbt(@NotNull NbtElement item, @NotNull DynamicRegistryManager reg) {
|
||||||
//#if MC>=12108
|
//#if MC>=12108
|
||||||
final @Nullable ItemStack stack = ItemStack.CODEC.decode(reg.getOps(NbtOps.INSTANCE), item).getOrThrow().getFirst();
|
final @Nullable ItemStack stack = ItemStack.CODEC.decode(reg.getOps(NbtOps.INSTANCE), item).getOrThrow().getFirst();
|
||||||
//#elseif MC>12001
|
//#else
|
||||||
//$$ final @Nullable ItemStack stack = ItemStack.fromNbt(reg, item).orElse(null);
|
//$$ final @Nullable ItemStack stack = ItemStack.fromNbt(reg, item).orElse(null);
|
||||||
//#elseif MC==12001
|
|
||||||
//$$ final @Nullable ItemStack stack = ItemStack.fromNbt((NbtCompound) item);
|
|
||||||
//#endif
|
//#endif
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
throw new IllegalStateException("Failed to decode item NBT (decode got null): (%s)".formatted(item));
|
throw new IllegalStateException("Failed to decode item NBT (decode got null): (%s)".formatted(item));
|
||||||
|
|||||||
@@ -120,11 +120,7 @@ public interface FabricUserDataHolder extends UserDataHolder {
|
|||||||
@Override
|
@Override
|
||||||
default Optional<Data.Items.EnderChest> getEnderChest() {
|
default Optional<Data.Items.EnderChest> getEnderChest() {
|
||||||
return Optional.of(FabricData.Items.EnderChest.adapt(
|
return Optional.of(FabricData.Items.EnderChest.adapt(
|
||||||
//#if MC==12001
|
|
||||||
//$$ getPlayer().getEnderChestInventory().stacks
|
|
||||||
//#else
|
|
||||||
getPlayer().getEnderChestInventory().getHeldStacks()
|
getPlayer().getEnderChestInventory().getHeldStacks()
|
||||||
//#endif
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,13 +82,9 @@ public class PlayerEntityMixin {
|
|||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
private boolean hasVanishingCurse(@NotNull ItemStack stack) {
|
private boolean hasVanishingCurse(@NotNull ItemStack stack) {
|
||||||
//#if MC==12001
|
|
||||||
//$$ return EnchantmentHelper.hasVanishingCurse(stack);
|
|
||||||
//#else
|
|
||||||
return EnchantmentHelper.hasAnyEnchantmentsIn(
|
return EnchantmentHelper.hasAnyEnchantmentsIn(
|
||||||
stack, TagKey.of(Enchantments.VANISHING_CURSE.getRegistryRef(), Enchantments.VANISHING_CURSE.getValue())
|
stack, TagKey.of(Enchantments.VANISHING_CURSE.getRegistryRef(), Enchantments.VANISHING_CURSE.getValue())
|
||||||
);
|
);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,11 +92,7 @@ public abstract class ServerPlayNetworkHandlerMixin {
|
|||||||
|
|
||||||
@Inject(method = "onCreativeInventoryAction", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onCreativeInventoryAction", at = @At("HEAD"), cancellable = true)
|
||||||
public void onCreativeInventoryAction(CreativeInventoryActionC2SPacket packet, CallbackInfo ci) {
|
public void onCreativeInventoryAction(CreativeInventoryActionC2SPacket packet, CallbackInfo ci) {
|
||||||
//#if MC==12001
|
|
||||||
//$$ int slot = packet.getSlot();
|
|
||||||
//#else
|
|
||||||
int slot = packet.slot();
|
int slot = packet.slot();
|
||||||
//#endif
|
|
||||||
if (slot < 0) {
|
if (slot < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user